Skip to content

Commit

Permalink
fix the bug that evenhanlder ignores the update triggered per sync-pe…
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviassss authored Jul 12, 2023
1 parent 940efc7 commit fb2f170
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions controllers/ingress/eventhandlers/ingress_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions controllers/service/eventhandlers/service_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb2f170

Please sign in to comment.