Skip to content

Commit

Permalink
Instead of doc update, change the verify step
Browse files Browse the repository at this point in the history
  • Loading branch information
kaarolch committed Sep 18, 2018
1 parent 730866f commit 0121bce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 1 addition & 6 deletions docs/upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ versions. Here are all version vars for each component:
* flannel_version
* kubedns_version

Please remember that some components upgrade depends on minimum installed version.
In example **calico version 2.6.5 upgrade to 3.1.1 is upgrading etcd store to etcdv3**.
The kubespray stack upgrade would failed when calico version is below 2.6.5. Please check
components' documentation and always upgrade test environment first.

#### Unsafe upgrade example

If you wanted to upgrade just kube_version from v1.4.3 to v1.4.6, you could
Expand All @@ -40,7 +35,7 @@ ansible-playbook cluster.yml -i inventory/sample/hosts.ini -e kube_version=v1.4.

#### Graceful upgrade

Kubespray also supports cordon, drain and uncordoning of nodes when performing
Kubespray also supports cordon, drain and uncordoning of nodes when performing
a cluster upgrade. There is a separate playbook used for this purpose. It is
important to note that upgrade-cluster.yml can only be used for upgrading an
existing cluster. That means there must be at least 1 kube-master already
Expand Down
18 changes: 18 additions & 0 deletions roles/kubernetes/preinstall/tasks/0020-verify-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,21 @@
tags:
- cloud-provider
- facts

- name: "Get current version of calico cluster version"
shell: "{{ bin_dir }}/calicoctl version | grep 'Cluster Version' | awk '{ print $3}'"
register: calico_version_on_server
run_once: yes
delegate_to: "{{ groups['kube-master'][0] }}"


- name: "Check that calico version is enought for upgrade"
assert:
that:
- calico_version_on_server.stdout|version_compare('v2.6.5', '>=')
msg: "Your version of calico is not fresh enough for upgrade. Minimum version v2.6.5"
when:
- 'calico_version_on_server.stdout is defined'
- 'calico_version_on_server.stdout != ""'
- inventory_hostname == groups['kube-master'][0]
run_once: yes

0 comments on commit 0121bce

Please sign in to comment.