From 887e16c3fc7ab59dca231c5cb83a91cef63839c4 Mon Sep 17 00:00:00 2001 From: Yaroslava Serdiuk Date: Tue, 9 Aug 2022 12:01:03 +0000 Subject: [PATCH] CA: Iterate through existed node groups in AnnotationNodeInfoProvider --- .../annotation_node_info_provider.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/cluster-autoscaler/processors/nodeinfosprovider/annotation_node_info_provider.go b/cluster-autoscaler/processors/nodeinfosprovider/annotation_node_info_provider.go index 7f1d2aaa5aeb..87d1c88b1bd0 100644 --- a/cluster-autoscaler/processors/nodeinfosprovider/annotation_node_info_provider.go +++ b/cluster-autoscaler/processors/nodeinfosprovider/annotation_node_info_provider.go @@ -45,18 +45,18 @@ func (p *AnnotationNodeInfoProvider) Process(ctx *context.AutoscalingContext, no if err != nil { return nil, err } - for _, nodeInfo := range nodeInfos { - nodeGroup, err := ctx.CloudProvider.NodeGroupForNode(nodeInfo.Node()) - if err != nil { - continue - } - template, err := nodeGroup.TemplateNodeInfo() - if err != nil { - continue - } - for key, val := range template.Node().Annotations { - if _, ok := nodeInfo.Node().Annotations[key]; !ok { - nodeInfo.Node().Annotations[key] = val + // Add annotatios to the NodeInfo to use later in expander. + nodeGroups := ctx.CloudProvider.NodeGroups() + for _, ng := range nodeGroups { + if nodeInfo, ok := nodeInfos[ng.Id()]; ok { + template, err := ng.TemplateNodeInfo() + if err != nil { + continue + } + for key, val := range template.Node().Annotations { + if _, ok := nodeInfo.Node().Annotations[key]; !ok { + nodeInfo.Node().Annotations[key] = val + } } } }