Last active
May 30, 2024 12:12
-
-
Save sj14/c30ed83c52d30c1b3a8f221a168bee0a to your computer and use it in GitHub Desktop.
Talos upgrade script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o nounset # fail if an unset variable is used | |
set -o errexit # fail if a command exits with non-zero | |
set -o pipefail # fail if a command in a pipe fails | |
readonly TALOS_VESION=1.7.2 | |
readonly K8S_VERSION=1.30.1 | |
readonly CLUSTERS=( <cluster-1> <cluster-2> ) # <-- ADJUST ME | |
OS=$(uname -s | tr "[:upper:]" "[:lower:]") | |
ARCHITECTURE="" | |
case $(uname -m) in | |
x86_64) ARCHITECTURE="amd64" ;; | |
esac | |
# Download corresponding talosctl | |
# TODO: add version check (talosctl version -lt $TALOS_VERSION...) | |
curl -Lo /usr/local/bin/talosctl \ | |
https://github.com/siderolabs/talos/releases/download/v$TALOS_VESION/talosctl-$OS-$ARCHITECTURE | |
chmod +x /usr/local/bin/talosctl | |
# Upgrade clusters | |
# TODO: version check talos,k8s vesion | |
for CLUSTER in "${CLUSTERS[@]}"; do | |
echo "--- upgrading Talos on: $CLUSTER ---" | |
talosctl upgrade --image ghcr.io/siderolabs/installer:v$TALOS_VESION --wait --preserve --context "$CLUSTER" | |
echo | |
echo "--- upgrading Kubernetes on: $CLUSTER ---" | |
talosctl upgrade-k8s --to $K8S_VERSION --context "$CLUSTER" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment