Merge pull request #28794 from fejta/auth

Do not depend on metadata server for auth
This commit is contained in:
Maisem Ali 2016-07-11 13:25:35 -07:00 committed by GitHub
commit fa663e3f63

View File

@ -226,7 +226,7 @@ fi
if [[ -f "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
echo 'Activating service account...' # No harm in doing this multiple times.
gcloud auth activate-service-account --key-file="${KUBEKINS_SERVICE_ACCOUNT_FILE}"
export GCE_SERVICE_ACCOUNT=$(gcloud auth list 2> /dev/null | grep active | cut -f3 -d' ')
unset GCE_SERVICE_ACCOUNT # Use checked in credentials, not the metadata server
unset KUBEKINS_SERVICE_ACCOUNT_FILE
elif [[ -n "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
echo "ERROR: cannot access service account file at: ${KUBEKINS_SERVICE_ACCOUNT_FILE}"