From 225feef83cfc079275315b4b52d56c9fd9efc656 Mon Sep 17 00:00:00 2001 From: IWAMOTO Toshihiro Date: Thu, 31 Jan 2019 16:49:04 +0900 Subject: [PATCH] Properly initialize CI cluster credential It has been using the cluster where argo ran --- test/scripts/run-tests.sh | 18 +++--------------- test/scripts/unit-test.sh | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/test/scripts/run-tests.sh b/test/scripts/run-tests.sh index e1720ef8194..315188503e5 100755 --- a/test/scripts/run-tests.sh +++ b/test/scripts/run-tests.sh @@ -39,21 +39,9 @@ echo "CLUSTER_NAME: ${CLUSTER_NAME}" echo "ZONE: ${GCP_ZONE}" echo "PROJECT: ${GCP_PROJECT}" -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clusterCaCertificate)'| base64 -d > ca.pem - -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clientCertificate)' | base64 -d > client.pem - -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clientKey)' | base64 -d > key.rsa - -kubectl config set-credentials temp-admin --username=admin --client-certificate=./client.pem --client-key=./key.rsa -kubectl config set-context temp-context --cluster=$(kubectl config get-clusters | grep ${CLUSTER_NAME}) --user=temp-admin -kubectl config use-context temp-context +gcloud --project ${PROJECT} container clusters get-credentials ${CLUSTER_NAME} \ + --zone ${ZONE} +kubectl config set-context $(kubectl config current-context) --namespace=default #This is required. But I don't know why. VERSION=${VERSION/%?/} diff --git a/test/scripts/unit-test.sh b/test/scripts/unit-test.sh index 5e6397d0f73..a169d09a9ae 100755 --- a/test/scripts/unit-test.sh +++ b/test/scripts/unit-test.sh @@ -34,21 +34,9 @@ gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS echo "Configuring kubectl" -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clusterCaCertificate)'| base64 -d > ca.pem - -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clientCertificate)' | base64 -d > client.pem - -gcloud container clusters describe ${CLUSTER_NAME} \ - --zone ${ZONE} \ - --format 'value(masterAuth.clientKey)' | base64 -d > key.rsa - -kubectl config set-credentials temp-admin --username=admin --client-certificate=./client.pem --client-key=./key.rsa -kubectl config set-context temp-context --cluster=$(kubectl config get-clusters | grep ${CLUSTER_NAME}) --user=temp-admin -kubectl config use-context temp-context +gcloud --project ${PROJECT} container clusters get-credentials ${CLUSTER_NAME} \ + --zone ${ZONE} +kubectl config set-context $(kubectl config current-context) --namespace=default kubectl apply -f - <