Commit b7e59dc 1 parent e7f70e4 commit b7e59dc Copy full SHA for b7e59dc
File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+
4
+ # 1) Set KUBECONFIG for spoke
5
+ export KUBECONFIG=/root/spoke/zt-sno1/kubeconfig-zt-sno1.yaml
6
+
7
+
8
+ # 2) Set variables
9
+ VERSIONS=' 4.11.44 4.12.23 4.13.5 4.14.0-ec.3'
10
+
11
+
12
+ # 3) Start upgrade procedure
13
+ for spoke_version in ${VERSIONS} ; do
14
+ echo " Upgrade towards ${spoke_version} started at: $( date) "
15
+ start=$( date)
16
+
17
+ # 3.2) pause machine config pools
18
+ oc patch mcp/master --patch ' {"spec":{"paused":false}}' --type=merge
19
+ oc patch mcp/worker --patch ' {"spec":{"paused":false}}' --type=merge
20
+
21
+ # 3.3) trigger upgrade operation
22
+ oc adm upgrade --to=" ${spoke_version} " --force
23
+
24
+ # 3.4) add label to allow upgrade to continue
25
+ oc label mcp/master operator.machineconfiguration.openshift.io/required-for-upgrade-
26
+
27
+ # 3.5) watch upgrade procedure
28
+ while true ;
29
+ do
30
+ # 3.5.1) watch BMC for node reboots
31
+ node_status=$( curl -sLk -H ' OData-Version: 4.0' -H ' Content-Type: application/json; charset=utf-8' -u < BMC_USER> :< BMC_PASS> ' https://<BMC_ADDRESS>/redfish/v1/Chassis/Self' | jq -r .PowerState)
32
+ if [ " ${node_status} " = " Off" ]
33
+ then
34
+ echo " Node started a reboot at ${start} "
35
+ fi
36
+
37
+ # 3.5.2) watch CVO for cluster upgrades
38
+ cvo_status=$( oc get clusterversion version --no-headers | awk -v version=" ${spoke_version} " ' { if($2==version) print "Upgrade finished"; else print}' ) ; echo " ${cvo_status} "
39
+ if [ " ${cvo_status} " = " Upgrade finished" ]
40
+ then
41
+ stop=$( date)
42
+ break
43
+ fi
44
+
45
+ sleep 25
46
+ done
47
+ echo " Upgrade to version ${spoke_version} started at ${start} and finished at ${stop} "
48
+
49
+ done
You can’t perform that action at this time.
0 commit comments