mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #88773 from vpickard/e2e-topology-manager-sriovdpReady
e2e-topology-manager: Wait for SR-IOV device plugin
This commit is contained in:
commit
50dd75f9c5
@ -20,6 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
testutils "k8s.io/kubernetes/test/utils"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -49,8 +50,9 @@ import (
|
|||||||
const (
|
const (
|
||||||
numalignCmd = `export CPULIST_ALLOWED=$( awk -F":\t*" '/Cpus_allowed_list/ { print $2 }' /proc/self/status); env; sleep 1d`
|
numalignCmd = `export CPULIST_ALLOWED=$( awk -F":\t*" '/Cpus_allowed_list/ { print $2 }' /proc/self/status); env; sleep 1d`
|
||||||
|
|
||||||
minNumaNodes = 2
|
minNumaNodes = 2
|
||||||
minCoreCount = 4
|
minCoreCount = 4
|
||||||
|
minSriovResource = 7 // This is the min number of SRIOV VFs needed on the system under test.
|
||||||
)
|
)
|
||||||
|
|
||||||
// Helper for makeTopologyManagerPod().
|
// Helper for makeTopologyManagerPod().
|
||||||
@ -276,8 +278,9 @@ func readServiceAccountV1OrDie(objBytes []byte) *v1.ServiceAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func findSRIOVResource(node *v1.Node) (string, int64) {
|
func findSRIOVResource(node *v1.Node) (string, int64) {
|
||||||
|
framework.Logf("Node status allocatable: %v", node.Status.Allocatable)
|
||||||
re := regexp.MustCompile(`^intel.com/.*sriov.*`)
|
re := regexp.MustCompile(`^intel.com/.*sriov.*`)
|
||||||
for key, val := range node.Status.Capacity {
|
for key, val := range node.Status.Allocatable {
|
||||||
resource := string(key)
|
resource := string(key)
|
||||||
if re.MatchString(resource) {
|
if re.MatchString(resource) {
|
||||||
v := val.Value()
|
v := val.Value()
|
||||||
@ -461,16 +464,20 @@ func setupSRIOVConfigOrFail(f *framework.Framework, configMap *v1.ConfigMap) *sr
|
|||||||
dpPod, err := f.ClientSet.CoreV1().Pods(metav1.NamespaceSystem).Create(context.TODO(), dp, metav1.CreateOptions{})
|
dpPod, err := f.ClientSet.CoreV1().Pods(metav1.NamespaceSystem).Create(context.TODO(), dp, metav1.CreateOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
if err = e2epod.WaitForPodCondition(f.ClientSet, metav1.NamespaceSystem, dp.Name, "Ready", 120*time.Second, testutils.PodRunningReady); err != nil {
|
||||||
|
framework.Logf("SRIOV Pod %v took too long to enter running/ready: %v", dp.Name, err)
|
||||||
|
}
|
||||||
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
sriovResourceName := ""
|
sriovResourceName := ""
|
||||||
var sriovResourceAmount int64
|
var sriovResourceAmount int64
|
||||||
ginkgo.By("Waiting for devices to become available on the local node")
|
ginkgo.By("Waiting for devices to become available on the local node")
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
node := getLocalNode(f)
|
node := getLocalNode(f)
|
||||||
framework.Logf("Node status: %v", node.Status.Capacity)
|
|
||||||
sriovResourceName, sriovResourceAmount = findSRIOVResource(node)
|
sriovResourceName, sriovResourceAmount = findSRIOVResource(node)
|
||||||
return sriovResourceAmount > 0
|
return sriovResourceAmount > minSriovResource
|
||||||
}, 2*time.Minute, framework.Poll).Should(gomega.BeTrue())
|
}, 2*time.Minute, framework.Poll).Should(gomega.BeTrue())
|
||||||
framework.Logf("Successfully created device plugin pod, detected %d SRIOV device %q", sriovResourceAmount, sriovResourceName)
|
framework.Logf("Successfully created device plugin pod, detected %d SRIOV allocatable devices %q", sriovResourceAmount, sriovResourceName)
|
||||||
|
|
||||||
return &sriovData{
|
return &sriovData{
|
||||||
configMap: configMap,
|
configMap: configMap,
|
||||||
|
Loading…
Reference in New Issue
Block a user