@@ -174,6 +174,7 @@ func (r *ReconcileMachineSet) Reconcile(ctx context.Context, request reconcile.R
174
174
}
175
175
176
176
if r .gate .Enabled (featuregate .Feature (openshiftfeatures .FeatureGateMachineAPIMigration )) {
177
+ machineSetName := machineSet .GetName ()
177
178
machineSetCopy := machineSet .DeepCopy ()
178
179
// Check Status.AuthoritativeAPI. If it's not set to MachineAPI. Set the
179
180
// paused condition true and return early.
@@ -188,12 +189,15 @@ func (r *ReconcileMachineSet) Reconcile(ctx context.Context, request reconcile.R
188
189
"The AuthoritativeAPI is set to %s" , string (machineSet .Status .AuthoritativeAPI ),
189
190
))
190
191
191
- machineSet , err := updateMachineSetStatus (r .Client , machineSet , machineSetCopy .Status )
192
- if err != nil {
193
- klog .Errorf ("%v: error updating status: %v" , machineSetCopy .Name , err )
192
+ _ , err := updateMachineSetStatus (r .Client , machineSet , machineSetCopy .Status )
193
+ if err != nil && ! apierrors .IsNotFound (err ) {
194
+ klog .Errorf ("%v: error updating status: %v" , machineSetName , err )
195
+ return reconcile.Result {}, fmt .Errorf ("error updating status: %w" , err )
196
+ } else if apierrors .IsNotFound (err ) {
197
+ return reconcile.Result {}, nil
194
198
}
195
199
196
- klog .Infof ("%v: machine set is paused, taking no further action" , machineSet . Name )
200
+ klog .Infof ("%v: machine set is paused, taking no further action" , machineSetName )
197
201
return reconcile.Result {}, nil
198
202
}
199
203
@@ -212,11 +216,17 @@ func (r *ReconcileMachineSet) Reconcile(ctx context.Context, request reconcile.R
212
216
"%s" ,
213
217
pausedFalseReason ,
214
218
))
215
- machineSet , err := updateMachineSetStatus (r .Client , machineSet , machineSetCopy .Status )
216
- if err != nil {
217
- klog .Errorf ("%v: error updating status: %v" , machineSetCopy .Name , err )
219
+
220
+ var err error
221
+ machineSet , err = updateMachineSetStatus (r .Client , machineSet , machineSetCopy .Status )
222
+ if err != nil && ! apierrors .IsNotFound (err ) {
223
+ klog .Errorf ("%v: error updating status: %v" , machineSetName , err )
224
+ return reconcile.Result {}, fmt .Errorf ("error updating status: %w" , err )
225
+ } else if apierrors .IsNotFound (err ) {
226
+ return reconcile.Result {}, nil
218
227
}
219
- klog .Infof ("%v: setting paused to false and continuing reconcile" , machineSet .Name )
228
+
229
+ klog .Infof ("%v: setting paused to false and continuing reconcile" , machineSetName )
220
230
}
221
231
222
232
result , err := r .reconcile (ctx , machineSet )
0 commit comments