Merge pull request #134745 from swatisehgal/device-plugin-e2e-flakiness-1

node: e2e: Ensure device plugin pod is Running/Ready before registration
This commit is contained in:
Kubernetes Prow Robot
2025-10-22 11:54:47 -07:00
committed by GitHub

View File

@@ -52,6 +52,7 @@ import (
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
testutils "k8s.io/kubernetes/test/utils"
)
var (
@@ -867,6 +868,13 @@ func testDevicePluginNodeReboot(f *framework.Framework, pluginSockDir string) {
devicePluginPod = e2epod.NewPodClient(f).CreateSync(ctx, dp)
framework.Logf("Waiting for device plugin pod to be Running")
err = e2epod.WaitForPodCondition(ctx, f.ClientSet, devicePluginPod.Namespace, devicePluginPod.Name, "Ready", 2*time.Minute, testutils.PodRunningReady)
if err != nil {
framework.Logf("Sample Device Pod %v took too long to enter running/ready: %v", dp.Name, err)
}
framework.ExpectNoError(err, "WaitForPodCondition() failed err: %v", err)
go func() {
// Since autoregistration is disabled for the device plugin (as REGISTER_CONTROL_FILE
// environment variable is specified), device plugin registration needs to be triggerred
@@ -893,7 +901,7 @@ func testDevicePluginNodeReboot(f *framework.Framework, pluginSockDir string) {
return ready &&
CountSampleDeviceCapacity(node) == expectedSampleDevsAmount &&
CountSampleDeviceAllocatable(node) == expectedSampleDevsAmount
}, 30*time.Second, framework.Poll).Should(gomega.BeTrueBecause("expected resource to be available on local node"))
}, 2*time.Minute, framework.Poll).Should(gomega.BeTrueBecause("expected resource exported by the sample device plugin to be available on local node"))
})
ginkgo.AfterEach(func(ctx context.Context) {