Skip to content

Commit

Permalink
Merge pull request #6144 from Shubham82/cherry-picked-of-#6090-upstre…
Browse files Browse the repository at this point in the history
…am-cluster-autoscaler-release-1.26

Backport #6090 [CA] Add aws csi zone label to node template into CA1.26
  • Loading branch information
k8s-ci-robot authored Sep 26, 2023
2 parents 849890d + 7647f5b commit f8aa91c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cluster-autoscaler/cloudprovider/aws/aws_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
autoDiscovererTypeASG = "asg"
asgAutoDiscovererKeyTag = "tag"
optionsTagsPrefix = "k8s.io/cluster-autoscaler/node-template/autoscaling-options/"
labelAwsCSITopologyZone = "topology.ebs.csi.aws.com/zone"
)

// AwsManager is handles aws communication and data caching.
Expand Down Expand Up @@ -395,6 +396,7 @@ func buildGenericLabels(template *asgTemplate, nodeName string) map[string]strin

result[apiv1.LabelTopologyRegion] = template.Region
result[apiv1.LabelTopologyZone] = template.Zone
result[labelAwsCSITopologyZone] = template.Zone
result[apiv1.LabelHostname] = nodeName
return result
}
Expand Down
5 changes: 4 additions & 1 deletion cluster-autoscaler/cloudprovider/aws/aws_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ func TestBuildGenericLabels(t *testing.T) {
Architecture: cloudprovider.DefaultArch,
},
Region: "us-east-1",
Zone: "us-east-1c",
}, "sillyname")
assert.Equal(t, "us-east-1", labels[apiv1.LabelZoneRegionStable])
assert.Equal(t, "us-east-1", labels[apiv1.LabelTopologyRegion])
assert.Equal(t, "us-east-1c", labels[apiv1.LabelTopologyZone])
assert.Equal(t, "us-east-1c", labels[labelAwsCSITopologyZone])
assert.Equal(t, "sillyname", labels[apiv1.LabelHostname])
assert.Equal(t, "c4.large", labels[apiv1.LabelInstanceTypeStable])
assert.Equal(t, cloudprovider.DefaultArch, labels[apiv1.LabelArchStable])
Expand Down

0 comments on commit f8aa91c

Please sign in to comment.