-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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 kubectl drain --timeout option when eviction is used #64378
Conversation
@wrdls: Reiterating the mentions to trigger a notification: 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. |
/assign @mengqiy |
@@ -619,7 +620,7 @@ func (o *DrainOptions) evictPods(pods []corev1.Pod, policyGroupVersion string, g | |||
if doneCount == len(pods) { | |||
return nil | |||
} | |||
case <-time.After(globalTimeout): | |||
case <-globalTimeoutCh: |
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.
Does it make any difference with the previous implementation?
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.
Yes, in the previous implementation it's basically a timeout per pod.
Run the following code locally and notice it never ends because the timer gets reset on each for loop iteration: https://play.golang.org/p/uq1I8nLx5Af
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.
The length of time to wait before giving up, zero means infinite
Umm, yes. The timeout here refreshes every time when a pod is successfully evicted which is inconsistent with the docs.
/ok-to-test |
@adohe Ping for approval :) |
/test pull-kubernetes-e2e-gce-device-plugin-gpu |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mengqiy, wrdls, yue9944882 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 |
/unassign |
/retest Review the full test history for this PR. Silence the bot with an |
Automatic merge from submit-queue (batch tested with PRs 64252, 64307, 64163, 64378, 64179). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
Timeout option of kubectl drain command is currently broken when using eviction to delete pods.
A new timer is made on each for loop iteration which means it gets reset each time a pod is evicted.
Release note:
@kubernetes/sig-cli-pr-reviews