Improve text, error level, tests...

This commit is contained in:
Per Bernhardt 2019-03-12 13:52:52 +01:00
parent 8a40e82ffb
commit c995e13249
2 changed files with 33 additions and 31 deletions

View file

@ -1199,6 +1199,10 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
altUps := upstreams[upsName] altUps := upstreams[upsName]
if altUps == nil {
klog.Warningf("alternative backend %s has already been removed", upsName)
} else {
merged := false merged := false
for _, loc := range servers[defServerName].Locations { for _, loc := range servers[defServerName].Locations {
@ -1217,6 +1221,7 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
delete(upstreams, altUps.Name) delete(upstreams, altUps.Name)
} }
} }
}
for _, rule := range ing.Spec.Rules { for _, rule := range ing.Spec.Rules {
for _, path := range rule.HTTP.Paths { for _, path := range rule.HTTP.Paths {
@ -1225,7 +1230,7 @@ func mergeAlternativeBackends(ing *ingress.Ingress, upstreams map[string]*ingres
altUps := upstreams[upsName] altUps := upstreams[upsName]
if altUps == nil { if altUps == nil {
klog.Errorf("alternative backend %s has already be removed", upsName) klog.Warningf("alternative backend %s has already been removed", upsName)
continue continue
} }

View file

@ -759,8 +759,7 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
}) })
}) })
Context("Single canary Ingress with multiple paths to same backend", func() { It("does not crash when canary ingress has multiple paths to the same non-matching backend", func() {
It("should work", func() {
host := "foo" host := "foo"
canaryIngName := fmt.Sprintf("%v-canary", host) canaryIngName := fmt.Sprintf("%v-canary", host)
annotations := map[string]string{ annotations := map[string]string{
@ -769,7 +768,6 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
} }
paths := []string{"/foo", "/bar"} paths := []string{"/foo", "/bar"}
ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, &annotations) ing := framework.NewSingleIngressWithMultiplePaths(canaryIngName, paths, host, f.Namespace, "httpy-svc-canary", 80, &annotations)
f.EnsureIngress(ing) f.EnsureIngress(ing)
@ -782,4 +780,3 @@ var _ = framework.IngressNginxDescribe("Annotations - canary", func() {
}) })
}) })
}) })
})