mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
NewPodEvictor: drop nodes parameter
This commit is contained in:
@@ -160,7 +160,6 @@ func (d *descheduler) runDeschedulerLoop(ctx context.Context, nodes []*v1.Node)
|
|||||||
d.rs.DryRun,
|
d.rs.DryRun,
|
||||||
d.deschedulerPolicy.MaxNoOfPodsToEvictPerNode,
|
d.deschedulerPolicy.MaxNoOfPodsToEvictPerNode,
|
||||||
d.deschedulerPolicy.MaxNoOfPodsToEvictPerNamespace,
|
d.deschedulerPolicy.MaxNoOfPodsToEvictPerNamespace,
|
||||||
nodes,
|
|
||||||
!d.rs.DisableMetrics,
|
!d.rs.DisableMetrics,
|
||||||
d.eventRecorder,
|
d.eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ type (
|
|||||||
|
|
||||||
type PodEvictor struct {
|
type PodEvictor struct {
|
||||||
client clientset.Interface
|
client clientset.Interface
|
||||||
nodes []*v1.Node
|
|
||||||
policyGroupVersion string
|
policyGroupVersion string
|
||||||
dryRun bool
|
dryRun bool
|
||||||
maxPodsToEvictPerNode *uint
|
maxPodsToEvictPerNode *uint
|
||||||
@@ -60,26 +59,17 @@ func NewPodEvictor(
|
|||||||
dryRun bool,
|
dryRun bool,
|
||||||
maxPodsToEvictPerNode *uint,
|
maxPodsToEvictPerNode *uint,
|
||||||
maxPodsToEvictPerNamespace *uint,
|
maxPodsToEvictPerNamespace *uint,
|
||||||
nodes []*v1.Node,
|
|
||||||
metricsEnabled bool,
|
metricsEnabled bool,
|
||||||
eventRecorder events.EventRecorder,
|
eventRecorder events.EventRecorder,
|
||||||
) *PodEvictor {
|
) *PodEvictor {
|
||||||
nodePodCount := make(nodePodEvictedCount)
|
|
||||||
namespacePodCount := make(namespacePodEvictCount)
|
|
||||||
for _, node := range nodes {
|
|
||||||
// Initialize podsEvicted till now with 0.
|
|
||||||
nodePodCount[node.Name] = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
return &PodEvictor{
|
return &PodEvictor{
|
||||||
client: client,
|
client: client,
|
||||||
nodes: nodes,
|
|
||||||
policyGroupVersion: policyGroupVersion,
|
policyGroupVersion: policyGroupVersion,
|
||||||
dryRun: dryRun,
|
dryRun: dryRun,
|
||||||
maxPodsToEvictPerNode: maxPodsToEvictPerNode,
|
maxPodsToEvictPerNode: maxPodsToEvictPerNode,
|
||||||
maxPodsToEvictPerNamespace: maxPodsToEvictPerNamespace,
|
maxPodsToEvictPerNamespace: maxPodsToEvictPerNamespace,
|
||||||
nodepodCount: nodePodCount,
|
nodepodCount: make(nodePodEvictedCount),
|
||||||
namespacePodCount: namespacePodCount,
|
namespacePodCount: make(namespacePodEvictCount),
|
||||||
metricsEnabled: metricsEnabled,
|
metricsEnabled: metricsEnabled,
|
||||||
eventRecorder: eventRecorder,
|
eventRecorder: eventRecorder,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,12 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/client-go/kubernetes/fake"
|
"k8s.io/client-go/kubernetes/fake"
|
||||||
core "k8s.io/client-go/testing"
|
core "k8s.io/client-go/testing"
|
||||||
|
"k8s.io/client-go/tools/events"
|
||||||
|
utilpointer "k8s.io/utils/pointer"
|
||||||
podutil "sigs.k8s.io/descheduler/pkg/descheduler/pod"
|
podutil "sigs.k8s.io/descheduler/pkg/descheduler/pod"
|
||||||
"sigs.k8s.io/descheduler/pkg/utils"
|
"sigs.k8s.io/descheduler/pkg/utils"
|
||||||
"sigs.k8s.io/descheduler/test"
|
"sigs.k8s.io/descheduler/test"
|
||||||
@@ -113,3 +116,52 @@ func TestPodTypes(t *testing.T) {
|
|||||||
t.Errorf("Expected p1 to be a normal pod.")
|
t.Errorf("Expected p1 to be a normal pod.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewPodEvictor(t *testing.T) {
|
||||||
|
pod1 := test.BuildTestPod("pod", 400, 0, "node", nil)
|
||||||
|
|
||||||
|
fakeClient := fake.NewSimpleClientset(pod1)
|
||||||
|
|
||||||
|
eventRecorder := &events.FakeRecorder{}
|
||||||
|
|
||||||
|
podEvictor := NewPodEvictor(
|
||||||
|
fakeClient,
|
||||||
|
"policy/v1",
|
||||||
|
false,
|
||||||
|
utilpointer.Uint(1),
|
||||||
|
nil,
|
||||||
|
false,
|
||||||
|
eventRecorder,
|
||||||
|
)
|
||||||
|
|
||||||
|
stubNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "node"}}
|
||||||
|
|
||||||
|
// 0 evictions expected
|
||||||
|
if evictions := podEvictor.NodeEvicted(stubNode); evictions != 0 {
|
||||||
|
t.Errorf("Expected 0 node evictions, got %q instead", evictions)
|
||||||
|
}
|
||||||
|
// 0 evictions expected
|
||||||
|
if evictions := podEvictor.TotalEvicted(); evictions != 0 {
|
||||||
|
t.Errorf("Expected 0 total evictions, got %q instead", evictions)
|
||||||
|
}
|
||||||
|
|
||||||
|
if podEvictor.NodeLimitExceeded(stubNode) {
|
||||||
|
t.Errorf("Expected NodeLimitExceeded to return false, got true instead")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !podEvictor.EvictPod(context.TODO(), pod1, EvictOptions{}) {
|
||||||
|
t.Errorf("Expected a pod eviction, got no eviction instead")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 node eviction expected
|
||||||
|
if evictions := podEvictor.NodeEvicted(stubNode); evictions != 1 {
|
||||||
|
t.Errorf("Expected 1 node eviction, got %q instead", evictions)
|
||||||
|
}
|
||||||
|
// 1 total eviction expected
|
||||||
|
if evictions := podEvictor.TotalEvicted(); evictions != 1 {
|
||||||
|
t.Errorf("Expected 1 total evictions, got %q instead", evictions)
|
||||||
|
}
|
||||||
|
if !podEvictor.NodeLimitExceeded(stubNode) {
|
||||||
|
t.Errorf("Expected NodeLimitExceeded to return true, got false instead")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -490,7 +490,6 @@ func TestHighNodeUtilization(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
testCase.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
@@ -642,7 +641,6 @@ func TestHighNodeUtilizationWithTaints(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
&item.evictionsExpected,
|
&item.evictionsExpected,
|
||||||
nil,
|
nil,
|
||||||
item.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -892,7 +892,6 @@ func TestLowNodeUtilization(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
test.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
@@ -1064,7 +1063,6 @@ func TestLowNodeUtilizationWithTaints(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
&item.evictionsExpected,
|
&item.evictionsExpected,
|
||||||
nil,
|
nil,
|
||||||
item.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -562,7 +562,6 @@ func TestPodLifeTime(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
tc.maxPodsToEvictPerNode,
|
tc.maxPodsToEvictPerNode,
|
||||||
tc.maxPodsToEvictPerNamespace,
|
tc.maxPodsToEvictPerNamespace,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -319,7 +319,6 @@ func TestFindDuplicatePods(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
testCase.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
@@ -768,7 +767,6 @@ func TestRemoveDuplicatesUniformly(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
testCase.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -381,7 +381,6 @@ func TestRemoveFailedPods(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ func TestRemovePodsHavingTooManyRestarts(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
tc.maxPodsToEvictPerNode,
|
tc.maxPodsToEvictPerNode,
|
||||||
tc.maxNoOfPodsToEvictPerNamespace,
|
tc.maxNoOfPodsToEvictPerNamespace,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -239,7 +239,6 @@ func TestPodAntiAffinity(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
test.maxPodsToEvictPerNode,
|
test.maxPodsToEvictPerNode,
|
||||||
test.maxNoOfPodsToEvictPerNamespace,
|
test.maxNoOfPodsToEvictPerNamespace,
|
||||||
test.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -365,7 +365,6 @@ func TestRemovePodsViolatingNodeAffinity(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
tc.maxPodsToEvictPerNode,
|
tc.maxPodsToEvictPerNode,
|
||||||
tc.maxNoOfPodsToEvictPerNamespace,
|
tc.maxNoOfPodsToEvictPerNamespace,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -406,7 +406,6 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
tc.maxPodsToEvictPerNode,
|
tc.maxPodsToEvictPerNode,
|
||||||
tc.maxNoOfPodsToEvictPerNamespace,
|
tc.maxNoOfPodsToEvictPerNamespace,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1462,7 +1462,6 @@ func TestTopologySpreadConstraint(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
tc.nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ func TestProfileDescheduleBalanceExtensionPointsEviction(t *testing.T) {
|
|||||||
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
||||||
defer eventBroadcaster.Shutdown()
|
defer eventBroadcaster.Shutdown()
|
||||||
|
|
||||||
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, nodes, true, eventRecorder)
|
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, true, eventRecorder)
|
||||||
|
|
||||||
prfl, err := NewProfile(
|
prfl, err := NewProfile(
|
||||||
test.config,
|
test.config,
|
||||||
@@ -306,7 +306,6 @@ func TestProfileExtensionPoints(t *testing.T) {
|
|||||||
|
|
||||||
n1 := testutils.BuildTestNode("n1", 2000, 3000, 10, nil)
|
n1 := testutils.BuildTestNode("n1", 2000, 3000, 10, nil)
|
||||||
n2 := testutils.BuildTestNode("n2", 2000, 3000, 10, nil)
|
n2 := testutils.BuildTestNode("n2", 2000, 3000, 10, nil)
|
||||||
nodes := []*v1.Node{n1, n2}
|
|
||||||
|
|
||||||
p1 := testutils.BuildTestPod(fmt.Sprintf("pod_1_%s", n1.Name), 200, 0, n1.Name, nil)
|
p1 := testutils.BuildTestPod(fmt.Sprintf("pod_1_%s", n1.Name), 200, 0, n1.Name, nil)
|
||||||
p1.ObjectMeta.OwnerReferences = []metav1.OwnerReference{{}}
|
p1.ObjectMeta.OwnerReferences = []metav1.OwnerReference{{}}
|
||||||
@@ -393,7 +392,7 @@ func TestProfileExtensionPoints(t *testing.T) {
|
|||||||
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
||||||
defer eventBroadcaster.Shutdown()
|
defer eventBroadcaster.Shutdown()
|
||||||
|
|
||||||
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, nodes, true, eventRecorder)
|
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, true, eventRecorder)
|
||||||
|
|
||||||
prfl, err := NewProfile(
|
prfl, err := NewProfile(
|
||||||
api.DeschedulerProfile{
|
api.DeschedulerProfile{
|
||||||
@@ -605,7 +604,7 @@ func TestProfileExtensionPointOrdering(t *testing.T) {
|
|||||||
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
eventBroadcaster, eventRecorder := utils.GetRecorderAndBroadcaster(ctx, eventClient)
|
||||||
defer eventBroadcaster.Shutdown()
|
defer eventBroadcaster.Shutdown()
|
||||||
|
|
||||||
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, nodes, true, eventRecorder)
|
podEvictor := evictions.NewPodEvictor(client, "policy/v1", false, nil, nil, true, eventRecorder)
|
||||||
|
|
||||||
prfl, err := NewProfile(
|
prfl, err := NewProfile(
|
||||||
api.DeschedulerProfile{
|
api.DeschedulerProfile{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func TestRemoveDuplicates(t *testing.T) {
|
|||||||
t.Errorf("Error listing node with %v", err)
|
t.Errorf("Error listing node with %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
_, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
||||||
|
|
||||||
t.Log("Creating testing namespace")
|
t.Log("Creating testing namespace")
|
||||||
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
||||||
@@ -177,7 +177,6 @@ func TestRemoveDuplicates(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func TestFailedPods(t *testing.T) {
|
|||||||
defer jobClient.Delete(ctx, job.Name, metav1.DeleteOptions{PropagationPolicy: &deletePropagationPolicy})
|
defer jobClient.Delete(ctx, job.Name, metav1.DeleteOptions{PropagationPolicy: &deletePropagationPolicy})
|
||||||
waitForJobPodPhase(ctx, t, clientSet, job, v1.PodFailed)
|
waitForJobPodPhase(ctx, t, clientSet, job, v1.PodFailed)
|
||||||
|
|
||||||
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode, nodes)
|
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode)
|
||||||
|
|
||||||
defaultevictorArgs := &defaultevictor.DefaultEvictorArgs{
|
defaultevictorArgs := &defaultevictor.DefaultEvictorArgs{
|
||||||
EvictLocalStoragePods: true,
|
EvictLocalStoragePods: true,
|
||||||
|
|||||||
@@ -196,7 +196,6 @@ func runPodLifetimePlugin(
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
maxPodsToEvictPerNamespace,
|
maxPodsToEvictPerNamespace,
|
||||||
nodes,
|
|
||||||
false,
|
false,
|
||||||
&events.FakeRecorder{},
|
&events.FakeRecorder{},
|
||||||
)
|
)
|
||||||
@@ -285,7 +284,7 @@ func TestLowNodeUtilization(t *testing.T) {
|
|||||||
t.Errorf("Error listing node with %v", err)
|
t.Errorf("Error listing node with %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
_, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
||||||
|
|
||||||
t.Log("Creating testing namespace")
|
t.Log("Creating testing namespace")
|
||||||
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
||||||
@@ -374,7 +373,7 @@ func TestLowNodeUtilization(t *testing.T) {
|
|||||||
waitForRCPodsRunning(ctx, t, clientSet, rc)
|
waitForRCPodsRunning(ctx, t, clientSet, rc)
|
||||||
|
|
||||||
// Run LowNodeUtilization plugin
|
// Run LowNodeUtilization plugin
|
||||||
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode, nodes)
|
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode)
|
||||||
|
|
||||||
defaultevictorArgs := &defaultevictor.DefaultEvictorArgs{
|
defaultevictorArgs := &defaultevictor.DefaultEvictorArgs{
|
||||||
EvictLocalStoragePods: true,
|
EvictLocalStoragePods: true,
|
||||||
@@ -1570,7 +1569,7 @@ func splitNodesAndWorkerNodes(nodes []v1.Node) ([]*v1.Node, []*v1.Node) {
|
|||||||
return allNodes, workerNodes
|
return allNodes, workerNodes
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPodEvictorOrFail(t *testing.T, clientSet clientset.Interface, getPodsAssignedToNode podutil.GetPodsAssignedToNodeFunc, nodes []*v1.Node) *evictions.PodEvictor {
|
func initPodEvictorOrFail(t *testing.T, clientSet clientset.Interface, getPodsAssignedToNode podutil.GetPodsAssignedToNodeFunc) *evictions.PodEvictor {
|
||||||
evictionPolicyGroupVersion, err := eutils.SupportEviction(clientSet)
|
evictionPolicyGroupVersion, err := eutils.SupportEviction(clientSet)
|
||||||
if err != nil || len(evictionPolicyGroupVersion) == 0 {
|
if err != nil || len(evictionPolicyGroupVersion) == 0 {
|
||||||
t.Fatalf("Error creating eviction policy group: %v", err)
|
t.Fatalf("Error creating eviction policy group: %v", err)
|
||||||
@@ -1584,7 +1583,6 @@ func initPodEvictorOrFail(t *testing.T, clientSet clientset.Interface, getPodsAs
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func TestTooManyRestarts(t *testing.T) {
|
|||||||
t.Errorf("Error listing node with %v", err)
|
t.Errorf("Error listing node with %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
_, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
||||||
|
|
||||||
t.Logf("Creating testing namespace %v", t.Name())
|
t.Logf("Creating testing namespace %v", t.Name())
|
||||||
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
||||||
@@ -167,7 +167,6 @@ func TestTooManyRestarts(t *testing.T) {
|
|||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
nodes,
|
|
||||||
false,
|
false,
|
||||||
eventRecorder,
|
eventRecorder,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func TestTopologySpreadConstraint(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Error listing node with %v", err)
|
t.Errorf("Error listing node with %v", err)
|
||||||
}
|
}
|
||||||
nodes, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
_, workerNodes := splitNodesAndWorkerNodes(nodeList.Items)
|
||||||
t.Log("Creating testing namespace")
|
t.Log("Creating testing namespace")
|
||||||
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
testNamespace := &v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "e2e-" + strings.ToLower(t.Name())}}
|
||||||
if _, err := clientSet.CoreV1().Namespaces().Create(ctx, testNamespace, metav1.CreateOptions{}); err != nil {
|
if _, err := clientSet.CoreV1().Namespaces().Create(ctx, testNamespace, metav1.CreateOptions{}); err != nil {
|
||||||
@@ -138,7 +138,7 @@ func TestTopologySpreadConstraint(t *testing.T) {
|
|||||||
defer test.DeleteDeployment(ctx, t, clientSet, violatorDeployment)
|
defer test.DeleteDeployment(ctx, t, clientSet, violatorDeployment)
|
||||||
test.WaitForDeploymentPodsRunning(ctx, t, clientSet, violatorDeployment)
|
test.WaitForDeploymentPodsRunning(ctx, t, clientSet, violatorDeployment)
|
||||||
|
|
||||||
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode, nodes)
|
podEvictor := initPodEvictorOrFail(t, clientSet, getPodsAssignedToNode)
|
||||||
|
|
||||||
// Run TopologySpreadConstraint strategy
|
// Run TopologySpreadConstraint strategy
|
||||||
t.Logf("Running RemovePodsViolatingTopologySpreadConstraint strategy for %s", name)
|
t.Logf("Running RemovePodsViolatingTopologySpreadConstraint strategy for %s", name)
|
||||||
|
|||||||
Reference in New Issue
Block a user