Skip to content

Trigger an explicit scale up error when expander filters out all scale-up options #7512

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 20 additions & 1 deletion cluster-autoscaler/core/scaleup/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,11 @@ func (o *ScaleUpOrchestrator) ScaleUp(
// Pick some expansion option.
bestOption := o.autoscalingContext.ExpanderStrategy.BestOption(options, nodeInfos)
if bestOption == nil || bestOption.NodeCount <= 0 {
klog.Infof("Expander filtered out all options, valid options: %d", len(options))
podEquivalenceGroups = markAllGroupsAsUnschedulable(podEquivalenceGroups, ExpansionOptionsFilteredOutReason)
return &status.ScaleUpStatus{
Result: status.ScaleUpNoOptionsAvailable,
PodsRemainUnschedulable: GetRemainingPods(podEquivalenceGroups, skippedNodeGroups),
PodsRemainUnschedulable: allPodsAsNoScaleUpInfo(podEquivalenceGroups, skippedNodeGroups),
ConsideredNodeGroups: nodeGroups,
}, nil
}
Expand Down Expand Up @@ -814,6 +816,23 @@ func GetRemainingPods(egs []*equivalence.PodGroup, skipped map[string]status.Rea
return remaining
}

// allPodsAsNoScaleUpInfo flattens all equivalence groups into a list of NoScaleUpInfo
func allPodsAsNoScaleUpInfo(egs []*equivalence.PodGroup, skipped map[string]status.Reasons) []status.NoScaleUpInfo {
noScaleUpInfos := make([]status.NoScaleUpInfo, 0, len(egs))
for _, eg := range egs {
for _, pod := range eg.Pods {
noScaleUpInfo := status.NoScaleUpInfo{
Pod: pod,
RejectedNodeGroups: eg.SchedulingErrors,
SkippedNodeGroups: skipped,
}
noScaleUpInfos = append(noScaleUpInfos, noScaleUpInfo)
}
}

return noScaleUpInfos
}

// GetPodsAwaitingEvaluation returns list of pods for which CA was unable to help
// this scale up loop (but should be able to help).
func GetPodsAwaitingEvaluation(egs []*equivalence.PodGroup, bestOption string) []*apiv1.Pod {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ func (sr *RejectedReasons) Reasons() []string {
var (
// AllOrNothingReason means the node group was rejected because not all pods would fit it when using all-or-nothing strategy.
AllOrNothingReason = NewRejectedReasons("not all pods would fit and scale-up is using all-or-nothing strategy")
// ExpansionOptionsFilteredOutReason means the node groups were considered as a scale-up candidates but got filtered
// out by the expander strategy.
ExpansionOptionsFilteredOutReason = NewRejectedReasons("expansion options filtered out and no longer considered")
)
Loading