mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Fix guestbook.sh to make it work on GKE.
This commit is contained in:
parent
ef758881d1
commit
5b77149461
@ -17,6 +17,8 @@
|
|||||||
# The following are test-specific settings.
|
# The following are test-specific settings.
|
||||||
CLUSTER_NAME="${CLUSTER_NAME:-${USER}-gke-e2e}"
|
CLUSTER_NAME="${CLUSTER_NAME:-${USER}-gke-e2e}"
|
||||||
NETWORK=${KUBE_GKE_NETWORK:-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
|
# For ease of maintenance, extract any pieces that do not vary between default
|
||||||
# and test in a common config.
|
# and test in a common config.
|
||||||
|
@ -37,11 +37,13 @@ GUESTBOOK="${KUBE_ROOT}/examples/guestbook"
|
|||||||
|
|
||||||
function teardown() {
|
function teardown() {
|
||||||
${KUBECTL} stop -f "${GUESTBOOK}"
|
${KUBECTL} stop -f "${GUESTBOOK}"
|
||||||
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
|
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
|
||||||
local REGION=${ZONE%-*}
|
local REGION=${ZONE%-*}
|
||||||
gcloud compute forwarding-rules delete -q --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true
|
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
|
||||||
gcloud compute target-pools delete -q --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true
|
gcloud compute forwarding-rules delete -q --project="${PROJECT}" --region ${REGION} "${INSTANCE_PREFIX}-default-frontend" || true
|
||||||
gcloud compute firewall-rules delete guestbook-e2e-minion-8000 -q || 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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +86,8 @@ ${KUBECTL} create -f "${GUESTBOOK}"
|
|||||||
# Verify that all pods are running
|
# Verify that all pods are running
|
||||||
wait_for_running
|
wait_for_running
|
||||||
|
|
||||||
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
|
if [[ "${KUBERNETES_PROVIDER}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]]; then
|
||||||
gcloud compute firewall-rules create --allow=tcp:8000 --network="${NETWORK}" --target-tags="${MINION_TAG}" guestbook-e2e-minion-8000
|
gcloud compute firewall-rules create --project="${PROJECT}" --allow=tcp:8000 --network="${NETWORK}" --target-tags="${MINION_TAG}" guestbook-e2e-minion-8000
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add a new entry to the guestbook and verify that it was remembered
|
# Add a new entry to the guestbook and verify that it was remembered
|
||||||
|
Loading…
Reference in New Issue
Block a user