Fix canary-weight-total annotation ignored in rule backends (#9729)

* Missed canary weight total

    - added canary weight total for spec rules

* - added e2e test
This commit is contained in:
Sergei Kaznakhovskii 2023-03-21 07:47:09 -06:00 committed by GitHub
parent a84cfe5cfa
commit e4a66fd2f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 15 deletions

View file

@ -830,6 +830,33 @@ var _ = framework.DescribeAnnotation("canary-*", func() {
TestMainlineCanaryDistribution(f, host)
})
ginkgo.It("should route requests split between mainline and canary if canary weight is 100 and weight total is 200", func() {
host := "foo"
annotations := map[string]string{}
ing := framework.NewSingleIngress(host, "/", host,
f.Namespace, framework.EchoService, 80, annotations)
f.EnsureIngress(ing)
f.WaitForNginxServer(host,
func(server string) bool {
return strings.Contains(server, "server_name foo")
})
canaryIngName := fmt.Sprintf("%v-canary", host)
canaryAnnotations := map[string]string{
"nginx.ingress.kubernetes.io/canary": "true",
"nginx.ingress.kubernetes.io/canary-weight": "100",
"nginx.ingress.kubernetes.io/canary-weight-total": "200",
}
canaryIng := framework.NewSingleIngress(canaryIngName, "/", host,
f.Namespace, canaryService, 80, canaryAnnotations)
f.EnsureIngress(canaryIng)
TestMainlineCanaryDistribution(f, host)
})
})
ginkgo.Context("Single canary Ingress", func() {