Merge pull request #3839 from perprogramming/bugfix/panic-on-multiple-non-matching-canary

Fix panic on multiple non-matching canary
This commit is contained in:
Kubernetes Prow Robot 2019-03-27 16:46:48 -07:00 committed by GitHub
commit e624fe171d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 12 deletions

View file

@ -758,4 +758,25 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
})
})
})
It("does not crash when canary ingress has multiple paths to the same non-matching backend", func() {
host := "foo"
canaryIngName := fmt.Sprintf("%v-canary", host)
annotations := map[string]string{
"nginx.ingress.kubernetes.io/canary": "true",
"nginx.ingress.kubernetes.io/canary-by-header": "CanaryByHeader",
}
paths := []string{"/foo", "/bar"}
ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, &annotations)
f.EnsureIngress(ing)
ing = framework.NewSingleIngress(host, "/", host, f.Namespace, "http-svc", 80, nil)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
func(server string) bool {
return Expect(server).Should(ContainSubstring("server_name foo"))
})
})
})