mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-03-01 16:58:52 -03:30
Add kubectl alias support (#10552)
Signed-off-by: tu1h <lihai.tu@daocloud.io>
This commit is contained in:
@@ -271,6 +271,7 @@ node_taints:
|
|||||||
* `audit_webhook_mode`: batch
|
* `audit_webhook_mode`: batch
|
||||||
* `audit_webhook_batch_max_size`: 100
|
* `audit_webhook_batch_max_size`: 100
|
||||||
* `audit_webhook_batch_max_wait`: 1s
|
* `audit_webhook_batch_max_wait`: 1s
|
||||||
|
* *kubectl_alias* - Bash alias of kubectl to interact with Kubernetes cluster much easier.
|
||||||
|
|
||||||
### Custom flags for Kube Components
|
### Custom flags for Kube Components
|
||||||
|
|
||||||
|
|||||||
@@ -228,3 +228,6 @@ auto_renew_certificates_systemd_calendar: "{{ 'Mon *-*-1,2,3,4,5,6,7 03:' ~
|
|||||||
# If we have requirement like without renewing certs upgrade the cluster,
|
# If we have requirement like without renewing certs upgrade the cluster,
|
||||||
# we can opt out from the default behavior by setting kubeadm_upgrade_auto_cert_renewal to false
|
# we can opt out from the default behavior by setting kubeadm_upgrade_auto_cert_renewal to false
|
||||||
kubeadm_upgrade_auto_cert_renewal: true
|
kubeadm_upgrade_auto_cert_renewal: true
|
||||||
|
|
||||||
|
# Bash alias of kubectl to interact with Kubernetes cluster much easier
|
||||||
|
# kubectl_alias: k
|
||||||
|
|||||||
@@ -60,6 +60,26 @@
|
|||||||
- upgrade
|
- upgrade
|
||||||
ignore_errors: true # noqa ignore-errors
|
ignore_errors: true # noqa ignore-errors
|
||||||
|
|
||||||
|
- name: Set bash alias for kubectl
|
||||||
|
blockinfile:
|
||||||
|
path: /etc/bash_completion.d/kubectl.sh
|
||||||
|
block: |-
|
||||||
|
alias {{ kubectl_alias }}=kubectl
|
||||||
|
if [[ $(type -t compopt) = "builtin" ]]; then
|
||||||
|
complete -o default -F __start_kubectl {{ kubectl_alias }}
|
||||||
|
else
|
||||||
|
complete -o default -o nospace -F __start_kubectl {{ kubectl_alias }}
|
||||||
|
fi
|
||||||
|
state: present
|
||||||
|
marker: "# Ansible entries {mark}"
|
||||||
|
when:
|
||||||
|
- ansible_os_family in ["Debian","RedHat"]
|
||||||
|
- kubectl_alias is defined and kubectl_alias != ""
|
||||||
|
tags:
|
||||||
|
- kubectl
|
||||||
|
- upgrade
|
||||||
|
ignore_errors: true # noqa ignore-errors
|
||||||
|
|
||||||
- name: Disable SecurityContextDeny admission-controller and enable PodSecurityPolicy
|
- name: Disable SecurityContextDeny admission-controller and enable PodSecurityPolicy
|
||||||
set_fact:
|
set_fact:
|
||||||
kube_apiserver_enable_admission_plugins: "{{ kube_apiserver_enable_admission_plugins | difference(['SecurityContextDeny']) | union(['PodSecurityPolicy']) | unique }}"
|
kube_apiserver_enable_admission_plugins: "{{ kube_apiserver_enable_admission_plugins | difference(['SecurityContextDeny']) | union(['PodSecurityPolicy']) | unique }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user