-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
fix(scheduling_queue): always put Pods with no unschedulable plugins into activeQ/backoffQ #119105
Conversation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold To involve other approvers. /cc @alculquicondor |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sanposhiho The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to reproduce the potential bug, and then verify the fix does work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, I'll work on that this weekend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added TestRequeueByPermitRejection.
Please check out sanposhiho@e0cd7a0.
You can see a failed test result where I run the same test in the master branch.
Also, what if there was no event, but the failure was an apiserver failure? In this case, the pod should enter the active queue or backoff, but not the unschedulable queue. |
@alculquicondor I think that's a good point and could be another blocker of the removal of the flush because Pods, rejected due to the kube-apiserver failure, would stuck in unschedQ in a worst case if we didn't have a flush. But, I'd say that's kind of difficult from the scheduler side to know whether the error is coming from the kube-apiserver unstable or not.. Because, in the first place, the scheduler cannot know which plugin in which extension point communicates with kube-apiserver. |
I don't think we need to make it specific to apiserver errors, but errors in general (as opposed to "Unschedulable(AndUnResolvable)" statuses). |
Sounds good. Let me have an issue for this. |
why not fix in this PR, as it's highly related? |
Sure, will do after I'm back to the normal days - this Friday. /unhold |
======= | ||
logger.V(5).Info("Pod moved to an internal scheduling queue", "pod", klog.KObj(pod), "event", ScheduleAttemptFailure, "queue", queue, "schedulingCycle", podSchedulingCycle) | ||
>>>>>>> dc313b9f0b9 (always put Pods with no unschedulable plugins into activeQ/backoffQ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, that's already fixed in the latest commit. I'll squash commits when doing rebase. 🙏
oh, this is the PR I was thinking of yesterday, @pohly |
d147da1
to
b211bfa
Compare
b211bfa
to
c878dd2
Compare
c878dd2
to
4890598
Compare
@@ -3180,3 +3203,11 @@ func Test_isPodWorthRequeuing(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func mustAddUnschedulableIfNotPresent(t *testing.T, q *PriorityQueue, logger klog.Logger, pInfo *framework.QueuedPodInfo, podSchedulingCycle int64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid ↓ in all places in pull-kubernetes-linter-hints
.
ERROR: pkg/scheduler/internal/queue/scheduling_queue_test.go:1559:32: Error return value of `q.AddUnschedulableIfNotPresent` is not checked (errcheck)
ERROR: q.AddUnschedulableIfNotPresent(logger, q.newQueuedPodInfo(highPriorityPodInfo.Pod, "plugin"), q.SchedulingCycle())
@Huang-Wei @alculquicondor rebase done. 🙏 |
@@ -1325,31 +1333,44 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueue(t *testing.T) { | |||
if p, err := q.Pop(); err != nil || p.Pod != hpp1 { | |||
t.Errorf("Expected: %v after Pop, but got: %v", hpp1, p.Pod.Name) | |||
} | |||
unschedulableQueuedPodInfo := q.newQueuedPodInfo(unschedulablePodInfo.Pod, "fooPlugin") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire test is too hard to read (anyone reading has to keep a mental state of all that happened in the previous steps). I wonder if it can be split into different test cases that target specific transitions.
But that would be for a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I'd like to do that refactor in a follow-up PR.
I guess somehow we can just merge this test and TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithQueueingHint
.
@alculquicondor fixed in 9932089. |
/lgtm |
LGTM label has been added. Git tree hash: 81c9e753437a35019829cbae8a63a9804f897307
|
…into activeQ/backoffQ (kubernetes#119105) * always put Pods with no unschedulable plugins into activeQ/backoffQ * address review comments
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR changes how the scheduling queue regards the scheduling failure.
We sometimes put the Pod back to the queue with the unschedulable plugins, and sometimes we don't.
The difference between these two cases is that the former is the rejection from the plugin, and the latter is the error from the plugin (or the scheduler, which shouldn't happen unless the scheduler has bugs).
More specifically, when the Pod is rejected in PreFilter, Filter, Reserve or Permit, the scheduler attached the failed plugin name to the Pod and put it back to the queue. And, when the Pod is rejected in another extension point (like Bind etc) which is probably because of the kube-apiserver failure (or the bug in the plugin impl), the scheduler put the pod to the queue without any plugin names.
In cases of the latter, it's more likely unexpected rejection and maybe it won't be resolved by cluster events.
This PR changes the scheduling queue to always put Pods without the failed plugins into activeQ/backoffQ so that we can prevent such Pods stuck in unschedQ forever.
Which issue(s) this PR fixes:
Ref: #118438 (comment)
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: