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 desc: Upgrade Talos on a node
dir: '{{.KUBERNETES_DIR}}/bootstrap/talos' dir: '{{.KUBERNETES_DIR}}/bootstrap/talos'
cmds: 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 - talosctl --nodes {{.NODE}} health --wait-timeout=10m --server=false
vars: vars:
MODE: '{{.MODE | default "default"}}' MODE: '{{.MODE | default "default"}}'
TALOS_SCEMATIC_ID:
sh: talosctl get nodeannotationspecs --nodes {{.NODE}} -o jsonpath='{.spec.value}'
requires: requires:
vars: ['NODE', 'IMAGE'] vars: ['NODE', 'VERSION']
preconditions: preconditions:
- msg: Missing talosconfig - msg: Missing talosconfig
sh: test -f {{.TALOSCONFIG}} sh: test -f {{.TALOSCONFIG}}
@@ -53,6 +55,9 @@ tasks:
sh: talosctl config info &>/dev/null sh: talosctl config info &>/dev/null
- msg: Node not found - msg: Node not found
sh: talosctl --nodes {{.NODE}} get machineconfig &>/dev/null 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: upgrade-k8s:
desc: Upgrade Kubernetes across the cluster desc: Upgrade Kubernetes across the cluster
@@ -69,6 +74,9 @@ tasks:
sh: talosctl --nodes {{.NODE}} get machineconfig &>/dev/null sh: talosctl --nodes {{.NODE}} get machineconfig &>/dev/null
- msg: Node not controller - msg: Node not controller
sh: talosctl config info --output json | jq --exit-status '.endpoints | index("{{.NODE}}") != null' &>/dev/null 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: nuke:
desc: Resets nodes back to maintenance mode desc: Resets nodes back to maintenance mode
+2 -2
View File
@@ -359,9 +359,9 @@ Resolving problems that you have could take some tweaking of your YAML manifests
```sh ```sh
# Upgrade Talos to a newer version # Upgrade Talos to a newer version
# NOTE: This needs to be run once on every node # NOTE: This needs to be run once on every node
task talos:upgrade NODE=? IMAGE=? task talos:upgrade NODE=? VERSION=?
# e.g. # e.g.
# task talos:upgrade NODE=192.168.42.10 IMAGE=factory.talos.dev/installer/${schematic_id}:v1.7.4 # task talos:upgrade NODE=192.168.42.10 VERSION=v1.8.1
``` ```
```sh ```sh