Download Calico KDD CRDs (#7372)

* Download Calico KDD CRDs

* Replace kustomize with lineinfile and use ansible assemble module

* Replace find+lineinfile by sed in shell module to avoid nested loop

* add condition on sed

* use block for kdd tasks + remove supernumerary kdd manifest apply in start "Start Calico resources"
This commit is contained in:
Erwan Miran
2021-03-19 01:06:36 +01:00
committed by GitHub
parent f103ac7640
commit 1c62af0c95
6 changed files with 52 additions and 3011 deletions

View File

@@ -110,33 +110,35 @@
- calico_pool_cidr_ipv6 is defined
- enable_dual_stack_networks
- name: Calico | Create calico manifests for kdd
template:
src: "{{ item.file }}.j2"
dest: "{{ kube_config_dir }}/{{ item.file }}"
with_items:
- {name: calico, file: kdd-crds.yml, type: kdd}
register: calico_node_kdd_manifest
- block:
- name: Calico | Remove unwanted annotations and creationTimestamp keys from metadata in Calico manifests
# noqa 303 - sed avoids using nested loop
shell: >-
sed -E -i
-e '/^\s{2,4}creationTimestamp: null$/d'
-e '/^\s{2,4}annotations:/{:1;/\(devel\)$/!{N;b 1}; /.*/d}'
{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds/*.yaml
when:
- calico_version is version('v3.17.0', '<')
- name: Calico | Create calico manifests for kdd
assemble:
src: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds"
dest: "{{ kube_config_dir }}/kdd-crds.yml"
regexp: ".*\\.yaml"
remote_src: true
- name: Calico | Create Calico Kubernetes datastore resources
kube:
kubectl: "{{ bin_dir }}/kubectl"
filename: "{{ kube_config_dir }}/kdd-crds.yml"
state: "latest"
when:
- inventory_hostname == groups['kube-master'][0]
when:
- inventory_hostname in groups['kube-master']
- calico_datastore == "kdd"
- name: Calico | Create Calico Kubernetes datastore resources
kube:
name: "{{ item.item.name }}"
namespace: "kube-system"
kubectl: "{{ bin_dir }}/kubectl"
resource: "{{ item.item.type }}"
filename: "{{ kube_config_dir }}/{{ item.item.file }}"
state: "latest"
with_items:
- "{{ calico_node_kdd_manifest.results }}"
when:
- inventory_hostname == groups['kube-master'][0]
- not item is skipped
loop_control:
label: "{{ item.item.file }}"
- name: Calico | Configure calico network pool
command:
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
@@ -327,7 +329,6 @@
state: "latest"
with_items:
- "{{ calico_node_manifests.results }}"
- "{{ calico_node_kdd_manifest.results }}"
- "{{ calico_node_typha_manifest.results }}"
when:
- inventory_hostname == groups['kube-master'][0]

File diff suppressed because it is too large Load Diff