Skip to content

Commit 0f5c460

Browse files
author
Matthew Fisher
committed
fix(scheduler): announce proper address
Before, the announce container relied on `getent` to retrieve the hostname. Some hosts do not have `getent hosts deis` properly routed, which would make the router crash and burn because it would try to route traffic to `:1234` instead of `10.0.2.14:1234`. Instead, the announce container now retrieves the host's IP address from /etc/environment. This is the public IP address, which is written to /etc/environment. See https://github.com/deis/deis/blob/master/contrib/coreos/override-plugin.rb#L87-L92 fixes #797
1 parent 507d0fb commit 0f5c460

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

controller/scheduler/coreos.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,9 @@ def attach(self, name):
221221
BindsTo={name}.service
222222
223223
[Service]
224-
ExecStartPre=/bin/sh -c "until /usr/bin/docker port {name} {port} >/dev/null 2>&1; do sleep 2; done; port=$(docker port {name} {port} | cut -d ':' -f2); host=$(getent hosts deis | awk {{'print $1'}}); echo Waiting for $port/tcp...; until netstat -lnt | grep :$port >/dev/null; do sleep 1; done"
225-
ExecStart=/bin/sh -c "port=$(docker port {name} {port} | cut -d ':' -f2); host=$(getent hosts deis | awk {{'print $1'}}); echo Connected to $host:$port/tcp, publishing to etcd...; while netstat -lnt | grep :$port >/dev/null; do etcdctl set /deis/services/{app}/{name} $host:$port --ttl 60 >/dev/null; sleep 45; done"
224+
EnvironmentFile=/etc/environment
225+
ExecStartPre=/bin/sh -c "until /usr/bin/docker port {name} {port} >/dev/null 2>&1; do sleep 2; done; port=$(docker port {name} {port} | cut -d ':' -f2); echo Waiting for $port/tcp...; until netstat -lnt | grep :$port >/dev/null; do sleep 1; done"
226+
ExecStart=/bin/sh -c "port=$(docker port {name} {port} | cut -d ':' -f2); echo Connected to $COREOS_PUBLIC_IPV4:$port/tcp, publishing to etcd...; while netstat -lnt | grep :$port >/dev/null; do etcdctl set /deis/services/{app}/{name} $COREOS_PUBLIC_IPV4:$port --ttl 60 >/dev/null; sleep 45; done"
226227
ExecStop=/usr/bin/etcdctl rm --recursive /deis/services/{app}/{name}
227228
228229
[X-Fleet]

0 commit comments

Comments
 (0)