Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not ignore unscheduled pods when NodeName not in set of worker nodes #92545

Merged
merged 1 commit into from
Jun 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 14 additions & 17 deletions test/e2e/scheduling/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -1045,23 +1045,20 @@ func translateIPv4ToIPv6(ip string) string {
// 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) {
for _, pod := range pods.Items {
if workerNodes.Has(pod.Spec.NodeName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously this was if !masterNodes.Has(pod.Spec.NodeName) so this isn't fully going back to the same functionality. The check for unscheduled nodes could consider master nodes in this case, but from my understanding of this check that would be fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very reasonable change for me.
Why we checked the NodeName is in names of workerNodes before checking the NodeName is empty (^^;)

if pod.Spec.NodeName != "" {
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
framework.ExpectEqual(scheduledCondition != nil, true)
if scheduledCondition != nil {
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)
}
if pod.Spec.NodeName != "" && workerNodes.Has(pod.Spec.NodeName) {
_, scheduledCondition := podutil.GetPodCondition(&pod.Status, v1.PodScheduled)
framework.ExpectEqual(scheduledCondition != nil, true)
if scheduledCondition != nil {
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)
}
}
}
Expand Down