From 2c1dd698914805ce21f16001a7d02b6429de3575 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Tue, 4 Dec 2018 20:37:45 +0100 Subject: [PATCH] Reset tasks specific to Calico (#3813) --- roles/network_plugin/calico/tasks/reset.yml | 19 +++++++++++++++++++ roles/reset/tasks/main.yml | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 roles/network_plugin/calico/tasks/reset.yml diff --git a/roles/network_plugin/calico/tasks/reset.yml b/roles/network_plugin/calico/tasks/reset.yml new file mode 100644 index 000000000..1cdab1262 --- /dev/null +++ b/roles/network_plugin/calico/tasks/reset.yml @@ -0,0 +1,19 @@ +--- +- name: reset | check dummy0 network device + stat: + path: /sys/class/net/dummy0 + register: dummy0 + +- name: reset | remove the network device created by calico + command: ip link del dummy0 + when: dummy0.stat.exists + +- name: reset | get remaining routes set by bird + command: ip route show proto bird + register: bird_routes + +- name: reset | remove remaining routes set by bird + command: "ip route del {{ bird_route }} proto bird" + with_items: "{{ bird_routes.stdout_lines }}" + loop_control: + loop_var: bird_route diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index ca54c51c4..5c776a3c1 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -205,7 +205,7 @@ - name: reset | include file with reset tasks specific to the network_plugin if exists include_tasks: "{{ (role_path + '/../network_plugin/' + kube_network_plugin + '/tasks/reset.yml') | realpath }}" when: - - kube_network_plugin in ['flannel', 'cilium', 'contiv', 'kube-router'] + - kube_network_plugin in ['flannel', 'cilium', 'contiv', 'kube-router', 'calico'] tags: - network