@@ -175,14 +175,12 @@ func (r *Reconciler) createMachineSetAndWait(ctx context.Context, deployment *cl
175
175
log = log .WithValues ("MachineSet" , klog .KObj (newMS ))
176
176
ctx = ctrl .LoggerInto (ctx , log )
177
177
178
- log .Info (fmt .Sprintf ("Creating new MachineSet, %s" , createReason ))
179
-
180
178
// Create the MachineSet.
181
179
if err := ssa .Patch (ctx , r .Client , machineDeploymentManagerName , newMS ); err != nil {
182
180
r .recorder .Eventf (deployment , corev1 .EventTypeWarning , "FailedCreate" , "Failed to create MachineSet %s: %v" , klog .KObj (newMS ), err )
183
181
return nil , errors .Wrapf (err , "failed to create new MachineSet %s" , klog .KObj (newMS ))
184
182
}
185
- log .V ( 4 ). Info ( "Created new MachineSet" )
183
+ log .Info ( fmt . Sprintf ( "MachineSet created (%s)" , createReason ) )
186
184
r .recorder .Eventf (deployment , corev1 .EventTypeNormal , "SuccessfulCreate" , "Created MachineSet %s" , klog .KObj (newMS ))
187
185
188
186
// Keep trying to get the MachineSet. This will force the cache to update and prevent any future reconciliation of
@@ -647,6 +645,8 @@ func (r *Reconciler) cleanupDeployment(ctx context.Context, oldMSs []*clusterv1.
647
645
r .recorder .Eventf (deployment , corev1 .EventTypeWarning , "FailedDelete" , "Failed to delete MachineSet %q: %v" , ms .Name , err )
648
646
return err
649
647
}
648
+ // Note: We intentionally log after Delete because we want this log line to show up only after DeletionTimestamp has been set.
649
+ log .Info ("Deleting MachineSet (cleanup of old MachineSet)" , "MachineSet" , klog .KObj (ms ))
650
650
r .recorder .Eventf (deployment , corev1 .EventTypeNormal , "SuccessfulDelete" , "Deleted MachineSet %q" , ms .Name )
651
651
}
652
652
0 commit comments