-
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 default scheduler crash if scheduler extender filter returns a not found node #79641
Conversation
Hi @yqwang-ms. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/assign @ravisantoshgudimetla |
/assign |
/retest |
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
Could you please help squash the commits?
I am not authorized to merge this pull request, @hex108 could you please help to click the "squash and merge" button? Such as |
You could squash the commits in your local machine and force push it to remote. |
053807a
to
d7a8a7f
Compare
Thanks for the info, @hex108 ,I have force pushed, please check :) |
/retest |
/lgtm Thanks! |
Hi @Huang-Wei @k82cn could you please take a look at this small fix? Thanks! |
Hi @hex108, I am not familar with the K8S PR process, could you please tell me what should I do to continue push this PR to approve? |
Wait for one of the approvers for approve. :) |
Great! Thanks! |
Hi @Huang-Wei @k82cn could you please take a look at this small fix when you free? :) |
/assign @k82cn |
/assign @Huang-Wei |
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.
Apologies for the late reply. Some comments below.
pkg/scheduler/core/extender.go
Outdated
nodeResult = append(nodeResult, nodeNameToInfo[(*result.NodeNames)[i]].Node()) | ||
for _, nodeName := range *result.NodeNames { | ||
if node, ok := nodeNameToInfo[nodeName]; ok { | ||
nodeResult = append(nodeResult, node.Node()) |
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.
With this PR, len(nodeResult)
is not necessarily the same as len(*result.NodeNames)
, so it'd good to change L303 to nodeResult = make([]*v1.Node)
.
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.
Thanks for your review. :)
For this comment, do you mean change to nodeResult = make([]*v1.Node, 0)
, however, len(nodeResult)
is expected to be the same as len(*result.NodeNames)
, and in common cases, it is. Otherwise, it is a rare "exception", and we already returned an error for this.
So, to optimize for most common cases, we would better to still make a slice with an expect capacity for the following fast appending.
Is that ok?
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.
For this comment, do you mean change to nodeResult = make([]*v1.Node, 0)
Yes, if the length is not fixed.
According to your comments that the length is fixed, and we return error upon mismatch. Technically we should do nodeResult = make([]*v1.Node, len(*result.NodeNames))
to ensure len
and cap
inside the slice are the same, and use nodeResult[i] = node.Node()
. (I recalled that I did a test and it showed a perf improvement).
Can you update the code, as well as L305 to L310, and make them squashed into one commit?
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.
Thanks! Adjusted according to your suggestion, as well as L311 to L314, pls check
/retest |
1 similar comment
/retest |
8602e85
to
5927ec4
Compare
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei, yqwang-ms 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 |
/retest |
What type of PR is this?
/kind bug
What this PR does / why we need it:
See issue #79640
Which issue(s) this PR fixes:
Fixes #79640
Special notes for your reviewer:
In future, we may should further improve the default scheduler tolerance to scheduler extender.
Does this PR introduce a user-facing change?: