Skip to content

Commit

Permalink
Merge pull request #44810 from rumpl/containerd-lazy-snapshotters
Browse files Browse the repository at this point in the history
c8d/pull: Add CRI-compatible annotation of pulled content
  • Loading branch information
neersighted committed Feb 21, 2023
2 parents 68fe202 + 782a369 commit 5c1d6c9
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
6 changes: 6 additions & 0 deletions daemon/containerd/image_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/containerd/containerd"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/pkg/snapshotters"
"github.com/containerd/containerd/platforms"
"github.com/docker/distribution"
"github.com/docker/distribution/reference"
Expand Down Expand Up @@ -63,6 +64,11 @@ func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string,
opts = append(opts, containerd.WithPullUnpack)
opts = append(opts, containerd.WithPullSnapshotter(i.snapshotter))

// AppendInfoHandlerWrapper will annotate the image with basic information like manifest and layer digests as labels;
// this information is used to enable remote snapshotters like nydus and stargz to query a registry.
infoHandler := snapshotters.AppendInfoHandlerWrapper(ref.String())
opts = append(opts, containerd.WithImageHandlerWrapper(infoHandler))

_, err = i.client.Pull(ctx, ref.String(), opts...)
return err
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ github.com/containerd/containerd/pkg/dialer
github.com/containerd/containerd/pkg/kmutex
github.com/containerd/containerd/pkg/seccomp
github.com/containerd/containerd/pkg/shutdown
github.com/containerd/containerd/pkg/snapshotters
github.com/containerd/containerd/pkg/ttrpcutil
github.com/containerd/containerd/pkg/userns
github.com/containerd/containerd/platforms
Expand Down

0 comments on commit 5c1d6c9

Please sign in to comment.