Skip to content

Commit a091b01

Browse files
rikatzrobinelfrink
andauthored
[Cherry Pick] - Fix default backend annotation and tests (#7487)
* Make custom-default-backend upstream name more unique. Signed-off-by: Robin Elfrink <[email protected]> * Fix default backend annotation test (#7486) Co-authored-by: Robin Elfrink <[email protected]>
1 parent f973f3f commit a091b01

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/ingress/controller/controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ func (n *NGINXController) getBackendServers(ingresses []*ingress.Ingress) ([]*in
727727
endps := getEndpoints(location.DefaultBackend, &sp, apiv1.ProtocolTCP, n.store.GetServiceEndpoints)
728728
// custom backend is valid only if contains at least one endpoint
729729
if len(endps) > 0 {
730-
name := fmt.Sprintf("custom-default-backend-%v", location.DefaultBackend.GetName())
730+
name := fmt.Sprintf("custom-default-backend-%v-%v", location.DefaultBackend.GetNamespace(), location.DefaultBackend.GetName())
731731
klog.V(3).Infof("Creating \"%v\" upstream based on default backend annotation", name)
732732

733733
nb := upstream.DeepCopy()

test/e2e/annotations/customhttperrors.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ var _ = framework.DescribeAnnotation("custom-http-errors", func() {
116116
}
117117
return false
118118
})
119-
assert.Contains(ginkgo.GinkgoT(), serverConfig, errorBlockName(fmt.Sprintf("custom-default-backend-%s", customDefaultBackend), "503"))
120-
assert.Contains(ginkgo.GinkgoT(), serverConfig, fmt.Sprintf("error_page %s = %s", "503", errorBlockName(fmt.Sprintf("custom-default-backend-%s", customDefaultBackend), "503")))
119+
assert.Contains(ginkgo.GinkgoT(), serverConfig, errorBlockName(fmt.Sprintf("custom-default-backend-%s-%s", f.Namespace, customDefaultBackend), "503"))
120+
assert.Contains(ginkgo.GinkgoT(), serverConfig, fmt.Sprintf("error_page %s = %s", "503", errorBlockName(fmt.Sprintf("custom-default-backend-%s-%s", f.Namespace, customDefaultBackend), "503")))
121121
})
122122
})

0 commit comments

Comments
 (0)