forked from hitachienergy/epiphany
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements and fix for upgrade role
- Loading branch information
Showing
6 changed files
with
88 additions
and
114 deletions.
There are no files selected for viewing
27 changes: 13 additions & 14 deletions
27
core/src/epicli/data/common/ansible/playbooks/roles/upgrade/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
--- | ||
- name: Check cluster version | ||
- name: Get cluster version | ||
environment: | ||
KUBECONFIG: "/home/{{ admin_user.name }}/.kube/config" | ||
shell: kubectl version --short | grep -i server | ||
shell: >- | ||
set -o pipefail && | ||
kubectl version --short -o json | jq --raw-output '.serverVersion.gitVersion' | ||
register: cluster_version | ||
changed_when: false | ||
|
||
- name: Check kubelet version | ||
- name: Get kubelet version | ||
environment: | ||
KUBECONFIG: "/home/{{ admin_user.name }}/.kube/config" | ||
shell: kubectl get node {{ inventory_hostname }} -o custom-columns=VERSION:.status.nodeInfo.kubeletVersion | ||
shell: >- | ||
kubectl get node {{ inventory_hostname }} -o jsonpath='{.status.nodeInfo.kubeletVersion}' | ||
register: kubelet_version | ||
changed_when: false | ||
|
||
- name: Upgrade master to {{ version }} | ||
include_tasks: "upgrade_master.yml" | ||
- name: Upgrade master to v{{ version }} | ||
include_tasks: upgrade_master.yml | ||
vars: | ||
version: "{{ ver }}" | ||
cni_version: "{{ cni_ver }}" | ||
when: | ||
- groups['kubernetes_master'][0] == inventory_hostname | ||
- (version == "1.12.10" and "1.11" in cluster_version.stdout) or | ||
(version == "1.13.8" and "1.12" in cluster_version.stdout) or | ||
(version == "1.14.4" and "1.13" in cluster_version.stdout) | ||
- cluster_version.stdout is version('v' + version, '<=') | ||
|
||
- name: Upgrade nodes to {{ version }} | ||
include_tasks: "upgrade_nodes.yml" | ||
- name: Upgrade node to v{{ version }} | ||
include_tasks: upgrade_node.yml | ||
vars: | ||
version: "{{ ver }}" | ||
cni_version: "{{ cni_ver }}" | ||
when: | ||
- inventory_hostname in groups['kubernetes_node'] | ||
- (version == "1.12.10" and "1.11" in kubelet_version.stdout and kubelet_version.stdout != cluster_version.stdout) or | ||
(version == "1.13.8" and "1.12" in kubelet_version.stdout and kubelet_version.stdout != cluster_version.stdout) or | ||
(version == "1.14.4" and "1.13" in kubelet_version.stdout and kubelet_version.stdout != cluster_version.stdout ) | ||
- kubelet_version.stdout is version('v' + version, '<=') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 21 additions & 20 deletions
41
core/src/epicli/data/common/ansible/playbooks/roles/upgrade/tasks/verify.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
--- | ||
- name: Get cluster version | ||
- name: verify | Get cluster version | ||
environment: | ||
KUBECONFIG: /home/{{ admin_user.name }}/.kube/config | ||
shell: kubectl version --short | grep -i server | ||
changed_when: false | ||
register: kubectl_cluster_version | ||
|
||
- name: Get kubectl version | ||
- name: verify | Verify cluster version | ||
assert: | ||
that: "'{{ version }}' in kubectl_cluster_version.stdout" | ||
|
||
- name: verify | Get kubectl version | ||
environment: | ||
KUBECONFIG: /home/{{ admin_user.name }}/.kube/config | ||
shell: kubectl version --client --short | awk '{print $3}' | ||
changed_when: false | ||
register: kubectl_client_version | ||
|
||
- name: Get kubeadm version | ||
- name: verify | Verify kubectl version | ||
assert: | ||
that: "'{{ version }}' in kubectl_client_version.stdout" | ||
|
||
- name: verify | Get kubeadm version | ||
environment: | ||
KUBECONFIG: /home/{{ admin_user.name }}/.kube/config | ||
shell: kubeadm version -o short | ||
changed_when: false | ||
register: kubeadm_version | ||
|
||
- name: Get node version | ||
- name: verify | Verify kubeadm version | ||
assert: | ||
that: "'{{ version }}' in kubeadm_version.stdout" | ||
|
||
- name: verify | Verify node version | ||
environment: | ||
KUBECONFIG: /home/{{ admin_user.name }}/.kube/config | ||
shell: kubectl get nodes {{ inventory_hostname }} -o wide | awk '{print $2" "$5}' | ||
changed_when: false | ||
register: get_node_status | ||
until: version in get_node_status.stdout | ||
retries: 30 # 1min | ||
delay: 2 | ||
|
||
- name: Verify cluster version | ||
assert: | ||
that: "'{{ version }}' in kubectl_cluster_version.stdout" | ||
|
||
- name: Verify kubectl version | ||
assert: | ||
that: "'{{ version }}' in kubectl_client_version.stdout" | ||
|
||
- name: Verify kubeadm version | ||
assert: | ||
that: "'{{ version }}' in kubeadm_version.stdout" | ||
|
||
- name: Verify node version and status | ||
- name: verify | Verify node status | ||
assert: | ||
that: | ||
- "'{{ version }}' in get_node_status.stdout" | ||
- "'Ready' in get_node_status.stdout" | ||
that: "'Ready' in get_node_status.stdout" |
Oops, something went wrong.