Do not raise exception if unscheduled Pod status is unknown

Currently when checking for unscheduled pods an exception will be raised
if a pod is not scheduled and the status is unknown. This update modifies
the logic to include any pod without a NodeName in the not scheduled
pods returned.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
This commit is contained in:
hasheddan 2020-06-29 07:11:04 -05:00
parent 1cbda2493d
commit 5f904f5e79
No known key found for this signature in database
GPG Key ID: BD68BC686A14C271

View File

@ -1052,15 +1052,8 @@ func GetPodsScheduled(workerNodes sets.String, pods *v1.PodList) (scheduledPods,
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionTrue)
scheduledPods = append(scheduledPods, pod)
}
} else {
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
framework.ExpectEqual(scheduledCondition != nil, true)
if scheduledCondition != nil {
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionFalse)
if scheduledCondition.Reason == "Unschedulable" {
notScheduledPods = append(notScheduledPods, pod)
}
}
} else if pod.Spec.NodeName == "" {
notScheduledPods = append(notScheduledPods, pod)
}
}
return