From 511ec280b9cec4f6463c532104a6eb89c20e3cbc Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 24 Sep 2014 16:03:38 -0700 Subject: [PATCH] Add a new network for e2e tests, to isolate it from any other cluster. --- cluster/gce/config-test.sh | 2 +- cluster/gce/util.sh | 17 +++++++++++++++++ hack/e2e-suite/update.sh | 8 ++++++++ hack/e2e-test.sh | 10 +++++----- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 7685743b29e..5df4cfe722a 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -21,7 +21,7 @@ MINION_SIZE=g1-small NUM_MINIONS=2 # gcloud/gcutil will expand this to the latest supported image. IMAGE=backports-debian-7-wheezy -NETWORK=default +NETWORK=e2e INSTANCE_PREFIX="e2e-test-${USER}" MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master" diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 0059c19ff97..96ed50e7bfa 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -149,6 +149,23 @@ function kube-up { grep -v "^#" $(dirname $0)/templates/salt-master.sh ) > ${KUBE_TEMP}/master-start.sh + if ! gcutil getnetwork "${NETWORK}"; then + echo "Creating new network for: ${NETWORK}" + gcutil addnetwork "${NETWORK}" --range "10.240.0.0/16" + gcutil addfirewall "${NETWORK}-default-internal" \ + --norespect_terminal_width \ + --project "${PROJECT}" \ + --network "${NETWORK}" \ + --allowed_ip_sources "10.0.0.0/8" \ + --allowed "tcp:1-65535,udp:1-65535,icmp" & + gcutil addfirewall "${NETWORK}-default-ssh" \ + --norespect_terminal_width \ + --project "${PROJECT}" \ + --network "${NETWORK}" \ + --allowed_ip_sources "0.0.0.0/0" \ + --allowed "tcp:22" & + fi + echo "Starting VMs and configuring firewalls" gcutil addfirewall ${MASTER_NAME}-https \ --norespect_terminal_width \ diff --git a/hack/e2e-suite/update.sh b/hack/e2e-suite/update.sh index 8fa0cf1255e..cd59d9bc6c3 100755 --- a/hack/e2e-suite/update.sh +++ b/hack/e2e-suite/update.sh @@ -31,6 +31,14 @@ function validate() { NUM_REPLICAS=$1 CONTAINER_IMAGE_VERSION=$2 POD_ID_LIST=$($KUBECFG '-template={{range.Items}}{{.ID}} {{end}}' -l simpleService=${CONTROLLER_NAME} list pods) + POD_ARR=($POD_ID_LIST) + while [ ${#POD_ARR[@]} -ne $NUM_REPLICAS ]; do + echo "Waiting for the right number of containers" + sleep 5 + POD_ID_LIST=$($KUBECFG '-template={{range.Items}}{{.ID}} {{end}}' -l simpleService=${CONTROLLER_NAME} list pods) + POD_ARR=($POD_ID_LIST) + done + # Container turn up on a clean cluster can take a while for the docker image pull. ALL_RUNNING=0 while [ $ALL_RUNNING -ne 1 ]; do diff --git a/hack/e2e-test.sh b/hack/e2e-test.sh index ca92e66f04a..28fb5e97ff8 100755 --- a/hack/e2e-test.sh +++ b/hack/e2e-test.sh @@ -17,6 +17,11 @@ # Starts a Kubernetes cluster, runs the e2e test suite, and shuts it # down. +# Use testing config +export KUBE_CONFIG_FILE="config-test.sh" +export KUBE_REPO_ROOT="$(dirname $0)/.." +export KUBECFG="${KUBE_REPO_ROOT}/cluster/kubecfg.sh -expect_version_match" + source $(dirname $0)/../cluster/kube-env.sh source $(dirname $0)/../cluster/$KUBERNETES_PROVIDER/util.sh @@ -29,11 +34,6 @@ TEAR_DOWN=${3:-0} # Exit on error set -e -# Use testing config -export KUBE_CONFIG_FILE="config-test.sh" -export KUBE_REPO_ROOT="$(dirname $0)/.." -export KUBECFG="${KUBE_REPO_ROOT}/cluster/kubecfg.sh -expect_version_match" - if [[ $TEAR_DOWN -ne 0 ]]; then detect-project trap test-teardown EXIT