{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/51327830","id":51327830,"diff_hunk":"@@ -227,28 +234,65 @@ func (o *DrainOptions) getPodsForDeletion() ([]api.Pod, error) {\n \t\t\t\t// gone/missing, not for any other cause.  TODO(mml): something more\n \t\t\t\t// sophisticated than this\n \t\t\t\tif err == nil && ds != nil {\n-\t\t\t\t\treplicated = true\n+\t\t\t\t\t// Otherwise, treat daemonset-managed pods as unmanaged since\n+\t\t\t\t\t// DaemonSet Controller currently ignores the unschedulable bit.\n+\t\t\t\t\t// FIXME(mml): Add link to the issue concerning a proper way to drain\n+\t\t\t\t\t// daemonset pods, probably using taints.\n+\t\t\t\t\tdaemonset_pod = true\n \t\t\t\t}\n \t\t\t}\n \t\t}\n-\t\tif replicated || o.Force {\n-\t\t\tpods = append(pods, pod)\n-\t\t}\n-\t\tif !replicated {\n+\t\tswitch {\n+\t\tcase daemonset_pod:\n+\t\t\tdaemonSetPodNames = append(daemonSetPodNames, pod.Name)\n+\t\tcase !replicated:\n \t\t\tunreplicatedPodNames = append(unreplicatedPodNames, pod.Name)\n+\t\t\tif o.Force {\n+\t\t\t\tpods = append(pods, pod)\n+\t\t\t}\n+\t\tdefault:\n+\t\t\tpods = append(pods, pod)\n \t\t}\n \t}\n \n-\tif len(unreplicatedPodNames) > 0 {\n-\t\tjoined := strings.Join(unreplicatedPodNames, \", \")\n-\t\tif !o.Force {\n-\t\t\treturn pods, fmt.Errorf(\"refusing to continue due to pods managed by neither a ReplicationController nor a DaemonSet: %s (use --force to override)\", joined)\n+\tif (!o.IgnoreDaemonsets && len(daemonSetPodNames) > 0) || (!o.Force && len(unreplicatedPodNames) > 0) {\n+\t\tif o.Force {\n+\t\t\treturn pods, errors.New(unmanagedMsg([]string{}, daemonSetPodNames, true))\n+\t\t} else {\n+\t\t\treturn pods, errors.New(unmanagedMsg(unreplicatedPodNames, daemonSetPodNames, true))\n \t\t}\n-\t\tfmt.Fprintf(o.out, \"WARNING: About to delete these pods managed by neither a ReplicationController nor a DaemonSet: %s\\n\", joined)\n+\t} else if len(unreplicatedPodNames) > 0 {","path":"pkg/kubectl/cmd/drain.go","position":96,"original_position":96,"commit_id":"fa0a01173e5a7ba28c448c1b229281c740b3b1ee","original_commit_id":"fa0a01173e5a7ba28c448c1b229281c740b3b1ee","user":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"body":"else not necessary","created_at":"2016-01-29T23:00:17Z","updated_at":"2016-01-29T23:00:17Z","html_url":"https://github.com/kubernetes/kubernetes/pull/20232#discussion_r51327830","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/51327830"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/20232#discussion_r51327830"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232","id":57413448,"html_url":"https://github.com/kubernetes/kubernetes/pull/20232","diff_url":"https://github.com/kubernetes/kubernetes/pull/20232.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/20232.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/20232","number":20232,"state":"open","locked":false,"title":"Stop deleting DaemonSet pods since they will be recreated immediately, and also require a flag when there are DaemonSet pods on the node.","user":{"login":"mml","id":3115,"avatar_url":"https://avatars.githubusercontent.com/u/3115?v=3","gravatar_id":"","url":"https://api.github.com/users/mml","html_url":"https://github.com/mml","followers_url":"https://api.github.com/users/mml/followers","following_url":"https://api.github.com/users/mml/following{/other_user}","gists_url":"https://api.github.com/users/mml/gists{/gist_id}","starred_url":"https://api.github.com/users/mml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mml/subscriptions","organizations_url":"https://api.github.com/users/mml/orgs","repos_url":"https://api.github.com/users/mml/repos","events_url":"https://api.github.com/users/mml/events{/privacy}","received_events_url":"https://api.github.com/users/mml/received_events","type":"User","site_admin":false},"body":"It took some work to get all the cases right in terms of error and warning messages, but the transcript below shows that it's good.  I will refactor that part and squash the commits, but putting the PR out for a little scrutiny of semantics.\r\n\r\n```console\r\n% echo $m\r\nkubernetes-minion-c9db\r\n% _output/local/bin/linux/amd64/kubectl drain $m\r\nnode \"kubernetes-minion-c9db\" cordoned\r\nerror: pods managed by neither a ReplicationController nor a DaemonSet: naked (use --force to override) and DaemonSet-managed pods: mmlds-0w8zz (use --ignore-daemonsets to ignore)\r\n\r\n% _output/local/bin/linux/amd64/kubectl drain $m --force\r\nnode \"kubernetes-minion-c9db\" already cordoned\r\nerror: DaemonSet-managed pods: mmlds-0w8zz (use --ignore-daemonsets to ignore)\r\n\r\n% _output/local/bin/linux/amd64/kubectl drain $m --ignore-daemonsets\r\nnode \"kubernetes-minion-c9db\" already cordoned\r\nerror: pods managed by neither a ReplicationController nor a DaemonSet: naked (use --force to override)\r\n\r\n% _output/local/bin/linux/amd64/kubectl drain $m --force --ignore-daemonsets\r\nnode \"kubernetes-minion-c9db\" already cordoned\r\nWARNING: About to delete these pods managed by neither a ReplicationController nor a DaemonSet: naked\r\npod \"naked\" deleted\r\npod \"kube-dns-v10-luuw6\" deleted\r\nnode \"kubernetes-minion-c9db\" drained\r\n```","created_at":"2016-01-27T19:56:22Z","updated_at":"2016-01-29T23:00:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"75d1d26e3ff09f1e499855fb83480a8840b563a1","assignee":{"login":"davidopp","id":8264113,"avatar_url":"https://avatars.githubusercontent.com/u/8264113?v=3","gravatar_id":"","url":"https://api.github.com/users/davidopp","html_url":"https://github.com/davidopp","followers_url":"https://api.github.com/users/davidopp/followers","following_url":"https://api.github.com/users/davidopp/following{/other_user}","gists_url":"https://api.github.com/users/davidopp/gists{/gist_id}","starred_url":"https://api.github.com/users/davidopp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidopp/subscriptions","organizations_url":"https://api.github.com/users/davidopp/orgs","repos_url":"https://api.github.com/users/davidopp/repos","events_url":"https://api.github.com/users/davidopp/events{/privacy}","received_events_url":"https://api.github.com/users/davidopp/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/20232/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/fa0a01173e5a7ba28c448c1b229281c740b3b1ee","head":{"label":"mml:daemonset-warn","ref":"daemonset-warn","sha":"fa0a01173e5a7ba28c448c1b229281c740b3b1ee","user":{"login":"mml","id":3115,"avatar_url":"https://avatars.githubusercontent.com/u/3115?v=3","gravatar_id":"","url":"https://api.github.com/users/mml","html_url":"https://github.com/mml","followers_url":"https://api.github.com/users/mml/followers","following_url":"https://api.github.com/users/mml/following{/other_user}","gists_url":"https://api.github.com/users/mml/gists{/gist_id}","starred_url":"https://api.github.com/users/mml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mml/subscriptions","organizations_url":"https://api.github.com/users/mml/orgs","repos_url":"https://api.github.com/users/mml/repos","events_url":"https://api.github.com/users/mml/events{/privacy}","received_events_url":"https://api.github.com/users/mml/received_events","type":"User","site_admin":false},"repo":{"id":45429185,"name":"kubernetes","full_name":"mml/kubernetes","owner":{"login":"mml","id":3115,"avatar_url":"https://avatars.githubusercontent.com/u/3115?v=3","gravatar_id":"","url":"https://api.github.com/users/mml","html_url":"https://github.com/mml","followers_url":"https://api.github.com/users/mml/followers","following_url":"https://api.github.com/users/mml/following{/other_user}","gists_url":"https://api.github.com/users/mml/gists{/gist_id}","starred_url":"https://api.github.com/users/mml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mml/subscriptions","organizations_url":"https://api.github.com/users/mml/orgs","repos_url":"https://api.github.com/users/mml/repos","events_url":"https://api.github.com/users/mml/events{/privacy}","received_events_url":"https://api.github.com/users/mml/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mml/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/mml/kubernetes","forks_url":"https://api.github.com/repos/mml/kubernetes/forks","keys_url":"https://api.github.com/repos/mml/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mml/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mml/kubernetes/teams","hooks_url":"https://api.github.com/repos/mml/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/mml/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/mml/kubernetes/events","assignees_url":"https://api.github.com/repos/mml/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/mml/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/mml/kubernetes/tags","blobs_url":"https://api.github.com/repos/mml/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mml/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mml/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/mml/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mml/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/mml/kubernetes/languages","stargazers_url":"https://api.github.com/repos/mml/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/mml/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/mml/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/mml/kubernetes/subscription","commits_url":"https://api.github.com/repos/mml/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/mml/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/mml/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/mml/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/mml/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/mml/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mml/kubernetes/merges","archive_url":"https://api.github.com/repos/mml/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mml/kubernetes/downloads","issues_url":"https://api.github.com/repos/mml/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/mml/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/mml/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/mml/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mml/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/mml/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/mml/kubernetes/deployments","created_at":"2015-11-02T23:37:23Z","updated_at":"2015-11-02T23:37:41Z","pushed_at":"2016-01-29T19:21:07Z","git_url":"git://github.com/mml/kubernetes.git","ssh_url":"git@github.com:mml/kubernetes.git","clone_url":"https://github.com/mml/kubernetes.git","svn_url":"https://github.com/mml/kubernetes","homepage":"http://kubernetes.io","size":155329,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"eb2c2d1af4a5f28d1fd4936ee98bd8653946588c","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-01-29T21:32:14Z","pushed_at":"2016-01-29T22:41:42Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":313148,"stargazers_count":12418,"watchers_count":12418,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3516,"mirror_url":null,"open_issues_count":2840,"forks":3516,"open_issues":2840,"watchers":12418,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/20232"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/20232"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/20232/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20232/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/fa0a01173e5a7ba28c448c1b229281c740b3b1ee"}}}}