This commit is contained in:
Maksym Fuhol 2025-09-18 13:37:07 +02:00 committed by GitHub
commit 26e3e02e06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View File

@ -176,9 +176,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
}
@ -843,6 +845,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 {

View File

@ -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")
)