Merge pull request #5317 from grosser/grosser/ref2

cluster-autoscaler: refactor BalanceScaleUpBetweenGroups
This commit is contained in:
Kubernetes Prow Robot 2022-12-19 00:49:44 -08:00 committed by GitHub
commit d9ffb8f5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -97,15 +97,16 @@ func (b *BalancingNodeGroupSetProcessor) BalanceScaleUpBetweenGroups(context *co
// group already maxed, ignore it
continue
}
info := ScaleUpInfo{
if maxSize > currentSize {
// we still have capacity to expand
totalCapacity += (maxSize - currentSize)
}
scaleUpInfos = append(scaleUpInfos, ScaleUpInfo{
Group: ng,
CurrentSize: currentSize,
NewSize: currentSize,
MaxSize: maxSize}
scaleUpInfos = append(scaleUpInfos, info)
if maxSize-currentSize > 0 {
totalCapacity += maxSize - currentSize
}
MaxSize: maxSize,
})
}
if totalCapacity < newNodes {
klog.V(2).Infof("Requested scale-up (%v) exceeds node group set capacity, capping to %v", newNodes, totalCapacity)