From 0ced1ddaeefdaa0095a5d141b47ffba7a7c6fadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Martins?= Date: Fri, 27 May 2016 20:38:44 +0100 Subject: [PATCH] Make local-up-cluster.sh IPv6 friendly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a new environment variable API_HOST_IP. API_HOST_IP allows the user to specify an IPv6 address that is parsable by Golang. API_HOST on the other hand allows the user to specify the IPv6 address to be used in a URL's format as described in RFC2732. Example: API_HOST_IP="FEDC:BA98:7654:3210:FEDC:BA98:7654:3210" API_HOST="[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210] or API_HOST_IP="FEDC:BA98:7654:3210:FEDC:BA98:7654:3210" API_HOST="[${API_HOST_IP}]" Signed-off-by: André Martins --- hack/local-up-cluster.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh index 11b473ade80..f9fcba1af2e 100755 --- a/hack/local-up-cluster.sh +++ b/hack/local-up-cluster.sh @@ -105,6 +105,8 @@ set +e API_PORT=${API_PORT:-8080} API_HOST=${API_HOST:-127.0.0.1} +API_HOST_IP=${API_HOST_IP:-${API_HOST}} +API_BIND_ADDR=${API_HOST_IP:-"0.0.0.0"} KUBELET_HOST=${KUBELET_HOST:-"127.0.0.1"} # By default only allow CORS for requests on localhost API_CORS_ALLOWED_ORIGINS=${API_CORS_ALLOWED_ORIGINS:-"/127.0.0.1(:[0-9]+)?$,/localhost(:[0-9]+)?$"} @@ -121,7 +123,7 @@ CLAIM_BINDER_SYNC_PERIOD=${CLAIM_BINDER_SYNC_PERIOD:-"10m"} # current k8s defaul function test_apiserver_off { # For the common local scenario, fail fast if server is already running. # this can happen if you run local-up-cluster.sh twice and kill etcd in between. - curl $API_HOST:$API_PORT + curl -g $API_HOST:$API_PORT if [ ! $? -eq 0 ]; then echo "API SERVER port is free, proceeding..." else @@ -275,9 +277,10 @@ function start_apiserver { --service-account-key-file="${SERVICE_ACCOUNT_KEY}" \ --service-account-lookup="${SERVICE_ACCOUNT_LOOKUP}" \ --admission-control="${ADMISSION_CONTROL}" \ - --insecure-bind-address="${API_HOST}" \ + --bind-address="${API_BIND_ADDR}" \ + --insecure-bind-address="${API_HOST_IP}" \ --insecure-port="${API_PORT}" \ - --advertise-address="${API_HOST}" \ + --advertise-address="${API_HOST_IP}" \ --etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \ --service-cluster-ip-range="10.0.0.0/24" \ --cloud-provider="${CLOUD_PROVIDER}" \