[Kubernetes] Ignore missing pass host header annotation.
A missing annotation would previously be handled in the default error case, causing a noisy warning-level log message to be generated each time. We add another case statement to ignore the case where the annotation is missing from the annotations map. Also piggybacking a minor improvement to the log message.
This commit is contained in:
parent
3fd6da06e0
commit
fe6c35bc6b
1 changed files with 8 additions and 6 deletions
|
@ -156,14 +156,16 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
|
||||||
|
|
||||||
PassHostHeader := p.getPassHostHeader()
|
PassHostHeader := p.getPassHostHeader()
|
||||||
|
|
||||||
passHostHeaderAnnotation := i.Annotations["traefik.frontend.passHostHeader"]
|
passHostHeaderAnnotation, ok := i.Annotations["traefik.frontend.passHostHeader"]
|
||||||
switch passHostHeaderAnnotation {
|
switch {
|
||||||
case "true":
|
case !ok:
|
||||||
PassHostHeader = true
|
// No op.
|
||||||
case "false":
|
case passHostHeaderAnnotation == "false":
|
||||||
PassHostHeader = false
|
PassHostHeader = false
|
||||||
|
case passHostHeaderAnnotation == "true":
|
||||||
|
PassHostHeader = true
|
||||||
default:
|
default:
|
||||||
log.Warnf("Unknown value of %s for traefik.frontend.passHostHeader, falling back to %s", passHostHeaderAnnotation, PassHostHeader)
|
log.Warnf("Unknown value '%s' for traefik.frontend.passHostHeader, falling back to %s", passHostHeaderAnnotation, PassHostHeader)
|
||||||
}
|
}
|
||||||
if realm := i.Annotations["ingress.kubernetes.io/auth-realm"]; realm != "" && realm != traefikDefaultRealm {
|
if realm := i.Annotations["ingress.kubernetes.io/auth-realm"]; realm != "" && realm != traefikDefaultRealm {
|
||||||
return nil, errors.New("no realm customization supported")
|
return nil, errors.New("no realm customization supported")
|
||||||
|
|
Loading…
Reference in a new issue