Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitSahastra committed Mar 27, 2024
1 parent 151b01e commit 0545224
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cloud/services/eks/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ func (s *Service) reconcileTrustPolicy() error {
}

func (s *Service) deleteOIDCProvider() error {

// In case of force pivot managed control plane do not have ARN in status, that lead to oidcProvider not getting cleaned up during delete.
// OidcProviderArnAnnotation will be used to avoid it.

annotations := s.scope.ControlPlane.GetAnnotations()
arn := annotations[OidcProviderArnAnnotation]

if arn == "" {
// Upgrade support for cluster without OidcProviderArnAnnotation set
arn = s.scope.ControlPlane.Status.OIDCProvider.ARN
}

Expand All @@ -168,6 +173,7 @@ func (s *Service) deleteOIDCProvider() error {
return errors.Wrap(err, "failed to update control plane with OIDC provider ARN")
}

// Remove OidcProviderArnAnnotation after successfully deleting oidc provider
annotations[OidcProviderArnAnnotation] = ""
s.scope.ControlPlane.SetAnnotations(annotations)

Expand Down

0 comments on commit 0545224

Please sign in to comment.