Skip to content

examples: add SLES 16 OS patch plan with drain and conditional reboot - #503

Merged
brandond merged 1 commit into
rancher:masterfrom
gusraggio:examples-sles16-patch
Dec 1, 2026
Merged

brandond merged 1 commit into
rancher:masterfrom
gusraggio:examples-sles16-patch

Conversation

@gusraggio

Copy link
Copy Markdown
Contributor

Summary

examples/suse/sles.yaml targets SLE 15 with zypper up and does not handle reboots. This adds examples/suse/sles16-patch.yaml: a Secret with an idempotent patch script and a Plan that patches SLES 16 nodes one at a time.

  • Nodes are selected by label (patch.suse.com/pending=true), so an external patch management tool can decide which nodes to patch.
  • The node is cordoned and drained (PodDisruptionBudgets are respected), patched with zypper patch, services still using deleted libraries are restarted (except the Kubernetes runtime), and the node reboots only when zypper flags a reboot (/run/reboot-needed).
  • The script retries when zypp is locked by another process and when zypper updated itself.
  • After the reboot the job pod runs again, finds nothing to do and completes; the controller then uncordons the node and clears the label with postCompleteLabels.

Related: #282 (reboot handling) and #22 (examples per OS). Because the reboot happens inside the job and the controller only uncordons when the job completes after the reboot, the node is not uncordoned before it reboots.

Testing

system-upgrade-controller v0.21.1 (release manifests) on RKE2 v1.36.6 with SLES 16.1 nodes:

  • Reboot path (/run/reboot-needed present): node cordoned, script rebooted the node, post-boot pod completed ("node patched, no reboot needed"), node uncordoned and label set to false; 0 failed requests to a 3-replica NodePort service during the run.
  • No-reboot path: completes without reboot.
  • zypp lock held for 100 s by another process: the script retried and completed.
    Also run earlier with v0.20.1 as shipped by Rancher 2.15.4 (kernel patch applied, 0 failed requests).

Signed-off-by: Gustavo Varela gvarela@suse.com

Comment thread examples/suse/sles16-patch.yaml Outdated
patch.sh: |
#!/bin/sh
set -u
for i in 1 2 3 4 5 6 7 8 9 10; do

@brandond brandond Dec 1, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an odd way to express retrying 10 times but sure!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, you're right. I changed it to a counter loop. That is the only change; the rest of the file is the same.

The existing SUSE example targets SLE 15 with 'zypper up' and does not
handle reboots. This plan patches SLES 16 nodes one at a time: nodes are
selected by label, cordoned and drained, patched with 'zypper patch',
services using deleted libraries are restarted, and the node reboots only
when zypper flags a reboot. The script is idempotent, so the pod that runs
after the reboot completes and the controller uncordons the node and
clears the label through postCompleteLabels.

Tested with system-upgrade-controller v0.21.1 on RKE2 v1.36.6 with SLES
16.1 nodes: forced reboot path, no-reboot path, and retry while zypp is
locked by another process.

Signed-off-by: Gustavo Varela <gvarela@suse.com>
@gusraggio
gusraggio force-pushed the examples-sles16-patch branch from 1bd20bc to 0893a2d Compare December 1, 2026 19:49
@brandond
brandond merged commit a51052d into rancher:master Dec 1, 2026
3 checks passed
@gusraggio
gusraggio deleted the examples-sles16-patch branch December 1, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants