fix auth in gce/upgrade.sh

This commit is contained in:
Mike Danese 2015-06-09 22:33:34 -07:00
parent 0dfb681ba5
commit 1a6842e06e

View File

@ -60,8 +60,8 @@ function usage() {
function upgrade-master() { function upgrade-master() {
echo "== Upgrading master to '${SERVER_BINARY_TAR_URL}'. Do not interrupt, deleting master instance. ==" echo "== Upgrading master to '${SERVER_BINARY_TAR_URL}'. Do not interrupt, deleting master instance. =="
get-password get-kubeconfig-basicauth
get-bearer-token get-kubeconfig-bearertoken
detect-master detect-master
@ -80,7 +80,17 @@ function upgrade-master() {
function wait-for-master() { function wait-for-master() {
echo "== Waiting for new master to respond to API requests ==" echo "== Waiting for new master to respond to API requests =="
until curl --insecure --user "${KUBE_USER}:${KUBE_PASSWORD}" --max-time 5 \ local curl_auth_arg
if [[ -n ${KUBE_BEARER_TOKEN:-} ]]; then
curl_auth_arg=(-H "Authorization: Bearer ${KUBE_BEARER_TOKEN}")
elif [[ -n ${KUBE_PASSWORD:-} ]]; then
curl_auth_arg=(--user "${KUBE_USER}:${KUBE_PASSWORD}")
else
echo "can't get auth credentials for the current master"
exit 1
fi
until curl --insecure "${curl_auth_arg[@]}" --max-time 5 \
--fail --output /dev/null --silent "https://${KUBE_MASTER_IP}/healthz"; do --fail --output /dev/null --silent "https://${KUBE_MASTER_IP}/healthz"; do
printf "." printf "."
sleep 2 sleep 2