Skip to content

Commit

Permalink
Add OCI Volume Source support
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Jul 4, 2024
1 parent 5a36935 commit fc6c9b1
Show file tree
Hide file tree
Showing 7 changed files with 582 additions and 492 deletions.
17 changes: 14 additions & 3 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,20 @@ 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}

// Add possible OCI volume mounts
for _, m := range config.Mounts {
if m.Image != nil && m.Image.Image != "" {
images = append(images, m.Image.Image)
}
}

for _, image := range images {
logrus.Infof("Pulling image: %s", image)
if _, err := PullImageWithSandbox(iClient, image, auth, podConfig, config.GetImage().GetAnnotations(), opts.pullOptions.timeout); err != nil {
return "", err
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
k8s.io/api v0.31.0-alpha.3
k8s.io/apimachinery v0.31.0-alpha.3
k8s.io/client-go v0.31.0-alpha.3
k8s.io/cri-api v0.31.0-alpha.3
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510
k8s.io/cri-client v0.31.0-alpha.2
k8s.io/klog/v2 v2.130.1
k8s.io/kubectl v0.30.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ k8s.io/client-go v0.31.0-alpha.3 h1:g9wbiICMHrFwxl3pGi63v2wPXL4Mk4z0ps6kMRHBcSI=
k8s.io/client-go v0.31.0-alpha.3/go.mod h1:vVK9F/qT7echvzsBfdH5EeH8WH6+SMcY7IbYJCZa6fU=
k8s.io/component-base v0.31.0-alpha.2 h1:bAYhaSt++Mf7x0042QkeKJpzOuMq3KP7WGiLIM2hBcA=
k8s.io/component-base v0.31.0-alpha.2/go.mod h1:4RdlW5OL0oab6gWaGWjxIcgORwuiuO49gV2GSxJ/9io=
k8s.io/cri-api v0.31.0-alpha.3 h1:sLth/Vdn/TpwCY3UZRIo4sme2trzl+nGYBUnQAypfzQ=
k8s.io/cri-api v0.31.0-alpha.3/go.mod h1:++pZmPOodkvdUTNnXKrhFD68SD9WBKVP7rwC9frDbzU=
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510 h1:AKDmYyMb9sepbFmMeHZvVzK/1k6Bvft9zFosCD2lBYQ=
k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510/go.mod h1:++pZmPOodkvdUTNnXKrhFD68SD9WBKVP7rwC9frDbzU=
k8s.io/cri-client v0.31.0-alpha.2 h1:xigvtg9fvmX7M9dZGMQVU70jo2/vavKecpzATS6+gJY=
k8s.io/cri-client v0.31.0-alpha.2/go.mod h1:uiBYYH7+qPNPAUro0U70XHOyxaB0G68yltzMO8cSyGE=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
Expand Down
4 changes: 2 additions & 2 deletions pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ func PullPublicImage(c internalapi.ImageManagerService, imageName string, podCon
imageSpec := &runtimeapi.ImageSpec{
Image: imageName,
}
id, err := c.PullImage(context.TODO(), imageSpec, nil, podConfig)
res, err := c.PullImage(context.TODO(), imageSpec, nil, podConfig)
ExpectNoError(err, "failed to pull image: %v", err)
return id
return res
}

// LoadYamlFile attempts to load the given YAML file into the given struct.
Expand Down
1,036 changes: 553 additions & 483 deletions vendor/k8s.io/cri-api/pkg/apis/runtime/v1/api.pb.go

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions vendor/k8s.io/cri-api/pkg/apis/runtime/v1/api.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ k8s.io/component-base/metrics/prometheusextension
k8s.io/component-base/tracing
k8s.io/component-base/tracing/api/v1
k8s.io/component-base/version
# k8s.io/cri-api v0.31.0-alpha.3
# k8s.io/cri-api v0.31.0-alpha.3.0.20240703224615-0b09b4cd1510
## explicit; go 1.22.0
k8s.io/cri-api/pkg/apis
k8s.io/cri-api/pkg/apis/runtime/v1
Expand Down

0 comments on commit fc6c9b1

Please sign in to comment.