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
kubelet: Add GracefulNodeShutdownPodPolicy config option to graceful node shutdown #108941
Conversation
201bf28
to
2bf4242
Compare
2bf4242
to
19e97d1
Compare
19e97d1
to
4287dbd
Compare
/test pull-kubernetes-node-kubelet-serial-containerd |
1 similar comment
/test pull-kubernetes-node-kubelet-serial-containerd |
Some api doc comments |
Add a new kubelet config option, GracefulNodeShutdownPodPolicy to control policy of how pod termination is handled during graceful shutdown. The two options are `SetTerminal` or `LeaveRunning`. The default is `SetTerminal` whill place set pod phase to terminal when the node gracefully shuts down (which is the current default behavior). The other policy type, `LeaveRunning`, will not change the pod phase during graceful shutdown. Also run `make generated_files` to regen api files after kubelet configuration update. Signed-off-by: David Porter <david@porter.me>
Add validation which checks that GracefulNodeShutdownPodPolicy is set to a expected value which is currently only `SetTerminal` or `LeaveRunning`. Also update the kubelet config validation unit tests. Signed-off-by: David Porter <david@porter.me>
Pass the config option from the kubelet config to the graceful node shutdown manager, and only update phase if the option is enabled. Signed-off-by: David Porter <david@porter.me>
Refactor the existing test to ensure we can test two scenarios, of `SetTerminal` or `LeaveRunning` which are two possible GracefulNodeShutdownPodPolicy policy types. Modify the check `isPodShutdown` to pass `expectPhaseToBeFailed` and only check phase if the option is enabled. Signed-off-by: David Porter <david@porter.me>
f48c4f3
to
3f1d465
Compare
@bobbypage: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
@bobbypage: PR needs rebase. 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. |
/cc @wzshiming |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Are we still targeting this for 1.25? |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to 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. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Graceful node shutdown currently places pods into terminal phase upon shutdown. As discussed in #104531 (comment) and #104531 (comment) some users/distributions would benefit from the ability to toggle this behavior and instead to not put pods into terminal phase on shutdown.
For example, if it's expected that after shutdown the node will reboot, it may be desirable to not place the pods into terminal phase, so that way after reboot the pods will start running again after the node comes back up.
This PR adds a new kubelet configuration option to toggle this behavior
GracefulNodeShutdownPodPolicy
. The default setting ofGracefulNodeShutdownPodPolicy
is enabledSetTerminal
(which matches current behavior since 1.20) when graceful node shutdown was introduced.Which issue(s) this PR fixes:
Fixes #108991
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: