From bd276bf130cb50f2cf2277ce3b07a3fbe9cb646b Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 12 Jun 2024 09:54:50 +0200 Subject: [PATCH] Add OCI Volume Source support Signed-off-by: Sascha Grunert --- cmd/crictl/container.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cmd/crictl/container.go b/cmd/crictl/container.go index 85742e51b0..1f3eed7caa 100644 --- a/cmd/crictl/container.go +++ b/cmd/crictl/container.go @@ -812,9 +812,21 @@ func CreateContainer( } // Try to pull the image before container creation - ann := config.GetImage().GetAnnotations() - if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, ann, opts.pullOptions.timeout); err != nil { - return "", err + images := []string{image} + logrus.Infof("Pulling container image: %s", image) + + // Add possible OCI volume mounts + for _, m := range config.Mounts { + if m.Image != nil && m.Image.Image != "" { + logrus.Infof("Pulling image %s to be mounted to container path: %s", image, m.ContainerPath) + images = append(images, m.Image.Image) + } + } + + for _, image := range images { + if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, config.GetImage().GetAnnotations(), opts.pullOptions.timeout); err != nil { + return "", err + } } }