From fb2f170c921dab5ee8bb7b95321b1c939c38ab97 Mon Sep 17 00:00:00 2001 From: Olivia Song Date: Wed, 12 Jul 2023 11:21:10 -0700 Subject: [PATCH] fix the bug that evenhanlder ignores the update triggered per sync-period (#3280) --- controllers/ingress/eventhandlers/ingress_events.go | 10 ++++++---- controllers/service/eventhandlers/service_events.go | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/controllers/ingress/eventhandlers/ingress_events.go b/controllers/ingress/eventhandlers/ingress_events.go index 4a9ba90b4..daab0b9b6 100644 --- a/controllers/ingress/eventhandlers/ingress_events.go +++ b/controllers/ingress/eventhandlers/ingress_events.go @@ -44,10 +44,12 @@ func (h *enqueueRequestsForIngressEvent) Update(e event.UpdateEvent, queue workq // 1. Ingress annotation updates // 2. Ingress spec updates // 3. Ingress deletion - if equality.Semantic.DeepEqual(ingOld.Annotations, ingNew.Annotations) && - equality.Semantic.DeepEqual(ingOld.Spec, ingNew.Spec) && - equality.Semantic.DeepEqual(ingOld.DeletionTimestamp.IsZero(), ingNew.DeletionTimestamp.IsZero()) { - return + if ! equality.Semantic.DeepEqual(ingOld.ResourceVersion, ingNew.ResourceVersion) { + if equality.Semantic.DeepEqual(ingOld.Annotations, ingNew.Annotations) && + equality.Semantic.DeepEqual(ingOld.Spec, ingNew.Spec) && + equality.Semantic.DeepEqual(ingOld.DeletionTimestamp.IsZero(), ingNew.DeletionTimestamp.IsZero()) { + return + } } h.enqueueIfBelongsToGroup(queue, ingNew) diff --git a/controllers/service/eventhandlers/service_events.go b/controllers/service/eventhandlers/service_events.go index 64af1f3ce..8511003ed 100644 --- a/controllers/service/eventhandlers/service_events.go +++ b/controllers/service/eventhandlers/service_events.go @@ -39,10 +39,12 @@ func (h *enqueueRequestsForServiceEvent) Update(e event.UpdateEvent, queue workq oldSvc := e.ObjectOld.(*corev1.Service) newSvc := e.ObjectNew.(*corev1.Service) - if equality.Semantic.DeepEqual(oldSvc.Annotations, newSvc.Annotations) && - equality.Semantic.DeepEqual(oldSvc.Spec, newSvc.Spec) && - equality.Semantic.DeepEqual(oldSvc.DeletionTimestamp.IsZero(), newSvc.DeletionTimestamp.IsZero()) { - return + if ! equality.Semantic.DeepEqual(oldSvc.ResourceVersion, newSvc.ResourceVersion) { + if equality.Semantic.DeepEqual(oldSvc.Annotations, newSvc.Annotations) && + equality.Semantic.DeepEqual(oldSvc.Spec, newSvc.Spec) && + equality.Semantic.DeepEqual(oldSvc.DeletionTimestamp.IsZero(), newSvc.DeletionTimestamp.IsZero()) { + return + } } h.enqueueManagedService(queue, newSvc)