Skip to content

Commit

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

Backport #6090 [CA] Add aws csi zone label to node template into CA1.24
  • Loading branch information
k8s-ci-robot authored Sep 28, 2023
2 parents d98b54f + 7acc0b3 commit 007e31d
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 @@ -56,6 +56,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 @@ -532,6 +533,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 @@ -101,8 +101,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 007e31d

Please sign in to comment.