Skip to content

Commit

Permalink
One additional cleanup: Send only the master name, rather the internal
Browse files Browse the repository at this point in the history
IP address. The configure-vm script can resolve this relatively easily
on the node. This is less painful for GKE, which creates all the
resources in parallel.
  • Loading branch information
zmerlynn committed Mar 10, 2015
1 parent 120dba4 commit b31b633
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 8 additions & 2 deletions cluster/gce/configure-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,15 @@ EOF
}

function salt-set-apiserver() {
local kube_master_ip
until kube_master_ip=$(getent hosts ${KUBERNETES_MASTER_NAME} | cut -f1 -d\ ); do
echo 'Waiting for DNS resolution of ${KUBERNETES_MASTER_NAME}...'
sleep 3
done

cat <<EOF >>/etc/salt/minion.d/grains.conf
api_servers: '${KUBERNETES_MASTER_IP}'
apiservers: '${KUBERNETES_MASTER_IP}'
api_servers: '${kube_master_ip}'
apiservers: '${kube_master_ip}'
EOF
}

Expand Down
8 changes: 3 additions & 5 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ function detect-master () {
KUBE_MASTER_IP=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
"${MASTER_NAME}" --fields networkInterfaces[0].accessConfigs[0].natIP \
--format=text | awk '{ print $2 }')
KUBE_MASTER_IP_INTERNAL=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
"${MASTER_NAME}" --fields networkInterfaces[0].networkIP \
--format=text | awk '{ print $2 }')
fi
if [[ -z "${KUBE_MASTER_IP-}" ]]; then
echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2
Expand Down Expand Up @@ -455,7 +452,7 @@ function build-kube-env {
add-to-env ${file} DNS_DOMAIN "${DNS_DOMAIN:-}"
add-to-env ${file} MASTER_HTPASSWD "${MASTER_HTPASSWD}"
if [[ "${master}" != "true" ]]; then
add-to-env ${file} KUBERNETES_MASTER_IP "${KUBE_MASTER_IP_INTERNAL}"
add-to-env ${file} KUBERNETES_MASTER_NAME "${MASTER_NAME}"
add-to-env ${file} ZONE "${ZONE}"
add-to-env ${file} EXTRA_DOCKER_OPTS "${EXTRA_DOCKER_OPTS}"
add-to-env ${file} ENABLE_DOCKER_REGISTRY_CACHE "${ENABLE_DOCKER_REGISTRY_CACHE:-false}"
Expand Down Expand Up @@ -558,7 +555,6 @@ function kube-up {

# Wait for last batch of jobs
wait-for-jobs
detect-master # We need the KUBE_MASTER_IP_INTERNAL for the node startup script
add-instance-metadata "${MASTER_NAME}" "kube-token=${KUBELET_TOKEN}"

echo "Creating minions."
Expand Down Expand Up @@ -614,6 +610,8 @@ function kube-up {
# Wait for last batch of jobs.
wait-for-jobs

detect-master

# Reserve the master's IP so that it can later be transferred to another VM
# without disrupting the kubelets. IPs are associated with regions, not zones,
# so extract the region name, which is the same as the zone but with the final
Expand Down

0 comments on commit b31b633

Please sign in to comment.