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

WIP: Registry image pruning reworked #5073

Closed
wants to merge 13 commits into from

Conversation

miminar
Copy link

@miminar miminar commented Oct 12, 2015

Rebases docker/distribution to current upstream master with storage API expose patch applied.

Replaces /admin/* routes with just /admin/prune that triggers garbage collection.

Garbage collection loads repositories (ImageStreams and ImageStreamDeletions), all their manifest revisions (Images) and dependend objects (layers and signatures). Manifest revision is marked for deletion if it has DeletionTimestamp set. Repository is marked for deletion if it is listed among ImageStreamDeletions. Any other dependent, loaded object is preserved if it's referenced by at least one object not marked for deletion.

Resolves #3333
Resolves #4339

TODOs:

  • Find a way, how to keep ImageStreamDeletion type without the need to export it in cli (which now prevents OSO's compilation). ImageStreamDeletions can now be described.
  • Rework oadm prune command to just mark obsolete Images for deletion.
  • Rework deletion of image streams to mark for deletion any referenced image, delete image stream itself and add its name to imageStreamDeletions. done
  • Define finalizer for Images and trigger its Finalize() from inside of docker registry. done
  • Remove admin/prune route - now used for testing.
  • Test it.
  • Let the garbage collection runs be configured.

@miminar
Copy link
Author

miminar commented Oct 12, 2015

@ncdc, @Kargakis: PTAL.

@ncdc
Copy link
Contributor

ncdc commented Oct 12, 2015

Rework deletion of image streams to mark for deletion any referenced image

This brings up an interesting question. Let's say I push project/repo1:latest, then do oc tag project/repo1:latest project/repo2:sometag, and then delete project/repo1. If you delete the image because you've deleted repo1, you can no longer pull project/repo2:sometag because it points to the image you've just marked for deletion.

@ncdc
Copy link
Contributor

ncdc commented Oct 12, 2015

cc @smarterclayton

@ncdc
Copy link
Contributor

ncdc commented Oct 12, 2015

I would like to get rid of the custom /admin route(s) if possible.

Also, when reapplying carried patches, please cherry-pick them individually instead of bundling them into a new commit. It is crucial that patches have commit messages with UPSTREAM (docker/distribution): <pr #>: <description>. Or if there isn't an upstream PR and we want to just carry the patch, replace <pr #> with carry.

@0xmichalis
Copy link
Contributor

and then delete project/repo1

@ncdc should we not allow deleting image streams that have symlinks?

@miminar
Copy link
Author

miminar commented Oct 12, 2015

If you delete the image because you've deleted repo1, you can no longer pull project/repo2:sometag because it points to the image you've just marked for deletion.

I'm not sure, how oc tag works. Ideally, it would create a new manifest with almost identical content except for Name and Tag and re-push. Re-push is needed to create layer links and signatures. Layers are already there. I'd rather have tags in consistence with registry's storage instead of preventing deletion if there were any tags created.

Update: could be solved in the registry during pruning. Manifest revision missing any layer or signature link could be rewritten.

Also, when reapplying carried patches, please cherry-pick them individually instead of bundling them into a new commit.

I'll try to look them up. Done.

@miminar miminar force-pushed the registry-refactored branch 2 times, most recently from fd785cd to f8610c3 Compare October 12, 2015 17:59
@liggitt
Copy link
Contributor

liggitt commented Oct 15, 2015

can you add UPSTREAM: PR#|<carry>|<drop>: ... to the titles of all the commits that touch the distribution Godeps?

@liggitt
Copy link
Contributor

liggitt commented Oct 15, 2015

and any commits that are just straight godep adds/bumps should have titles of bump(<dep name>): <version hash>

Michal Minar and others added 3 commits October 16, 2015 10:19
…bf78f8b4

New dependency for github.com/docker/distribution

Signed-off-by: Michal Minar <[email protected]>
Add support for custom routes and custom auth records per route.
Michal Minar added 3 commits October 17, 2015 21:04
Remove this commit once the admin routes are gone.

Signed-off-by: Michal Minar <[email protected]>
- Repository components 1 character long allowed
- Use new docker/distribution/registry/api/errcode package

Signed-off-by: Michal Minar <[email protected]>
@miminar miminar force-pushed the registry-refactored branch 3 times, most recently from eb32338 to 53a34bf Compare October 19, 2015 14:04
Michal Minar and others added 7 commits October 20, 2015 19:48
Stored in `/openshift.io/imagestreamdeletions` it contains references to
deleted image streams that needs to be purged from internal docker
registry.

It's not namespaced.

Signed-off-by: Michal Minar <[email protected]>
Allow to update status of Images

Signed-off-by: Michal Minar <[email protected]>
Allow to list images of imagestreams from inside of registry.

Signed-off-by: Michal Minar <[email protected]>

Signed-off-by: Michal Minar <[email protected]>
Renamed ImportController to ImageStreamController since now apart from
importing of images/tags it handles image stream's finalization as well.

Signed-off-by: Michal Minar <[email protected]>
Conflicts:
	pkg/cmd/admin/prune/images.go
	pkg/image/prune/imagepruner.go
- Don't add layers and blobs from graph.
- Marking image deleted instead of deleting it.

Signed-off-by: Michal Minar <[email protected]>
`POST admin/prune` route triggers a garbage collection in docker registry
where orphaned repositories, manifest revisions, layers, signatures and
blobs are deleted.

Signed-off-by: Michal Minar <[email protected]>
@miminar miminar force-pushed the registry-refactored branch from 53a34bf to f598ee8 Compare October 20, 2015 17:49
@smarterclayton
Copy link
Contributor

Is this targeted to 3.1? It's really, really late to be making changes here.

@ncdc
Copy link
Contributor

ncdc commented Oct 22, 2015

These are huge changes. I think we need to consider this for 3.2 instead.

@liggitt
Copy link
Contributor

liggitt commented Oct 22, 2015

agree 😨

@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 22, 2015
@miminar
Copy link
Author

miminar commented Oct 23, 2015

Yeah, that's what I was afraid of happening once we decided to go with finalization and watching its scope extending over the code base. But I agree with you. I'd rather not rush with these changes and give them a second thought.

I'll break up the changes into smaller, tested pieces to make it easier to digest and review.

@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 13, 2015
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2015
@openshift-bot
Copy link
Contributor

Origin Action Required: Pull request cannot be automatically merged, please rebase your branch from latest HEAD and push again

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2015
@soltysh
Copy link
Contributor

soltysh commented Nov 24, 2015

@miminar are you going to pick it up now that we're post 1.1? I'd love to see this in.

@miminar
Copy link
Author

miminar commented Nov 25, 2015

@soltysh I'd love to. However, it's still blocked on #4339 which in turn is block on upstream. They respond neither to comments nor on irc. It worries me. I don't know what to do about it.

@danmcp
Copy link

danmcp commented Jan 19, 2016

@miminar What are the next steps here?

@miminar
Copy link
Author

miminar commented Jan 20, 2016

@danmcp rebase it, split it into smaller pieces for review and write proper tests. This can be closed anyway.

@miminar miminar closed this Jan 20, 2016
@miminar miminar deleted the registry-refactored branch November 10, 2016 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants