Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added failed machine to prevent scaledown #291

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cluster-autoscaler/cloudprovider/mcm/mcm_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ func (m *McmManager) prioritizeMachinesForDeletion(targetMachineRefs []*Ref, mdN
klog.Errorf("Unable to fetch Machine object %s, Error: %v", machineRef.Name, err)
return true, err
}
if isMachineTerminating(mc) {
if isMachineFailedOrTerminating(mc) {
return false, nil
}
expectedToTerminateMachineNodePairs[mc.Name] = mc.Labels["node"]
Expand Down Expand Up @@ -988,10 +988,10 @@ func buildGenericLabels(template *nodeTemplate, nodeName string) map[string]stri
return result
}

// isMachineTerminating returns true if machine is already being terminated or considered for termination by autoscaler.
func isMachineTerminating(machine *v1alpha1.Machine) bool {
if !machine.GetDeletionTimestamp().IsZero() {
klog.Infof("Machine %q is already being terminated, and hence skipping the deletion", machine.Name)
// isMachineFailedOrTerminating returns true if machine is already being terminated or considered for termination by autoscaler.
func isMachineFailedOrTerminating(machine *v1alpha1.Machine) bool {
if !machine.GetDeletionTimestamp().IsZero() || machine.Status.LastOperation.State == v1alpha1.MachineStateFailed {
rishabh-11 marked this conversation as resolved.
Show resolved Hide resolved
klog.Infof("Machine %q is already being failed or terminated, and hence skipping the deletion", machine.Name)
rishabh-11 marked this conversation as resolved.
Show resolved Hide resolved
return true
}
return false
Expand Down
Loading