Created
September 3, 2021 08:28
-
-
Save reschenburgIDBS/6cecad636237ffa2f2eeeb5939c56b5f to your computer and use it in GitHub Desktop.
patch tiller image to new ghcr registry
This file contains 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 | |
# stashing original context | |
OLD_CONTEXT=$(kubectl config current-context) | |
if [ -z "$1" ]; then | |
NEW_CONTEXT=$(kubectl config get-contexts --output=name | fzf) | |
else | |
NEW_CONTEXT="$1" | |
fi | |
echo "updating tiller image on cluster ${NEW_CONTEXT}" | |
kubectl config use-context "$NEW_CONTEXT" | |
printf "old" | |
kubectl describe deployment/tiller-deploy --namespace=kube-system | grep Image | |
HELM_VERSION=$(kubectl get deployment/tiller-deploy -o jsonpath='{.spec.template.spec.containers[0].image}' --namespace kube-system | cut -d ":" -f2) | |
#check it exists first by pulling locally | |
docker pull -q ghcr.io/helm/tiller:${HELM_VERSION} && kubectl set image deployment/tiller-deploy tiller=ghcr.io/helm/tiller:${HELM_VERSION} --namespace=kube-system | |
printf "new" | |
kubectl describe deployment/tiller-deploy --namespace=kube-system | grep Image | |
# restoring original context | |
kubectl config use-context "$OLD_CONTEXT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment