@@ -416,15 +416,22 @@ talosctl gen config "${cluster_name}" "${k8s_endpoint}" --with-secrets=secrets.y
416
416
# Screen: Select upgrade option
417
417
if [ " $OP " = upgrade ]; then
418
418
upgrade_option=$( dialog --keep-tite --title talos-bootstrap --menu " Select upgrade option" 0 0 0 \
419
- 1 " apply config and perform upgrade" \
420
- 2 " apply config and perform upgrade (with preserve option)" \
421
- 3 " apply config on live and skip upgrade" 3>&1 1>&2 2>&3 ) || exit 0
419
+ 1 " apply config on live and skip upgrade" \
420
+ 2 " apply config and perform upgrade (mode: default)" \
421
+ 3 " apply config and perform upgrade (mode: powercycle)" \
422
+ 4 " apply config and perform upgrade with force (mode: default)" \
423
+ 5 " apply config and perform upgrade with force (mode: powercycle)" \
424
+ 6 " apply config and schedule upgrade to perform it after a reboot" 3>&1 1>&2 2>&3 ) || exit 0
422
425
423
426
should_upgrade=1
427
+ upgrade_opt=" "
424
428
case ${upgrade_option} in
425
- 1) preserve_opt=" --preserve" ;;
426
- 2) preserve_opt=" " ;;
427
- 3) should_upgrade=" 0" ;;
429
+ 1) should_upgrade=0 ;;
430
+ 3) upgrade_opt=" --reboot-mode default" ;;
431
+ 3) upgrade_opt=" --reboot-mode powercycle" ;;
432
+ 4) upgrade_opt=" --force --reboot-mode default" ;;
433
+ 4) upgrade_opt=" --force --reboot-mode powercycle" ;;
434
+ 6) upgrade_opt=" --stage" ;;
428
435
esac
429
436
fi
430
437
@@ -443,7 +450,7 @@ talosctl apply -e "${bootstrap_ip}" -n "${bootstrap_ip}" -f "${role}.yaml" ${OPT
443
450
if [ " $OP " = upgrade ] && [ " ${should_upgrade} " = 1 ]; then
444
451
image=$( talosctl -e " ${node} " -n " ${node} " get machineconfig -o jsonpath=" {.spec.machine.install.image}" ${OPTS} )
445
452
printf " %s\nXXX\n%s\n%s\nXXX\n" " 10" " Scheduling upgrade..." " (image: $image )"
446
- talosctl -e " ${node} " -n " ${node} " upgrade ${preserve_opt } -i " ${image} " --wait=false ${OPTS} || exit $?
453
+ talosctl -e " ${node} " -n " ${node} " upgrade ${upgrade_opt } -i " ${image} " --wait=false ${OPTS} || exit $?
447
454
fi
448
455
449
456
if [ " $OP " = upgrade ]; then
@@ -460,7 +467,7 @@ talosctl apply -e "${bootstrap_ip}" -n "${bootstrap_ip}" -f "${role}.yaml" ${OPT
460
467
sleep 0.2
461
468
if [ " ${new_is_pingable} " = 0 ]; then
462
469
if [ " ${old_is_up} " = 1 ]; then
463
- status=$( timeout 1 talosctl --talosconfig=talosconfig -e " ${node} " -n " ${node} " get machinestatus ${OPTS} -o jsonpath={.spec.stage}) 2>&1
470
+ status=$( timeout 3 talosctl --talosconfig=talosconfig -e " ${node} " -n " ${node} " get machinestatus ${OPTS} -o jsonpath={.spec.stage} 2> /dev/null )
464
471
if [ $? = 124 ]; then
465
472
old_is_up=0
466
473
fi
@@ -482,7 +489,7 @@ talosctl apply -e "${bootstrap_ip}" -n "${bootstrap_ip}" -f "${role}.yaml" ${OPT
482
489
fi
483
490
fi
484
491
485
- if timeout 1 talosctl --talosconfig=talosconfig -e " ${node} " -n " ${node} " get machinestatus > /dev/null 2>&1 ; then
492
+ if timeout 3 talosctl --talosconfig=talosconfig -e " ${node} " -n " ${node} " get machinestatus > /dev/null 2>&1 ; then
486
493
new_is_up=1
487
494
fi
488
495
0 commit comments