From 46c536d261c06d4496db4446dbafe2d00eb705ed Mon Sep 17 00:00:00 2001 From: zhengtianbao Date: Tue, 9 Nov 2021 04:43:39 -0600 Subject: [PATCH] Add krew auto completion (#8171) --- roles/kubernetes-apps/krew/tasks/krew.yml | 12 ++++++++++++ roles/reset/tasks/main.yml | 1 + 2 files changed, 13 insertions(+) diff --git a/roles/kubernetes-apps/krew/tasks/krew.yml b/roles/kubernetes-apps/krew/tasks/krew.yml index 7e8161fc3..dab6b8057 100644 --- a/roles/kubernetes-apps/krew/tasks/krew.yml +++ b/roles/kubernetes-apps/krew/tasks/krew.yml @@ -19,3 +19,15 @@ environment: KREW_ROOT: "{{ krew_root_dir }}" KREW_DEFAULT_INDEX_URI: "{{ krew_default_index_uri | default('') }}" + +- name: Krew | Get krew completion + command: "{{ local_release_dir }}/krew-{{ host_os }}_{{ image_arch }} completion bash" + changed_when: False + register: krew_completion + check_mode: False + +- name: Krew | Install krew completion + copy: + dest: /etc/bash_completion.d/krew.sh + content: "{{ krew_completion.stdout }}" + become: True \ No newline at end of file diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 94e1fbe70..6941f2150 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -322,6 +322,7 @@ - /etc/bash_completion.d/crictl - /etc/bash_completion.d/nerdctl - /etc/bash_completion.d/krew + - /etc/bash_completion.d/krew.sh - "{{ krew_root_dir | default('/usr/local/krew') }}" - /etc/modules-load.d/kube_proxy-ipvs.conf - /etc/modules-load.d/kubespray-br_netfilter.conf