From d948846930d5630be9cc30733cb37b4e3ae45dfb Mon Sep 17 00:00:00 2001 From: Huabing Zhao Date: Sat, 23 Nov 2024 11:46:46 +0000 Subject: [PATCH] fix test Signed-off-by: Huabing Zhao --- internal/provider/kubernetes/predicates.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/provider/kubernetes/predicates.go b/internal/provider/kubernetes/predicates.go index 79a15a01c15..b7a87aca260 100644 --- a/internal/provider/kubernetes/predicates.go +++ b/internal/provider/kubernetes/predicates.go @@ -297,6 +297,9 @@ func (r *gatewayAPIReconciler) validateServiceForReconcile(obj client.Object) bo // Trigger a status update for the Gateway. // The status updater will check the service to get the addresses of the Gateway, // and check the Deployment/DaemonSet to get the status of the Gateway workload. + // Since the gtw.Status does not have the real changed status, we need to delete it first to avoid the status + // is equal to the previous status, and make sure the subscriber can get the update. + r.resources.GatewayStatuses.Delete(utils.NamespacedName(gtw)) r.resources.GatewayStatuses.Store(utils.NamespacedName(gtw), >w.Status) return false } @@ -534,6 +537,9 @@ func (r *gatewayAPIReconciler) validateObjectForReconcile(obj client.Object) boo // Trigger a status update for the Gateway. // The status updater will check the service to get the addresses of the Gateway, // and check the Deployment/DaemonSet to get the status of the Gateway workload. + // Since the gtw.Status does not have the real changed status, we need to delete it first to avoid the status + // is equal to the previous status, and make sure the subscriber can get the update. + r.resources.GatewayStatuses.Delete(utils.NamespacedName(gtw)) r.resources.GatewayStatuses.Store(utils.NamespacedName(gtw), >w.Status) return false } @@ -642,6 +648,9 @@ func (r *gatewayAPIReconciler) updateStatusForGatewaysUnderGatewayClass(ctx cont } for _, gateway := range gateways.Items { + // Since the gtw.Status does not have the real changed status, we need to delete it first to avoid the status + // is equal to the previous status, and make sure the subscriber can get the update. + r.resources.GatewayStatuses.Delete(utils.NamespacedName(&gateway)) r.resources.GatewayStatuses.Store(utils.NamespacedName(&gateway), &gateway.Status) }