feat: change talos upgrade task to support version instead of image (#1603)

* feat: change talos upgrade task to support version instead of image

* Update README.md

* Update Taskfile.yaml

* Update Taskfile.yaml

* Update Taskfile.yaml

* Update Taskfile.yaml
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-10-11 07:35:08 -04:00
1 parent df74ade69a
commit 636d2fd840
2 files changed
+12 -4

No files matched your search

+10 -2
View File
@@ -40,12 +40,14 @@ tasks:
desc: Upgrade Talos on a node
dir: '{{.KUBERNETES_DIR}}/bootstrap/talos'
cmds:
- talosctl --nodes {{.NODE}} upgrade --image {{.IMAGE}} --timeout=10m --reboot-mode={{.MODE}}
- talosctl --nodes {{.NODE}} upgrade --image="factory.talos.dev/installer/{{.TALOS_SCHEMATIC_ID}}:{{.VERSION}}" --timeout=10m --reboot-mode={{.MODE}}
- talosctl --nodes {{.NODE}} health --wait-timeout=10m --server=false
vars:
MODE: '{{.MODE | default "default"}}'
TALOS_SCEMATIC_ID:
sh: talosctl get nodeannotationspecs --nodes {{.NODE}} -o jsonpath='{.spec.value}'
requires:
vars: ['NODE', 'IMAGE']
vars: ['NODE', 'VERSION']
preconditions:
- msg: Missing talosconfig
sh: test -f {{.TALOSCONFIG}}
@@ -53,6 +55,9 @@ tasks:
sh: talosctl config info &>/dev/null
- msg: Node not found
sh: talosctl --nodes {{.NODE}} get machineconfig &>/dev/null
- msg: Upstream Talos version not found
sh: |
curl -fsSL -H "Authorization: Bearer $(curl -fsSL 'https://ghcr.io/token?scope=repository:siderolabs/talos:pull' | jq -r '.token')" https://ghcr.io/v2/siderolabs/talos/manifests/{{.VERSION}} &>/dev/null
upgrade-k8s:
desc: Upgrade Kubernetes across the cluster
@@ -69,6 +74,9 @@ tasks:
sh: talosctl --nodes {{.NODE}} get machineconfig &>/dev/null
- msg: Node not controller
sh: talosctl config info --output json | jq --exit-status '.endpoints | index("{{.NODE}}") != null' &>/dev/null
- msg: Upstream Kubernetes version not found
sh: |
curl -fsSL -H "Authorization: Bearer $(curl -fsSL 'https://ghcr.io/token?scope=repository:siderolabs/kubelet:pull' | jq -r '.token')" https://ghcr.io/v2/siderolabs/kubelet/manifests/{{.VERSION}} &>/dev/null
nuke:
desc: Resets nodes back to maintenance mode