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 ignore daemonsets and others #87361

Conversation

zhouya0
Copy link
Member

@zhouya0 zhouya0 commented Jan 19, 2020

What type of PR is this?

/kind bug

What this PR does / why we need it:
This is actually a change back of the PR which is submitted 3 months ago.
#84562

The origin PR wants stop those pods whose status.delete is false add to podDeleteList. The thought is good but actually after this logic there is a

	if errs := list.errors(); len(errs) > 0 {
		return list, errs
	}

The function list.errors will check those pods who has i.status.reason == podDeleteStatusTypeError. So those daemonsets, pods with volumes and others, whose status.delete is actually false will never be found in conditions after this PR. Causing error like kubernetes/kubectl#803.

Which issue(s) this PR fixes:

Fixes # kubernetes/kubectl#803

Does this PR introduce a user-facing change?:

Fix kubectl drain ignore daemonsets and others.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 19, 2020
@zhouya0
Copy link
Member Author

zhouya0 commented Jan 19, 2020

/cc @mengqiy @seans3 @apelisse
/assign @smarterclayton

@zhouya0
Copy link
Member Author

zhouya0 commented Jan 19, 2020

/test pull-kubernetes-e2e-kind

@zhouya0
Copy link
Member Author

zhouya0 commented Jan 19, 2020

/test pull-kubernetes-e2e-gce

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/priority backlog

status: status,
})
}
pods = append(pods, podDelete{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree with this change, especially after looking at

// Note that we return false in cases where the pod is DaemonSet managed,
// regardless of flags.
//
// The exception is for pods that are orphaned (the referencing
// management resource - including DaemonSet - is not found).
// Such pods will be deleted if --force is used.
.

Can you please add a comment here, why this is done so, this will prevent eventual "optimization" like that from the PR you're reverting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'll try to do this.

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jan 21, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: soltysh, zhouya0

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 Jan 21, 2020
@soltysh
Copy link
Contributor

soltysh commented Jan 21, 2020

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jan 21, 2020
@k8s-ci-robot
Copy link
Contributor

@zhouya0: you cannot LGTM your own PR.

In response to this:

/lgtm

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.

@zhouya0 zhouya0 force-pushed the fix_kubectl_drain_ignore_daemonsets_and_ohters branch from 2519982 to f124726 Compare February 3, 2020 02:35
@zhouya0 zhouya0 force-pushed the fix_kubectl_drain_ignore_daemonsets_and_ohters branch from f124726 to e3c8add Compare February 3, 2020 02:37
@zhouya0
Copy link
Member Author

zhouya0 commented Feb 3, 2020

/test pull-kubernetes-integration

@zhouya0 zhouya0 closed this Feb 3, 2020
@zhouya0 zhouya0 reopened this Feb 3, 2020
@zhouya0
Copy link
Member Author

zhouya0 commented Feb 3, 2020

/test pull-kubernetes-integration

@zhouya0 zhouya0 requested a review from soltysh February 3, 2020 06:33
Copy link
Member

@wawa0210 wawa0210 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@wawa0210
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 12, 2020
@k8s-ci-robot k8s-ci-robot merged commit a330def into kubernetes:master Feb 12, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Feb 12, 2020
@tedyu
Copy link
Contributor

tedyu commented Feb 12, 2020

Thanks for the fix.

wking pushed a commit to wking/kubernetes that referenced this pull request Jul 21, 2020
…nore_daemonsets_and_ohters

Fix kubectl drain ignore daemonsets and others

Kubernetes-commit: a330def
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. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants