diff --git a/cluster/gke/config-test.sh b/cluster/gke/config-test.sh index 33d641eb33abd..62bb71ccdb03d 100644 --- a/cluster/gke/config-test.sh +++ b/cluster/gke/config-test.sh @@ -17,6 +17,8 @@ # The following are test-specific settings. CLUSTER_NAME="${CLUSTER_NAME:-${USER}-gke-e2e}" NETWORK=${KUBE_GKE_NETWORK:-e2e} +MINION_TAG="k8s-${CLUSTER_NAME}-node" + # For ease of maintenance, extract any pieces that do not vary between default # and test in a common config. diff --git a/hack/e2e-suite/guestbook.sh b/hack/e2e-suite/guestbook.sh index 3226e237f2895..9b7cacf43621a 100755 --- a/hack/e2e-suite/guestbook.sh +++ b/hack/e2e-suite/guestbook.sh @@ -37,11 +37,13 @@ GUESTBOOK="${KUBE_ROOT}/examples/guestbook" function teardown() { ${KUBECTL} stop -f "${GUESTBOOK}" - if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then + if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then local REGION=${ZONE%-*} - gcloud compute forwarding-rules delete -q --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true - gcloud compute target-pools delete -q --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true - gcloud compute firewall-rules delete guestbook-e2e-minion-8000 -q || true + if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then + gcloud compute forwarding-rules delete -q --project="${PROJECT}" --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true + gcloud compute target-pools delete -q --project="${PROJECT}" --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true + fi + gcloud compute firewall-rules delete guestbook-e2e-minion-8000 -q --project="${PROJECT}" || true fi } @@ -84,8 +86,8 @@ ${KUBECTL} create -f "${GUESTBOOK}" # Verify that all pods are running wait_for_running -if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then - gcloud compute firewall-rules create --allow=tcp:8000 --network="${NETWORK}" --target-tags="${MINION_TAG}" guestbook-e2e-minion-8000 +if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then + gcloud compute firewall-rules create --project="${PROJECT}" --allow=tcp:8000 --network="${NETWORK}" --target-tags="${MINION_TAG}" guestbook-e2e-minion-8000 fi # Add a new entry to the guestbook and verify that it was remembered