Skip to content

Commit

Permalink
snapshot: get image reference from cri annotations for guest pull
Browse files Browse the repository at this point in the history
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
(containerd/containerd#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 <[email protected]>
  • Loading branch information
ChengyuZhu6 committed Dec 7, 2023
1 parent 671c414 commit 4473328
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion snapshot/mount_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 4473328

Please sign in to comment.