Fix Get current calico version (#9873)

Signed-off-by: hang.jiang <hang.jiang@daocloud.io>
pull/9878/head
蒋航 2023-03-10 21:48:40 +08:00 committed by GitHub
parent 7747ff2572
commit 99115ad04b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -43,13 +43,20 @@
run_once: True run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}" delegate_to: "{{ groups['kube_control_plane'][0] }}"
- name: Check if calico exists - name: Check if calicoctl.sh exists
stat: stat:
path: "{{ bin_dir }}/calicoctl.sh" path: "{{ bin_dir }}/calicoctl.sh"
register: calico_exists register: calicoctl_sh_exists
run_once: True run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}" 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 - name: Check that current calico version is enough for upgrade
block: block:
- name: Get current calico version - name: Get current calico version
@ -69,7 +76,7 @@
But current version is {{ calico_version_on_server.stdout }}. But current version is {{ calico_version_on_server.stdout }}.
run_once: True run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}" 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" - name: "Check that cluster_id is set if calico_rr enabled"
assert: assert: