e2e: topomgr: add test infra
This patch all the testing infra and utilities needed to run e2e topology manager tests. This include setup a guaranteed pod which needs some devices. The simplest real device available for the purpose are the SRIOV devices, hence we use them. This patch pulls the SRIOV device plugin from the official, yet external, repository. We do it as close as possible for the nvidia GPU plugin. This patch also performs minor refactoring for some test framework utilities, needed to support the new e2e tests. Finally, we add an empty e2e topology manager test, to be completed by the next patch. Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
commontest "k8s.io/kubernetes/test/e2e/common"
|
||||
"k8s.io/kubernetes/test/e2e/framework"
|
||||
"k8s.io/kubernetes/test/e2e/framework/gpu"
|
||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||
)
|
||||
|
||||
@@ -68,6 +69,7 @@ func updateImageWhiteList() {
|
||||
framework.ImageWhiteList = NodeImageWhiteList.Union(commontest.CommonImageWhiteList)
|
||||
// Images from extra envs
|
||||
framework.ImageWhiteList.Insert(getNodeProblemDetectorImage())
|
||||
framework.ImageWhiteList.Insert(getSRIOVDevicePluginImage())
|
||||
}
|
||||
|
||||
func getNodeProblemDetectorImage() string {
|
||||
@@ -184,3 +186,26 @@ func getGPUDevicePluginImage() string {
|
||||
}
|
||||
return ds.Spec.Template.Spec.Containers[0].Image
|
||||
}
|
||||
|
||||
// getSRIOVDevicePluginImage returns the image of SRIOV device plugin.
|
||||
func getSRIOVDevicePluginImage() string {
|
||||
data, err := testfiles.Read(SRIOVDevicePluginDSYAML)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to read the device plugin manifest: %v", err)
|
||||
return ""
|
||||
}
|
||||
ds, err := framework.DsFromData(data)
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user