From c74e04efea67dc3d3c804361915ca6a949632286 Mon Sep 17 00:00:00 2001 From: Daniel Norberg Date: Thu, 12 Jun 2014 13:03:49 -0400 Subject: [PATCH] cluster: allow providing KUBE_MASTER_IP env var To avoid overhead of always querying gcloud. --- cluster/util.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cluster/util.sh b/cluster/util.sh index 51f5acd8b1a..d477f3e595c 100755 --- a/cluster/util.sh +++ b/cluster/util.sh @@ -70,9 +70,11 @@ function detect-minions () { function detect-master () { KUBE_MASTER=${MASTER_NAME} - KUBE_MASTER_IP=$(gcloud compute instances get ${MASTER_NAME} \ - --fields networkInterfaces[].accessConfigs[].natIP --format=text \ - | tail -n 1 | cut -f 2 -d ' ') + if [ -z "$KUBE_MASTER_IP" ]; then + KUBE_MASTER_IP=$(gcloud compute instances get ${MASTER_NAME} \ + --fields networkInterfaces[].accessConfigs[].natIP --format=text \ + | tail -n 1 | cut -f 2 -d ' ') + 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'" exit 1