Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Use dedicated informerFactory for node lifecycle controller #90865

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions test/integration/node/lifecycle_test.go
Expand Up @@ -134,18 +134,17 @@ func TestTaintBasedEvictions(t *testing.T) {
testCtx = testutils.InitTestScheduler(t, testCtx, true, nil)
defer testutils.CleanupTest(t, testCtx)
cs := testCtx.ClientSet
informers := testCtx.InformerFactory
_, err := cs.CoreV1().Namespaces().Create(context.TODO(), testCtx.NS, metav1.CreateOptions{})
if err != nil {
t.Errorf("Failed to create namespace %+v", err)
}

// Start NodeLifecycleController for taint.
nc, err := nodelifecycle.NewNodeLifecycleController(
informers.Coordination().V1().Leases(),
informers.Core().V1().Pods(),
informers.Core().V1().Nodes(),
informers.Apps().V1().DaemonSets(),
externalInformers.Coordination().V1().Leases(),
externalInformers.Core().V1().Pods(),
externalInformers.Core().V1().Nodes(),
externalInformers.Apps().V1().DaemonSets(),
cs,
5*time.Second, // Node monitor grace period
time.Minute, // Node startup grace period
Expand All @@ -167,8 +166,8 @@ func TestTaintBasedEvictions(t *testing.T) {
// Waiting for all controller sync.
externalInformers.Start(testCtx.Ctx.Done())
externalInformers.WaitForCacheSync(testCtx.Ctx.Done())
informers.Start(testCtx.Ctx.Done())
informers.WaitForCacheSync(testCtx.Ctx.Done())
testCtx.InformerFactory.Start(testCtx.Ctx.Done())
testCtx.InformerFactory.WaitForCacheSync(testCtx.Ctx.Done())

nodeRes := v1.ResourceList{
v1.ResourceCPU: resource.MustParse("4000m"),
Expand Down
13 changes: 6 additions & 7 deletions test/integration/scheduler/taint_test.go
Expand Up @@ -79,15 +79,14 @@ func TestTaintNodeByCondition(t *testing.T) {
defer testutils.CleanupTest(t, testCtx)

cs := testCtx.ClientSet
informers := testCtx.InformerFactory
nsName := testCtx.NS.Name

// Start NodeLifecycleController for taint.
nc, err := nodelifecycle.NewNodeLifecycleController(
informers.Coordination().V1().Leases(),
informers.Core().V1().Pods(),
informers.Core().V1().Nodes(),
informers.Apps().V1().DaemonSets(),
externalInformers.Coordination().V1().Leases(),
externalInformers.Core().V1().Pods(),
externalInformers.Core().V1().Nodes(),
externalInformers.Apps().V1().DaemonSets(),
cs,
time.Hour, // Node monitor grace period
time.Second, // Node startup grace period
Expand All @@ -108,8 +107,8 @@ func TestTaintNodeByCondition(t *testing.T) {
// Waiting for all controller sync.
externalInformers.Start(testCtx.Ctx.Done())
externalInformers.WaitForCacheSync(testCtx.Ctx.Done())
informers.Start(testCtx.Ctx.Done())
informers.WaitForCacheSync(testCtx.Ctx.Done())
testCtx.InformerFactory.Start(testCtx.Ctx.Done())
testCtx.InformerFactory.WaitForCacheSync(testCtx.Ctx.Done())

// -------------------------------------------
// Test TaintNodeByCondition feature.
Expand Down