From 44733280e5ab6361ed4546411495ee446e4675e5 Mon Sep 17 00:00:00 2001 From: ChengyuZhu6 Date: Tue, 5 Dec 2023 09:02:47 +0800 Subject: [PATCH] snapshot: get image reference from cri annotations for guest pull The sandbox image (pause image) name cannot be stored in annotations by containerd, so snapshotter is unable to retrieve it. This means that the source field of `KataVirtualVolume` has to be set to "" to support guest pull in proxy mode now. However, once containerd fixes this bug (https://github.com/containerd/containerd/pull/9419), I think the nydus snapshotter could be able to get the sandbox image name from annotations directly. I recommend that we can support to obtain the image name through "containerd.io/snapshot/cri.image-ref" in snapshotter. If this value is empty, the source should be set to "", otherwise it should be set to the image name. Signed-off-by: ChengyuZhu6 --- snapshot/mount_option.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/snapshot/mount_option.go b/snapshot/mount_option.go index 6fbb418bd1..50624e73de 100644 --- a/snapshot/mount_option.go +++ b/snapshot/mount_option.go @@ -151,10 +151,11 @@ func (o *snapshotter) mountWithKataVolume(ctx context.Context, id string, overla func (o *snapshotter) mountWithProxyVolume(rafs rafs.Rafs) ([]string, error) { options := []string{} + source := rafs.Annotations[label.CRIImageRef] for k, v := range rafs.Annotations { options = append(options, fmt.Sprintf("%s=%s", k, v)) } - opt, err := o.prepareKataVirtualVolume(label.NydusProxyMode, "", KataVirtualVolumeImageGuestPullType, "", options, rafs.Annotations) + opt, err := o.prepareKataVirtualVolume(label.NydusProxyMode, source, KataVirtualVolumeImageGuestPullType, "", options, rafs.Annotations) if err != nil { return options, errors.Wrapf(err, "failed to prepare KataVirtualVolume") }