Skip to content

Commit

Permalink
Backport kubernetes#6090 [CA] Add aws csi zone label to node template…
Browse files Browse the repository at this point in the history
… into CA1.26
  • Loading branch information
Shubham82 committed Sep 26, 2023
1 parent 849890d commit 7647f5b
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 7647f5b

Please sign in to comment.