Merge pull request #81391 from oomichi/cleanup-GetGPUDevicePluginImage

Move GetGPUDevicePluginImage to the test
This commit is contained in:
Kubernetes Prow Robot 2019-08-15 07:20:48 -07:00 committed by GitHub
commit fec7d35f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 21 deletions

View File

@ -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",
],
)

View File

@ -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
}

View File

@ -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
}