Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download Calico KDD CRDs #7372

Merged
merged 5 commits into from
Mar 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace find+lineinfile by sed in shell module to avoid nested loop
mirwan committed Mar 15, 2021
commit 9c44b05c6fedf52118a3210a6bd89241dd371e71
31 changes: 7 additions & 24 deletions roles/network_plugin/calico/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -110,33 +110,16 @@
- calico_pool_cidr_ipv6 is defined
- enable_dual_stack_networks

- name: Calico | Get the list of CRDs manifests
find:
paths: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds"
patterns: "^crd\\.projectcalico\\.org_.*?\\.ya?ml$"
use_regex: yes
register: calico_kdd_crds_manifests
- 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'
no_log: true

- name: Calico | Replace unwanted annotations and creationTimestamp keys from metadata in Calico manifests
lineinfile:
path: "{{ item.0.path }}"
state: absent
regexp: "{{ item.1 }}"
loop: "{{ calico_kdd_crds_manifests.files|product(lines_to_remove)|list }}"
loop_control:
label: "{{ item.0.path|basename }}"
vars:
lines_to_remove:
- "^\\s{2,4}annotations:$"
- "^\\s{2,4}controller-gen\\.kubebuilder\\.io/version: \\(devel\\)$"
- "^\\s{2,4}creationTimestamp: null$"
when:
- inventory_hostname in groups['kube-master']
- calico_datastore == "kdd"

- name: Calico | Create calico manifests for kdd
assemble:
mirwan marked this conversation as resolved.
Show resolved Hide resolved