-
Notifications
You must be signed in to change notification settings - Fork 71
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
make -garbage-collect aware of manifest lists (aka "fat" manifests) #7
Comments
I think this is a high-priority item; labeling it as a bug for now because I'm too lazy to create P0/P1/P2/P3 priority labels. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Closing this issue for now because we don't plan on using garbage collection for the promoter any more (it will be a separate tool). As this issue won't be worked on for the foreseeable future, I'm closing this. |
Currently the garbage collection logic just checks if a digest has no associated tags, and if so, deletes them. This doesn't account for manifest lists.
Thankfully, the
gcloud
call we use currently in version 234.0.0 crashes if we attempt to delete a digest that is referenced by a manifest list, so nothing happens (and we can use -delete-extra-tags safely).The solution is to just use the Docker Registry API for this. Let's use the example of gcr.io/cip-demo-prod/coredns. The first call we can use is:
to get all digests/tag information for an image path. Then we can identify if a digest is actually a manifest list (and not a regular digest) if it has
"imageSizeBytes": "0"
. Then for each manifest list, we can figure out the child manifests that it references by doing a 2nd call:The annoying/ugly part is that we need to migrate away from our simple dependence of
gcloud
, but that is probably inevitable anyway. AFAIKgcloud
does not support querying about manifest lists (to figure out what images a manifest list references). Thedocker
CLI does support this operation, but depending on the docker CLI is not desirable (when a library will do). Thankfully it appears that there is already a Go library that implements the Docker registry API here https://github.com/google/go-containerregistry/blob/52aa2729ea7597c8d5f7d6a977fa5cab9fc3a77a/pkg/v1/google/list.go#L69, so we could use that instead (hmm, but it doesn't appear to support distinguishing between a plain manifest and manifest list (see https://github.com/google/go-containerregistry/blob/52aa2729ea7597c8d5f7d6a977fa5cab9fc3a77a/pkg/gcrane/copy.go#L196 for the only usage of a DockerManifestList type in that repo).We could just curl out instead --- it's the dumbest thing that will work.
The text was updated successfully, but these errors were encountered: