mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Merge pull request #92545 from hasheddan/scheduling-part-two
Do not ignore unscheduled pods when NodeName not in set of worker nodes
This commit is contained in:
commit
18db08b813
@ -1045,8 +1045,7 @@ func translateIPv4ToIPv6(ip string) string {
|
|||||||
// GetPodsScheduled returns a number of currently scheduled and not scheduled Pods on worker nodes.
|
// GetPodsScheduled returns a number of currently scheduled and not scheduled Pods on worker nodes.
|
||||||
func GetPodsScheduled(workerNodes sets.String, pods *v1.PodList) (scheduledPods, notScheduledPods []v1.Pod) {
|
func GetPodsScheduled(workerNodes sets.String, pods *v1.PodList) (scheduledPods, notScheduledPods []v1.Pod) {
|
||||||
for _, pod := range pods.Items {
|
for _, pod := range pods.Items {
|
||||||
if workerNodes.Has(pod.Spec.NodeName) {
|
if pod.Spec.NodeName != "" && workerNodes.Has(pod.Spec.NodeName) {
|
||||||
if pod.Spec.NodeName != "" {
|
|
||||||
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
|
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
|
||||||
framework.ExpectEqual(scheduledCondition != nil, true)
|
framework.ExpectEqual(scheduledCondition != nil, true)
|
||||||
if scheduledCondition != nil {
|
if scheduledCondition != nil {
|
||||||
@ -1059,12 +1058,10 @@ func GetPodsScheduled(workerNodes sets.String, pods *v1.PodList) (scheduledPods,
|
|||||||
if scheduledCondition != nil {
|
if scheduledCondition != nil {
|
||||||
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionFalse)
|
framework.ExpectEqual(scheduledCondition.Status, v1.ConditionFalse)
|
||||||
if scheduledCondition.Reason == "Unschedulable" {
|
if scheduledCondition.Reason == "Unschedulable" {
|
||||||
|
|
||||||
notScheduledPods = append(notScheduledPods, pod)
|
notScheduledPods = append(notScheduledPods, pod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user