Skip to content

Commit

Permalink
controllers: adapt for CAPI 1.9 breaking changes
Browse files Browse the repository at this point in the history
Add schemes into predicates (see
kubernetes-sigs/cluster-api#11239)
  • Loading branch information
EmilienM committed Nov 20, 2024
1 parent 67ce538 commit 095f633
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions controllers/openstackcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,15 +868,15 @@ func (r *OpenStackClusterReconciler) SetupWithManager(ctx context.Context, mgr c
}
return requests
}),
builder.WithPredicates(predicates.ClusterUnpaused(ctrl.LoggerFrom(ctx))),
builder.WithPredicates(predicates.ClusterUnpaused(mgr.GetScheme(), ctrl.LoggerFrom(ctx))),
).
Watches(
&infrav1alpha1.OpenStackServer{},
handler.EnqueueRequestForOwner(mgr.GetScheme(), mgr.GetRESTMapper(), &infrav1.OpenStackCluster{}),
builder.WithPredicates(OpenStackServerReconcileComplete(log)),
).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
WithEventFilter(predicates.ResourceIsNotExternallyManaged(ctrl.LoggerFrom(ctx))).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
WithEventFilter(predicates.ResourceIsNotExternallyManaged(mgr.GetScheme(), ctrl.LoggerFrom(ctx))).
Complete(r)
}

Expand Down
4 changes: 2 additions & 2 deletions controllers/openstackmachine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ func (r *OpenStackMachineReconciler) SetupWithManager(ctx context.Context, mgr c
&clusterv1.Machine{},
handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrav1.SchemeGroupVersion.WithKind("OpenStackMachine"))),
).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
Watches(
&clusterv1.Cluster{},
handler.EnqueueRequestsFromMapFunc(r.requeueOpenStackMachinesForUnpausedCluster(ctx)),
builder.WithPredicates(predicates.ClusterUnpausedAndInfrastructureReady(log)),
builder.WithPredicates(predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), log)),
).
// NOTE: we don't watch OpenStackCluster here, even though the
// OpenStackMachine controller directly requires values from
Expand Down

0 comments on commit 095f633

Please sign in to comment.