@@ -152,29 +152,23 @@ func (r *Metal3MachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
152152 }
153153
154154 // Check pause annotation on associated bmh (if any)
155- if ! cluster .Spec .Paused {
156- err := machineMgr .RemovePauseAnnotation (ctx )
157- if err != nil {
158- machineLog .Info ("failed to check pause annotation on associated bmh" )
159- conditions .MarkFalse (capm3Machine , infrav1 .AssociateBMHCondition , infrav1 .PauseAnnotationRemoveFailedReason , clusterv1 .ConditionSeverityInfo , "" )
160- return ctrl.Result {}, nil
161- }
162- } else {
163- // set pause annotation on associated bmh (if any)
155+ if annotations .IsPaused (cluster , capm3Machine ) {
164156 err := machineMgr .SetPauseAnnotation (ctx )
165157 if err != nil {
166158 machineLog .Info ("failed to set pause annotation on associated bmh" )
167159 conditions .MarkFalse (capm3Machine , infrav1 .AssociateBMHCondition , infrav1 .PauseAnnotationSetFailedReason , clusterv1 .ConditionSeverityInfo , "" )
168160 return ctrl.Result {}, nil
169161 }
170- }
171-
172- // Return early if the M3Machine or Cluster is paused.
173- if annotations .IsPaused (cluster , capm3Machine ) {
174162 machineLog .Info ("reconciliation is paused for this object" )
175163 conditions .MarkFalse (capm3Machine , infrav1 .AssociateBMHCondition , infrav1 .Metal3MachinePausedReason , clusterv1 .ConditionSeverityInfo , "" )
176164 return ctrl.Result {Requeue : true , RequeueAfter : requeueAfter }, nil
177165 }
166+ err = machineMgr .RemovePauseAnnotation (ctx )
167+ if err != nil {
168+ machineLog .Info ("failed to remove pause annotation on associated bmh" )
169+ conditions .MarkFalse (capm3Machine , infrav1 .AssociateBMHCondition , infrav1 .PauseAnnotationRemoveFailedReason , clusterv1 .ConditionSeverityInfo , "" )
170+ return ctrl.Result {}, nil
171+ }
178172
179173 // Handle deleted machines
180174 if ! capm3Machine .ObjectMeta .DeletionTimestamp .IsZero () {
0 commit comments