Skip to content

Commit 4c9a9eb

Browse files
Merge pull request #49 from platform9/private/main/jayanth/BYOUpgrade
Not removing cluster-name label in the case of upgrade
2 parents e8084a5 + f1c0048 commit 4c9a9eb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

controllers/infrastructure/byomachine_controller.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,16 @@ func (r *ByoMachineReconciler) markHostForCleanup(ctx context.Context, machineSc
613613
}
614614
machineScope.ByoHost.Annotations[infrav1.HostCleanupAnnotation] = ""
615615

616-
// remove the pf9 cluster label
617-
logger.Info("Removing pf9 cluster label %s from ByoHost %s", infrav1.ClusterLabel, machineScope.ByoHost.Name)
618-
delete(machineScope.ByoHost.Labels, infrav1.ClusterLabel)
616+
// Debug: Log the value and presence of the upgrade-in-progress annotation
617+
upgradeInProgress, ok := machineScope.ByoMachine.Annotations["barista.platform9.io/upgrade-in-progress"]
618+
logger.Info("DEBUG: upgrade-in-progress annotation check", "value", upgradeInProgress, "present", ok)
619+
// Improved logic: skip label removal only if annotation exists and is set to "true"
620+
if ok && upgradeInProgress == "true" {
621+
logger.Info("Upgrade in progress: skipping removal of pf9 cluster label from ByoHost %s", machineScope.ByoHost.Name)
622+
} else {
623+
logger.Info("Removing pf9 cluster label %s from ByoHost %s", infrav1.ClusterLabel, machineScope.ByoHost.Name)
624+
delete(machineScope.ByoHost.Labels, infrav1.ClusterLabel)
625+
}
619626

620627
// Issue the patch for byohost
621628
return helper.Patch(ctx, machineScope.ByoHost)

0 commit comments

Comments
 (0)