From 37e4734f8e17f6e7d7e074002ec9f10cbb774820 Mon Sep 17 00:00:00 2001 From: Xunzhuo Date: Wed, 13 Dec 2023 20:29:09 +0800 Subject: [PATCH] Update internal/provider/kubernetes/predicates.go Co-authored-by: Karol Szwaj Signed-off-by: Xunzhuo --- internal/provider/kubernetes/predicates.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/provider/kubernetes/predicates.go b/internal/provider/kubernetes/predicates.go index 406948e11c44..d669dc7f5569 100644 --- a/internal/provider/kubernetes/predicates.go +++ b/internal/provider/kubernetes/predicates.go @@ -319,9 +319,12 @@ func (r *gatewayAPIReconciler) validateDeploymentForReconcile(obj client.Object) if !ok { return false } - for _, gtw := range res.Gateways { - gtw := gtw - r.statusUpdateForGateway(ctx, gtw) + if res != nil && len(res.Gateways) > 0 { + for _, gw := range res.Gateways { + gw := gw + r.statusUpdateForGateway(ctx, gw) + } + } } return false }