One additional cleanup: Send only the master name, rather the internal

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.
pull/6/head
Zach Loafman 2015-03-10 08:59:19 -07:00
parent 120dba474e
commit b31b633f85
2 changed files with 11 additions and 7 deletions

View File

@ -302,9 +302,15 @@ EOF
} }
function salt-set-apiserver() { 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 cat <<EOF >>/etc/salt/minion.d/grains.conf
api_servers: '${KUBERNETES_MASTER_IP}' api_servers: '${kube_master_ip}'
apiservers: '${KUBERNETES_MASTER_IP}' apiservers: '${kube_master_ip}'
EOF EOF
} }

View File

@ -216,9 +216,6 @@ function detect-master () {
KUBE_MASTER_IP=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \ KUBE_MASTER_IP=$(gcloud compute instances describe --project "${PROJECT}" --zone "${ZONE}" \
"${MASTER_NAME}" --fields networkInterfaces[0].accessConfigs[0].natIP \ "${MASTER_NAME}" --fields networkInterfaces[0].accessConfigs[0].natIP \
--format=text | awk '{ print $2 }') --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 fi
if [[ -z "${KUBE_MASTER_IP-}" ]]; then 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 echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" >&2
@ -455,7 +452,7 @@ function build-kube-env {
add-to-env ${file} DNS_DOMAIN "${DNS_DOMAIN:-}" add-to-env ${file} DNS_DOMAIN "${DNS_DOMAIN:-}"
add-to-env ${file} MASTER_HTPASSWD "${MASTER_HTPASSWD}" add-to-env ${file} MASTER_HTPASSWD "${MASTER_HTPASSWD}"
if [[ "${master}" != "true" ]]; then 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} ZONE "${ZONE}"
add-to-env ${file} EXTRA_DOCKER_OPTS "${EXTRA_DOCKER_OPTS}" add-to-env ${file} EXTRA_DOCKER_OPTS "${EXTRA_DOCKER_OPTS}"
add-to-env ${file} ENABLE_DOCKER_REGISTRY_CACHE "${ENABLE_DOCKER_REGISTRY_CACHE:-false}" add-to-env ${file} ENABLE_DOCKER_REGISTRY_CACHE "${ENABLE_DOCKER_REGISTRY_CACHE:-false}"
@ -558,7 +555,6 @@ function kube-up {
# Wait for last batch of jobs # Wait for last batch of jobs
wait-for-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}" add-instance-metadata "${MASTER_NAME}" "kube-token=${KUBELET_TOKEN}"
echo "Creating minions." echo "Creating minions."
@ -614,6 +610,8 @@ function kube-up {
# Wait for last batch of jobs. # Wait for last batch of jobs.
wait-for-jobs wait-for-jobs
detect-master
# Reserve the master's IP so that it can later be transferred to another VM # 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, # 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 # so extract the region name, which is the same as the zone but with the final