Skip to content

Commit

Permalink
fix: prevent the remote ResourceSlice controller to reconcile multipl…
Browse files Browse the repository at this point in the history
…e times

The remote ResourceSlice controller reconciled multiple times when the
status of the resource was changed. To fix this issue this patch adds
the GenerationChangedPredicate, allowing to reconcile only when the
specs of the resource changes.
  • Loading branch information
claudiolor committed Oct 15, 2024
1 parent 06472a9 commit a7c3a4d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ func (r *RemoteResourceSliceReconciler) SetupWithManager(mgr ctrl.Manager) error
}

return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceRemote).
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(predicate.And(remoteResSliceFilter, withCSR()))).
For(
&authv1beta1.ResourceSlice{},
// With GenerationChangedPredicate we prevent to reconcile multiple times when the status of the resource changes
builder.WithPredicates(predicate.And(remoteResSliceFilter, withCSR(), predicate.GenerationChangedPredicate{})),
).
Watches(&authv1beta1.Tenant{}, handler.EnqueueRequestsFromMapFunc(r.resourceSlicesEnquer())).
Complete(r)
}
Expand Down

0 comments on commit a7c3a4d

Please sign in to comment.