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 configurable sleep between polling intervals for GCE status #1544

Merged
merged 2 commits into from
Oct 3, 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: 2 additions & 0 deletions cluster/gce/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ MINION_TAG="${INSTANCE_PREFIX}-minion"
MINION_NAMES=($(eval echo ${INSTANCE_PREFIX}-minion-{1..${NUM_MINIONS}}))
MINION_IP_RANGES=($(eval echo "10.244.{1..${NUM_MINIONS}}.0/24"))
MINION_SCOPES=""
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
POLL_SLEEP_INTERVAL=3
2 changes: 2 additions & 0 deletions cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ MINION_TAG="${INSTANCE_PREFIX}-minion"
MINION_NAMES=($(eval echo ${INSTANCE_PREFIX}-minion-{1..${NUM_MINIONS}}))
MINION_IP_RANGES=($(eval echo "10.245.{1..${NUM_MINIONS}}.0/24"))
MINION_SCOPES=""
# Increase the sleep interval value if concerned about API rate limits. 3, in seconds, is the default.
POLL_SLEEP_INTERVAL=3
31 changes: 23 additions & 8 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,26 @@ function kube-up {
# firewalls can be added concurrent with instance creation.
gcutil addnetwork "${NETWORK}" --range "10.240.0.0/16"
gcutil addfirewall "${NETWORK}-default-internal" \
--norespect_terminal_width \
--project "${PROJECT}" \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--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}" \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--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 \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--network ${NETWORK} \
--target_tags ${MASTER_TAG} \
--allowed tcp:443 &
Expand All @@ -180,8 +183,9 @@ function kube-up {
) > "${KUBE_TEMP}/master-start.sh"

gcutil addinstance ${MASTER_NAME}\
--norespect_terminal_width \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--zone ${ZONE} \
--machine_type ${MASTER_SIZE} \
--image ${IMAGE} \
Expand All @@ -200,15 +204,17 @@ function kube-up {
) > ${KUBE_TEMP}/minion-start-${i}.sh

gcutil addfirewall ${MINION_NAMES[$i]}-all \
--norespect_terminal_width \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--network ${NETWORK} \
--allowed_ip_sources ${MINION_IP_RANGES[$i]} \
--allowed "tcp,udp,icmp,esp,ah,sctp" &

gcutil addinstance ${MINION_NAMES[$i]} \
--norespect_terminal_width \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--zone ${ZONE} \
--machine_type ${MINION_SIZE} \
--image ${IMAGE} \
Expand All @@ -220,8 +226,9 @@ function kube-up {
--metadata_from_file "startup-script:${KUBE_TEMP}/minion-start-${i}.sh" &

gcutil addroute ${MINION_NAMES[$i]} ${MINION_IP_RANGES[$i]} \
--norespect_terminal_width \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--network ${NETWORK} \
--next_hop_instance ${ZONE}/instances/${MINION_NAMES[$i]} &
done
Expand Down Expand Up @@ -313,12 +320,14 @@ function kube-down {
gcutil deletefirewall \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
${MASTER_NAME}-https &

gcutil deleteinstance \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
--delete_boot_pd \
--zone ${ZONE} \
Expand All @@ -327,19 +336,23 @@ function kube-down {
gcutil deletefirewall \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
${MINION_NAMES[*]/%/-all} &

gcutil deleteinstance \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
--delete_boot_pd \
--zone ${ZONE} \
${MINION_NAMES[*]} &

gcutil deleteroute \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
${MINION_NAMES[*]} &

Expand Down Expand Up @@ -396,8 +409,9 @@ function test-setup {
if [[ ${ALREADY_UP} -ne 1 ]]; then
# Open up port 80 & 8080 so common containers on minions can be reached
gcutil addfirewall \
--norespect_terminal_width \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--target_tags ${MINION_TAG} \
--allowed tcp:80,tcp:8080 \
--network ${NETWORK} \
Expand All @@ -412,6 +426,7 @@ function test-teardown {
gcutil deletefirewall \
--project ${PROJECT} \
--norespect_terminal_width \
--sleep_between_polls "${POLL_SLEEP_INTERVAL}" \
--force \
${MINION_TAG}-${INSTANCE_PREFIX}-http-alt || true > /dev/null
$(dirname $0)/../cluster/kube-down.sh > /dev/null
Expand Down