-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 the condition of drain on pre-remove task #8634
Conversation
When running cluster.yml for new machines what containerd is already install but Kubernetes cluster were not installed before, the task "remove-node | List nodes" is failed like "changed": false, "cmd": [ "/usr/local/bin/kubectl", "--kubeconfig", "/etc/kubernetes/admin.conf", "get", "nodes", "-o", "go-template={{ range .items }}{{ .metadata.name }} {{ "\n" }}{{ end }}" ], .. "stderr": "error: stat /etc/kubernetes/admin.conf: no such file or directory", That was due to lack to check the existing Kubernetes cluster exists or not before running "kubectl drain" command. This adds the check to avoid the issue.
Thanks @oomichi ! /lgtm |
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.
@oomichi 🎉
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: floryut, oomichi 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 |
When running cluster.yml for new machines what containerd is already install but Kubernetes cluster were not installed before, the task "remove-node | List nodes" is failed like "changed": false, "cmd": [ "/usr/local/bin/kubectl", "--kubeconfig", "/etc/kubernetes/admin.conf", "get", "nodes", "-o", "go-template={{ range .items }}{{ .metadata.name }} {{ "\n" }}{{ end }}" ], .. "stderr": "error: stat /etc/kubernetes/admin.conf: no such file or directory", That was due to lack to check the existing Kubernetes cluster exists or not before running "kubectl drain" command. This adds the check to avoid the issue.
When running cluster.yml for new machines what containerd is already install but Kubernetes cluster were not installed before, the task "remove-node | List nodes" is failed like "changed": false, "cmd": [ "/usr/local/bin/kubectl", "--kubeconfig", "/etc/kubernetes/admin.conf", "get", "nodes", "-o", "go-template={{ range .items }}{{ .metadata.name }} {{ "\n" }}{{ end }}" ], .. "stderr": "error: stat /etc/kubernetes/admin.conf: no such file or directory", That was due to lack to check the existing Kubernetes cluster exists or not before running "kubectl drain" command. This adds the check to avoid the issue.
When running cluster.yml for new machines what containerd is already install but Kubernetes cluster were not installed before, the task "remove-node | List nodes" is failed like "changed": false, "cmd": [ "/usr/local/bin/kubectl", "--kubeconfig", "/etc/kubernetes/admin.conf", "get", "nodes", "-o", "go-template={{ range .items }}{{ .metadata.name }} {{ "\n" }}{{ end }}" ], .. "stderr": "error: stat /etc/kubernetes/admin.conf: no such file or directory", That was due to lack to check the existing Kubernetes cluster exists or not before running "kubectl drain" command. This adds the check to avoid the issue.
What type of PR is this?
/kind bug
What this PR does / why we need it:
When running cluster.yml for new machines what containerd is already install but Kubernetes cluster were not installed before,
the task "remove-node | List nodes" is failed like
That was due to lack to check the existing Kubernetes cluster exists or not before running "kubectl drain" command.
This adds the check to avoid the issue.
Which issue(s) this PR fixes:
Fixes #8627
Does this PR introduce a user-facing change?: