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

Fix panic when kubelet register if a node object already exists with no Status.Capacity or Status.Allocatable #95269

Merged
merged 1 commit into from Dec 9, 2020

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Oct 3, 2020

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

fix the panic when kubelet registers if a node object already exists with no Status.Capacity or Status.Allocatable

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. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. labels Oct 3, 2020
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 3, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Oct 3, 2020

/sig node

Copy link
Member

@odinuge odinuge left a 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

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 3, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 3, 2020
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 3, 2020
@@ -129,6 +129,24 @@ func (kl *Kubelet) reconcileHugePageResource(initialNode, existingNode *v1.Node)
requiresUpdate := false
supportedHugePageResources := sets.String{}

if existingNode.Status.Capacity == nil {
Copy link
Contributor

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@SataQiu
Copy link
Member Author

SataQiu commented Oct 9, 2020

/assign @derekwaynecarr

@SataQiu
Copy link
Member Author

SataQiu commented Oct 13, 2020

/triage accepted
/priority important-soon

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 13, 2020
@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 Nov 4, 2020
@SataQiu
Copy link
Member Author

SataQiu commented Nov 4, 2020

Hey @thockin!

I am ok with merging this no relnote, so feel free to unhold. Tho., in my experience the patch release managers prefer to have relnotes when backporting, to actually show what changes (and therefore it is nice to have it here as well).

/lgtm

@odinuge Thanks for your reminding. I have added a release note. If you have a better one, please feel free to feedback.

@odinuge
Copy link
Member

odinuge commented Nov 4, 2020

Nice @SataQiu!

/hold cancel

@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 Nov 4, 2020
needsUpdate bool
}{
{
name: "no update needed when capacity and available of the existing node are not nil",
Copy link
Member

@bobbypage bobbypage Nov 4, 2020

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

Copy link
Member Author

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.

@bobbypage
Copy link
Member

/lgtm

Thanks for the fix! Have you thought about also proposing cherrypicking this to 1.19?

@NicolasT
Copy link
Contributor

NicolasT commented Nov 4, 2020

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>
@SataQiu
Copy link
Member Author

SataQiu commented Nov 6, 2020

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

A PR for release-1.19 has been filed. (#96297)

@bobbypage
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 20, 2020
@NicolasT
Copy link
Contributor

/assign @dchen1107

@derekwaynecarr
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[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 /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 Dec 1, 2020
@justaugustus justaugustus added this to the v1.21 milestone Dec 1, 2020
@k8s-ci-robot k8s-ci-robot merged commit e40cba5 into kubernetes:master Dec 9, 2020
k8s-ci-robot added a commit that referenced this pull request Dec 16, 2020
cherry pick of #95269: fix the panic when kubelet registers if a node object already exists with no Status.Capacity or Status.Allocatable
k8s-ci-robot added a commit that referenced this pull request Feb 2, 2021
…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
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/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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. 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
None yet
Development

Successfully merging this pull request may close these issues.

Kubelet register fail if a node object already exists with no "Status.Capacity"