-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Extender preemption should respect IsInterested() #66291
Conversation
Thanks for picking up 👍 |
/assign @bsalamat A preemption related minor fix, kindly ping for review. |
/lgtm |
Co-authored-by: Harry Zhang <resouer@gmail.com> Co-authored-by: Chun Chen <ramichen@tencent.com>
@@ -1349,7 +1373,7 @@ func TestPreempt(t *testing.T) { | |||
t.Errorf("unexpected error in preemption: %v", err) | |||
} | |||
if (node != nil && node.Name != test.expectedNode) || (node == nil && len(test.expectedNode) != 0) { | |||
t.Errorf("expected node: %v, got: %v", test.expectedNode, node) | |||
t.Errorf("expected node: %v, got: %v", test.expectedNode, node.GetName()) |
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.
Note for reviewers: logging out whole node object here seems too verbose.
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 agree.
cc @kubernetes/sig-scheduling-pr-reviews , any comments? |
/lgtm |
/cc @bsalamat |
@@ -282,7 +282,7 @@ func (g *genericScheduler) processPreemptionWithExtenders( | |||
) (map[*v1.Node]*schedulerapi.Victims, error) { | |||
if len(nodeToVictims) > 0 { | |||
for _, extender := range g.extenders { | |||
if extender.SupportsPreemption() { | |||
if extender.SupportsPreemption() && extender.IsInterested(pod) { |
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.
Here's a case in my mind: ext_1
interests pod_1
, ext_2
interests pod_2
, both pods can preempt pod_3
, pod_4
, pod_5
(priorities in order); if pod_3
and pod_5
on the same pod, scheduler may preempt pod_3
and pod_5
because of race condition, as the extender did not know pod's new status until get event from apiserver.
Did we discuss this case when introducing preemption extender?
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.
In "both pods can preempt pod_3, pod_4, pod_5 (priorities in order); if pod_3 and pod_5 on the same pod", what do you mean pods or pod here?
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.
Note that dup or re-preemption in this case is tolerable by system.
We did talk about information sync in extender side, for now, we left it for extender to handle as it will not break existing logic.
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.
we left it for extender to handle as it will not break existing logic.
Extender need to get Pod's latest status to "handle" it (e.g. nominatedNode and deleteTimestamp from apiserver), we can not make sure extender get the latest status when we schedule next pod. That's similar case that we introduced Bind
. Do we know who's the user of preemption extender? I'm ok to keep current behaviour if no user or the user accept that; as I'd like to keep it simple enough.
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.
In "both pods can preempt pod_3, pod_4, pod_5 (priorities in order); if pod_3 and pod_5 on the same pod", what do you mean pods or pod here?
@xiaoxubeii , pods is pod_1 and pod_2; pod should be node, typo :)
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.
cc @ravigadde for user input
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.
@resouer My experience has been with one extender only. Diff seems reasonable.
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.
/lgtm
Thanks, @resouer!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, resouer, xiaoxubeii, yastij 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Extender preemption should respect IsInterested()
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #66289
Special notes for your reviewer:
The bug is reported and the first commit is co-authored by: @chenchun
Release note: