From 370ec6b46b5e1f8ec16007558841ac3ede93f865 Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Mon, 22 Jan 2024 19:20:23 +0000 Subject: [PATCH] cmd/k8s-operator: don't proceed with Ingress that has no valid backends (#10919) Do not provision resources for a tailscale Ingress that has no valid backends. Updates tailscale/tailscale#10910 Signed-off-by: Irbe Krumina --- cmd/k8s-operator/ingress.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/k8s-operator/ingress.go b/cmd/k8s-operator/ingress.go index 17871af3a..af09be075 100644 --- a/cmd/k8s-operator/ingress.go +++ b/cmd/k8s-operator/ingress.go @@ -230,6 +230,12 @@ func (a *IngressReconciler) maybeProvision(ctx context.Context, logger *zap.Suga } } + if len(web.Handlers) == 0 { + logger.Warn("Ingress contains no valid backends") + a.recorder.Eventf(ing, corev1.EventTypeWarning, "NoValidBackends", "no valid backends") + return nil + } + crl := childResourceLabels(ing.Name, ing.Namespace, "ingress") var tags []string if tstr, ok := ing.Annotations[AnnotationTags]; ok {