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 kubectl drain --timeout option when eviction is used #64378

Merged
merged 1 commit into from
Jun 20, 2018

Conversation

wrdls
Copy link
Contributor

@wrdls wrdls commented May 27, 2018

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:

Fix kubectl drain --timeout option when eviction is used.

@kubernetes/sig-cli-pr-reviews

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 27, 2018
@k8s-ci-robot
Copy link
Contributor

@wrdls: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cli-pr-reviews

In response to this:

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:

Fix kubectl drain --timeout option when eviction is used.

@kubernetes/sig-cli-pr-reviews

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 27, 2018
@k8s-ci-robot k8s-ci-robot requested review from dims and eparis May 27, 2018 18:44
@wrdls
Copy link
Contributor Author

wrdls commented May 28, 2018

/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:
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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.

@yue9944882
Copy link
Member

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 28, 2018
@yue9944882
Copy link
Member

@adohe Ping for approval :)

@wrdls
Copy link
Contributor Author

wrdls commented May 28, 2018

/test pull-kubernetes-e2e-gce-device-plugin-gpu

@mengqiy
Copy link
Member

mengqiy commented Jun 6, 2018

/lgtm
@wrdls Can you add a test for it?

@k8s-ci-robot
Copy link
Contributor

[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 /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 Jun 6, 2018
@dims
Copy link
Member

dims commented Jun 9, 2018

/unassign
/uncc

@k8s-ci-robot k8s-ci-robot removed the request for review from dims June 9, 2018 14:14
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@k8s-github-robot
Copy link

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.

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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants