removed virtctl, fixed stern

This commit is contained in:
Jonas Forsberg 2022-09-30 10:51:55 +02:00
parent bb0f3ffc7b
commit 60584cbc68

View File

@ -1,15 +1,14 @@
function upgrade_tools(){ function upgrade_tools(){
new_log "Install client tools" echo "Install/Upgrade client tools"
echo "- kubectl" echo "- kubectl"
echo "- helm" echo "- helm"
echo "- stern" echo "- stern"
echo "- virtctl"
if asktobreak; then if asktobreak; then
return return
fi fi
set +e
echo "---- kubectl ----" echo "---- kubectl ----"
local CURRENT_PWD="$(pwd)"
cd $HOME/bin cd $HOME/bin
if [[ -f kubectl ]]; then if [[ -f kubectl ]]; then
KUBECTL_CURRENT=$(./kubectl version --client 2> /dev/null| sed -n 's/.* GitVersion:"\(v[0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p') KUBECTL_CURRENT=$(./kubectl version --client 2> /dev/null| sed -n 's/.* GitVersion:"\(v[0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p')
@ -53,24 +52,9 @@ function upgrade_tools(){
if [[ "$STERN_CURRENT" != "$STERN_STABLE" ]]; then if [[ "$STERN_CURRENT" != "$STERN_STABLE" ]]; then
echo "updating to $STERN_STABLE" echo "updating to $STERN_STABLE"
curl -LO https://github.com/stern/stern/releases/download/$STERN_STABLE/stern_${STERN_STABLE:1}_linux_amd64.tar.gz curl -LO https://github.com/stern/stern/releases/download/$STERN_STABLE/stern_${STERN_STABLE:1}_linux_amd64.tar.gz
tar xvzf stern_${STERN_STABLE:1}_linux_amd64.tar.gz --strip-components=1 stern_${STERN_STABLE:1}_linux_amd64/stern tar xvzf stern_${STERN_STABLE:1}_linux_amd64.tar.gz stern
rm stern_${STERN_STABLE:1}_linux_amd64.tar.gz rm stern_${STERN_STABLE:1}_linux_amd64.tar.gz
fi fi
echo "" echo ""
echo "---- virtctl ----" cd "$CURRENT_PWD"
if [[ -f stern ]]; then
VIRTCTL_CURRENT="$(./virtctl version --client 2> /dev/null| sed -n 's/.*GitVersion:"\(v[0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p')"
else
VIRTCTL_CURRENT="N/A"
fi
VIRTCTL_STABLE="$(curl -Ls https://github.com/kubevirt/kubevirt/releases | egrep 'href="/kubevirt/kubevirt/releases/tag/v[0-9]+.[0-9]+.[0-9]+*\"' | head -n 1 | sed -n 's/.*tag\/\(v.*\)" data.*/\1/p')"
echo "Installed version: $VIRTCTL_CURRENT"
echo "Latest stable version: $VIRTCTL_STABLE"
if [[ "$VIRTCTL_CURRENT" != "$VIRTCTL_STABLE" ]]; then
echo "updating to $VIRTCTL_STABLE"
curl -Lo virtctl https://github.com/kubevirt/kubevirt/releases/download/$VIRTCTL_STABLE/virtctl-$VIRTCTL_STABLE-linux-amd64
chmod +x ./virtctl
fi
echo ""
set -e
} }