update
This commit is contained in:
@@ -21,8 +21,8 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -68,16 +68,19 @@ func NVIDIADevicePlugin(ns string) *v1.Pod {
|
|||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGPUDevicePluginImage() (string, error) {
|
func GetGPUDevicePluginImage() string {
|
||||||
ds, err := DsFromManifest(GPUDevicePluginDSYAML)
|
ds, err := DsFromManifest(GPUDevicePluginDSYAML)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
glog.Errorf("Failed to parse the device plugin image: %v", err)
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
if ds == nil {
|
if ds == nil {
|
||||||
return "", fmt.Errorf("empty DaemonSet from DSYAML")
|
glog.Errorf("Failed to parse the device plugin image: the extracted DaemonSet is nil")
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
if len(ds.Spec.Template.Spec.Containers) < 1 {
|
||||||
return "", fmt.Errorf("no container specified in the DSYAML")
|
glog.Errorf("Failed to parse the device plugin image: cannot extract the container from YAML")
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
return ds.Spec.Template.Spec.Containers[0].Image, nil
|
return ds.Spec.Template.Spec.Containers[0].Image
|
||||||
}
|
}
|
||||||
|
@@ -52,18 +52,12 @@ var NodeImageWhiteList = sets.NewString(
|
|||||||
imageutils.GetE2EImage(imageutils.Netexec),
|
imageutils.GetE2EImage(imageutils.Netexec),
|
||||||
imageutils.GetE2EImage(imageutils.Nonewprivs),
|
imageutils.GetE2EImage(imageutils.Nonewprivs),
|
||||||
imageutils.GetPauseImageNameForHostArch(),
|
imageutils.GetPauseImageNameForHostArch(),
|
||||||
|
framework.GetGPUDevicePluginImage(),
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Union NodeImageWhiteList and CommonImageWhiteList into the framework image white list.
|
// Union NodeImageWhiteList and CommonImageWhiteList into the framework image white list.
|
||||||
framework.ImageWhiteList = NodeImageWhiteList.Union(commontest.CommonImageWhiteList)
|
framework.ImageWhiteList = NodeImageWhiteList.Union(commontest.CommonImageWhiteList)
|
||||||
|
|
||||||
// parse the device plugin image from url
|
|
||||||
if image, err := framework.GetGPUDevicePluginImage(); err != nil {
|
|
||||||
glog.Errorf("Failed to parse the device plugin image: %v", err)
|
|
||||||
} else {
|
|
||||||
framework.ImageWhiteList.Insert(image)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// puller represents a generic image puller
|
// puller represents a generic image puller
|
||||||
|
Reference in New Issue
Block a user