From 095f6333e0dbeccc4dee71dfef50fda2f780e52d Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 12 Nov 2024 09:04:08 -0500 Subject: [PATCH] controllers: adapt for CAPI 1.9 breaking changes Add schemes into predicates (see https://github.com/kubernetes-sigs/cluster-api/pull/11239) --- controllers/openstackcluster_controller.go | 6 +++--- controllers/openstackmachine_controller.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/openstackcluster_controller.go b/controllers/openstackcluster_controller.go index c396b4b4c8..f8dcd44948 100644 --- a/controllers/openstackcluster_controller.go +++ b/controllers/openstackcluster_controller.go @@ -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) } diff --git a/controllers/openstackmachine_controller.go b/controllers/openstackmachine_controller.go index 3de18d0dc5..559f271e2d 100644 --- a/controllers/openstackmachine_controller.go +++ b/controllers/openstackmachine_controller.go @@ -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