Skip to content

Commit

Permalink
Merge pull request #3783 from dkoshkin/main
Browse files Browse the repository at this point in the history
fix: wrong EKS tag when upgrading older clusters
  • Loading branch information
k8s-ci-robot authored Oct 19, 2022
2 parents 3778b36 + c88c19e commit e43049d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/cloud/services/eks/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ func (s *Service) reconcileCluster(ctx context.Context) error {
} else {
tagKey := infrav1.ClusterAWSCloudProviderTagKey(eksClusterName)
ownedTag := cluster.Tags[tagKey]
if ownedTag == nil {
return fmt.Errorf("checking owner of %s is %s: %w", s.scope.KubernetesClusterName(), eksClusterName, err)
// Prior to https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/3573,
// Clusters were tagged using s.scope.Name()
// To support upgrading older clusters, check for both tags
oldTagKey := infrav1.ClusterAWSCloudProviderTagKey(s.scope.Name())
oldOwnedTag := cluster.Tags[oldTagKey]

if ownedTag == nil && oldOwnedTag == nil {
return fmt.Errorf("EKS cluster resource %q must have a tag with key %q or %q", eksClusterName, oldTagKey, tagKey)
}

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

0 comments on commit e43049d

Please sign in to comment.