Automatically open NodePort firewall rules for e2e tests

pull/6/head
Justin Santa Barbara 2015-05-22 22:39:40 -04:00
parent c68e4163fe
commit ae80ed53cf
2 changed files with 23 additions and 1 deletions

View File

@ -923,6 +923,15 @@ function test-setup {
--allow tcp:80 tcp:8080 \ --allow tcp:80 tcp:8080 \
--network "${NETWORK}" \ --network "${NETWORK}" \
"${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" "${MINION_TAG}-${INSTANCE_PREFIX}-http-alt"
# Open up the NodePort range
# TODO(justinsb): Move to main setup, if we decide whether we want to do this by default.
gcloud compute firewall-rules create \
--project "${PROJECT}" \
--target-tags "${MINION_TAG}" \
--allow tcp:30000-32767,udp:30000-32767 \
--network "${NETWORK}" \
"${MINION_TAG}-${INSTANCE_PREFIX}-nodeports"
} }
# Execute after running tests to perform any required clean-up. This is called # Execute after running tests to perform any required clean-up. This is called
@ -934,6 +943,10 @@ function test-teardown {
--project "${PROJECT}" \ --project "${PROJECT}" \
--quiet \ --quiet \
"${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" || true "${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" || true
gcloud compute firewall-rules delete \
--project "${PROJECT}" \
--quiet \
"${MINION_TAG}-${INSTANCE_PREFIX}-nodeports" || true
"${KUBE_ROOT}/cluster/kube-down.sh" "${KUBE_ROOT}/cluster/kube-down.sh"
} }

View File

@ -171,6 +171,13 @@ function test-setup() {
--project "${PROJECT}" \ --project "${PROJECT}" \
--target-tags "${MINION_TAG}" \ --target-tags "${MINION_TAG}" \
--network="${NETWORK}" --network="${NETWORK}"
"${GCLOUD}" compute firewall-rules create \
"${MINION_TAG}-${USER}-nodeports" \
--allow tcp:30000-32767,udp:30000-32767 \
--project "${PROJECT}" \
--target-tags "${MINION_TAG}" \
--network="${NETWORK}"
} }
# Ensure that we have a password created for validating to the master. # Ensure that we have a password created for validating to the master.
@ -285,9 +292,11 @@ function test-teardown() {
MINION_TAG="k8s-${CLUSTER_NAME}-node" MINION_TAG="k8s-${CLUSTER_NAME}-node"
# First, remove anything we did with test-setup (currently, the firewall). # First, remove anything we did with test-setup (currently, the firewall).
# NOTE: Keep in sync with name above in test-setup. # NOTE: Keep in sync with names above in test-setup.
"${GCLOUD}" compute firewall-rules delete "${MINION_TAG}-${USER}-http-alt" \ "${GCLOUD}" compute firewall-rules delete "${MINION_TAG}-${USER}-http-alt" \
--project="${PROJECT}" || true --project="${PROJECT}" || true
"${GCLOUD}" compute firewall-rules delete "${MINION_TAG}-${USER}-nodeports" \
--project="${PROJECT}" || true
# Then actually turn down the cluster. # Then actually turn down the cluster.
"${KUBE_ROOT}/cluster/kube-down.sh" "${KUBE_ROOT}/cluster/kube-down.sh"