Skip to content

Remove gogo from proto bindings (part 1: CRI) #128653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions hack/_update-generated-proto-bindings-gogo-dockerized.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance we can avoid an entire new script that replicates everything but the kube::protoc::generate_proto_gogo call?

we wouldn't need hack/_update-generated-proto-bindings-gogo-dockerized.sh if we require telling _update-generated-proto-bindings-dockerized.sh which generator to use, like this:

diff --git a/hack/_update-generated-proto-bindings-dockerized.sh b/hack/_update-generated-proto-bindings-dockerized.sh
index 163143b1af4..127f9a240a5 100755
--- a/hack/_update-generated-proto-bindings-dockerized.sh
+++ b/hack/_update-generated-proto-bindings-dockerized.sh
@@ -26,11 +26,13 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
 source "${KUBE_ROOT}/hack/lib/protoc.sh"
 source "${KUBE_ROOT}/hack/lib/util.sh"
 
-if [ "$#" == 0 ]; then
-    echo "usage: $0 <api_dir>..."
+if (( $# < 2 )); then
+    echo "usage: $0 [gogo|protoc] <api_dir>..."
     exit 1
 fi
 
+generator=$1; shift
+
 kube::protoc::check_protoc
 
 for api; do
@@ -47,6 +49,16 @@ for api; do
 
     for file in "${protos[@]}"; do
         dir="$(dirname "${file}")"
-        kube::protoc::generate_proto "${dir}"
+        case "${generator}" in
+        gogo)
+          kube::protoc::generate_proto_gogo "${dir}"
+          ;;
+        protoc)
+          kube::protoc::generate_proto "${dir}"
+          ;;
+        *)
+          echo "Unknown generator ${generator}" >&2
+          exit 1
+        esac
     done
 done
diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh
index a653eed737b..bb8a43149d5 100755
--- a/hack/update-codegen.sh
+++ b/hack/update-codegen.sh
@@ -945,15 +945,15 @@ function codegen::protobindings() {
     done
 
     if kube::protoc::check_protoc >/dev/null; then
-      hack/_update-generated-proto-bindings-gogo-dockerized.sh "${apis_using_gogo[@]}"
-      hack/_update-generated-proto-bindings-dockerized.sh "${apis_using_protoc[@]}"
+      hack/_update-generated-proto-bindings-dockerized.sh gogo   "${apis_using_gogo[@]}"
+      hack/_update-generated-proto-bindings-dockerized.sh protoc "${apis_using_protoc[@]}"
     else
       kube::log::status "protoc ${PROTOC_VERSION} not found (can install with hack/install-protoc.sh); generating containerized..."
       # NOTE: All output from this script needs to be copied back to the calling
       # source tree.  This is managed in kube::build::copy_output in build/common.sh.
       # If the output set is changed update that function.
-      build/run.sh hack/_update-generated-proto-bindings-gogo-dockerized.sh "${apis_using_gogo[@]}"
-      build/run.sh hack/_update-generated-proto-bindings-dockerized.sh "${apis_using_protoc[@]}"
+      build/run.sh hack/_update-generated-proto-bindings-dockerized.sh gogo   "${apis_using_gogo[@]}"
+      build/run.sh hack/_update-generated-proto-bindings-dockerized.sh protoc "${apis_using_protoc[@]}"
     fi
 }

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script generates `*/api.pb.go` files from protobuf files `*/api.proto`.

set -o errexit
set -o nounset
set -o pipefail

KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)"

source "${KUBE_ROOT}/hack/lib/init.sh"
source "${KUBE_ROOT}/hack/lib/protoc.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"

if [ "$#" == 0 ]; then
echo "usage: $0 <api_dir>..."
exit 1
fi

kube::protoc::check_protoc

for api; do
# This can't use `git ls-files` because it runs in a container without the
# .git dir synced.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xref: #112862

protos=()
kube::util::read-array protos < <( \
find "${api}" -type f -name "api.proto")

if [ "${#protos[@]}" == 0 ]; then
echo "ERROR: no 'api.proto' files under '${api}'"
exit 1
fi

for file in "${protos[@]}"; do
dir="$(dirname "${file}")"
kube::protoc::generate_proto_gogo "${dir}"
done
done
46 changes: 40 additions & 6 deletions hack/lib/protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ PROTOC_VERSION=23.4
# $1: Full path to the directory where the api.proto file is
function kube::protoc::generate_proto() {
kube::golang::setup_env
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo
go -C "${KUBE_ROOT}/hack/tools" install google.golang.org/protobuf/cmd/protoc-gen-go
go -C "${KUBE_ROOT}/hack/tools" install google.golang.org/grpc/cmd/protoc-gen-go-grpc

kube::protoc::check_protoc

Expand All @@ -41,6 +42,20 @@ function kube::protoc::generate_proto() {
kube::protoc::format "${package}"
}

# Generates $1/api.pb.go from the protobuf file $1/api.proto
# and formats it correctly
# $1: Full path to the directory where the api.proto file is
function kube::protoc::generate_proto_gogo() {
kube::golang::setup_env
GOPROXY=off go install k8s.io/code-generator/cmd/go-to-protobuf/protoc-gen-gogo

kube::protoc::check_protoc

local package=${1}
kube::protoc::protoc_gogo "${package}"
kube::protoc::format "${package}"
}

# Checks that the current protoc version matches the required version and
# exit 1 if it's not the case
function kube::protoc::check_protoc() {
Expand All @@ -55,7 +70,7 @@ function kube::protoc::check_protoc() {

# Generates $1/api.pb.go from the protobuf file $1/api.proto
# $1: Full path to the directory where the api.proto file is
function kube::protoc::protoc() {
function kube::protoc::protoc_gogo() {
local package=${1}
gogopath=$(dirname "$(kube::util::find-binary "protoc-gen-gogo")")

Expand All @@ -76,17 +91,36 @@ function kube::protoc::protoc() {
)
}

# Generates $1/api.pb.go from the protobuf file $1/api.proto without using gogo
# $1: Full path to the directory where the api.proto file is
function kube::protoc::protoc() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a new pattern where functions not meant to be called directly have a ::internal:: segment (something thockin started I think), probably makes sense here if we're calling kube::protoc::check_protoc elsewhere but not here and making kube::protoc::generate_proto_gogo the "public api" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like

kube::golang::internal::lazy_normalize() {

Copy link
Member Author

@saschagrunert saschagrunert Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I understand that correctly. What we do here is trying to keep the same structure as existing but introducing a parallel implementation (gogo vs non gogo).

Do you suggest that we need to refactor them into another location?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BenTheElder do you have a suggestion how to refactor that or should I follow-up when other proto bindings move over to use non-gogo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that could be a follow-up that transitions both the kube::protoc::protoc_gogo / kube::protoc::protoc function names to add ::internal:: segments ... keeping this as focused on the specific delta between gogo protoc is helpful for reviewing this PR

local package=${1}

protoc \
--proto_path="$(pwd -P)" \
--proto_path="${KUBE_ROOT}/vendor" \
--proto_path="${KUBE_ROOT}/staging/src" \
--proto_path="${KUBE_ROOT}/third_party/protobuf" \
--go_out=. \
--go_opt=paths=source_relative \
--go-grpc_out=. \
--go-grpc_opt=paths=source_relative \
"${package}"/api.proto
}

# Formats $1/api.pb.go, adds the boilerplate comments and run gofmt on it
# $1: Full path to the directory where the api.proto file is
function kube::protoc::format() {
local package=${1}

# Update boilerplate for the generated file.
cat hack/boilerplate/boilerplate.generatego.txt "${package}/api.pb.go" > tmpfile && mv tmpfile "${package}/api.pb.go"

# Run gofmt to clean up the generated code.
kube::golang::setup_env
gofmt -s -w "${package}/api.pb.go"

# Update boilerplate for the generated files.
for file in "${package}"/api*.pb.go ; do
cat hack/boilerplate/boilerplate.generatego.txt "${file}" > tmpfile && mv tmpfile "${file}"
gofmt -s -w "${file}"
done
}

# Compares the contents of $1 and $2
Expand Down
3 changes: 2 additions & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ require (
github.com/vektra/mockery/v2 v2.40.3
go.uber.org/automaxprocs v1.6.0
golang.org/x/mod v0.23.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1
google.golang.org/protobuf v1.36.4
gotest.tools/gotestsum v1.12.0
honnef.co/go/tools v0.6.0
k8s.io/publishing-bot v0.5.0
Expand Down Expand Up @@ -205,7 +207,6 @@ require (
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
7 changes: 7 additions & 0 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand All @@ -996,6 +999,10 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
4 changes: 4 additions & 0 deletions hack/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ import (
// for publishing bot
_ "golang.org/x/mod/modfile"
_ "k8s.io/publishing-bot/cmd/publishing-bot/config"

// protobuf generation
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)
1 change: 0 additions & 1 deletion hack/unwanted-dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
"k8s.io/apiserver",
"k8s.io/client-go",
"k8s.io/code-generator",
"k8s.io/cri-api",
"k8s.io/externaljwt",
"k8s.io/kms",
"k8s.io/kube-aggregator",
Expand Down
16 changes: 10 additions & 6 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,7 @@ function codegen::subprojects() {
function codegen::protobindings() {
# Each element of this array is a directory containing subdirectories which
# eventually contain a file named "api.proto".
local apis=(
"staging/src/k8s.io/cri-api/pkg/apis/runtime"

local apis_using_gogo=(
"staging/src/k8s.io/kubelet/pkg/apis/podresources"

"staging/src/k8s.io/kubelet/pkg/apis/deviceplugin"
Expand All @@ -928,6 +926,10 @@ function codegen::protobindings() {

"staging/src/k8s.io/externaljwt/apis"
)
local apis_using_protoc=(
"staging/src/k8s.io/cri-api/pkg/apis/runtime"
)
local apis=("${apis_using_gogo[@]}" "${apis_using_protoc[@]}")

kube::log::status "Generating protobuf bindings for ${#apis[@]} targets"
if [[ "${DBG_CODEGEN}" == 1 ]]; then
Expand All @@ -938,18 +940,20 @@ function codegen::protobindings() {
fi

for api in "${apis[@]}"; do
git_find -z ":(glob)${api}"/'**/api.pb.go' \
git_find -z ":(glob)${api}"/'**/api*.pb.go' \
| xargs -0 rm -f
done

if kube::protoc::check_protoc >/dev/null; then
hack/_update-generated-proto-bindings-dockerized.sh "${apis[@]}"
hack/_update-generated-proto-bindings-gogo-dockerized.sh "${apis_using_gogo[@]}"
hack/_update-generated-proto-bindings-dockerized.sh "${apis_using_protoc[@]}"
else
kube::log::status "protoc ${PROTOC_VERSION} not found (can install with hack/install-protoc.sh); generating containerized..."
# NOTE: All output from this script needs to be copied back to the calling
# source tree. This is managed in kube::build::copy_output in build/common.sh.
# If the output set is changed update that function.
build/run.sh hack/_update-generated-proto-bindings-dockerized.sh "${apis[@]}"
build/run.sh hack/_update-generated-proto-bindings-gogo-dockerized.sh "${apis_using_gogo[@]}"
build/run.sh hack/_update-generated-proto-bindings-dockerized.sh "${apis_using_protoc[@]}"
fi
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/kubelet/kuberuntime/kuberuntime_container_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/types"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
libcontainercgroups "github.com/opencontainers/cgroups"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -738,7 +739,11 @@ func TestGenerateLinuxContainerConfigNamespaces(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
got, err := m.generateLinuxContainerConfig(&tc.pod.Spec.Containers[0], tc.pod, nil, "", tc.target, false)
assert.NoError(t, err)
if diff := cmp.Diff(tc.want, got.SecurityContext.NamespaceOptions); diff != "" {
if diff := cmp.Diff(
tc.want,
got.SecurityContext.NamespaceOptions,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the need for this change a sign that the generated types are changing in ways that will break consumers?

cmpopts.IgnoreUnexported(runtimeapi.NamespaceOption{}),
); diff != "" {
t.Errorf("%v: diff (-want +got):\n%v", t.Name(), diff)
}
})
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubelet/kuberuntime/kuberuntime_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (m *kubeGenericRuntimeManager) GetImageSize(ctx context.Context, image kube
if resp.Image == nil {
return 0, nil
}
return resp.Image.Size_, nil
return resp.Image.GetSize(), nil
}

// ListImages gets all images currently on the machine.
Expand All @@ -119,7 +119,7 @@ func (m *kubeGenericRuntimeManager) ListImages(ctx context.Context) ([]kubeconta

images = append(images, kubecontainer.Image{
ID: img.Id,
Size: int64(img.Size_),
Size: int64(img.GetSize()),
RepoTags: img.RepoTags,
RepoDigests: img.RepoDigests,
Spec: toKubeContainerImageSpec(img),
Expand Down Expand Up @@ -153,7 +153,7 @@ func (m *kubeGenericRuntimeManager) ImageStats(ctx context.Context) (*kubecontai
}
stats := &kubecontainer.ImageStats{}
for _, img := range allImages {
stats.TotalStorageBytes += img.Size_
stats.TotalStorageBytes += img.GetSize()
}
return stats, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubelet/kuberuntime/kuberuntime_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ type imageVolumePulls = map[string]imageVolumePullResult
// If spec is nil, then err and msg should be set.
// If err is nil, then spec should be set.
type imageVolumePullResult struct {
spec runtimeapi.ImageSpec
spec *runtimeapi.ImageSpec
err error
msg string
}
Expand Down Expand Up @@ -1470,7 +1470,7 @@ func (m *kubeGenericRuntimeManager) toKubeContainerImageVolumes(imageVolumePullR
continue
}

imageVolumes[v.Name] = &res.spec
imageVolumes[v.Name] = res.spec
}

if lastErr != nil {
Expand Down Expand Up @@ -1509,7 +1509,7 @@ func (m *kubeGenericRuntimeManager) getImageVolumes(ctx context.Context, pod *v1
}

klog.V(4).InfoS("Pulled image", "ref", ref, "pod", klog.KObj(pod))
res[volume.Name] = imageVolumePullResult{spec: runtimeapi.ImageSpec{
res[volume.Name] = imageVolumePullResult{spec: &runtimeapi.ImageSpec{
Image: ref,
UserSpecifiedImage: volume.Image.Reference,
RuntimeHandler: podRuntimeHandler,
Expand Down
16 changes: 9 additions & 7 deletions pkg/kubelet/kuberuntime/kuberuntime_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ func makeFakePodSandbox(t *testing.T, m *kubeGenericRuntimeManager, template san
Ip: ip,
})
}
podSandBoxStatus.Network.AdditionalIps = additionalPodIPs
if len(additionalPodIPs) > 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why this change was required

podSandBoxStatus.Network.AdditionalIps = additionalPodIPs
}
return podSandBoxStatus

}
Expand Down Expand Up @@ -3070,8 +3072,8 @@ func TestToKubeContainerImageVolumes(t *testing.T) {
"empty volumes": {},
"multiple volumes": {
pullResults: imageVolumePulls{
volume1: imageVolumePullResult{spec: imageSpec1},
volume2: imageVolumePullResult{spec: imageSpec2},
volume1: imageVolumePullResult{spec: &imageSpec1},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar question about why a change from struct to pointer was required, and if that represents changes in the types that will break consumers as well

volume2: imageVolumePullResult{spec: &imageSpec2},
},
container: &v1.Container{
VolumeMounts: []v1.VolumeMount{
Expand All @@ -3086,7 +3088,7 @@ func TestToKubeContainerImageVolumes(t *testing.T) {
},
"not matching volume": {
pullResults: imageVolumePulls{
"different": imageVolumePullResult{spec: imageSpec1},
"different": imageVolumePullResult{spec: &imageSpec1},
},
container: &v1.Container{
VolumeMounts: []v1.VolumeMount{{Name: volume1}},
Expand Down Expand Up @@ -3145,8 +3147,8 @@ func TestGetImageVolumes(t *testing.T) {
{Name: volume2, VolumeSource: v1.VolumeSource{Image: &v1.ImageVolumeSource{Reference: image2, PullPolicy: v1.PullAlways}}},
}}},
expectedImageVolumePulls: imageVolumePulls{
volume1: imageVolumePullResult{spec: imageSpec1},
volume2: imageVolumePullResult{spec: imageSpec2},
volume1: imageVolumePullResult{spec: &imageSpec1},
volume2: imageVolumePullResult{spec: &imageSpec2},
},
},
"different than image volumes": {
Expand All @@ -3161,7 +3163,7 @@ func TestGetImageVolumes(t *testing.T) {
{Name: volume2, VolumeSource: v1.VolumeSource{Image: &v1.ImageVolumeSource{Reference: "image", PullPolicy: v1.PullNever}}}, // fails
}}},
expectedImageVolumePulls: imageVolumePulls{
volume1: imageVolumePullResult{spec: imageSpec1},
volume1: imageVolumePullResult{spec: &imageSpec1},
volume2: imageVolumePullResult{err: imagetypes.ErrImageNeverPull, msg: `Container image "image" is not present with pull policy of Never`},
},
},
Expand Down
Loading