Skip to content

Commit 10ab017

Browse files
hardikdrprashanth26
authored andcommitted
Fix unexpected freeze during scale-down issue
1 parent cfd44c2 commit 10ab017

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

pkg/controller/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ func (dc *controller) reconcileClusterMachineDeployment(key string) error {
451451
// If MachineDeployment is frozen and no deletion timestamp, don't process it
452452
if deployment.Labels["freeze"] == "True" && deployment.DeletionTimestamp == nil {
453453
glog.V(3).Infof("MachineDeployment %q is frozen, and hence not processeing", deployment.Name)
454-
return nil
454+
//return nil
455455
}
456456

457457
// Validate MachineDeployment

pkg/controller/machine_safety.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const (
4444
LastReplicaUpdate = "safety.machine.sapcloud.io/lastreplicaupdate"
4545
)
4646

47-
// SafetyCheck controller is used to protect the controller from orphan VMs being created
47+
// SafetyCheck controller is used to protect the controller from orphan or excess VMs being created
4848
func (c *controller) reconcileClusterMachineSafety(key string) error {
4949
var wg sync.WaitGroup
5050

@@ -125,7 +125,7 @@ func (c *controller) checkAndFreezeORUnfreezeMachineSets(wg *sync.WaitGroup) {
125125
if machineSet.Labels["freeze"] != "True" &&
126126
fullyLabeledReplicasCount >= higherThreshold {
127127
message := fmt.Sprintf(
128-
"The number of machines backing MachineSet: %s is %d > %d which is the Max-ScaleUp-Limit",
128+
"The number of machines backing MachineSet: %s is %d >= %d which is the Max-ScaleUp-Limit",
129129
machineSet.Name,
130130
fullyLabeledReplicasCount,
131131
higherThreshold,

pkg/controller/machineset.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,12 @@ func (c *controller) manageReplicas(allMachines []*v1alpha1.Machine, machineSet
341341

342342
diff := len(activeMachines) - int(machineSet.Spec.Replicas)
343343
if diff < 0 {
344-
//glog.Info("Start Create:", diff)
344+
// If MachineSet is frozen and no deletion timestamp, don't process it
345+
if machineSet.Labels["freeze"] == "True" && machineSet.DeletionTimestamp == nil {
346+
glog.V(2).Infof("MachineSet %q is frozen, and hence not processing", machineSet.Name)
347+
return nil
348+
}
349+
345350
diff *= -1
346351
if diff > BurstReplicas {
347352
diff = BurstReplicas
@@ -444,12 +449,6 @@ func (c *controller) reconcileClusterMachineSet(key string) error {
444449
return err
445450
}
446451

447-
// If MachineSet is frozen and no deletion timestamp, don't process it
448-
if machineSet.Labels["freeze"] == "True" && machineSet.DeletionTimestamp == nil {
449-
glog.V(3).Infof("MachineSet %q is frozen, and hence not processeing", machineSet.Name)
450-
return nil
451-
}
452-
453452
// Validate MachineSet
454453
internalMachineSet := &machine.MachineSet{}
455454
err = c.internalExternalScheme.Convert(machineSet, internalMachineSet, nil)

0 commit comments

Comments
 (0)