e2e: topomgr: add option to specify the SRIOV conf

We cannot anticipate all the possible configurations
needed by the SRIOV device plugin: there is too much variety.

Hence, we need to allow the test environment to supply
a host-specific ConfigMap to properly configure the device
plugin and avoid false negatives.

We still provide a the default config map as fallback and reference.

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani 2020-02-03 17:03:07 +01:00
parent 6687fcc78c
commit 1b5801a086
4 changed files with 20 additions and 3 deletions

View File

@ -167,6 +167,9 @@ type TestContextType struct {
// ProgressReportURL is the URL which progress updates will be posted to as tests complete. If empty, no updates are sent.
ProgressReportURL string
// SriovdpConfigMapFile is the path to the ConfigMap to configure the SRIOV device plugin on this host.
SriovdpConfigMapFile string
}
// NodeKillerConfig describes configuration of NodeKiller -- a utility to

View File

@ -80,6 +80,7 @@ func registerNodeFlags(flags *flag.FlagSet) {
flags.StringVar(&framework.TestContext.ImageDescription, "image-description", "", "The description of the image which the test will be running on.")
flags.StringVar(&framework.TestContext.SystemSpecName, "system-spec-name", "", "The name of the system spec (e.g., gke) that's used in the node e2e test. The system specs are in test/e2e_node/system/specs/. This is used by the test framework to determine which tests to run for validating the system requirements.")
flags.Var(cliflag.NewMapStringString(&framework.TestContext.ExtraEnvs), "extra-envs", "The extra environment variables needed for node e2e tests. Format: a list of key=value pairs, e.g., env1=val1,env2=val2")
flags.StringVar(&framework.TestContext.SriovdpConfigMapFile, "sriovdp-configmap-file", "", "The name of the SRIOV device plugin Config Map to load.")
}
func init() {

View File

@ -10,8 +10,8 @@ data:
"resourceName": "intel_sriov_netdevice",
"selectors": {
"vendors": ["8086"],
"devices": ["154c", "10ed", "1521"],
"drivers": ["i40evf", "ixgbevf", "igb"]
"devices": ["154c", "10ed"],
"drivers": ["i40evf", "ixgbevf"]
}
},
{

View File

@ -19,6 +19,7 @@ package e2enode
import (
"context"
"fmt"
"io/ioutil"
"os/exec"
"regexp"
"strconv"
@ -491,9 +492,21 @@ func runTopologyManagerNodeAlignmentSinglePodTest(f *framework.Framework, sriovR
}
func runTopologyManagerNodeAlignmentSuiteTests(f *framework.Framework, numaNodes int) {
cmData := testfiles.ReadOrDie(SRIOVDevicePluginCMYAML)
var err error
configMap := readConfigMapV1OrDie(testfiles.ReadOrDie(SRIOVDevicePluginCMYAML))
// the SRIOVDP configuration is hw-dependent, so we allow per-test-host customization.
framework.Logf("host-local SRIOV Device Plugin Config Map %q", framework.TestContext.SriovdpConfigMapFile)
if framework.TestContext.SriovdpConfigMapFile != "" {
cmData, err = ioutil.ReadFile(framework.TestContext.SriovdpConfigMapFile)
if err != nil {
framework.Failf("unable to load the SRIOV Device Plugin ConfigMap: %v", err)
}
} else {
framework.Logf("Using built-in SRIOV Device Plugin Config Map")
}
configMap := readConfigMapV1OrDie(cmData)
ginkgo.By(fmt.Sprintf("Creating configMap %v/%v", metav1.NamespaceSystem, configMap.Name))
if _, err = f.ClientSet.CoreV1().ConfigMaps(metav1.NamespaceSystem).Create(context.TODO(), configMap, metav1.CreateOptions{}); err != nil {
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)