Skip to content

Commit 18db08b

Browse files
authored
Merge pull request kubernetes#92545 from hasheddan/scheduling-part-two
Do not ignore unscheduled pods when NodeName not in set of worker nodes
2 parents e9bb71c + 9ab31af commit 18db08b

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

test/e2e/scheduling/predicates.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,23 +1045,20 @@ func translateIPv4ToIPv6(ip string) string {
10451045
// GetPodsScheduled returns a number of currently scheduled and not scheduled Pods on worker nodes.
10461046
func GetPodsScheduled(workerNodes sets.String, pods *v1.PodList) (scheduledPods, notScheduledPods []v1.Pod) {
10471047
for _, pod := range pods.Items {
1048-
if workerNodes.Has(pod.Spec.NodeName) {
1049-
if pod.Spec.NodeName != "" {
1050-
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
1051-
framework.ExpectEqual(scheduledCondition != nil, true)
1052-
if scheduledCondition != nil {
1053-
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionTrue)
1054-
scheduledPods = append(scheduledPods, pod)
1055-
}
1056-
} else {
1057-
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
1058-
framework.ExpectEqual(scheduledCondition != nil, true)
1059-
if scheduledCondition != nil {
1060-
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionFalse)
1061-
if scheduledCondition.Reason == "Unschedulable" {
1062-
1063-
notScheduledPods = append(notScheduledPods, pod)
1064-
}
1048+
if pod.Spec.NodeName != "" && workerNodes.Has(pod.Spec.NodeName) {
1049+
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
1050+
framework.ExpectEqual(scheduledCondition != nil, true)
1051+
if scheduledCondition != nil {
1052+
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionTrue)
1053+
scheduledPods = append(scheduledPods, pod)
1054+
}
1055+
} else {
1056+
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
1057+
framework.ExpectEqual(scheduledCondition != nil, true)
1058+
if scheduledCondition != nil {
1059+
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionFalse)
1060+
if scheduledCondition.Reason == "Unschedulable" {
1061+
notScheduledPods = append(notScheduledPods, pod)
10651062
}
10661063
}
10671064
}

0 commit comments

Comments
 (0)