-
Notifications
You must be signed in to change notification settings - Fork 39.9k
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 panic when kubelet register if a node object already exists with no Status.Capacity or Status.Allocatable #95269
Conversation
/sig 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.
/lgtm
/retest
This should have a proper changelog entry, and should be backported to previous releases.
/hold
edd436a
to
c3f107f
Compare
c3f107f
to
57d2cbd
Compare
pkg/kubelet/kubelet_node_status.go
Outdated
@@ -129,6 +129,24 @@ func (kl *Kubelet) reconcileHugePageResource(initialNode, existingNode *v1.Node) | |||
requiresUpdate := false | |||
supportedHugePageResources := sets.String{} | |||
|
|||
if existingNode.Status.Capacity == nil { |
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.
Could consider factoring out this code (and the block below) which would allow for some extra unit-tests.
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.
Thank you for your review @NicolasT . Is there any more detailed reconstruction plan?
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.
Not sure I understand the question? You basically have two (+-) 12-line code blocks that are roughly the same, parametrized over two Node
objects, 'returning' (so to say) some bool
. Sounds like a good opportunity to turn that functionality into a function which then you call twice, and for which some unit-test(s) can be written.
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.
Sounds good!
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.
Done!
/assign @derekwaynecarr |
57d2cbd
to
6776a9d
Compare
/triage accepted |
@odinuge Thanks for your reminding. I have added a release note. If you have a better one, please feel free to feedback. |
Nice @SataQiu! /hold cancel |
needsUpdate bool | ||
}{ | ||
{ | ||
name: "no update needed when capacity and available of the existing node are not nil", |
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.
nit s/available/allocatable in name here and rest of test cases
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 a lot @bobbypage ! The nit has been fixed.
/lgtm Thanks for the fix! Have you thought about also proposing cherrypicking this to 1.19? |
Such backport would be appreciated: next to our original report, where we discovered the issue in 1.19 (essentially making 1.19 incompatible with our deployment mechanism), there appears to be more interest (#95188 (comment)). |
…with no Status.Capacity or Status.Allocatable Signed-off-by: SataQiu <1527062125@qq.com>
6776a9d
to
c73ea0a
Compare
A PR for release-1.19 has been filed. (#96297) |
/lgtm |
/assign @dchen1107 |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: derekwaynecarr, NicolasT, odinuge, SataQiu, TeddyAndrieux 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 |
cherry pick of #95269: fix the panic when kubelet registers if a node object already exists with no Status.Capacity or Status.Allocatable
…c-1.20 cherry pick of #95269: fix the panic when kubelet registers if a node object already exists with no Status.Capacity or Status.Allocatable
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fix panic when kubelet register if a node object already exists with no Status.Capacity or Status.Allocatable
Which issue(s) this PR fixes:
Fixes #95188
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: