Skip to content

Commit 451e99b

Browse files
fix(*): Announce the published port to etcd
Announce the external instead of the internal port to etcd. Currently all components are using the same internal and external port, so this never broke deis. Before publishing etcd, scan whether the internal port is opened Builder listens on 22 (internal) and is published on 2223
1 parent 1f09b18 commit 451e99b

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

bin/boot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ if [[ ! -z $PUBLISH ]]; then
8282
set +e
8383

8484
# wait for the service to become available on PUBLISH port
85-
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PUBLISH\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
85+
sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do sleep 1; done
8686

8787
# while the port is listening, publish to etcd
88-
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PUBLISH\" && \$1 ~ \"$PROTO.?\"") ]] ; do
88+
while [[ ! -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".$PORT\" && \$1 ~ \"$PROTO.?\"") ]] ; do
8989
etcdctl --no-sync -C $ETCD set $ETCD_PATH/host $HOST --ttl $ETCD_TTL >/dev/null
90-
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PORT --ttl $ETCD_TTL >/dev/null
90+
etcdctl --no-sync -C $ETCD set $ETCD_PATH/port $PUBLISH --ttl $ETCD_TTL >/dev/null
9191
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
9292
done
9393

tests/controller_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tests
33
import (
44
"fmt"
55
"testing"
6+
"time"
67

78
"github.com/deis/deis/tests/dockercli"
89
"github.com/deis/deis/tests/etcdutils"
@@ -54,5 +55,9 @@ func TestController(t *testing.T) {
5455
if err != nil {
5556
t.Fatal(err)
5657
}
58+
// FIXME: Wait until etcd keys are published
59+
time.Sleep(5000 * time.Millisecond)
5760
dockercli.DeisServiceTest(t, name, port, "http")
61+
etcdutils.VerifyEtcdValue(t, "/deis/controller/host", host, etcdPort)
62+
etcdutils.VerifyEtcdValue(t, "/deis/controller/port", port, etcdPort)
5863
}

0 commit comments

Comments
 (0)