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 authored and adamjensenbot committed Oct 24, 2024
1 parent 8aec47f commit b2ac20b
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 b2ac20b

Please sign in to comment.