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

StatefulSet: fix kube-controller-manager panic due to StatefulSetPersistentVolumeClaimRetentionPolicy being nil #113358

Merged

Conversation

mengjiao-liu
Copy link
Member

@mengjiao-liu mengjiao-liu commented Oct 26, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

When we start the feature gate only in kube-controller-manager (actually need to start this feature gate in kube-apiserver too, but maybe haven't started or forgot), kube-controller-manager shouldn't cause a panic.
#113319 (comment)

Fix a bug that causes the kube-controller-manager component to panic when the value of StatefulSetPersistentVolumeClaimRetentionPolicy is nil.

Which issue(s) this PR fixes:

Fixes #113319

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. 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. labels Oct 26, 2022
@mengjiao-liu
Copy link
Member Author

/sig apps

@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 26, 2022
Copy link
Contributor

@ialidzhikov ialidzhikov left a comment

Choose a reason for hiding this comment

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

@mengjiao-liu can you add an unit test to prevent regressing in the future?

@ialidzhikov
Copy link
Contributor

/assign @mattcary

@mattcary
Copy link
Contributor

That looks to be all the bare references to the policy, so this should fix the update problem.

I'm not sure of how to add a unit test for covering a cluster update across the feature gate being enabled. Maybe change runTestOverPVCRetentionPolicies to add a case with a nil policy?

@mengjiao-liu
Copy link
Member Author

mengjiao-liu commented Oct 27, 2022

@mengjiao-liu can you add an unit test to prevent regressing in the future?

Okay. I've added this case that StatefulSetPersistentVolumeClaimRetentionPolicy is nil in the runTestOverPVCRetentionPolicies to test.

@mengjiao-liu mengjiao-liu changed the title StatefulSet: fix the issue where StatefulSetPersistentVolumeClaimRetentionPolicy is nil StatefulSet: fix kube-controller-manager panic due to StatefulSetPersistentVolumeClaimRetentionPolicy being nil Oct 27, 2022
@mattcary
Copy link
Contributor

Okay. I've added this case that StatefulSetPersistentVolumeClaimRetentionPolicy is nil in the runTestOverPVCRetentionPolicies to test.

Thanks! A minor nit then I think this is good to go.

@mattcary
Copy link
Contributor

/lgtm

/priority now

We'll need someone to improve this.

@k8s-ci-robot
Copy link
Contributor

@mattcary: The label(s) priority/now cannot be applied, because the repository doesn't have them.

In response to this:

/lgtm

/priority now

We'll need someone to improve this.

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.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2022
@mattcary
Copy link
Contributor

/priority important-now

@k8s-ci-robot
Copy link
Contributor

@mattcary: The label(s) priority/important-now cannot be applied, because the repository doesn't have them.

In response to this:

/priority important-now

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.

@mattcary
Copy link
Contributor

/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Oct 27, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Oct 27, 2022
@mengjiao-liu
Copy link
Member Author

Please take a look.@janetkuo @soltysh @smarterclayton

@mengjiao-liu
Copy link
Member Author

/priority important-soon

@k8s-ci-robot k8s-ci-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Nov 1, 2022
@smarterclayton
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mengjiao-liu, smarterclayton

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 Nov 1, 2022
@dims
Copy link
Member

dims commented Nov 1, 2022

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 1, 2022
@k8s-ci-robot k8s-ci-robot merged commit 9b5fa57 into kubernetes:master Nov 1, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Nov 1, 2022
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. 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/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
6 participants