From 23c42cd8b2f4c81f8a0da694332bd8f63fcddbc2 Mon Sep 17 00:00:00 2001 From: Abhishek Shah Date: Fri, 3 Apr 2015 11:40:09 -0700 Subject: [PATCH] Etcd listens on localhost for GCE --- cluster/saltbase/salt/etcd/etcd.manifest | 10 +++++++--- cluster/saltbase/salt/kube-apiserver/default | 7 +++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cluster/saltbase/salt/etcd/etcd.manifest b/cluster/saltbase/salt/etcd/etcd.manifest index 566678cac32f3..cfd5fd7bc40a8 100644 --- a/cluster/saltbase/salt/etcd/etcd.manifest +++ b/cluster/saltbase/salt/etcd/etcd.manifest @@ -1,4 +1,8 @@ -{% set ipv4_addr = salt['grains.get']('fqdn_ip4')[0] -%} +{% if grains.cloud is defined and grains.cloud == 'gce' -%} + {% set etcd_addr = "127.0.0.1" -%} +{% else -%} + {% set etcd_addr = salt['grains.get']('fqdn_ip4')[0] -%} +{% endif -%} { "apiVersion": "v1beta3", @@ -13,9 +17,9 @@ "command": [ "/usr/local/bin/etcd", "--addr", - "{{ipv4_addr}}:4001", + "{{etcd_addr}}:4001", "--bind-addr", - "0.0.0.0:4001", + "{{etcd_addr}}:4001", "--data-dir", "/var/etcd/data" ], diff --git a/cluster/saltbase/salt/kube-apiserver/default b/cluster/saltbase/salt/kube-apiserver/default index 982c65f4d7e3f..816e50898ab94 100644 --- a/cluster/saltbase/salt/kube-apiserver/default +++ b/cluster/saltbase/salt/kube-apiserver/default @@ -31,11 +31,10 @@ {% set publicAddressOverride = "--public_address_override=" + grains.publicAddressOverride -%} {% endif -%} -{% if grains.etcd_servers is defined -%} - {% set etcd_servers = "--etcd_servers=http://" + grains.etcd_servers + ":4001" -%} -{% elif grains.cloud == 'gce' -%} - {# TODO(zmerlynn): I can't see why this isn't generally applicable, but making this change surgical for now. #} +{% if grains.cloud is defined and grains.cloud == 'gce' -%} {% set etcd_servers = "--etcd_servers=http://127.0.0.1:4001" -%} +{% elif grains.etcd_servers is defined -%} + {% set etcd_servers = "--etcd_servers=http://" + grains.etcd_servers + ":4001" -%} {% else -%} {% set ips = salt['mine.get']('roles:kubernetes-master', 'network.ip_addrs', 'grain').values() -%} {% set etcd_servers = "--etcd_servers=http://" + ips[0][0] + ":4001" -%}