Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt: image gc: garbage-collect images from the store #1697

Merged
merged 3 commits into from Nov 11, 2015

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Oct 30, 2015

This commit makes rkt image gc remove images from the store apart from
unreferenced treestores.

By default, images not used in the last 24h will be removed. This can be
configured with the --grace-period.

Fixes #1205

@iaguis
Copy link
Member Author

iaguis commented Oct 30, 2015

I have a couple of questions for this:

  • Does the name of the flag sound right?
  • Right now, if no flag is specified, it defaults to 15 days, is that reasonable? Alternatives are:
    • We could do nothing if the flag is not specified (only treestore GC)
    • We could make the flag mandatory (treestore and store GC are coupled)

cc @robszumski

@robszumski
Copy link
Contributor

I think the flag name needs to hint more at what it does. It seems like this should just the the default behavior, right? How is this different than the grace period flag? I also don't see any docs that explain how to use this, hence my questions.

For an "in the wild" example, the https://github.com/spotify/docker-gc container uses a much tighter timeframe of 1 hour.

@iaguis
Copy link
Member Author

iaguis commented Nov 3, 2015

I think the flag name needs to hint more at what it does. It seems like this should just the the default behavior, right? How is this different than the grace period flag? I also don't see any docs that explain how to use this, hence my questions.

rkt image gc removes images that haven't been used in the time specified by --last-used (15 days if it's not specified). It also removes all the tree-stores that are not referenced by any pod. I think I'll change --last-used's default to 24h.

The grace period flag belongs to rkt gc and defines the time to wait before discarding inactive pods from the garbage. Maybe we can call this flag grace period too...

I'll add some documentation.

Thanks!

@iaguis iaguis force-pushed the lastused-image branch 2 times, most recently from 1bf9cf5 to 1222505 Compare November 3, 2015 15:16
@iaguis
Copy link
Member Author

iaguis commented Nov 3, 2015

Updated

@robszumski
Copy link
Contributor

LGTM on docs

@@ -90,6 +81,26 @@ func runRmImage(cmd *cobra.Command, args []string) (exit int) {
if errors > 0 {
stderr("rkt: %d image(s) cannot be removed", errors)
}
return fmt.Errorf("error(s) found while removing images")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this message be prepended with rkt:?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since it's an error I'm returning, I leave that to the caller.

But yeah, None of the callers were adding rkt: so I'll change that.

@krnowak
Copy link
Collaborator

krnowak commented Nov 11, 2015

Some nits, otherwise LFAD.

We need it for garbage collecting images.
This commit makes rkt image gc remove images from the store apart from
unreferenced treestores.

By default, images not used in the last 24h will be removed. This can be
configured with the `--grace-period`.
@krnowak
Copy link
Collaborator

krnowak commented Nov 11, 2015

LFAD.

@krnowak
Copy link
Collaborator

krnowak commented Nov 11, 2015

But let's wait for green first.

iaguis added a commit that referenced this pull request Nov 11, 2015
rkt: image gc: garbage-collect images from the store
@iaguis iaguis merged commit 7ae9206 into rkt:master Nov 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants