Skip to content

Commit adec55d

Browse files
committed
Add OCI Volume Source support
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
1 parent 71030a7 commit adec55d

File tree

7 files changed

+582
-492
lines changed

7 files changed

+582
-492
lines changed

cmd/crictl/container.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,20 @@ func CreateContainer(
808808
}
809809

810810
// Try to pull the image before container creation
811-
ann := config.GetImage().GetAnnotations()
812-
if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, ann, opts.pullOptions.timeout); err != nil {
813-
return "", err
811+
images := []string{image}
812+
813+
// Add possible OCI volume mounts
814+
for _, m := range config.Mounts {
815+
if m.Image != nil && m.Image.Image != "" {
816+
images = append(images, m.Image.Image)
817+
}
818+
}
819+
820+
for _, image := range images {
821+
logrus.Infof("Pulling image: %s", image)
822+
if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, config.GetImage().GetAnnotations(), opts.pullOptions.timeout); err != nil {
823+
return "", err
824+
}
814825
}
815826
}
816827

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require (
3232
k8s.io/api v0.31.0-alpha.3
3333
k8s.io/apimachinery v0.31.0-alpha.3
3434
k8s.io/client-go v0.31.0-alpha.3
35-
k8s.io/cri-api v0.31.0-alpha.3
35+
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510
3636
k8s.io/cri-client v0.31.0-alpha.3
3737
k8s.io/klog/v2 v2.130.1
3838
k8s.io/kubectl v0.30.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ k8s.io/client-go v0.31.0-alpha.3 h1:g9wbiICMHrFwxl3pGi63v2wPXL4Mk4z0ps6kMRHBcSI=
249249
k8s.io/client-go v0.31.0-alpha.3/go.mod h1:vVK9F/qT7echvzsBfdH5EeH8WH6+SMcY7IbYJCZa6fU=
250250
k8s.io/component-base v0.31.0-alpha.3 h1:JgTZxZ+QCkyuvbnUXQg5Lscz22t7Sj//+GjUSHD4yGo=
251251
k8s.io/component-base v0.31.0-alpha.3/go.mod h1:95zosfpQ0maOQqM/KBuXyvaBzsb/2u+MCgPv7dl4To8=
252-
k8s.io/cri-api v0.31.0-alpha.3 h1:sLth/Vdn/TpwCY3UZRIo4sme2trzl+nGYBUnQAypfzQ=
253-
k8s.io/cri-api v0.31.0-alpha.3/go.mod h1:++pZmPOodkvdUTNnXKrhFD68SD9WBKVP7rwC9frDbzU=
252+
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510 h1:AKDmYyMb9sepbFmMeHZvVzK/1k6Bvft9zFosCD2lBYQ=
253+
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510/go.mod h1:++pZmPOodkvdUTNnXKrhFD68SD9WBKVP7rwC9frDbzU=
254254
k8s.io/cri-client v0.31.0-alpha.3 h1:/2BK7UuXJWksnnea3o5L5TZePb0v212ul+HR5RxF2oY=
255255
k8s.io/cri-client v0.31.0-alpha.3/go.mod h1:oLipemI457hkLq+BYbN5BfiWpMGqOwnOG2yBpg5kexo=
256256
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=

pkg/framework/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ func PullPublicImage(c internalapi.ImageManagerService, imageName string, podCon
362362
imageSpec := &runtimeapi.ImageSpec{
363363
Image: imageName,
364364
}
365-
id, err := c.PullImage(context.TODO(), imageSpec, nil, podConfig)
365+
res, err := c.PullImage(context.TODO(), imageSpec, nil, podConfig)
366366
ExpectNoError(err, "failed to pull image: %v", err)
367-
return id
367+
return res
368368
}
369369

370370
// LoadYamlFile attempts to load the given YAML file into the given struct.

vendor/k8s.io/cri-api/pkg/apis/runtime/v1/api.pb.go

Lines changed: 553 additions & 483 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ k8s.io/component-base/metrics/prometheusextension
563563
k8s.io/component-base/tracing
564564
k8s.io/component-base/tracing/api/v1
565565
k8s.io/component-base/version
566-
# k8s.io/cri-api v0.31.0-alpha.3
566+
# k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510
567567
## explicit; go 1.22.0
568568
k8s.io/cri-api/pkg/apis
569569
k8s.io/cri-api/pkg/apis/runtime/v1

0 commit comments

Comments
 (0)