Graduate PodDisruptionConditions to stable

This commit is contained in:
Michal Wozniak
2024-06-13 09:34:56 +02:00
parent d40676c227
commit bf0c9885a4
17 changed files with 399 additions and 663 deletions

View File

@@ -1437,7 +1437,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().Obj()},
nodes: []string{"node1"},
nominatedNodeStatus: nil,
expected: false,
expected: true,
},
{
name: "Pod without nominated node",
@@ -1456,8 +1456,7 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
expected: false,
},
{
name: "victim Pods terminating, feature PodDisruptionConditions is enabled",
fts: feature.Features{EnablePodDisruptionConditions: true},
name: "victim Pods terminating",
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
@@ -1465,34 +1464,17 @@ func TestPodEligibleToPreemptOthers(t *testing.T) {
expected: false,
},
{
name: "non-victim Pods terminating, feature PodDisruptionConditions is enabled",
fts: feature.Features{EnablePodDisruptionConditions: true},
name: "non-victim Pods terminating",
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().Obj()},
nodes: []string{"node1"},
expected: true,
},
{
name: "victim Pods terminating, feature PodDisruptionConditions is disabled",
fts: feature.Features{EnablePodDisruptionConditions: false},
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().
Condition(v1.DisruptionTarget, v1.ConditionTrue, v1.PodReasonPreemptionByScheduler).Obj()},
nodes: []string{"node1"},
expected: false,
},
{
name: "non-victim Pods terminating, feature PodDisruptionConditions is disabled",
fts: feature.Features{EnablePodDisruptionConditions: false},
pod: st.MakePod().Name("p_with_nominated_node").UID("p").Priority(highPriority).NominatedNodeName("node1").Obj(),
pods: []*v1.Pod{st.MakePod().Name("p1").UID("p1").Priority(lowPriority).Node("node1").Terminating().Obj()},
nodes: []string{"node1"},
expected: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
test.fts.EnablePodDisruptionConditions = true
logger, ctx := ktesting.NewTestContext(t)
ctx, cancel := context.WithCancel(ctx)
defer cancel()