Merge pull request #30053 from fejta/gke

Automatic merge from submit-queue

Set GOOGLE_APPLICATION_CREDENTIALS after activating

https://developers.google.com/identity/protocols/application-default-credentials

We should set this explicitly as https://golang.org/pkg/os/user/#User (which the oauth libraries use: [sdk.go] - [default.go] via [CreateGCECloud]) will ignore any `$HOME` overrides.

[CreateGCECloud]: fa95788e56/test/e2e/e2e.go (L75)
[sdk.go]: fa95788e56/vendor/golang.org/x/oauth2/google/sdk.go (L165)
[default.go]: fa95788e56/vendor/golang.org/x/oauth2/google/default.go (L101)

Mitigates https://github.com/kubernetes/kubernetes/issues/28514 and related to https://github.com/kubernetes/test-infra/issues/266
This commit is contained in:
Kubernetes Submit Queue 2016-08-04 11:23:53 -07:00 committed by GitHub
commit 41abea5a96

View File

@ -258,6 +258,8 @@ 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}"
# https://developers.google.com/identity/protocols/application-default-credentials
export GOOGLE_APPLICATION_CREDENTIALS="${KUBEKINS_SERVICE_ACCOUNT_FILE}"
unset KUBEKINS_SERVICE_ACCOUNT_FILE
elif [[ -n "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
echo "ERROR: cannot access service account file at: ${KUBEKINS_SERVICE_ACCOUNT_FILE}"