@@ -54,6 +54,7 @@ import (
54
54
"sigs.k8s.io/cluster-api/util/finalizers"
55
55
clog "sigs.k8s.io/cluster-api/util/log"
56
56
"sigs.k8s.io/cluster-api/util/patch"
57
+ "sigs.k8s.io/cluster-api/util/paused"
57
58
"sigs.k8s.io/cluster-api/util/predicates"
58
59
"sigs.k8s.io/cluster-api/util/secret"
59
60
)
@@ -123,6 +124,10 @@ func (r *InMemoryMachineReconciler) Reconcile(ctx context.Context, req ctrl.Requ
123
124
log = log .WithValues ("Cluster" , klog .KObj (cluster ))
124
125
ctx = ctrl .LoggerInto (ctx , log )
125
126
127
+ if isPaused , conditionChanged , err := paused .EnsurePausedCondition (ctx , r .Client , cluster , inMemoryMachine ); err != nil || isPaused || conditionChanged {
128
+ return ctrl.Result {}, err
129
+ }
130
+
126
131
// Return early if the object or Cluster is paused.
127
132
if annotations .IsPaused (cluster , inMemoryMachine ) {
128
133
log .Info ("Reconciliation is paused for this object" )
@@ -1146,7 +1151,7 @@ func (r *InMemoryMachineReconciler) SetupWithManager(ctx context.Context, mgr ct
1146
1151
err = ctrl .NewControllerManagedBy (mgr ).
1147
1152
For (& infrav1.InMemoryMachine {}).
1148
1153
WithOptions (options ).
1149
- WithEventFilter (predicates .ResourceNotPausedAndHasFilterLabel (mgr .GetScheme (), predicateLog , r .WatchFilterValue )).
1154
+ WithEventFilter (predicates .ResourceHasFilterLabel (mgr .GetScheme (), predicateLog , r .WatchFilterValue )).
1150
1155
Watches (
1151
1156
& clusterv1.Machine {},
1152
1157
handler .EnqueueRequestsFromMapFunc (util .MachineToInfrastructureMapFunc (infrav1 .GroupVersion .WithKind ("InMemoryMachine" ))),
@@ -1159,7 +1164,7 @@ func (r *InMemoryMachineReconciler) SetupWithManager(ctx context.Context, mgr ct
1159
1164
& clusterv1.Cluster {},
1160
1165
handler .EnqueueRequestsFromMapFunc (clusterToInMemoryMachines ),
1161
1166
builder .WithPredicates (
1162
- predicates .ClusterUnpausedAndInfrastructureReady (mgr .GetScheme (), predicateLog ),
1167
+ predicates .ClusterInfrastructureReady (mgr .GetScheme (), predicateLog ),
1163
1168
),
1164
1169
).Complete (r )
1165
1170
if err != nil {
0 commit comments