@@ -44,10 +44,10 @@ import (
44
44
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
45
45
"sigs.k8s.io/cluster-api/internal/util/ssa"
46
46
"sigs.k8s.io/cluster-api/util"
47
- "sigs.k8s.io/cluster-api/util/annotations"
48
47
"sigs.k8s.io/cluster-api/util/conditions"
49
48
"sigs.k8s.io/cluster-api/util/finalizers"
50
49
"sigs.k8s.io/cluster-api/util/patch"
50
+ "sigs.k8s.io/cluster-api/util/paused"
51
51
"sigs.k8s.io/cluster-api/util/predicates"
52
52
)
53
53
@@ -116,7 +116,6 @@ func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
116
116
// TODO: should this wait for Cluster.Status.InfrastructureReady similar to Infra Machine resources?
117
117
builder .WithPredicates (
118
118
predicates .All (mgr .GetScheme (), predicateLog ,
119
- predicates .ClusterUnpaused (mgr .GetScheme (), predicateLog ),
120
119
predicates .ResourceHasFilterLabel (mgr .GetScheme (), predicateLog , r .WatchFilterValue ),
121
120
),
122
121
),
@@ -167,10 +166,8 @@ func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request)
167
166
mp .Spec .ClusterName , mp .Name , mp .Namespace )
168
167
}
169
168
170
- // Return early if the object or Cluster is paused.
171
- if annotations .IsPaused (cluster , mp ) {
172
- log .Info ("Reconciliation is paused for this object" )
173
- return ctrl.Result {}, nil
169
+ if isPaused , conditionChanged , err := paused .EnsurePausedCondition (ctx , r .Client , cluster , mp ); err != nil || isPaused || conditionChanged {
170
+ return ctrl.Result {}, err
174
171
}
175
172
176
173
// Initialize the patch helper.
0 commit comments