mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-15 18:20:02 -03:30
calico: default to using kdd datastore (#6693)
If already deployed, get current datastore from CNI config file
This commit is contained in:
@@ -81,7 +81,7 @@ kube_etcd_cert_file: node-{{ inventory_hostname }}.pem
|
||||
kube_etcd_key_file: node-{{ inventory_hostname }}-key.pem
|
||||
|
||||
# Choose data store type for calico: "etcd" or "kdd" (kubernetes datastore)
|
||||
# The default value calico_datastore: "etcd" is set in role kubespray-default
|
||||
# The default value for calico_datastore is set in role kubespray-default
|
||||
|
||||
# Use typha (only with kdd)
|
||||
typha_enabled: false
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
---
|
||||
- name: Slurp CNI config
|
||||
slurp:
|
||||
src: /etc/cni/net.d/10-calico.conflist
|
||||
register: calico_cni_config_slurp
|
||||
failed_when: false
|
||||
|
||||
- block:
|
||||
- name: Set fact calico_cni_config from slurped CNI config
|
||||
set_fact:
|
||||
calico_cni_config: "{{ calico_cni_config_slurp['content'] | b64decode | from_json }}"
|
||||
- name: Set fact calico_datastore to etcd if needed
|
||||
set_fact:
|
||||
calico_datastore: etcd
|
||||
when: "'etcd_endpoints' in calico_cni_config.plugins.0"
|
||||
when: calico_cni_config_slurp.content is defined
|
||||
|
||||
- name: Calico | Get kubelet hostname
|
||||
shell: >-
|
||||
set -o pipefail && {{ bin_dir }}/kubectl get node -o custom-columns='NAME:.metadata.name,INTERNAL-IP:.status.addresses[?(@.type=="InternalIP")].address'
|
||||
@@ -8,4 +24,4 @@
|
||||
register: calico_kubelet_name
|
||||
delegate_to: "{{ groups['kube-master'][0] }}"
|
||||
when:
|
||||
- "cloud_provider is defined"
|
||||
- "cloud_provider is defined"
|
||||
|
||||
Reference in New Issue
Block a user