cmd/k8s-operator: default ingress paths to '/' if not specified by user (#15706)

in resource

Fixes #14908

Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
Tom Meadows
2025-04-17 16:14:34 +01:00
committed by GitHub
parent 26f31f73f4
commit 9666c2e700
2 changed files with 178 additions and 8 deletions
+6
View File
@@ -292,9 +292,15 @@ func validateIngressClass(ctx context.Context, cl client.Client) error {
func handlersForIngress(ctx context.Context, ing *networkingv1.Ingress, cl client.Client, rec record.EventRecorder, tlsHost string, logger *zap.SugaredLogger) (handlers map[string]*ipn.HTTPHandler, err error) {
addIngressBackend := func(b *networkingv1.IngressBackend, path string) {
if path == "" {
path = "/"
rec.Eventf(ing, corev1.EventTypeNormal, "PathUndefined", "configured backend is missing a path, defaulting to '/'")
}
if b == nil {
return
}
if b.Service == nil {
rec.Eventf(ing, corev1.EventTypeWarning, "InvalidIngressBackend", "backend for path %q is missing service", path)
return