From 0fa841208f0ce83e603352829e404f42461bb5eb Mon Sep 17 00:00:00 2001 From: "hang.jiang" Date: Thu, 9 Mar 2023 18:23:19 +0800 Subject: [PATCH] Fix Get current calico version Signed-off-by: hang.jiang --- roles/network_plugin/calico/tasks/check.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/roles/network_plugin/calico/tasks/check.yml b/roles/network_plugin/calico/tasks/check.yml index 81f37ef7e09..c500f74342e 100644 --- a/roles/network_plugin/calico/tasks/check.yml +++ b/roles/network_plugin/calico/tasks/check.yml @@ -43,13 +43,20 @@ run_once: True delegate_to: "{{ groups['kube_control_plane'][0] }}" -- name: Check if calico exists +- name: Check if calicoctl.sh exists stat: path: "{{ bin_dir }}/calicoctl.sh" - register: calico_exists + register: calicoctl_sh_exists run_once: True delegate_to: "{{ groups['kube_control_plane'][0] }}" +- name: Check if calico ClusterInformation exists + command: "{{ bin_dir }}/calicoctl.sh get ClusterInformation" + register: clusterinformation_exists + run_once: True + delegate_to: "{{ groups['kube_control_plane'][0] }}" + when: calicoctl_sh_exists.stat.exists + - name: Check that current calico version is enough for upgrade block: - name: Get current calico version @@ -69,7 +76,7 @@ But current version is {{ calico_version_on_server.stdout }}. run_once: True delegate_to: "{{ groups['kube_control_plane'][0] }}" - when: calico_exists.stat.exists + when: calicoctl_sh_exists.stat.exists and clusterinformation_exists.rc == 0 - name: "Check that cluster_id is set if calico_rr enabled" assert: