Skip to content

Commit

Permalink
Merge pull request #6261 from sibucan/aws-capacity-type-fix
Browse files Browse the repository at this point in the history
Fix capacityType label in AWS ManagedNodeGroup
  • Loading branch information
k8s-ci-robot authored Dec 4, 2023
2 parents 04b89f6 + 7ffb662 commit c0661b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cluster-autoscaler/cloudprovider/aws/aws_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (m *awsWrapper) getManagedNodegroupInfo(nodegroupName string, clusterName s
}

if r.Nodegroup.CapacityType != nil && len(*r.Nodegroup.CapacityType) > 0 {
labels["capacityType"] = *r.Nodegroup.CapacityType
labels["eks.amazonaws.com/capacityType"] = *r.Nodegroup.CapacityType
}

if r.Nodegroup.Version != nil && len(*r.Nodegroup.Version) > 0 {
Expand Down
6 changes: 3 additions & 3 deletions cluster-autoscaler/cloudprovider/aws/aws_wrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestGetManagedNodegroup(t *testing.T) {
assert.Equal(t, labelMap[labelKey2], labelValue2)
assert.Equal(t, labelMap["diskSize"], strconv.FormatInt(diskSize, 10))
assert.Equal(t, labelMap["amiType"], amiType)
assert.Equal(t, labelMap["capacityType"], capacityType)
assert.Equal(t, labelMap["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, labelMap["k8sVersion"], k8sVersion)
assert.Equal(t, labelMap["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(tagMap), 2)
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestGetManagedNodegroupWithNilValues(t *testing.T) {
assert.Equal(t, len(taintList), 0)
assert.Equal(t, len(labelMap), 4)
assert.Equal(t, labelMap["amiType"], amiType)
assert.Equal(t, labelMap["capacityType"], capacityType)
assert.Equal(t, labelMap["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, labelMap["k8sVersion"], k8sVersion)
assert.Equal(t, labelMap["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(tagMap), 0)
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestGetManagedNodegroupWithEmptyValues(t *testing.T) {
assert.Equal(t, len(taintList), 0)
assert.Equal(t, len(labelMap), 4)
assert.Equal(t, labelMap["amiType"], amiType)
assert.Equal(t, labelMap["capacityType"], capacityType)
assert.Equal(t, labelMap["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, labelMap["k8sVersion"], k8sVersion)
assert.Equal(t, labelMap["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(tagMap), 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestGetManagedNodegroupNoTaintsOrLabels(t *testing.T) {
assert.Equal(t, len(cacheObj.taints), 0)
assert.Equal(t, len(cacheObj.labels), 4)
assert.Equal(t, cacheObj.labels["amiType"], amiType)
assert.Equal(t, cacheObj.labels["capacityType"], capacityType)
assert.Equal(t, cacheObj.labels["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, cacheObj.labels["k8sVersion"], k8sVersion)
assert.Equal(t, cacheObj.labels["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(cacheObj.tags), 0)
Expand Down Expand Up @@ -213,7 +213,7 @@ func TestGetManagedNodegroupWithTaintsAndLabels(t *testing.T) {
assert.Equal(t, cacheObj.labels[labelKey2], labelValue2)
assert.Equal(t, cacheObj.labels["diskSize"], strconv.FormatInt(diskSize, 10))
assert.Equal(t, cacheObj.labels["amiType"], amiType)
assert.Equal(t, cacheObj.labels["capacityType"], capacityType)
assert.Equal(t, cacheObj.labels["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, cacheObj.labels["k8sVersion"], k8sVersion)
assert.Equal(t, cacheObj.labels["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(cacheObj.tags), 2)
Expand Down Expand Up @@ -326,7 +326,7 @@ func TestGetManagedNodegroupInfoObjectNoCachedNodegroup(t *testing.T) {
assert.Equal(t, mngInfoObject.labels[labelKey2], labelValue2)
assert.Equal(t, mngInfoObject.labels["diskSize"], strconv.FormatInt(diskSize, 10))
assert.Equal(t, mngInfoObject.labels["amiType"], amiType)
assert.Equal(t, mngInfoObject.labels["capacityType"], capacityType)
assert.Equal(t, mngInfoObject.labels["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, mngInfoObject.labels["k8sVersion"], k8sVersion)
assert.Equal(t, mngInfoObject.labels["eks.amazonaws.com/nodegroup"], nodegroupName)
assert.Equal(t, len(mngInfoObject.tags), 2)
Expand Down Expand Up @@ -417,7 +417,7 @@ func TestGetManagedNodegroupLabelsNoCachedNodegroup(t *testing.T) {
assert.Equal(t, labelsMap[labelKey2], labelValue2)
assert.Equal(t, labelsMap["diskSize"], strconv.FormatInt(diskSize, 10))
assert.Equal(t, labelsMap["amiType"], amiType)
assert.Equal(t, labelsMap["capacityType"], capacityType)
assert.Equal(t, labelsMap["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, labelsMap["k8sVersion"], k8sVersion)
assert.Equal(t, labelsMap["eks.amazonaws.com/nodegroup"], nodegroupName)
k.AssertCalled(t, "DescribeNodegroup", &eks.DescribeNodegroupInput{
Expand Down Expand Up @@ -513,7 +513,7 @@ func TestGetManagedNodegroupLabelsWithCachedNodegroupThatExpires(t *testing.T) {
assert.Equal(t, newLabelsMap[labelKey2], labelValue2)
assert.Equal(t, newLabelsMap["diskSize"], strconv.FormatInt(diskSize, 10))
assert.Equal(t, newLabelsMap["amiType"], amiType)
assert.Equal(t, newLabelsMap["capacityType"], capacityType)
assert.Equal(t, newLabelsMap["eks.amazonaws.com/capacityType"], capacityType)
assert.Equal(t, newLabelsMap["k8sVersion"], k8sVersion)
assert.Equal(t, newLabelsMap["eks.amazonaws.com/nodegroup"], nodegroupName)
k.AssertCalled(t, "DescribeNodegroup", &eks.DescribeNodegroupInput{
Expand Down

0 comments on commit c0661b5

Please sign in to comment.