-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deletion of IAM roles and policies #11558
Conversation
if err != nil { | ||
return fmt.Errorf("error detaching IAM role policy %q: %v", *policy.PolicyArn, err) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it works to UpdateAssumeRolePolicy
to a PolicyDocument that grants nothing, but I consider that future cleanup work.
@@ -143,6 +143,87 @@ func (s *IAMRole) CheckChanges(a, e, changes *IAMRole) error { | |||
} | |||
|
|||
func (_ *IAMRole) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *IAMRole) error { | |||
if e.RolePolicyDocument == nil { | |||
klog.V(2).Infof("Deleting IAM role %q", a.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason for doing deletion in RenderAWS
rather than in a fi.Deletion
? I believe you can just do the same check as above in findDeletion
and all the logic below in Delete
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the dryrun behavior of fi.Task
. For other task types we'll probably want the cloud provider selection.
A followup work item is to write a fi.Deletion
adapter to fi.Task
, so the cluster deletion code could be subsumed into the task reconciliation code for object such as this that have to be deleted in both cluster delete and apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. For some tasks, we added Delete
flag that sort of gives both the dryrun behaviour and fi.Deletion
, but it would be nice if we could allow deletion without that property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do need some way to represent the deleted state so that dryrun can print something useful. I do need to look at how dryrun represents IamRole
changes, as it doesn't currently show well what attached policies are changing.
/hold if anyone else wants to review |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: olemarkus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
No description provided.