Skip to content

Commit

Permalink
[fix] Detach velero node policy on cluster deletion (#664)
Browse files Browse the repository at this point in the history
* [fix] Detach velero node policy on cluster deletion

If we won't detach the IAM policy then it's not possible to delete the cluster.

Ticket: https://mattermost.atlassian.net/browse/CLD-2450

* Update internal/provisioner/kops_provisioner_cluster.go

Co-authored-by: Gabe Jackson <[email protected]>

Co-authored-by: Gabe Jackson <[email protected]>
  • Loading branch information
spirosoik and gabrieljackson authored Jun 8, 2022
1 parent a43adbf commit bb19dd8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/provisioner/kops_provisioner_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,10 @@ func (provisioner *KopsProvisioner) cleanupKopsCluster(cluster *model.Cluster, a
if err != nil {
return errors.Wrap(err, "unable to detach custom node policy")
}
err = awsClient.DetachPolicyFromRole(iamRole, aws.VeleroNodePolicyName, logger)
if err != nil {
return errors.Wrap(err, "unable to detach velero node policy")
}

_, err = kopsClient.GetCluster(kopsMetadata.Name)
if err != nil {
Expand Down

0 comments on commit bb19dd8

Please sign in to comment.