Allow custom global configuration at multiple levels

This commit is contained in:
Manuel de Brito Fontes 2017-10-01 11:45:33 -03:00
parent 5fadaf5f57
commit 05b212e1de
3 changed files with 33 additions and 0 deletions

View file

@ -281,6 +281,11 @@ http {
proxy_pass_header Server;
{{ end }}
{{ if not (empty $cfg.HTTPSnippet) }}
# Custom code snippet configured in the configuration configmap
{{ $cfg.HTTPSnippet }};
{{ end }}
{{ range $name, $upstream := $backends }}
{{ if eq $upstream.SessionAffinity.AffinityType "cookie" }}
upstream sticky-{{ $upstream.Name }} {
@ -394,6 +399,10 @@ http {
server_name {{ $server.Alias }};
{{ 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 }}
}
@ -808,6 +817,11 @@ stream {
{{/* Add any additional configuration defined */}}
{{ $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 (hasPrefix $location.Backend "custom-default-backend-") }}
proxy_set_header X-Code 503;