diff --git a/scripts/library.sh b/scripts/library.sh index efac7318b01..d9a2e0bdbab 100755 --- a/scripts/library.sh +++ b/scripts/library.sh @@ -164,10 +164,16 @@ function acquire_cluster_admin_role() { # might not have the necessary permission. local password=$(gcloud --format="value(masterAuth.password)" \ container clusters describe $2 --zone=$3) - kubectl config set-credentials cluster-admin --username=admin --password=${password} + kubectl config set-credentials cluster-admin \ + --username=admin --password=${password} + kubectl config set-context $(kubectl config current-context) \ + --user=cluster-admin kubectl create clusterrolebinding cluster-admin-binding \ --clusterrole=cluster-admin \ --user=$1 + # Reset back to the default account + gcloud container clusters get-credentials \ + $2 --zone=$3 --project $(gcloud config get-value project) } # Runs a go test and generate a junit summary through bazel.