From 2efa60b84988d997349d7e52c2a6270c634abf84 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Tue, 13 Aug 2019 23:58:59 +0000 Subject: [PATCH] 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. --- test/e2e/framework/gpu/BUILD | 1 - test/e2e/framework/gpu/gpu_util.go | 19 ------------------- test/e2e_node/image_list.go | 20 +++++++++++++++++++- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/test/e2e/framework/gpu/BUILD b/test/e2e/framework/gpu/BUILD index 340b4bc2ed0..42f0f5246bc 100644 --- a/test/e2e/framework/gpu/BUILD +++ b/test/e2e/framework/gpu/BUILD @@ -10,7 +10,6 @@ go_library( "//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//test/e2e/framework:go_default_library", - "//vendor/k8s.io/klog:go_default_library", ], ) diff --git a/test/e2e/framework/gpu/gpu_util.go b/test/e2e/framework/gpu/gpu_util.go index 415d4b1a93d..6fc4c1e2b46 100644 --- a/test/e2e/framework/gpu/gpu_util.go +++ b/test/e2e/framework/gpu/gpu_util.go @@ -20,7 +20,6 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" - "k8s.io/klog" "k8s.io/kubernetes/test/e2e/framework" ) @@ -62,21 +61,3 @@ func NVIDIADevicePlugin() *v1.Pod { p.Spec.Affinity = nil return p } - -// GetGPUDevicePluginImage returns the image of GPU device plugin. -func GetGPUDevicePluginImage() string { - ds, err := framework.DsFromManifest(GPUDevicePluginDSYAML) - if err != nil { - klog.Errorf("Failed to parse the device plugin image: %v", err) - return "" - } - if ds == nil { - klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil") - return "" - } - if len(ds.Spec.Template.Spec.Containers) < 1 { - klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML") - return "" - } - return ds.Spec.Template.Spec.Containers[0].Image -} diff --git a/test/e2e_node/image_list.go b/test/e2e_node/image_list.go index 68c70e2694f..184aad8140b 100644 --- a/test/e2e_node/image_list.go +++ b/test/e2e_node/image_list.go @@ -53,7 +53,7 @@ var NodeImageWhiteList = sets.NewString( imageutils.GetE2EImage(imageutils.Perl), imageutils.GetE2EImage(imageutils.Nonewprivs), imageutils.GetPauseImageName(), - gpu.GetGPUDevicePluginImage(), + getGPUDevicePluginImage(), "gcr.io/kubernetes-e2e-test-images/node-perf/npb-is:1.0", "gcr.io/kubernetes-e2e-test-images/node-perf/npb-ep:1.0", "gcr.io/kubernetes-e2e-test-images/node-perf/tf-wide-deep-amd64:1.0", @@ -167,3 +167,21 @@ func PrePullAllImages() error { } return nil } + +// getGPUDevicePluginImage returns the image of GPU device plugin. +func getGPUDevicePluginImage() string { + ds, err := framework.DsFromManifest(gpu.GPUDevicePluginDSYAML) + if err != nil { + klog.Errorf("Failed to parse the device plugin image: %v", err) + return "" + } + if ds == nil { + klog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil") + return "" + } + if len(ds.Spec.Template.Spec.Containers) < 1 { + klog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML") + return "" + } + return ds.Spec.Template.Spec.Containers[0].Image +}