@@ -295,7 +295,6 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l
295295 // https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/InstanceConfiguration/
296296 if err := machinePoolScope .ReconcileInstanceConfiguration (ctx ); err != nil {
297297 r .Recorder .Eventf (machinePoolScope .OCIMachinePool , corev1 .EventTypeWarning , "FailedLaunchTemplateReconcile" , "Failed to reconcile launch template: %v" , err )
298- machinePoolScope .Error (err , "failed to reconcile launch template" )
299298 return ctrl.Result {}, err
300299 }
301300
@@ -305,13 +304,15 @@ func (r *OCIMachinePoolReconciler) reconcileNormal(ctx context.Context, logger l
305304 // Find existing Instance Pool
306305 instancePool , err := machinePoolScope .FindInstancePool (ctx )
307306 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 , "" )
309309 return ctrl.Result {}, err
310310 }
311311
312312 if instancePool == nil {
313313 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 , "" )
315316 return ctrl.Result {}, err
316317 }
317318 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
398399 if instancePool == nil {
399400 machinePoolScope .OCIMachinePool .Status .Ready = false
400401 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" )
402403 r .Recorder .Eventf (machinePoolScope .OCIMachinePool , corev1 .EventTypeNormal , infrav2exp .InstancePoolNotFoundReason , "Unable to find matching instance pool" )
403404 } else {
404405 switch instancePool .LifecycleState {
@@ -462,13 +463,14 @@ func (r *OCIMachinePoolReconciler) reconcileMachines(ctx context.Context, err er
462463 }
463464 err = cloudutil .CreateMachinePoolMachinesIfNotExists (ctx , params )
464465 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 , "" )
466468 return errors .Wrap (err , "failed to create missing machines" )
467469 }
468470
469471 err = cloudutil .DeleteOrphanedMachinePoolMachines (ctx , params )
470472 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 , "" )
472474 return errors .Wrap (err , "failed to delete orphaned machines" )
473475 }
474476 return nil
0 commit comments