This commit is contained in:
tianshapjq
2018-02-07 09:32:42 +08:00
parent d17f1ce5bf
commit 15c6df5d01
2 changed files with 10 additions and 13 deletions

View File

@@ -21,8 +21,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"fmt"
. "github.com/onsi/gomega"
"github.com/golang/glog"
)
const (
@@ -68,16 +68,19 @@ func NVIDIADevicePlugin(ns string) *v1.Pod {
return p
}
func GetGPUDevicePluginImage() (string, error) {
func GetGPUDevicePluginImage() string {
ds, err := DsFromManifest(GPUDevicePluginDSYAML)
if err != nil {
return "", err
glog.Errorf("Failed to parse the device plugin image: %v", err)
return ""
}
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 {
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
}