Skip to content

Commit

Permalink
Merge pull request #1464 from saschagrunert/oci-volumesource-cri-tools
Browse files Browse the repository at this point in the history
Add OCI Volume Source support to `crictl [create|run] --with-pull`
  • Loading branch information
k8s-ci-robot authored Jul 17, 2024
2 parents ac82070 + bd276bf commit b956b5c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit b956b5c

Please sign in to comment.