Make proxy_next_upstream_tries configurable (#2232)

* Make proxy_next_upstream_tries configurable

* Code generation
This commit is contained in:
maxlaverse 2018-03-22 12:12:36 +01:00 committed by Manuel Alejandro de Brito Fontes
parent 4f5fa47d27
commit 8575769781
9 changed files with 59 additions and 28 deletions

View file

@ -33,6 +33,7 @@ type Config struct {
CookieDomain string `json:"cookieDomain"`
CookiePath string `json:"cookiePath"`
NextUpstream string `json:"nextUpstream"`
NextUpstreamTries int `json:"nextUpstreamTries"`
ProxyRedirectFrom string `json:"proxyRedirectFrom"`
ProxyRedirectTo string `json:"proxyRedirectTo"`
RequestBuffering string `json:"requestBuffering"`
@ -71,6 +72,9 @@ func (l1 *Config) Equal(l2 *Config) bool {
if l1.NextUpstream != l2.NextUpstream {
return false
}
if l1.NextUpstreamTries != l2.NextUpstreamTries {
return false
}
if l1.RequestBuffering != l2.RequestBuffering {
return false
}
@ -141,6 +145,11 @@ func (a proxy) Parse(ing *extensions.Ingress) (interface{}, error) {
nu = defBackend.ProxyNextUpstream
}
nut, err := parser.GetIntAnnotation("proxy-next-upstream-tries", ing)
if err != nil {
nut = defBackend.ProxyNextUpstreamTries
}
rb, err := parser.GetStringAnnotation("proxy-request-buffering", ing)
if err != nil || rb == "" {
rb = defBackend.ProxyRequestBuffering
@ -161,5 +170,5 @@ func (a proxy) Parse(ing *extensions.Ingress) (interface{}, error) {
pb = defBackend.ProxyBuffering
}
return &Config{bs, ct, st, rt, bufs, cd, cp, nu, prf, prt, rb, pb}, nil
return &Config{bs, ct, st, rt, bufs, cd, cp, nu, nut, prf, prt, rb, pb}, nil
}