Skip to content

Commit b2ac20b

Browse files
claudioloradamjensenbot
authored andcommitted
fix: prevent the remote ResourceSlice controller to reconcile multiple 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.
1 parent 8aec47f commit b2ac20b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/liqo-controller-manager/authentication/remoteresourceslice-controller/remoteresourceslice_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ func (r *RemoteResourceSliceReconciler) SetupWithManager(mgr ctrl.Manager) error
271271
}
272272

273273
return ctrl.NewControllerManagedBy(mgr).Named(consts.CtrlResourceSliceRemote).
274-
For(&authv1beta1.ResourceSlice{}, builder.WithPredicates(predicate.And(remoteResSliceFilter, withCSR()))).
274+
For(
275+
&authv1beta1.ResourceSlice{},
276+
// With GenerationChangedPredicate we prevent to reconcile multiple times when the status of the resource changes
277+
builder.WithPredicates(predicate.And(remoteResSliceFilter, withCSR(), predicate.GenerationChangedPredicate{})),
278+
).
275279
Watches(&authv1beta1.Tenant{}, handler.EnqueueRequestsFromMapFunc(r.resourceSlicesEnquer())).
276280
Complete(r)
277281
}

0 commit comments

Comments
 (0)