Skip to content

Commit

Permalink
Use kube_config_dir for kubeconfig
Browse files Browse the repository at this point in the history
The path of kubeconfig should be configurable, and its default value
is /etc/kubernetes/admin.conf. Most paths of the file are configurable
but some were not. This make those configurable.
  • Loading branch information
Kenichi Omichi committed Sep 21, 2021
1 parent 6f79112 commit 72aabcc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roles/remove-node/pre-remove/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- name: remove-node | Drain node except daemonsets resource # noqa 301
command: >-
{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf drain
{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf drain
--force
--ignore-daemonsets
--grace-period {{ drain_grace_period }}
Expand Down
2 changes: 1 addition & 1 deletion roles/upgrade/post-upgrade/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: Uncordon node
command: "{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf uncordon {{ kube_override_hostname|default(inventory_hostname) }}"
command: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf uncordon {{ kube_override_hostname|default(inventory_hostname) }}"
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when:
- needs_cordoning|default(false)
2 changes: 1 addition & 1 deletion roles/upgrade/pre-upgrade/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
delay: "{{ drain_retry_delay_seconds }}"
rescue:
- name: Set node back to schedulable
command: "{{ bin_dir }}/kubectl --kubeconfig /etc/kubernetes/admin.conf uncordon {{ inventory_hostname }}"
command: "{{ bin_dir }}/kubectl --kubeconfig {{ kube_config_dir }}/admin.conf uncordon {{ inventory_hostname }}"
when: upgrade_node_uncordon_after_drain_failure
- name: Fail after rescue
fail:
Expand Down

0 comments on commit 72aabcc

Please sign in to comment.