Update check calico version command (#9861)

pull/9866/head
Jack 2023-03-08 16:31:12 +08:00 committed by GitHub
parent 82f68ca395
commit 1ca50f3eea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 23 deletions

View File

@ -43,22 +43,23 @@
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
- name: Get current calico cluster version
shell: "set -o pipefail && {{ bin_dir }}/calicoctl.sh version | grep 'Cluster Version:' | awk '{ print $3}'"
- name: Check if calico exists
stat:
path: "{{ bin_dir }}/calicoctl.sh"
register: calico_exists
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
- name: Check that current calico version is enough for upgrade
block:
- name: Get current calico version
shell: "set -o pipefail && {{ bin_dir }}/calicoctl.sh version | grep 'Client Version:' | awk '{ print $3}'"
args:
executable: /bin/bash
register: calico_version_on_server
async: 10
poll: 3
run_once: True
until: calico_version_on_server.stdout != 'unknown'
retries: 5
delay: "{{ retry_stagger | random + 3 }}"
delegate_to: "{{ groups['kube_control_plane'][0] }}"
changed_when: false
failed_when: false
- name: Check that current calico version is enough for upgrade
- name: Assert that current calico version is enough for upgrade
assert:
that:
- calico_version_on_server.stdout is version(calico_min_version_required, '>=')
@ -66,12 +67,9 @@
Your version of calico is not fresh enough for upgrade.
Minimum version is {{ calico_min_version_required }} supported by the previous kubespray release.
But current version is {{ calico_version_on_server.stdout }}.
when:
- 'calico_version_on_server.stdout is defined'
- calico_version_on_server.stdout
- inventory_hostname == groups['kube_control_plane'][0]
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when: calico_exists.stat.exists
- name: "Check that cluster_id is set if calico_rr enabled"
assert: