Skip to content

Commit

Permalink
Avoid reloads when endpoints are not available
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Nov 1, 2018
1 parent cb87676 commit 36acede
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1173,18 +1173,13 @@ stream {
proxy_set_header X-Service-Port $service_port;
{{ end }}

{{ if not (empty $location.Backend) }}
{{ buildProxyPass $server.Hostname $all.Backends $location }}
{{ if (or (eq $location.Proxy.ProxyRedirectFrom "default") (eq $location.Proxy.ProxyRedirectFrom "off")) }}
proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }};
{{ else if not (eq $location.Proxy.ProxyRedirectTo "off") }}
proxy_redirect {{ $location.Proxy.ProxyRedirectFrom }} {{ $location.Proxy.ProxyRedirectTo }};
{{ end }}
{{ else }}
# No endpoints available for the request
return 503;
{{ end }}
{{ else }}
# Location denied. Reason: {{ $location.Denied | printf "%q" }}
return 503;
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/servicebackend/service_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {

f.WaitForNginxServer(host,
func(server string) bool {
return strings.Contains(server, "return 503;")
return strings.Contains(server, "proxy_pass http://upstream_balancer;")
})

resp, _, errs := gorequest.New().
Expand All @@ -72,7 +72,7 @@ var _ = framework.IngressNginxDescribe("Service backend - 503", func() {

f.WaitForNginxServer(host,
func(server string) bool {
return strings.Contains(server, "return 503;")
return strings.Contains(server, "proxy_pass http://upstream_balancer;")
})

resp, _, errs := gorequest.New().
Expand Down

0 comments on commit 36acede

Please sign in to comment.