Minion->Node rename: OLD_NODE_TAG, NODE_TAG

This commit is contained in:
Brad Erickson 2015-11-23 19:06:00 -08:00
parent bd06c19aa8
commit e67be19a5b
10 changed files with 29 additions and 29 deletions

View File

@ -71,7 +71,7 @@ NODE_ROOT_DISK_SIZE=${NODE_ROOT_DISK_SIZE:-32}
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
NODE_SCOPES="" NODE_SCOPES=""
POLL_SLEEP_INTERVAL=3 POLL_SLEEP_INTERVAL=3
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET

View File

@ -69,7 +69,7 @@ NODE_ROOT_DISK_SIZE=${NODE_ROOT_DISK_SIZE:-32}
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
NODE_SCOPES="" NODE_SCOPES=""
POLL_SLEEP_INTERVAL=3 POLL_SLEEP_INTERVAL=3
SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16" # formerly PORTAL_NET

View File

@ -181,7 +181,7 @@ function query-running-minions () {
Name=vpc-id,Values=${VPC_ID} \ Name=vpc-id,Values=${VPC_ID} \
Name=tag:KubernetesCluster,Values=${CLUSTER_ID} \ Name=tag:KubernetesCluster,Values=${CLUSTER_ID} \
Name=tag:aws:autoscaling:groupName,Values=${ASG_NAME} \ Name=tag:aws:autoscaling:groupName,Values=${ASG_NAME} \
Name=tag:Role,Values=${MINION_TAG} \ Name=tag:Role,Values=${NODE_TAG} \
--query ${query} --query ${query}
} }
@ -1014,7 +1014,7 @@ function start-minions() {
--max-size ${NUM_MINIONS} \ --max-size ${NUM_MINIONS} \
--vpc-zone-identifier ${SUBNET_ID} \ --vpc-zone-identifier ${SUBNET_ID} \
--tags ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=Name,Value=${NODE_INSTANCE_PREFIX} \ --tags ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=Name,Value=${NODE_INSTANCE_PREFIX} \
ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=Role,Value=${MINION_TAG} \ ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=Role,Value=${NODE_TAG} \
ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=KubernetesCluster,Value=${CLUSTER_ID} ResourceId=${ASG_NAME},ResourceType=auto-scaling-group,Key=KubernetesCluster,Value=${CLUSTER_ID}
# Wait for the minions to be running # Wait for the minions to be running

View File

@ -40,7 +40,7 @@ NETWORK=${KUBE_GCE_NETWORK:-default}
INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-kubernetes}" INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-kubernetes}"
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.244.0.0/16}" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.244.0.0/16}"
NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}" NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}"

View File

@ -41,7 +41,7 @@ NETWORK=${KUBE_GCE_NETWORK:-e2e}
INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}" INSTANCE_PREFIX="${KUBE_GCE_INSTANCE_PREFIX:-e2e-test-${USER}}"
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}" CLUSTER_IP_RANGE="${CLUSTER_IP_RANGE:-10.245.0.0/16}"
MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}" MASTER_IP_RANGE="${MASTER_IP_RANGE:-10.246.0.0/24}"
NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}" NODE_SCOPES="${NODE_SCOPES:-compute-rw,monitoring,logging-write,storage-ro}"

View File

@ -382,7 +382,7 @@ function create-node-template {
--boot-disk-size "${NODE_DISK_SIZE}" \ --boot-disk-size "${NODE_DISK_SIZE}" \
--image-project="${NODE_IMAGE_PROJECT}" \ --image-project="${NODE_IMAGE_PROJECT}" \
--image "${NODE_IMAGE}" \ --image "${NODE_IMAGE}" \
--tags "${MINION_TAG}" \ --tags "${NODE_TAG}" \
--network "${NETWORK}" \ --network "${NETWORK}" \
${preemptible_minions} \ ${preemptible_minions} \
$2 \ $2 \
@ -649,7 +649,7 @@ function kube-up {
create-master-instance "${MASTER_RESERVED_IP}" & create-master-instance "${MASTER_RESERVED_IP}" &
# Create a single firewall rule for all minions. # Create a single firewall rule for all minions.
create-firewall-rule "${MINION_TAG}-all" "${CLUSTER_IP_RANGE}" "${MINION_TAG}" & create-firewall-rule "${NODE_TAG}-all" "${CLUSTER_IP_RANGE}" "${NODE_TAG}" &
# Report logging choice (if any). # Report logging choice (if any).
if [[ "${ENABLE_NODE_LOGGING-}" == "true" ]]; then if [[ "${ENABLE_NODE_LOGGING-}" == "true" ]]; then
@ -877,11 +877,11 @@ function kube-down {
fi fi
# Delete firewall rule for minions. # Delete firewall rule for minions.
if gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-all" &>/dev/null; then if gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_TAG}-all" &>/dev/null; then
gcloud compute firewall-rules delete \ gcloud compute firewall-rules delete \
--project "${PROJECT}" \ --project "${PROJECT}" \
--quiet \ --quiet \
"${MINION_TAG}-all" "${NODE_TAG}-all"
fi fi
# Delete routes. # Delete routes.
@ -989,7 +989,7 @@ function check-resources {
return 1 return 1
fi fi
if gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-all" &>/dev/null; then if gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_TAG}-all" &>/dev/null; then
KUBE_RESOURCE_FOUND="Firewall rules for ${MASTER_NAME}-all" KUBE_RESOURCE_FOUND="Firewall rules for ${MASTER_NAME}-all"
return 1 return 1
fi fi
@ -1153,34 +1153,34 @@ function test-setup {
local start=`date +%s` local start=`date +%s`
gcloud compute firewall-rules create \ gcloud compute firewall-rules create \
--project "${PROJECT}" \ --project "${PROJECT}" \
--target-tags "${MINION_TAG}" \ --target-tags "${NODE_TAG}" \
--allow tcp:80,tcp:8080 \ --allow tcp:80,tcp:8080 \
--network "${NETWORK}" \ --network "${NETWORK}" \
"${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null || true "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null || true
# As there is no simple way to wait longer for this operation we need to manually # As there is no simple way to wait longer for this operation we need to manually
# wait some additional time (20 minutes altogether). # wait some additional time (20 minutes altogether).
until gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null || [ $(($start + 1200)) -lt `date +%s` ] until gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null || [ $(($start + 1200)) -lt `date +%s` ]
do sleep 5 do sleep 5
done done
# Check if the firewall rule exists and fail if it does not. # Check if the firewall rule exists and fail if it does not.
gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt"
# Open up the NodePort range # Open up the NodePort range
# TODO(justinsb): Move to main setup, if we decide whether we want to do this by default. # TODO(justinsb): Move to main setup, if we decide whether we want to do this by default.
start=`date +%s` start=`date +%s`
gcloud compute firewall-rules create \ gcloud compute firewall-rules create \
--project "${PROJECT}" \ --project "${PROJECT}" \
--target-tags "${MINION_TAG}" \ --target-tags "${NODE_TAG}" \
--allow tcp:30000-32767,udp:30000-32767 \ --allow tcp:30000-32767,udp:30000-32767 \
--network "${NETWORK}" \ --network "${NETWORK}" \
"${MINION_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null || true "${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null || true
# As there is no simple way to wait longer for this operation we need to manually # As there is no simple way to wait longer for this operation we need to manually
# wait some additional time (20 minutes altogether). # wait some additional time (20 minutes altogether).
until gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null || [ $(($start + 1200)) -lt `date +%s` ] until gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null || [ $(($start + 1200)) -lt `date +%s` ]
do sleep 5 do sleep 5
done done
# Check if the firewall rule exists and fail if it does not. # Check if the firewall rule exists and fail if it does not.
gcloud compute firewall-rules describe --project "${PROJECT}" "${MINION_TAG}-${INSTANCE_PREFIX}-nodeports" gcloud compute firewall-rules describe --project "${PROJECT}" "${NODE_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
@ -1191,11 +1191,11 @@ function test-teardown {
gcloud compute firewall-rules delete \ gcloud compute firewall-rules delete \
--project "${PROJECT}" \ --project "${PROJECT}" \
--quiet \ --quiet \
"${MINION_TAG}-${INSTANCE_PREFIX}-http-alt" || true "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" || true
gcloud compute firewall-rules delete \ gcloud compute firewall-rules delete \
--project "${PROJECT}" \ --project "${PROJECT}" \
--quiet \ --quiet \
"${MINION_TAG}-${INSTANCE_PREFIX}-nodeports" || true "${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" || true
"${KUBE_ROOT}/cluster/kube-down.sh" "${KUBE_ROOT}/cluster/kube-down.sh"
} }

View File

@ -17,7 +17,7 @@
# 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" NODE_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

View File

@ -163,7 +163,7 @@ function kube-up() {
# GCLOUD # GCLOUD
# ZONE # ZONE
# Vars set: # Vars set:
# MINION_TAG # NODE_TAG
function test-setup() { function test-setup() {
echo "... in gke:test-setup()" >&2 echo "... in gke:test-setup()" >&2
# Detect the project into $PROJECT if it isn't set # Detect the project into $PROJECT if it isn't set
@ -171,22 +171,22 @@ function test-setup() {
detect-minions >&2 detect-minions >&2
# At this point, CLUSTER_NAME should have been used, so its value is final. # At this point, CLUSTER_NAME should have been used, so its value is final.
MINION_TAG=$($GCLOUD compute instances describe ${NODE_NAMES[0]} --project="${PROJECT}" --zone="${ZONE}" | grep -o "gke-${CLUSTER_NAME}-.\{8\}-node" | head -1) NODE_TAG=$($GCLOUD compute instances describe ${NODE_NAMES[0]} --project="${PROJECT}" --zone="${ZONE}" | grep -o "gke-${CLUSTER_NAME}-.\{8\}-node" | head -1)
OLD_MINION_TAG="k8s-${CLUSTER_NAME}-node" OLD_NODE_TAG="k8s-${CLUSTER_NAME}-node"
# Open up port 80 & 8080 so common containers on minions can be reached. # Open up port 80 & 8080 so common containers on minions can be reached.
"${GCLOUD}" compute firewall-rules create \ "${GCLOUD}" compute firewall-rules create \
"${CLUSTER_NAME}-http-alt" \ "${CLUSTER_NAME}-http-alt" \
--allow tcp:80,tcp:8080 \ --allow tcp:80,tcp:8080 \
--project "${PROJECT}" \ --project "${PROJECT}" \
--target-tags "${MINION_TAG},${OLD_MINION_TAG}" \ --target-tags "${NODE_TAG},${OLD_NODE_TAG}" \
--network="${NETWORK}" --network="${NETWORK}"
"${GCLOUD}" compute firewall-rules create \ "${GCLOUD}" compute firewall-rules create \
"${CLUSTER_NAME}-nodeports" \ "${CLUSTER_NAME}-nodeports" \
--allow tcp:30000-32767,udp:30000-32767 \ --allow tcp:30000-32767,udp:30000-32767 \
--project "${PROJECT}" \ --project "${PROJECT}" \
--target-tags "${MINION_TAG},${OLD_MINION_TAG}" \ --target-tags "${NODE_TAG},${OLD_NODE_TAG}" \
--network="${NETWORK}" --network="${NETWORK}"
} }

View File

@ -20,7 +20,7 @@ GUEST_ID=debian7_64Guest
INSTANCE_PREFIX=kubernetes INSTANCE_PREFIX=kubernetes
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_MEMORY_MB=1024 MASTER_MEMORY_MB=1024

View File

@ -20,7 +20,7 @@ GUEST_ID=debian7_64Guest
INSTANCE_PREFIX="e2e-test-${USER}" INSTANCE_PREFIX="e2e-test-${USER}"
MASTER_TAG="${INSTANCE_PREFIX}-master" MASTER_TAG="${INSTANCE_PREFIX}-master"
MINION_TAG="${INSTANCE_PREFIX}-minion" NODE_TAG="${INSTANCE_PREFIX}-minion"
MASTER_NAME="${INSTANCE_PREFIX}-master" MASTER_NAME="${INSTANCE_PREFIX}-master"
MASTER_MEMORY_MB=1024 MASTER_MEMORY_MB=1024