@@ -295,7 +295,6 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l
295
295
// https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/InstanceConfiguration/
296
296
if err := machinePoolScope .ReconcileInstanceConfiguration (ctx ); err != nil {
297
297
r .Recorder .Eventf (machinePoolScope .OCIMachinePool , corev1 .EventTypeWarning , "FailedLaunchTemplateReconcile" , "Failed to reconcile launch template: %v" , err )
298
- machinePoolScope .Error (err , "failed to reconcile launch template" )
299
298
return ctrl.Result {}, err
300
299
}
301
300
@@ -305,13 +304,15 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l
305
304
// Find existing Instance Pool
306
305
instancePool , err := machinePoolScope .FindInstancePool (ctx )
307
306
if err != nil {
308
- conditions .MarkUnknown (machinePoolScope .OCIMachinePool , infrav2exp .InstancePoolReadyCondition , infrav2exp .InstancePoolNotFoundReason , err .Error ())
307
+ r .Recorder .Event (machinePoolScope .OCIMachinePool , corev1 .EventTypeWarning , "ReconcileError" , err .Error ())
308
+ conditions .MarkUnknown (machinePoolScope .OCIMachinePool , infrav2exp .InstancePoolReadyCondition , infrav2exp .InstancePoolNotFoundReason , "" )
309
309
return ctrl.Result {}, err
310
310
}
311
311
312
312
if instancePool == nil {
313
313
if _ , err := machinePoolScope .CreateInstancePool (ctx ); err != nil {
314
- conditions .MarkFalse (machinePoolScope .OCIMachinePool , infrav2exp .InstancePoolReadyCondition , infrav2exp .InstancePoolProvisionFailedReason , clusterv1 .ConditionSeverityError , err .Error ())
314
+ r .Recorder .Event (machinePoolScope .OCIMachinePool , corev1 .EventTypeWarning , "ReconcileError" , err .Error ())
315
+ conditions .MarkFalse (machinePoolScope .OCIMachinePool , infrav2exp .InstancePoolReadyCondition , infrav2exp .InstancePoolProvisionFailedReason , clusterv1 .ConditionSeverityError , "" )
315
316
return ctrl.Result {}, err
316
317
}
317
318
r .Recorder .Eventf (machinePoolScope .OCIMachinePool , corev1 .EventTypeNormal , "InstancePoolCreated" , "Created new Instance Pool: %s" , machinePoolScope .OCIMachinePool .GetName ())
@@ -398,7 +399,7 @@ func (r *OCIMachinePoolReconciler) reconcileDelete(ctx context.Context, machineP
398
399
if instancePool == nil {
399
400
machinePoolScope .OCIMachinePool .Status .Ready = false
400
401
conditions .MarkFalse (machinePoolScope .OCIMachinePool , infrav2exp .InstancePoolReadyCondition , infrav2exp .InstancePoolNotFoundReason , clusterv1 .ConditionSeverityWarning , "" )
401
- machinePoolScope .Info ("Instance Pool may already be deleted" , "displayName" , instancePool . DisplayName , "id" , instancePool . Id )
402
+ machinePoolScope .Info ("Instance Pool may already be deleted" )
402
403
r .Recorder .Eventf (machinePoolScope .OCIMachinePool , corev1 .EventTypeNormal , infrav2exp .InstancePoolNotFoundReason , "Unable to find matching instance pool" )
403
404
} else {
404
405
switch instancePool .LifecycleState {
@@ -462,13 +463,14 @@ func (r *OCIMachinePoolReconciler) reconcileMachines(ctx context.Context, err er
462
463
}
463
464
err = cloudutil .CreateMachinePoolMachinesIfNotExists (ctx , params )
464
465
if err != nil {
465
- conditions .MarkFalse (machinePoolScope .OCIMachinePool , clusterv1 .ReadyCondition , "FailedToDeleteOrphanedMachines" , clusterv1 .ConditionSeverityWarning , err .Error ())
466
+ r .Recorder .Event (machinePoolScope .OCIMachinePool , corev1 .EventTypeWarning , "FailedToCreateNewMachines" , err .Error ())
467
+ conditions .MarkFalse (machinePoolScope .OCIMachinePool , clusterv1 .ReadyCondition , "FailedToCreateNewMachines" , clusterv1 .ConditionSeverityWarning , "" )
466
468
return errors .Wrap (err , "failed to create missing machines" )
467
469
}
468
470
469
471
err = cloudutil .DeleteOrphanedMachinePoolMachines (ctx , params )
470
472
if err != nil {
471
- conditions .MarkFalse (machinePoolScope .OCIMachinePool , clusterv1 .ReadyCondition , "FailedToDeleteOrphanedMachines" , clusterv1 .ConditionSeverityWarning , err . Error () )
473
+ conditions .MarkFalse (machinePoolScope .OCIMachinePool , clusterv1 .ReadyCondition , "FailedToDeleteOrphanedMachines" , clusterv1 .ConditionSeverityWarning , "" )
472
474
return errors .Wrap (err , "failed to delete orphaned machines" )
473
475
}
474
476
return nil
0 commit comments