Skip to content

Commit

Permalink
uograde-script
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpeople committed Oct 18, 2024
1 parent b5d503d commit 622bff4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions scripts/upgrade-everything.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
CONFIGFILE="${BASEDIR}/kubernetes/bootstrap/talos/talconfig.yaml"

[ -f ${CONFIGFILE} ] || exit 1

controller=192.168.13.10
talosImageURL=$(grep talosImageURL ${BASEDIR}/kubernetes/bootstrap/talos/talconfig.yaml | awk '{ print $2 }' | head -1)
k8sVersion=$(grep kubernetesVersion ${BASEDIR}/kubernetes/bootstrap/talos/talconfig.yaml | awk '{ print $2 }')
talosVersion=$(grep talosVersion ${BASEDIR}/kubernetes/bootstrap/talos/talconfig.yaml | awk '{ print $2 }')
image=${talosImageURL}:${talosVersion}
to=${k8sVersion}
node=$(kubectl get nodes -o wide --no-headers | grep -v $talosVersion | awk '{ print $6 }' | tr '\n' ',' | sed '$s/,$/\n/')

[ ! -z "$talosImageURL" ] || exit 1
[ ! -z "$k8sVersion" ] || exit 1
[ ! -z "$talosVersion" ] || exit 1

echo Updating Talos to ${talosVersion} if neccessary in 10s
sleep 10

task talos:upgrade

nodesWithOldReleaseShouldBe=0
nodesWithOldReleaseAre=$(kubectl get nodes -o wide --no-headers | grep -v ${talosVersion} | wc -l)

if [[ $nodesWithOldReleaseAre -ne $nodesWithOldReleaseShouldBe ]]
then
echo "Not all nodes have been upgraded. Exiting now"
exit 1
fi

echo Updating Kubernetes to ${k8sVersion} if neccessary in 10s
sleep 10

nodesWithOldReleaseAre=$(kubectl get nodes -o wide --no-headers | grep -v ${k8sVersion} | wc -l)
if [[ $nodesWithOldReleaseAre -eq $nodesWithOldReleaseShouldBe ]]
then
echo "Not all nodes have been upgraded. Exiting now"
exit 1
fi

task talos:upgrade-k8s

0 comments on commit 622bff4

Please sign in to comment.