Skip to content

Commit 146332e

Browse files
committed
Make etcd3 setup work with IPv6 addresses
The client are told to connect to SERVICE_HOST instead of HOST_IP, so we need to start etcd3 with matching listening parameters. Change-Id: I96389090180d21d25d72df8f9e8905b850bcaee9 Partial-Bug: 1656329
1 parent 7617ac2 commit 146332e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/etcd3

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ function start_etcd3 {
4040
cmd+=" --initial-cluster-state new --initial-cluster-token etcd-cluster-01"
4141
cmd+=" --initial-cluster $HOSTNAME=http://$SERVICE_HOST:2380"
4242
cmd+=" --initial-advertise-peer-urls http://$SERVICE_HOST:2380"
43-
cmd+=" --advertise-client-urls http://${HOST_IP}:$ETCD_PORT"
44-
cmd+=" --listen-peer-urls http://0.0.0.0:2380 "
45-
cmd+=" --listen-client-urls http://${HOST_IP}:$ETCD_PORT"
43+
cmd+=" --advertise-client-urls http://$SERVICE_HOST:$ETCD_PORT"
44+
if [ "$SERVICE_LISTEN_ADDRESS" == "::" ]; then
45+
cmd+=" --listen-peer-urls http://[::]:2380 "
46+
else
47+
cmd+=" --listen-peer-urls http://0.0.0.0:2380 "
48+
fi
49+
cmd+=" --listen-client-urls http://$SERVICE_HOST:$ETCD_PORT"
4650

4751
local unitfile="$SYSTEMD_DIR/$ETCD_SYSTEMD_SERVICE"
4852
write_user_unit_file $ETCD_SYSTEMD_SERVICE "$cmd" "" "root"

0 commit comments

Comments
 (0)