From 6b9d55b0713f15950c9a83eda383343923c95f25 Mon Sep 17 00:00:00 2001 From: Yaroslava Serdiuk Date: Thu, 16 Feb 2023 16:14:19 +0000 Subject: [PATCH] Decrease node group size only if the node pass resource check for scale down candidate --- cluster-autoscaler/core/scaledown/unneeded/nodes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster-autoscaler/core/scaledown/unneeded/nodes.go b/cluster-autoscaler/core/scaledown/unneeded/nodes.go index b48884622b25..8dbdb3171d9c 100644 --- a/cluster-autoscaler/core/scaledown/unneeded/nodes.go +++ b/cluster-autoscaler/core/scaledown/unneeded/nodes.go @@ -185,7 +185,6 @@ func (n *Nodes) unremovableReason(context *context.AutoscalingContext, v *node, if reason := verifyMinSize(node.Name, nodeGroup, nodeGroupSize, as); reason != simulator.NoReason { return reason } - nodeGroupSize[nodeGroup.Id()]-- resourceDelta, err := n.limitsFinder.DeltaForNode(context, node, nodeGroup, resourcesWithLimits) if err != nil { @@ -209,6 +208,7 @@ func (n *Nodes) unremovableReason(context *context.AutoscalingContext, v *node, return simulator.MinimalResourceLimitExceeded } + nodeGroupSize[nodeGroup.Id()]-- return simulator.NoReason }