From 428e52e0d14576e5c461f7169fcff5751342f455 Mon Sep 17 00:00:00 2001 From: Sergey Kolekonov Date: Tue, 16 Jul 2019 19:35:24 +0400 Subject: [PATCH] Fix calico handler for containerd (#4985) crictl tool must be used to delete containers in case of containerd deployment --- roles/network_plugin/calico/handlers/main.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/network_plugin/calico/handlers/main.yml b/roles/network_plugin/calico/handlers/main.yml index 64218c040..7bb17dd66 100644 --- a/roles/network_plugin/calico/handlers/main.yml +++ b/roles/network_plugin/calico/handlers/main.yml @@ -3,12 +3,18 @@ command: /bin/true notify: - delete 10-calico.conflist - - delete calico-node containers + - docker | delete calico-node containers + - containerd | delete calico-node containers - name: delete 10-calico.conflist file: - path: /etc/calico/10-calico.conflist + path: /etc/cni/net.d/10-calico.conflist state: absent -- name: delete calico-node containers +- name: docker | delete calico-node containers shell: "docker ps -af name=k8s_POD_calico-node* -q | xargs --no-run-if-empty docker rm -f" + when: container_manager in ["docker"] + +- name: containerd | delete calico-node containers + shell: 'crictl pods --name calico-node-* -q | xargs -I% --no-run-if-empty bash -c "crictl stopp % && crictl rmp %"' + when: container_manager in ["crio", "containerd"]