Skip to content

Commit

Permalink
feat: change talos upgrade task to support version instead of image (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
onedr0p authored Oct 11, 2024
1 parent df74ade commit 636d2fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .taskfiles/Talos/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,24 @@ 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}}
- msg: Unable to retrieve Talos config
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ Resolving problems that you have could take some tweaking of your YAML manifests
```sh
# Upgrade Talos to a newer version
# NOTE: This needs to be run once on every node
task talos:upgrade NODE=? IMAGE=?
task talos:upgrade NODE=? VERSION=?
# 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
Expand Down

0 comments on commit 636d2fd

Please sign in to comment.