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.
This commit is contained in:
Kenichi Omichi
2019-08-13 23:58:59 +00:00
parent 77fca12f66
commit 2efa60b849
3 changed files with 19 additions and 21 deletions

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
}