Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new network for e2e tests, to isolate it from any other cluster. #1435

Merged
merged 1 commit into from
Sep 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" &
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that you can launch a VM on a network that isn't created yet so this may introduce a race. I'd (a) move this up above where we create the master-start.sh script and (b) put a wait in for the network itself. To do that the "wait and report errors" snippet below should probably be pulled out into a function.

I have a e2e tweak coming and I'm happy to make these changes there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah -- I see that the network is created synchronously but the firewalls are done in the background. I'll add a clarifying comment in my PR.

fi

echo "Starting VMs and configuring firewalls"
gcutil addfirewall ${MASTER_NAME}-https \
--norespect_terminal_width \
Expand Down
8 changes: 8 additions & 0 deletions hack/e2e-suite/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit for later or maybe never: Would be nice if this said how many more...

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
Expand Down
10 changes: 5 additions & 5 deletions hack/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down