Skip to content

Commit fec7d35

Browse files
authored
Merge pull request kubernetes#81391 from oomichi/cleanup-GetGPUDevicePluginImage
Move GetGPUDevicePluginImage to the test
2 parents 273e926 + 2efa60b commit fec7d35

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

test/e2e/framework/gpu/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ go_library(
1010
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
1111
"//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library",
1212
"//test/e2e/framework:go_default_library",
13-
"//vendor/k8s.io/klog:go_default_library",
1413
],
1514
)
1615

test/e2e/framework/gpu/gpu_util.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
v1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/util/uuid"
23-
"k8s.io/klog"
2423
"k8s.io/kubernetes/test/e2e/framework"
2524
)
2625

@@ -62,21 +61,3 @@ func NVIDIADevicePlugin() *v1.Pod {
6261
p.Spec.Affinity = nil
6362
return p
6463
}
65-
66-
// GetGPUDevicePluginImage returns the image of GPU device plugin.
67-
func GetGPUDevicePluginImage() string {
68-
ds, err := framework.DsFromManifest(GPUDevicePluginDSYAML)
69-
if err != nil {
70-
klog.Errorf("Failed to parse the device plugin image: %v", err)
71-
return ""
72-
}
73-
if ds == nil {
74-
klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil")
75-
return ""
76-
}
77-
if len(ds.Spec.Template.Spec.Containers) < 1 {
78-
klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML")
79-
return ""
80-
}
81-
return ds.Spec.Template.Spec.Containers[0].Image
82-
}

test/e2e_node/image_list.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var NodeImageWhiteList = sets.NewString(
5353
imageutils.GetE2EImage(imageutils.Perl),
5454
imageutils.GetE2EImage(imageutils.Nonewprivs),
5555
imageutils.GetPauseImageName(),
56-
gpu.GetGPUDevicePluginImage(),
56+
getGPUDevicePluginImage(),
5757
"gcr.io/kubernetes-e2e-test-images/node-perf/npb-is:1.0",
5858
"gcr.io/kubernetes-e2e-test-images/node-perf/npb-ep:1.0",
5959
"gcr.io/kubernetes-e2e-test-images/node-perf/tf-wide-deep-amd64:1.0",
@@ -167,3 +167,21 @@ func PrePullAllImages() error {
167167
}
168168
return nil
169169
}
170+
171+
// getGPUDevicePluginImage returns the image of GPU device plugin.
172+
func getGPUDevicePluginImage() string {
173+
ds, err := framework.DsFromManifest(gpu.GPUDevicePluginDSYAML)
174+
if err != nil {
175+
klog.Errorf("Failed to parse the device plugin image: %v", err)
176+
return ""
177+
}
178+
if ds == nil {
179+
klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil")
180+
return ""
181+
}
182+
if len(ds.Spec.Template.Spec.Containers) < 1 {
183+
klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML")
184+
return ""
185+
}
186+
return ds.Spec.Template.Spec.Containers[0].Image
187+
}

0 commit comments

Comments
 (0)