@@ -2181,7 +2181,7 @@ func (c *controller) canMarkMachineFailed(machineDeployName, machineName, namesp
21812181 if machine .Status .CurrentStatus .Phase != v1alpha1 .MachineUnknown && machine .Status .CurrentStatus .Phase != v1alpha1 .MachineRunning {
21822182 // since Preserved Failed machines are not replaced immediately,
21832183 // they need not be considered towards inProgress
2184- if ! machineutils . IsPreserveExpiryTimeSet ( machine ) {
2184+ if machine . Status . CurrentStatus . PreserveExpiryTime == nil {
21852185 inProgress ++
21862186 }
21872187 switch machine .Status .CurrentStatus .Phase {
@@ -2370,9 +2370,8 @@ Utility Functions for Machine Preservation
23702370// preserveMachine contains logic to start the preservation of a machine and node.
23712371func (c * controller ) preserveMachine (ctx context.Context , machine * v1alpha1.Machine , preserveValue string ) error {
23722372 nodeName := machine .Labels [v1alpha1 .NodeLabelKey ]
2373- isExpirySet := machineutils .IsPreserveExpiryTimeSet (machine )
23742373 updatedMachine := machine .DeepCopy ()
2375- if ! isExpirySet {
2374+ if machine . Status . CurrentStatus . PreserveExpiryTime == nil {
23762375 klog .V (4 ).Infof ("Starting preservation flow for machine %q." , machine .Name )
23772376 // Step 1: Add preserveExpiryTime to machine status
23782377 updatedMachine , err := c .setPreserveExpiryTimeOnMachine (ctx , updatedMachine )
@@ -2526,7 +2525,7 @@ func (c *controller) shouldNodeBeDrained(machine *v1alpha1.Machine, existingCond
25262525func (c * controller ) stopMachinePreservation (ctx context.Context , machine * v1alpha1.Machine ) error {
25272526 // removal of preserveExpiryTime is the last step of stopping preservation
25282527 // if preserveExpiryTime is not set, preservation is already stopped
2529- if ! machineutils . IsPreserveExpiryTimeSet ( machine ) {
2528+ if machine . Status . CurrentStatus . PreserveExpiryTime == nil {
25302529 return nil
25312530 }
25322531 nodeName := machine .Labels [v1alpha1 .NodeLabelKey ]
0 commit comments