Skip to content

Commit

Permalink
fix: use new enqueue function for component controllers
Browse files Browse the repository at this point in the history
The upgrade to new controller-runtime package switched the way that a controller enqueued
a new request for reconciliation.  Because of this, bad code was generated, specifically
when a collection and components are generated by operator-builder.  This is a simple change
to use the new methodology to enqueue a request.

Signed-off-by: Dustin Scott <[email protected]>
  • Loading branch information
scottd018 committed Apr 19, 2024
1 parent 6c41dbf commit a42b246
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (r *{{ .Resource.Kind }}Reconciler) EnqueueRequestOnCollectionChange(req *w
}
// create a function which maps this specific reconcile request
mapFn := func(collection client.Object) []reconcile.Request {
mapFn := func(_ context.Context, collection client.Object) []reconcile.Request {
return []reconcile.Request{
{
NamespacedName: types.NamespacedName{
Expand All @@ -307,7 +307,7 @@ func (r *{{ .Resource.Kind }}Reconciler) EnqueueRequestOnCollectionChange(req *w
// watch the collection and use our map function to enqueue the request
if err := r.Controller.Watch(
&source.Kind{Type: req.Collection},
source.Kind(r.Manager.GetCache(), req.Collection),
handler.EnqueueRequestsFromMapFunc(mapFn),
predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
Expand Down

0 comments on commit a42b246

Please sign in to comment.