-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Set content labels based on content type #4414
Conversation
This commit adds a flag through Pull API for allowing GC to clean layer contents up after unpacking these contents completed. This patch takes an approach to directly delete GC labels pointing to layers from the manifest blob. This will result in other snapshotters cannot reuse these contents on the next pull. But this patch mainly focuses on CRI use-cases where single snapshotter is usually used throughout the node lifecycle so this shouldn't be a matter. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Give control of the content labeling process for children to the client. This allows the client to control the names associated with the labels and filter out labels. Signed-off-by: Derek McGowan <derek@mcg.dev>
Build succeeded.
|
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.
LGTM
nit:
Converters add GC labels by their own so we can't dedupe old images that require manifest conversions. But they are special cases so I think we can make follow-up PRs for covering them as well (if needed).
containerd/remotes/docker/converter.go
Lines 78 to 81 in ec05460
labels := map[string]string{} | |
for i, c := range append([]ocispec.Descriptor{manifest.Config}, manifest.Layers...) { | |
labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = c.Digest.String() | |
} |
containerd/remotes/docker/schema1/converter.go
Lines 211 to 215 in ec05460
labels := map[string]string{} | |
labels["containerd.io/gc.ref.content.0"] = manifest.Config.Digest.String() | |
for i, ch := range manifest.Layers { | |
labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i+1)] = ch.Digest.String() | |
} |
And thanks a lot for this patch! |
LGTM |
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.
LGTM
@ktock Do you want to open a follow-up PR? |
Yes, I'm willing to work on the following-up PRs and update on cri-plugin's side to enable this dedupe functionality. (update on cri plugin might be the first) |
This change gives control of the content labeling process for children to the client. This allows the client to control the names associated with the labels and filter out labels.
Includes and replaces changes from #4332
This newer approach avoids the additional label mutation pass after unpack. This prevents the process for removing previously set labels and better ensures the content gets garbage collected if the client ends the operation before the removal.
Comment from #4332
Fixes: #4304
This commit adds a flag through Pull API for allowing GC to clean layer contents up after unpacking these contents completed.
This patch takes an approach to directly delete GC labels pointing to layers from the manifest blob. This will result in other snapshotters cannot reuse these contents on the next pull. But this patch mainly focuses on CRI use-cases where single snapshotter is usually used throughout the node lifecycle so this shouldn't be a matter.
Could I get comments on this approach towards unpacked contents deduplication?
What I currently concern is whether is it OK to clean layers up immediately after the unpack because other services in containerd will also be inaccessible to that contents.
Related also to: #4249