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

Finished pods can be drained #31763

Merged
merged 1 commit into from
Sep 28, 2016

Conversation

fraenkel
Copy link
Contributor

@fraenkel fraenkel commented Aug 31, 2016

fixes #26080


This change is Reviewable

Kubectl drain will now drain finished Pods

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

8 similar comments
@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-bot
Copy link

k8s-bot commented Aug 31, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message will repeat several times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-label-needed labels Aug 31, 2016
@adohe-zz
Copy link

Generally lgtm.

@adohe-zz
Copy link

pkg/kubectl/cmd/drain.go, line 350 [r1] (raw file):

      if pod.Status.Phase == api.PodSucceeded || pod.Status.Phase == api.PodFailed {
          continue
      }

it would be better to draw some comments here.


Comments from Reviewable

@fraenkel
Copy link
Contributor Author

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.


pkg/kubectl/cmd/drain.go, line 350 [r1] (raw file):

 
podOk := true
for _, filt := range []podFilter{mirrorPodFilter, o.localStorageFilter, o.unreplicatedFilter, o.daemonsetFilter} {
filterOk, w, f := filt(pod)
So really one question would be whether this check should be global to all filters or targetted to the unreplicationFilter where there is no Replication Controller found.
But I will add a comment once I know how targeted we would like this check.
Part of me was wondering what would happen if a deamonset were restarting and I caught it in the middle where it is Failed, unlikely but possible.


Comments from Reviewable

@adohe-zz
Copy link

pkg/kubectl/cmd/drain.go, line 350 [r1] (raw file):

Previously, fraenkel (Michael Fraenkel) wrote…

 
podOk := true
for _, filt := range []podFilter{mirrorPodFilter, o.localStorageFilter, o.unreplicatedFilter, o.daemonsetFilter} {
filterOk, w, f := filt(pod)
So really one question would be whether this check should be global to all filters or targetted to the unreplicationFilter where there is no Replication Controller found.
But I will add a comment once I know how targeted we would like this check.
Part of me was wondering what would happen if a deamonset were restarting and I caught it in the middle where it is Failed, unlikely but possible.

yes, this is possible. any way to check daemonsets on node?

Comments from Reviewable

@fraenkel
Copy link
Contributor Author

Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion.


pkg/kubectl/cmd/drain.go, line 350 [r1] (raw file):

Previously, AdoHe (TonyAdo) wrote…

yes, this is possible. any way to check daemonsets on node?

daemonSets seem to be treated differently. There is already a flag on drain to ignore daemonSets (--ignore-daemonsets). However, it too has a similar underlying issue. If the Controller or Namespace cannot be found, drain will always fail.

We can choose to fix the filters or go fix the root problem which is what to do with the Controller is not found.
There is a comment saying that a missing Controller is an error but something more sophisticated is needed. This comment has been there since drain was first created. If one cannot find a pod's controller is it safe to remove the pod?

The other option is to allow the --force and --ignore-daemonsets to actually work in all cases rather than fail when the controller is not found. Although this seems more like a bug if the Controller and Namespace are missing for a DaemonSet.

My plan is to move the current logic to the unreplicatedFilter and let all the other filters apply. If we run across some new situation, we can review the appropriate fix at that time.


Comments from Reviewable

- Don't bother trying to filter pods that have succeeded or failed
@brendandburns brendandburns added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2016
@brendandburns
Copy link
Contributor

LGTM from the bulk LGTM tool (testing...)

@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Sep 9, 2016
@k8s-bot
Copy link

k8s-bot commented Sep 9, 2016

GCE e2e build/test passed for commit 9cff11d.

@liggitt
Copy link
Member

liggitt commented Sep 9, 2016

untagging until assignee comments
@brendandburns, do we know why the tag was added here?

@liggitt liggitt removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2016
@pwittrock pwittrock added 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. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels Sep 27, 2016
@pwittrock
Copy link
Member

@k8s-bot test this issue: #IGNORE

@k8s-ci-robot
Copy link
Contributor

Jenkins GKE smoke e2e failed for commit 9cff11d. Full PR test history.

The magic incantation to run this job again is @k8s-bot gke e2e test this. Please help us cut down flakes by linking to an open flake issue when you hit one in your PR.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 563919c into kubernetes:master Sep 28, 2016
@fraenkel fraenkel deleted the drain_finished branch February 1, 2017 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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.

kubectl drain should ignore or delete Completed pods
9 participants