From 1880fe6937b218cb14d7903d7efd0cfec6475909 Mon Sep 17 00:00:00 2001 From: Brett Elliott Date: Thu, 27 May 2021 17:53:52 +0200 Subject: [PATCH] Don't start CA in cooldown mode. --- cluster-autoscaler/core/static_autoscaler.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 3dfced108c82..11c3b42c3840 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -149,12 +149,15 @@ func NewStaticAutoscaler( scaleDown := NewScaleDown(autoscalingContext, processors, clusterStateRegistry) + // Set the initial scale times to be less than the start time so as to + // not start in cooldown mode. + initialScaleTime := time.Now().Add(-time.Hour) return &StaticAutoscaler{ AutoscalingContext: autoscalingContext, startTime: time.Now(), - lastScaleUpTime: time.Now(), - lastScaleDownDeleteTime: time.Now(), - lastScaleDownFailTime: time.Now(), + lastScaleUpTime: initialScaleTime, + lastScaleDownDeleteTime: initialScaleTime, + lastScaleDownFailTime: initialScaleTime, scaleDown: scaleDown, processors: processors, processorCallbacks: processorCallbacks,