Skip to content

Commit e43049d

Browse files
authored
Merge pull request #3783 from dkoshkin/main
fix: wrong EKS tag when upgrading older clusters
2 parents 3778b36 + c88c19e commit e43049d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/cloud/services/eks/cluster.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,14 @@ func (s *Service) reconcileCluster(ctx context.Context) error {
6262
} else {
6363
tagKey := infrav1.ClusterAWSCloudProviderTagKey(eksClusterName)
6464
ownedTag := cluster.Tags[tagKey]
65-
if ownedTag == nil {
66-
return fmt.Errorf("checking owner of %s is %s: %w", s.scope.KubernetesClusterName(), eksClusterName, err)
65+
// Prior to https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3573,
66+
// Clusters were tagged using s.scope.Name()
67+
// To support upgrading older clusters, check for both tags
68+
oldTagKey := infrav1.ClusterAWSCloudProviderTagKey(s.scope.Name())
69+
oldOwnedTag := cluster.Tags[oldTagKey]
70+
71+
if ownedTag == nil && oldOwnedTag == nil {
72+
return fmt.Errorf("EKS cluster resource %q must have a tag with key %q or %q", eksClusterName, oldTagKey, tagKey)
6773
}
6874

6975
s.scope.V(2).Info("Found owned EKS cluster in AWS", "cluster", klog.KRef("", eksClusterName))

0 commit comments

Comments
 (0)