From 6fe68a737e320022e32f45d5f4fd80e7cae9bffd Mon Sep 17 00:00:00 2001 From: Brad Erickson Date: Mon, 23 Nov 2015 19:03:44 -0800 Subject: [PATCH] Minion->Node rename: NODE_IP_BASE, NODE_IP_RANGES, NODE_IP_RANGE, etc NODE_IPS NODE_IP NODE_MEMORY_MB --- Vagrantfile | 2 +- cluster/vagrant/config-default.sh | 4 ++-- cluster/vagrant/provision-master.sh | 2 +- cluster/vagrant/provision-minion.sh | 8 ++++---- cluster/vagrant/util.sh | 18 +++++++++--------- cluster/vsphere/config-default.sh | 4 ++-- cluster/vsphere/config-test.sh | 4 ++-- cluster/vsphere/templates/salt-minion.sh | 2 +- cluster/vsphere/util.sh | 4 ++-- docs/design/networking.md | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index bcedbb3698e..514179fe73c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -22,7 +22,7 @@ $num_minion = (ENV['NUM_MINIONS'] || 1).to_i # ip configuration $master_ip = ENV['MASTER_IP'] -$minion_ip_base = ENV['MINION_IP_BASE'] || "" +$minion_ip_base = ENV['NODE_IP_BASE'] || "" $minion_ips = $num_minion.times.collect { |n| $minion_ip_base + "#{n+3}" } # Determine the OS platform to use diff --git a/cluster/vagrant/config-default.sh b/cluster/vagrant/config-default.sh index 6208ffbed3e..c0f69bc0257 100755 --- a/cluster/vagrant/config-default.sh +++ b/cluster/vagrant/config-default.sh @@ -31,14 +31,14 @@ export MASTER_NAME="${INSTANCE_PREFIX}-master" REGISTER_MASTER_KUBELET=${REGISTER_MASTER:-false} # Map out the IPs, names and container subnets of each minion -export MINION_IP_BASE=${MINION_IP_BASE-"10.245.1."} +export NODE_IP_BASE=${NODE_IP_BASE-"10.245.1."} NODE_CONTAINER_SUBNET_BASE="10.246" MASTER_CONTAINER_NETMASK="255.255.255.0" MASTER_CONTAINER_ADDR="${NODE_CONTAINER_SUBNET_BASE}.0.1" MASTER_CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.1/24" CONTAINER_SUBNET="${NODE_CONTAINER_SUBNET_BASE}.0.0/16" for ((i=0; i < NUM_MINIONS; i++)) do - MINION_IPS[$i]="${MINION_IP_BASE}$((i+3))" + NODE_IPS[$i]="${NODE_IP_BASE}$((i+3))" MINION_NAMES[$i]="${INSTANCE_PREFIX}-minion-$((i+1))" NODE_CONTAINER_SUBNETS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1/24" NODE_CONTAINER_ADDRS[$i]="${NODE_CONTAINER_SUBNET_BASE}.$((i+1)).1" diff --git a/cluster/vagrant/provision-master.sh b/cluster/vagrant/provision-master.sh index da94a72cf72..fc5176dcb9e 100755 --- a/cluster/vagrant/provision-master.sh +++ b/cluster/vagrant/provision-master.sh @@ -70,7 +70,7 @@ fi # Setup hosts file to support ping by hostname to each minion in the cluster from apiserver for (( i=0; i<${#MINION_NAMES[@]}; i++)); do minion=${MINION_NAMES[$i]} - ip=${MINION_IPS[$i]} + ip=${NODE_IPS[$i]} if [ ! "$(cat /etc/hosts | grep $minion)" ]; then echo "Adding $minion to hosts file" echo "$ip $minion" >> /etc/hosts diff --git a/cluster/vagrant/provision-minion.sh b/cluster/vagrant/provision-minion.sh index f0cebe264ae..d8befaa7026 100755 --- a/cluster/vagrant/provision-minion.sh +++ b/cluster/vagrant/provision-minion.sh @@ -94,12 +94,12 @@ if [ ! "$(cat /etc/hosts | grep $MASTER_NAME)" ]; then echo "Adding $MASTER_NAME to hosts file" echo "$MASTER_IP $MASTER_NAME" >> /etc/hosts fi -echo "$MINION_IP $MINION_NAME" >> /etc/hosts +echo "$NODE_IP $MINION_NAME" >> /etc/hosts # Setup hosts file to support ping by hostname to each minion in the cluster for (( i=0; i<${#MINION_NAMES[@]}; i++)); do minion=${MINION_NAMES[$i]} - ip=${MINION_IPS[$i]} + ip=${NODE_IPS[$i]} if [ ! "$(cat /etc/hosts | grep $minion)" ]; then echo "Adding $minion to hosts file" echo "$ip $minion" >> /etc/hosts @@ -145,13 +145,13 @@ cat </etc/salt/minion.d/grains.conf grains: cloud: vagrant network_mode: openvswitch - node_ip: '$(echo "$MINION_IP" | sed -e "s/'/''/g")' + node_ip: '$(echo "$NODE_IP" | sed -e "s/'/''/g")' api_servers: '$(echo "$MASTER_IP" | sed -e "s/'/''/g")' networkInterfaceName: '$(echo "$NETWORK_IF_NAME" | sed -e "s/'/''/g")' roles: - kubernetes-pool cbr-cidr: '$(echo "$CONTAINER_SUBNET" | sed -e "s/'/''/g")' - hostname_override: '$(echo "$MINION_IP" | sed -e "s/'/''/g")' + hostname_override: '$(echo "$NODE_IP" | sed -e "s/'/''/g")' docker_opts: '$(echo "$DOCKER_OPTS" | sed -e "s/'/''/g")' EOF diff --git a/cluster/vagrant/util.sh b/cluster/vagrant/util.sh index b6085138ec1..9a6198db147 100644 --- a/cluster/vagrant/util.sh +++ b/cluster/vagrant/util.sh @@ -28,7 +28,7 @@ function detect-master () { # Get minion IP addresses and store in KUBE_NODE_IP_ADDRESSES[] function detect-minions { echo "Minions already detected" 1>&2 - KUBE_NODE_IP_ADDRESSES=("${MINION_IPS[@]}") + KUBE_NODE_IP_ADDRESSES=("${NODE_IPS[@]}") } # Verify prereqs on host machine Also sets exports USING_KUBE_SCRIPTS=true so @@ -125,7 +125,7 @@ function create-provision-scripts { echo "MASTER_NAME='${INSTANCE_PREFIX}-master'" echo "MASTER_IP='${MASTER_IP}'" echo "MINION_NAMES=(${MINION_NAMES[@]})" - echo "MINION_IPS=(${MINION_IPS[@]})" + echo "NODE_IPS=(${NODE_IPS[@]})" echo "NODE_IP='${MASTER_IP}'" echo "CONTAINER_SUBNET='${CONTAINER_SUBNET}'" echo "CONTAINER_NETMASK='${MASTER_CONTAINER_NETMASK}'" @@ -170,10 +170,10 @@ function create-provision-scripts { echo "MASTER_IP='${MASTER_IP}'" echo "MINION_NAMES=(${MINION_NAMES[@]})" echo "MINION_NAME=(${MINION_NAMES[$i]})" - echo "MINION_IPS=(${MINION_IPS[@]})" - echo "MINION_IP='${MINION_IPS[$i]}'" + echo "NODE_IPS=(${NODE_IPS[@]})" + echo "NODE_IP='${NODE_IPS[$i]}'" echo "NODE_ID='$i'" - echo "NODE_IP='${MINION_IPS[$i]}'" + echo "NODE_IP='${NODE_IPS[$i]}'" echo "MASTER_CONTAINER_SUBNET='${MASTER_CONTAINER_SUBNET}'" echo "CONTAINER_ADDR='${NODE_CONTAINER_ADDRS[$i]}'" echo "CONTAINER_NETMASK='${NODE_CONTAINER_NETMASKS[$i]}'" @@ -242,13 +242,13 @@ function verify-cluster { echo echo "Waiting for each minion to be registered with cloud provider" - for (( i=0; i<${#MINION_IPS[@]}; i++)); do - local machine="${MINION_IPS[$i]}" + for (( i=0; i<${#NODE_IPS[@]}; i++)); do + local machine="${NODE_IPS[$i]}" local count="0" until [[ "$count" == "1" ]]; do local minions minions=$("${KUBE_ROOT}/cluster/kubectl.sh" get nodes -o go-template='{{range.items}}{{.metadata.name}}:{{end}}' --api-version=v1) - count=$(echo $minions | grep -c "${MINION_IPS[i]}") || { + count=$(echo $minions | grep -c "${NODE_IPS[i]}") || { printf "." sleep 2 count="0" @@ -339,7 +339,7 @@ function test-teardown { # Find the minion name based on the IP address function find-vagrant-name-by-ip { local ip="$1" - local ip_pattern="${MINION_IP_BASE}(.*)" + local ip_pattern="${NODE_IP_BASE}(.*)" # This is subtle. We map 10.245.2.2 -> minion-1. We do this by matching a # regexp and using the capture to construct the name. diff --git a/cluster/vsphere/config-default.sh b/cluster/vsphere/config-default.sh index 8ef419e5022..43cfbc224f0 100755 --- a/cluster/vsphere/config-default.sh +++ b/cluster/vsphere/config-default.sh @@ -27,8 +27,8 @@ MASTER_MEMORY_MB=1024 MASTER_CPU=1 MINION_NAMES=($(eval echo ${INSTANCE_PREFIX}-minion-{1..${NUM_MINIONS}})) -MINION_IP_RANGES=($(eval echo "10.244.{1..${NUM_MINIONS}}.0/24")) -MINION_MEMORY_MB=2048 +NODE_IP_RANGES=($(eval echo "10.244.{1..${NUM_MINIONS}}.0/24")) +NODE_MEMORY_MB=2048 NODE_CPU=1 SERVICE_CLUSTER_IP_RANGE="10.244.240.0/20" # formerly PORTAL_NET diff --git a/cluster/vsphere/config-test.sh b/cluster/vsphere/config-test.sh index bf9c68b05e7..39ca55d7233 100755 --- a/cluster/vsphere/config-test.sh +++ b/cluster/vsphere/config-test.sh @@ -27,8 +27,8 @@ MASTER_MEMORY_MB=1024 MASTER_CPU=1 MINION_NAMES=($(eval echo ${INSTANCE_PREFIX}-minion-{1..${NUM_MINIONS}})) -MINION_IP_RANGES=($(eval echo "10.244.{1..${NUM_MINIONS}}.0/24")) -MINION_MEMORY_MB=1024 +NODE_IP_RANGES=($(eval echo "10.244.{1..${NUM_MINIONS}}.0/24")) +NODE_MEMORY_MB=1024 NODE_CPU=1 SERVICE_CLUSTER_IP_RANGE="10.244.240.0/20" # formerly PORTAL_NET diff --git a/cluster/vsphere/templates/salt-minion.sh b/cluster/vsphere/templates/salt-minion.sh index 2f7dcafc915..3a02aa2bbfc 100755 --- a/cluster/vsphere/templates/salt-minion.sh +++ b/cluster/vsphere/templates/salt-minion.sh @@ -41,7 +41,7 @@ grains: roles: - kubernetes-pool - kubernetes-pool-vsphere - cbr-cidr: $MINION_IP_RANGE + cbr-cidr: $NODE_IP_RANGE EOF # Install Salt diff --git a/cluster/vsphere/util.sh b/cluster/vsphere/util.sh index e28608137f1..30616366679 100755 --- a/cluster/vsphere/util.sh +++ b/cluster/vsphere/util.sh @@ -273,12 +273,12 @@ function kube-up { grep -v "^#" "${KUBE_ROOT}/cluster/vsphere/templates/hostname.sh" echo "KUBE_MASTER=${KUBE_MASTER}" echo "KUBE_MASTER_IP=${KUBE_MASTER_IP}" - echo "MINION_IP_RANGE=${MINION_IP_RANGES[$i]}" + echo "NODE_IP_RANGE=${NODE_IP_RANGES[$i]}" grep -v "^#" "${KUBE_ROOT}/cluster/vsphere/templates/salt-minion.sh" ) > "${KUBE_TEMP}/minion-start-${i}.sh" ( - kube-up-vm "${MINION_NAMES[$i]}" -c ${NODE_CPU-1} -m ${MINION_MEMORY_MB-1024} + kube-up-vm "${MINION_NAMES[$i]}" -c ${NODE_CPU-1} -m ${NODE_MEMORY_MB-1024} kube-run "${MINION_NAMES[$i]}" "${KUBE_TEMP}/minion-start-${i}.sh" ) & done diff --git a/docs/design/networking.md b/docs/design/networking.md index 56009d5b85b..3259a83a67f 100644 --- a/docs/design/networking.md +++ b/docs/design/networking.md @@ -134,7 +134,7 @@ Example of GCE's advanced routing rules: ```sh gcloud compute routes add "${MINION_NAMES[$i]}" \ --project "${PROJECT}" \ - --destination-range "${MINION_IP_RANGES[$i]}" \ + --destination-range "${NODE_IP_RANGES[$i]}" \ --network "${NETWORK}" \ --next-hop-instance "${MINION_NAMES[$i]}" \ --next-hop-instance-zone "${ZONE}" &