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

Set content labels based on content type #4414

Merged
merged 2 commits into from
Jul 24, 2020

Conversation

dmcgowan
Copy link
Member

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

ktock and others added 2 commits June 21, 2020 11:16
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>
@theopenlab-ci
Copy link

theopenlab-ci bot commented Jul 21, 2020

Build succeeded.

@AkihiroSuda AkihiroSuda added this to the 1.4 milestone Jul 21, 2020
Copy link
Member

@ktock ktock left a 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).

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()
}

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()
}

@ktock
Copy link
Member

ktock commented Jul 21, 2020

And thanks a lot for this patch!

@crosbymichael
Copy link
Member

LGTM

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@AkihiroSuda AkihiroSuda merged commit d184a0a into containerd:master Jul 24, 2020
@AkihiroSuda
Copy link
Member

@ktock Do you want to open a follow-up PR?

@ktock
Copy link
Member

ktock commented Jul 24, 2020

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)

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.

image stored in both sys-root and devicemapper volume
5 participants