Merge pull request #1454 from aledbf/global-confg
Allow custom global configuration at multiple levels
This commit is contained in:
commit
b20aa7cb9c
3 changed files with 33 additions and 0 deletions
|
@ -537,6 +537,16 @@ Default: 9411
|
||||||
**zipkin-service-name:** specifies the service name to use for any traces created
|
**zipkin-service-name:** specifies the service name to use for any traces created
|
||||||
Default: nginx
|
Default: nginx
|
||||||
|
|
||||||
|
**http-snippet:** adds custom configuration to the http section of the nginx configuration
|
||||||
|
Default: ""
|
||||||
|
|
||||||
|
**server-snippet:** adds custom configuration to all the servers in the nginx configuration
|
||||||
|
Default: ""
|
||||||
|
|
||||||
|
**location-snippet:** adds custom configuration to all the locations in the nginx configuration
|
||||||
|
Default: ""
|
||||||
|
|
||||||
|
|
||||||
### Default configuration options
|
### Default configuration options
|
||||||
|
|
||||||
The following table shows the options, the default value and a description.
|
The following table shows the options, the default value and a description.
|
||||||
|
|
|
@ -391,6 +391,15 @@ type Configuration struct {
|
||||||
// ZipkinServiceName specifies the service name to use for any traces created
|
// ZipkinServiceName specifies the service name to use for any traces created
|
||||||
// Default: nginx
|
// Default: nginx
|
||||||
ZipkinServiceName string `json:"zipkin-service-name"`
|
ZipkinServiceName string `json:"zipkin-service-name"`
|
||||||
|
|
||||||
|
// HTTPSnippet adds custom configuration to the http section of the nginx configuration
|
||||||
|
HTTPSnippet string `json:"http-snippet"`
|
||||||
|
|
||||||
|
// ServerSnippet adds custom configuration to all the servers in the nginx configuration
|
||||||
|
ServerSnippet string `json:"server-snippet"`
|
||||||
|
|
||||||
|
// LocationSnippet adds custom configuration to all the locations in the nginx configuration
|
||||||
|
LocationSnippet string `json:"location-snippet"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDefault returns the default nginx configuration
|
// NewDefault returns the default nginx configuration
|
||||||
|
|
|
@ -281,6 +281,11 @@ http {
|
||||||
proxy_pass_header Server;
|
proxy_pass_header Server;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not (empty $cfg.HTTPSnippet) }}
|
||||||
|
# Custom code snippet configured in the configuration configmap
|
||||||
|
{{ $cfg.HTTPSnippet }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ range $name, $upstream := $backends }}
|
{{ range $name, $upstream := $backends }}
|
||||||
{{ if eq $upstream.SessionAffinity.AffinityType "cookie" }}
|
{{ if eq $upstream.SessionAffinity.AffinityType "cookie" }}
|
||||||
upstream sticky-{{ $upstream.Name }} {
|
upstream sticky-{{ $upstream.Name }} {
|
||||||
|
@ -394,6 +399,10 @@ http {
|
||||||
server_name {{ $server.Alias }};
|
server_name {{ $server.Alias }};
|
||||||
{{ template "SERVER" serverConfig $all $server }}
|
{{ template "SERVER" serverConfig $all $server }}
|
||||||
|
|
||||||
|
{{ if not (empty $cfg.ServerSnippet) }}
|
||||||
|
# Custom code snippet configured in the configuration configmap
|
||||||
|
{{ $cfg.ServerSnippet }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ template "CUSTOM_ERRORS" $all }}
|
{{ template "CUSTOM_ERRORS" $all }}
|
||||||
}
|
}
|
||||||
|
@ -808,6 +817,11 @@ stream {
|
||||||
{{/* Add any additional configuration defined */}}
|
{{/* Add any additional configuration defined */}}
|
||||||
{{ $location.ConfigurationSnippet }}
|
{{ $location.ConfigurationSnippet }}
|
||||||
|
|
||||||
|
{{ if not (empty $all.Cfg.LocationSnippet) }}
|
||||||
|
# Custom code snippet configured in the configuration configmap
|
||||||
|
{{ $all.Cfg.LocationSnippet }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{/* if we are sending the request to a custom default backend, we add the required headers */}}
|
{{/* if we are sending the request to a custom default backend, we add the required headers */}}
|
||||||
{{ if (hasPrefix $location.Backend "custom-default-backend-") }}
|
{{ if (hasPrefix $location.Backend "custom-default-backend-") }}
|
||||||
proxy_set_header X-Code 503;
|
proxy_set_header X-Code 503;
|
||||||
|
|
Loading…
Reference in a new issue