From 8355a446f52cbf0d8e14ace880360f907b83eca0 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Mon, 15 Mar 2021 08:33:43 +0100 Subject: [PATCH] use block for kdd tasks + remove supernumerary kdd manifest apply in start "Start Calico resources" --- roles/network_plugin/calico/tasks/install.yml | 61 ++++++++----------- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/roles/network_plugin/calico/tasks/install.yml b/roles/network_plugin/calico/tasks/install.yml index 5e2b0f359c8..c4831cbbc82 100644 --- a/roles/network_plugin/calico/tasks/install.yml +++ b/roles/network_plugin/calico/tasks/install.yml @@ -110,47 +110,35 @@ - calico_pool_cidr_ipv6 is defined - enable_dual_stack_networks -- 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: - - inventory_hostname in groups['kube-master'] - - calico_datastore == 'kdd' - - calico_version is version('v3.17.0', '<') +- 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 }}/{{ item.file }}" - regexp: ".*\\.yaml" - remote_src: true - with_items: - - {name: calico, file: kdd-crds.yml, type: kdd} - register: calico_node_kdd_manifest + - 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 -" @@ -341,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]