Skip to content

Commit 2efa60b

Browse files
author
Kenichi Omichi
committed
Move GetGPUDevicePluginImage to the test
GetGPUDevicePluginImage() was called in some e2e node test only. So it is not worth keeping the function as a part of e2e test framework. This moves GetGPUDevicePluginImage() to the e2e node test for code cleanup.
1 parent 77fca12 commit 2efa60b

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)