mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
test: Use dedicated informerFactory for node lifecycle controller
This commit is contained in:
parent
eec809aa93
commit
fc11871c61
@ -134,7 +134,6 @@ 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)
|
||||
@ -142,10 +141,10 @@ func TestTaintBasedEvictions(t *testing.T) {
|
||||
|
||||
// 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
|
||||
@ -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"),
|
||||
|
@ -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
|
||||
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user