From 3958c6645d311e4f48e5d780292529e09049804d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Tu=C5=BCnik?= Date: Fri, 24 Jul 2020 15:11:45 +0200 Subject: [PATCH] Add an annotation identifying upcoming nodes --- cluster-autoscaler/core/static_autoscaler.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 6420e826bbc9..456ceae6a3f0 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -57,6 +57,9 @@ const ( unschedulablePodWithGpuTimeBuffer = 30 * time.Second // How long should Cluster Autoscaler wait for nodes to become ready after start. nodesNotReadyAfterStartTimeout = 10 * time.Minute + + // NodeUpcomingAnnotation is an annotation CA adds to nodes which are upcoming. + NodeUpcomingAnnotation = "cluster-autoscaler.k8s.io/upcoming-node" ) // StaticAutoscaler is an autoscaler which has all the core functionality of a CA but without the reconfiguration feature @@ -795,6 +798,12 @@ func getUpcomingNodeInfos(registry *clusterstate.ClusterStateRegistry, nodeInfos klog.Warningf("Couldn't find template for node group %s", nodeGroup) continue } + + if nodeTemplate.Node().Annotations == nil { + nodeTemplate.Node().Annotations = make(map[string]string) + } + nodeTemplate.Node().Annotations[NodeUpcomingAnnotation] = "true" + for i := 0; i < numberOfNodes; i++ { // Ensure new nodes have different names because nodeName // will be used as a map key. Also deep copy pods (daemonsets &