-
Notifications
You must be signed in to change notification settings - Fork 0
/
rke-update-sles.yaml
62 lines (61 loc) · 1.98 KB
/
rke-update-sles.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
apiVersion: v1
kind: Secret
metadata:
name: rke-update-sles-script
namespace: rke-update-sles
type: Opaque
stringData:
rke-update-sles.sh: |
#!/bin/bash
# set -e
# update the repos connected to the server
zypper ref
# install all available updates
zypper patch --with-update --allow-vendor-change -y
# we have to update a second time in case the update stack is updated
zypper patch --with-update --allow-vendor-change -y
# zypper up -y
# check if zypper says the server requires a reboot
# zypper gives back "0" if no reboot is needed
zypper needs-rebooting; NEEDS_REBOOTING=$?
# check if any service needs a restart - we also reboot if a service needs restarting
# the following is "1" if no service restart is required
zypper ps|grep "You may wish to restart these processes"; ZYPPER_PS=$?
# output for the logs
echo "NEEDS_REBOOTING = $NEEDS_REBOOTING"
echo "ZYPPER_PS = $ZYPPER_PS"
# check if reboot is needed and only reboot if zypper ps does show that a process restart is needed" and
if [ ! "$ZYPPER_PS" == "0" ] && [ "$NEEDS_REBOOTING" == "0" ]; then
echo "No reboot required"
exit 0
else
echo "Reboot required so initiating the reboot, now!"
# see if this helps against "unknown" pods
#reboot
shutdown -r +1
fi
---
apiVersion: upgrade.cattle.io/v1
kind: Plan
metadata:
name: rke-update-sles
namespace: rke-update-sles
spec:
concurrency: 1
tolerations:
- {key: CriticalAddonsOnly, operator: Exists}
nodeSelector:
matchExpressions:
- {key: skip-rke-update-sles, operator: DoesNotExist}
serviceAccountName: rke-update-sles
secrets:
- name: rke-update-sles-script
path: /host/run/system-upgrade/secrets/update
drain:
force: false
version: sles-2024-07-15-14
upgrade:
image: registry.suse.com/bci/bci-base:15.6.47.5.13
command: ["chroot", "/host"]
args: ["sh", "/run/system-upgrade/secrets/update/rke-update-sles.sh"]