Update function hasClusterTag to fix issue #64230

Fixes issue #64230, by changing function hasClusterTag, in aws/tags.go, to ensure that a list of tags containing a tag with a key which matches clusterTagKey will return true even if a TagNameKubernetesClusterLegacy tag also exists in the list with a value other than the ClusterID.

/sig aws
This commit is contained in:
Tim Wilfong 2018-05-23 13:54:20 -07:00 committed by GitHub
parent b143093a62
commit 0a95581de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,14 +137,14 @@ func (t *awsTagging) hasClusterTag(tags []*ec2.Tag) bool {
clusterTagKey := t.clusterTagKey()
for _, tag := range tags {
tagKey := aws.StringValue(tag.Key)
// Check if this is a newer-style cluster tag before checking if legacy tag value matches ClusterID
if tagKey == clusterTagKey {
return true
}
// For 1.6, we continue to recognize the legacy tags, for the 1.5 -> 1.6 upgrade
if tagKey == TagNameKubernetesClusterLegacy {
return aws.StringValue(tag.Value) == t.ClusterID
}
if tagKey == clusterTagKey {
return true
}
}
return false
}