Commit 03fb11c
committed
fix(talosctl): reboot after a failed drain during upgrade
talosctl upgrade writes the new installer image to disk before it
drains the Kubernetes node and reboots into it. When the drain step
failed - for example because the apiserver is unreachable or the
cluster is not yet bootstrapped - the command returned early, before
the reboot. That left the upgrade half-applied: the new image was
staged on disk while the node kept running the old version, with no
reboot to activate it and no signal to the operator, since the earlier
progress output already read "upgrade completed". The next unrelated
reboot would then silently boot into the staged image.
Once the image is committed to disk, aborting before the reboot is the
worst outcome. The drain is a best-effort courtesy and must not strand
the upgrade, so warn about the failed drain and continue to the reboot
so the staged image is actually applied.
Draining cordons each node before evicting its pods, so a drain that
fails after the cordon leaves the node unschedulable. drainNodes threw
away the collected node map on error, so the deferred uncordon was
skipped: the node rebooted into the new version but stayed
SchedulingDisabled, and with the reboot succeeding the command still
exited 0 - an orphaned cordon with no error surfaced. Return the
partial map on error so the existing uncordon step restores the node
to schedulable once it is Ready again.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>1 parent ea95578 commit 03fb11c
2 files changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| |||
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
106 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
0 commit comments