mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #81391 from oomichi/cleanup-GetGPUDevicePluginImage
Move GetGPUDevicePluginImage to the test
This commit is contained in:
commit
fec7d35f26
@ -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",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user