From 3fd905677754c16aa903c376ae8a95ba112254c7 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 7e8161fc31d..dab6b8057bb 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 94e1fbe7039..6941f2150e8 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