-
Notifications
You must be signed in to change notification settings - Fork 108
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
[SHIPA-2024] Prunes dead apps from framework status when removing framework #171
Conversation
cmd/ketch/framework_remove.go
Outdated
@@ -48,6 +49,9 @@ func frameworkRemove(ctx context.Context, cfg config, options frameworkRemoveOpt | |||
return fmt.Errorf("failed to get framework: %w", err) | |||
} | |||
|
|||
if err := pruneRemovedAppsFromStatus(ctx, cfg, framework); err != nil { | |||
return fmt.Errorf("failed to update framework's apps: %w", 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.
Do you think it would be better to have the message say failed to prune framework's apps:
just for a little bit more clarification?
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.
It sure would. Change made.
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.
Small suggestion, but nothing that is an actual concern.
Excited to see this problem fixed!
patchedFramework := framework | ||
patchedFramework.Status.Apps = updatedApps | ||
patch := client.MergeFrom(&framework) | ||
return cfg.Client().Status().Patch(ctx, &patchedFramework, patch) |
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.
Is there a chance to get the object has been modified; please apply your changes to the latest version and try again
? retry.RetryOnConflict()?
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.
Good call. I added it around the entire pruneRemovedAppsFromStatus
function.
Description
Deleting a framework and it's apps simultaneously, e.g. terraform, script, etc. can occasionally create a situation where an app is removed, but is still in the framework's
framework.Status.Apps
list. This can cause frustration since a user cannot remove the framework ("contains running apps" error) nor can they remove the already-removed app. This PR prunes non-existent apps from theframework.Status.Apps
list prior to the framework delete.Fixes # 2024
Type of change
Testing
Documentation
Final Checklist: