-
Notifications
You must be signed in to change notification settings - Fork 40.9k
kubectl: drain daemonSetFilter with other APIVersion #128779
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
kubectl: drain daemonSetFilter with other APIVersion #128779
Conversation
Signed-off-by: Aleksey Gavrilov <[email protected]>
Welcome @alexey-gavrilov-flant! |
Hi @alexey-gavrilov-flant. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
/auto-cc |
/ok-to-test |
@seans3 What's the next step? |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
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.
/lgtm
/approve
/triage accepted
/priority backlog
LGTM label has been added. Git tree hash: a0922e7e0c636dada97571cfde70225c898a6f52
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexey-gavrilov-flant, soltysh 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 |
/refresh |
/test pull-kubernetes-cmd |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Since I can't reopen a past fix attempt. I created a new PR
This is a copy of another PR #101556
When using the drain command of kubectl, all DaemonSets will be filtered. But the way to judge that workloadRef is DaemonSet in Filter only considers the Kind of workloadRef and ignores the APIVersion of workloadRef.
kubernetes/staging/src/k8s.io/kubectl/pkg/drain/filters.go
Line 182 in f631c0e
However, the logic that follows immediately obtains all apps/v1 DaemonSet, which will cause if there is a crd with the same name as Kind (Kind=DaemonSet), it will be regarded as a native DaemonSet, but in fact, the original DaemonSet cannot obtain this CRD and thus DrainNode The problem of failure.
kubernetes/staging/src/k8s.io/kubectl/pkg/drain/filters.go
Lines 190 to 196 in f631c0e
Example:
there is a crd kruise-daemonSet
When we DrainNode, it mistakenly regards it as a native DaemonSet, but the native DaemonSet cannot be obtained and an error is reported
So I added detailed judgments here to find if the workload is native DaemonSet or not.
Which issue(s) this PR fixes:
Fixes #101557
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: