Skip to content

Commit

Permalink
Merge pull request kubernetes#6417 from ArtfulCoder/local_etcd
Browse files Browse the repository at this point in the history
Etcd listens on localhost for GCE
  • Loading branch information
zmerlynn committed Apr 3, 2015
2 parents e0c9d9e + 23c42cd commit 98bf5ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 7 additions & 3 deletions cluster/saltbase/salt/etcd/etcd.manifest
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
],
Expand Down
7 changes: 3 additions & 4 deletions cluster/saltbase/salt/kube-apiserver/default
Original file line number Diff line number Diff line change
Expand Up @@ -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" -%}
Expand Down

0 comments on commit 98bf5ae

Please sign in to comment.