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

plume prune enhancement #343

Merged
merged 12 commits into from
Jul 12, 2022
Merged

plume prune enhancement #343

merged 12 commits into from
Jul 12, 2022

Conversation

jepio
Copy link
Member

@jepio jepio commented Jul 1, 2022

plume prune enhancements

  • support keeping N most recently created images when deleting
  • support "soft-deleting" images (removing launchpermissions) for configurable time before permanently deleting
  • support checking "lastlaunchtime" when image is being removed
  • display statistics on image removal
  • update aws go sdk

How to use

./bin/plume prune --check-last-launched --dry-run --channel edge -v  --keep-last 2 --days 365 --days-soft-deleted 30

Testing done

Tested with dry-run only, would run on "edge" channel first.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)

@jepio
Copy link
Member Author

jepio commented Jul 1, 2022

Here's the log output for a dry-run on the edge channel:
out.log

@jepio jepio force-pushed the jepio/plume-prune-enhancement branch from 6d97932 to a02cda8 Compare July 1, 2022 12:43
@jepio jepio force-pushed the jepio/plume-prune-enhancement branch from a02cda8 to 51a9e08 Compare July 1, 2022 12:53
Copy link
Member

@krnowak krnowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicks only.

cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
cmd/plume/prune.go Outdated Show resolved Hide resolved
@jepio jepio force-pushed the jepio/plume-prune-enhancement branch 2 times, most recently from 23e480a to f090429 Compare July 5, 2022 12:45
@jepio
Copy link
Member Author

jepio commented Jul 7, 2022

@tormath1 would love it if you would take a look as well

@@ -56,6 +67,18 @@ func runPrune(cmd *cobra.Command, args []string) {
if len(args) > 0 {
plog.Fatal("No args accepted")
}
if daysLastLaunched < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the helper:

Only used when --check-last-launched is set.

Even if the default value is 0, we could add an extra condition like you're doing later:

Suggested change
if daysLastLaunched < 0 {
if checkLastLaunched && daysLastLaunched < 0 {

EDIT: we could even group the two statements:

Suggested change
if daysLastLaunched < 0 {
if checkLastLaunched && (daysLastLaunched < 0 || daysLastLaunched == 0) {
daysLastLaunched = days

Copy link
Member Author

@jepio jepio Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would rather keep the if-blocks separate so that we can report a clear error messages to users. But you made me realize I need at least one more check: if !checkLastLaunched && daysLastLaunched > 0 so that we tell users that the option will be ignored.

cmd/plume/prune.go Outdated Show resolved Hide resolved
platform/api/aws/images.go Outdated Show resolved Hide resolved
platform/api/aws/images.go Outdated Show resolved Hide resolved
@jepio jepio force-pushed the jepio/plume-prune-enhancement branch from f090429 to d698ec3 Compare July 12, 2022 07:39
Copy link
Contributor

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! :)

@jepio jepio merged commit 28840a5 into flatcar-master Jul 12, 2022
@jepio jepio deleted the jepio/plume-prune-enhancement branch July 12, 2022 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants