-
Notifications
You must be signed in to change notification settings - Fork 38.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
Promote kubelet graceful node shutdown to beta #99735
Promote kubelet graceful node shutdown to beta #99735
Conversation
/triage accepted |
/hold |
/priority important-soon |
/retest |
/lgtm |
/assign @thockin for api review (there's a few small changes) /assign @derekwaynecarr for approvals |
thanks for following up from slack /approve |
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.
I only looked at the apis part Seems OK
@@ -379,10 +379,10 @@ type KubeletConfiguration struct { | |||
// EnableSystemLogHandler enables /logs handler. | |||
EnableSystemLogHandler bool | |||
// ShutdownGracePeriod specifies the total duration that the node should delay the shutdown and total grace period for pod termination during a node shutdown. | |||
// Defaults to 30 seconds, requires GracefulNodeShutdown feature gate to be enabled. | |||
// Defaults to 0 seconds. |
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.
We're adding a new +featureGate=GracefulNodeShutdown
tag - if you put it here, later tooling will use it automatically.
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, I can add that.
Should the featureGate=GracefulNodeShutdown
tag be added here or in https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kubelet/config/v1beta1/types.go (where I see there's already existing tags like +optional
)?
@@ -252,4 +252,10 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura | |||
if obj.EnableDebugFlagsHandler == nil { | |||
obj.EnableDebugFlagsHandler = utilpointer.BoolPtr(true) | |||
} | |||
if obj.ShutdownGracePeriod == zeroDuration { | |||
obj.ShutdownGracePeriod = metav1.Duration{Duration: 0} |
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.
How is metav1.Duration{Duration: 0}
different from zeroDuration
? They seem identical to me?
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.
It should be the same, I just added it to be explicit that we actually want to the default value here (since all the existing kubelet config time duration fields compared against zeroDuration here and set the appropriate default).
So I think it can be dropped, but was thinking would be better to be explicit about the default. Let me know what you think.
The versioned files or both.
…On Fri, Mar 5, 2021 at 3:01 PM David Porter ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/kubelet/apis/config/types.go
<#99735 (comment)>
:
> @@ -379,10 +379,10 @@ type KubeletConfiguration struct {
// EnableSystemLogHandler enables /logs handler.
EnableSystemLogHandler bool
// ShutdownGracePeriod specifies the total duration that the node should delay the shutdown and total grace period for pod termination during a node shutdown.
- // Defaults to 30 seconds, requires GracefulNodeShutdown feature gate to be enabled.
+ // Defaults to 0 seconds.
thanks, I can add that.
Should the featureGate=GracefulNodeShutdown tag be added here or in
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/kubelet/config/v1beta1/types.go
(where there's I see there's already existing tags like +optional)?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#99735 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVDJ6KWCQWDG7FL2EBDTCFPC5ANCNFSM4YSC7VCQ>
.
|
It's just a smell to see `if x == 0 { x = 0 }` - like something went wrong
and forgot to get updated.
I'll approve - fix it or not at your leisure.
/approve
…On Fri, Mar 5, 2021 at 3:04 PM David Porter ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/kubelet/apis/config/v1beta1/defaults.go
<#99735 (comment)>
:
> @@ -252,4 +252,10 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
if obj.EnableDebugFlagsHandler == nil {
obj.EnableDebugFlagsHandler = utilpointer.BoolPtr(true)
}
+ if obj.ShutdownGracePeriod == zeroDuration {
+ obj.ShutdownGracePeriod = metav1.Duration{Duration: 0}
It should be the same, I just added it to be explicit that we actually
want to the default value here (since all the existing kubelet config time
duration fields compared against zeroDuration here and set the appropriate
default).
So I think it can be dropped, but was thinking would be better to be
explicit about the default.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#99735 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVC6HATGZDDCL3GFTLLTCFPQNANCNFSM4YSC7VCQ>
.
|
- Change the feature gate from alpha to beta and enable it by default - Update a few of the unit tests due to feature gate being enabled by default - Small refactor in `nodeshutdown_manager` which adds `featureEnabled` function (which checks that feature gate and that `kubeletConfig.ShutdownGracePeriod > 0`). - Use `featureEnabled()` to exit early from shutdown manager in the case that the feature is disabled - Update kubelet config defaulting to be explicit that `ShutdownGracePeriod` and `ShutdownGracePeriodCriticalPods` default to zero and update the godoc comments. - Update defaults and add featureGate tag in api config godoc. With this feature now in beta and the feature gate enabled by default, to enable graceful shutdown all that will be required is to configure `ShutdownGracePeriod` and `ShutdownGracePeriodCriticalPods` in the kubelet config. If not configured, they will be defaulted to zero, and graceful shutdown will effectively be disabled.
6e20f15
to
893f5fd
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bobbypage, derekwaynecarr, mrunalp, thockin, wzshiming 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 |
Updated PR by adding |
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
thanks all! /unhold |
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Promoting kubelet graceful node shutdown to beta.
nodeshutdown_manager
which addsfeatureEnabled
function (which checks that feature gate and thatkubeletConfig.ShutdownGracePeriod > 0
).featureEnabled()
to exit early from shutdown manager in the case that the feature is disabledShutdownGracePeriod
andShutdownGracePeriodCriticalPods
default to zero and update the godoc comments.With this feature now in beta and the feature gate enabled by default, to enable graceful shutdown all that will be required is to configure
ShutdownGracePeriod
andShutdownGracePeriodCriticalPods
in the kubelet config. If not configured, they will be defaulted to zero, and graceful shutdown will effectively be disabled.Which issue(s) this PR fixes:
Special notes for your reviewer:
Enhancement issue: kubernetes/enhancements#2000
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: