2020-06-18 14:49:13 +07:00
|
|
|
#!/usr/bin/env bash
|
2019-11-02 21:32:58 +07:00
|
|
|
|
2019-11-16 22:22:10 +07:00
|
|
|
# Retries a command on failure.
|
|
|
|
# $1 - the max number of attempts
|
|
|
|
# $2... - the command to run
|
|
|
|
|
|
|
|
retry() {
|
|
|
|
local -r -i max_attempts="$1"; shift
|
|
|
|
local -r cmd="$@"
|
|
|
|
local -i attempt_num=1
|
|
|
|
until $cmd
|
|
|
|
do
|
|
|
|
if ((attempt_num==max_attempts))
|
|
|
|
then
|
|
|
|
echo "Attempt $attempt_num failed and there are no more attempts left!"
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
echo "Attempt $attempt_num failed! Trying again in 10 seconds..."
|
|
|
|
sleep 10
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2019-11-02 21:32:58 +07:00
|
|
|
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
|
2019-11-16 22:22:10 +07:00
|
|
|
retry 10 kubectl port-forward --address 0.0.0.0 -n kubernetes-dashboard service/kubernetes-dashboard 443:443
|