Refactor "multi" handlers to use listen (#10542)

* containerd: refactor handlers to use 'listen'

* cri-dockerd: refactor handlers to use 'listen'

* cri-o: refactor handlers to use 'listen'

* docker: refactor handlers to use 'listen'

* etcd: refactor handlers to use 'listen'

* control-plane: refactor handlers to use 'listen'

* kubeadm: refactor handlers to use 'listen'

* node: refactor handlers to use 'listen'

* preinstall: refactor handlers to use 'listen'

* calico: refactor handlers to use 'listen'

* kube-router: refactor handlers to use 'listen'

* macvlan: refactor handlers to use 'listen'
This commit is contained in:
Max Gautier
2023-11-08 12:28:30 +01:00
committed by GitHub
parent c9d685833b
commit 8ebeb88e57
14 changed files with 85 additions and 158 deletions

View File

@@ -1,16 +1,10 @@
---
- name: Reset_calico_cni
command: /bin/true
when: calico_cni_config is defined
notify:
- Delete 10-calico.conflist
- Calico | delete calico-node docker containers
- Calico | delete calico-node crio/containerd containers
- name: Delete 10-calico.conflist
file:
path: /etc/cni/net.d/10-calico.conflist
state: absent
listen: Reset_calico_cni
when: calico_cni_config is defined
- name: Calico | delete calico-node docker containers
shell: "set -o pipefail && {{ docker_bin_dir }}/docker ps -af name=k8s_POD_calico-node* -q | xargs --no-run-if-empty {{ docker_bin_dir }}/docker rm -f"
@@ -19,7 +13,10 @@
register: docker_calico_node_remove
until: docker_calico_node_remove is succeeded
retries: 5
when: container_manager in ["docker"]
when:
- container_manager in ["docker"]
- calico_cni_config is defined
listen: Reset_calico_cni
- name: Calico | delete calico-node crio/containerd containers
shell: 'set -o pipefail && {{ bin_dir }}/crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c "{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %"'
@@ -28,4 +25,7 @@
register: crictl_calico_node_remove
until: crictl_calico_node_remove is succeeded
retries: 5
when: container_manager in ["crio", "containerd"]
when:
- container_manager in ["crio", "containerd"]
- calico_cni_config is defined
listen: Reset_calico_cni