Skip to content
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

Delete & update in certain IAM resource #19

Open
redradrat opened this issue Dec 8, 2020 · 0 comments
Open

Delete & update in certain IAM resource #19

redradrat opened this issue Dec 8, 2020 · 0 comments
Labels
block stable? This issue needs to be clarified before major release. help wanted Extra attention is needed question Further information is requested

Comments

@redradrat
Copy link
Owner

redradrat commented Dec 8, 2020

As AWS does not allow for in-place updates of certain resources (Role, PolicyAttachment, ...) we currently delete the previous resource, and recreate it. This might cause issues, when hitting resource limits?

How to make this safe? The point is, if this happens in production due to something triggering the re-creation, this might leave a Role uncreated and cause services, using this role, to fail. Not sure about it...

// RECONCILE THE RESOURCE
// if there is already an ARN in our status, then we recreate the object completely
// (because AWS only supports description updates)
if role.Status.ARN != "" {
// delete the actual AWS Object and pass the cleanup function
statusUpdater, err := DeleteAWSObject(iamsvc, ins, cleanupFunc)
// we got a StatusUpdater function returned... let's execute it
statusUpdater(ins, &role, ctx, r.Status(), log)
if err != nil {
// we had an error during AWS Object deletion... so we return here to retry
log.Error(err, "error while deleting Role during reconciliation")
return ctrl.Result{}, err
}
}
statusUpdater, err := CreateAWSObject(iamsvc, ins, DoNothingPreFunc)
statusUpdater(ins, &role, ctx, r.Status(), log)
if err != nil {
log.Error(err, "error while creating Role during reconciliation")
return ctrl.Result{}, err
}
log.Info(fmt.Sprintf("Created Role '%s'", role.Status.ARN))

@redradrat redradrat added bug Something isn't working help wanted Extra attention is needed question Further information is requested block stable? This issue needs to be clarified before major release. and removed bug Something isn't working labels Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block stable? This issue needs to be clarified before major release. help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant