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

the scheduling queue logs the error and treats it as QueueAfterBackoff #119290

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

carlory
Copy link
Member

@carlory carlory commented Jul 13, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

See #119155 (comment)

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

QueueingHint got error in its returning value. If QueueingHint returns error, the scheduler logs the error and treats the event as QueueAfterBackoff so that the Pod wouldn't be stuck in the unschedulable pod pool.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 13, 2023
Copy link
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

Thanks for a prompt action!

pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue_test.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue_test.go Outdated Show resolved Hide resolved
@sanposhiho
Copy link
Member

/assign

@carlory
Copy link
Member Author

carlory commented Jul 13, 2023

@sanposhiho updated.

pkg/scheduler/framework/types.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
pkg/scheduler/internal/queue/scheduling_queue.go Outdated Show resolved Hide resolved
@carlory carlory force-pushed the add-logger branch 3 times, most recently from fcfad44 to 080dfa0 Compare July 14, 2023 02:22
@carlory
Copy link
Member Author

carlory commented Jul 14, 2023

@sanposhiho I pushed some changes. please review again.

//
// - `pod`: the Pod to be enqueued, which is rejected by this plugin in the past.
// - `oldObj` `newObj`: the object involved in that event.
// - For example, the given event is "Node deleted", the `oldObj` will be that deleted Node.
// - `oldObj` is nil if the event is add event.
// - `newObj` is nil if the event is delete event.
type QueueingHintFn func(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{}) QueueingHint
type QueueingHintFn func(logger klog.Logger, pod *v1.Pod, oldObj, newObj interface{}) (QueueingHint, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

since breaking api anyway, we can add ctx as a parameter, since almost everything in the framework accepts one (except this and one other place I noticed)

Copy link
Member Author

Choose a reason for hiding this comment

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

cc @sanposhiho what do you think?

There's some discuss about logger and ctx. #119155 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, maybe Aldo missed my followup question on ctx in the original thread. Let me follow up again in the original PR.

I'd like to make this PR's scope only change for error. We can easily have another change for ctx if we conclude we have.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

tiny nits only. will /lgtm after them

/approve

@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 14, 2023
@carlory carlory force-pushed the add-logger branch 2 times, most recently from b9dd8b7 to 7fd4897 Compare July 16, 2023 13:01
@carlory
Copy link
Member Author

carlory commented Aug 7, 2023

/test pull-kubernetes-e2e-gce

@@ -813,6 +813,54 @@ func Test_buildQueueingHintMap(t *testing.T) {
},
},
},
{
name: "node and pod plugin (QueueingHintFn returns error)",
Copy link
Member

Choose a reason for hiding this comment

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

Why is this test case needed?
Test_buildQueueingHintMap is literary to test buildQueueingHintMap function, and the returning value from QueueingHintFn is completely not related to this test.

Copy link
Member

Choose a reason for hiding this comment

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

The reason we're comparing the result like this is Golang cannot compare the function is the same.
So, we change the result coming from QueueingHintFn in every fake plugin and check registered functions are expected ones by checking the result from QueueingHint

if fn.QueueingHintFn(logger, nil, nil, nil) != wantfns[i].QueueingHintFn(logger, nil, nil, nil) {

Copy link
Member

Choose a reason for hiding this comment

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

Then no need to compare QueueingHintFn also, because pluginName tells everything.

Comment on lines -170 to +169
func As[T runtime.Object](oldObj, newobj interface{}) (T, T, error) {
func As[T any](oldObj, newobj interface{}) (T, T, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's add one unit test case to confirm we can convert objects to klog.KMetadata

Copy link
Member Author

Choose a reason for hiding this comment

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

@sanposhiho added.

@carlory carlory force-pushed the add-logger branch 5 times, most recently from 3b88220 to 6eefacb Compare September 20, 2023 09:23
…nd treats it as QueueAfterBackoff.

Co-authored-by: Kensei Nakada <[email protected]>

Co-authored-by: Kante Yin <[email protected]>

Co-authored-by: XsWack <[email protected]>
Copy link
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

Perfect, thanks for a long journey here!

/lgtm
/hold

Please add the release note. (someone may already be using the queueing hint in out-of-tree plugins) Once done, I'll /approve.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Sep 22, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 38fb9f9ee3a9accb042704f26130e4207475ed32

@sanposhiho
Copy link
Member

/release-note-edit release-note QueueingHint's function got `error` in returning value. If QueueingHint returns error, the scheduler logs the error and treats the event as QueueAfterBackoff so that the Pod wouldn't be stuck in the unschedulable pod pool.

@sanposhiho
Copy link
Member

/release-note-edit

QueueingHint got error in its returning value. If QueueingHint returns error, the scheduler logs the error and treats the event as QueueAfterBackoff so that the Pod wouldn't be stuck in the unschedulable pod pool.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 22, 2023
Copy link
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

It works.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carlory, 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 /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 Sep 22, 2023
@sanposhiho
Copy link
Member

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 22, 2023
@k8s-ci-robot k8s-ci-robot merged commit 3ac83f5 into kubernetes:master Sep 22, 2023
18 checks passed
SIG Node PR Triage automation moved this from Needs Reviewer to Done Sep 22, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Sep 22, 2023
@carlory carlory deleted the add-logger branch September 22, 2023 18:21
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. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

7 participants