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

Extender preemption should respect IsInterested() #66291

Merged
merged 1 commit into from
Jul 24, 2018

Conversation

resouer
Copy link
Contributor

@resouer resouer commented Jul 17, 2018

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:

Extender preemption should respect IsInterested()

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. labels Jul 17, 2018
@chenchun
Copy link
Contributor

Thanks for picking up 👍

@resouer
Copy link
Contributor Author

resouer commented Jul 18, 2018

/assign @bsalamat

A preemption related minor fix, kindly ping for review.

@xiaoxubeii
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 18, 2018
Co-authored-by: Harry Zhang <resouer@gmail.com>
Co-authored-by: Chun Chen <ramichen@tencent.com>
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 23, 2018
@@ -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())
Copy link
Contributor Author

@resouer resouer Jul 23, 2018

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.

Copy link
Member

Choose a reason for hiding this comment

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

I agree.

@resouer
Copy link
Contributor Author

resouer commented Jul 23, 2018

cc @kubernetes/sig-scheduling-pr-reviews , any comments?

@yastij
Copy link
Member

yastij commented Jul 23, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 23, 2018
@yastij
Copy link
Member

yastij commented Jul 23, 2018

/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) {
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

@resouer resouer Jul 24, 2018

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.

Copy link
Member

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.

Copy link
Member

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 :)

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Member

@bsalamat bsalamat left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks, @resouer!

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 2119d34 into kubernetes:master Jul 24, 2018
@resouer resouer deleted the fix-extender branch July 25, 2018 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scheduler extender preemption should respect IsInterested()
9 participants