From 5ae76ea66edb39606ac412393e12774960420a16 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Thu, 7 Mar 2019 09:15:39 +0000 Subject: [PATCH] UPSTREAM: : fix max cluster size calculation on scale up When scaling up the calculation for computing the maximum cluster size does not take into account the number of any upcoming nodes and it is possible to grow the cluster beyond the cluster size (--max-nodes-total). Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1670695 --- cluster-autoscaler/core/scale_up.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster-autoscaler/core/scale_up.go b/cluster-autoscaler/core/scale_up.go index 671d74cf5a7..f2b046954e0 100644 --- a/cluster-autoscaler/core/scale_up.go +++ b/cluster-autoscaler/core/scale_up.go @@ -427,7 +427,7 @@ func ScaleUp(context *context.AutoscalingContext, processors *ca_processors.Auto newNodes := bestOption.NodeCount - if context.MaxNodesTotal > 0 && len(nodes)+newNodes > context.MaxNodesTotal { + if context.MaxNodesTotal > 0 && len(nodes)+newNodes+len(upcomingNodes) > context.MaxNodesTotal { klog.V(1).Infof("Capping size to max cluster total size (%d)", context.MaxNodesTotal) newNodes = context.MaxNodesTotal - len(nodes) - len(upcomingNodes) if newNodes < 1 {