From 146332e349416ac0b3c9653b0ae68d55dbb3f9de Mon Sep 17 00:00:00 2001 From: Jens Harbott Date: Wed, 20 Sep 2017 06:18:08 +0000 Subject: [PATCH] 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 --- lib/etcd3 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/etcd3 b/lib/etcd3 index 60e827add2..e6a04f11de 100644 --- a/lib/etcd3 +++ b/lib/etcd3 @@ -40,9 +40,13 @@ function start_etcd3 { cmd+=" --initial-cluster-state new --initial-cluster-token etcd-cluster-01" cmd+=" --initial-cluster $HOSTNAME=http://$SERVICE_HOST:2380" cmd+=" --initial-advertise-peer-urls http://$SERVICE_HOST:2380" - cmd+=" --advertise-client-urls http://${HOST_IP}:$ETCD_PORT" - cmd+=" --listen-peer-urls http://0.0.0.0:2380 " - cmd+=" --listen-client-urls http://${HOST_IP}:$ETCD_PORT" + cmd+=" --advertise-client-urls http://$SERVICE_HOST:$ETCD_PORT" + if [ "$SERVICE_LISTEN_ADDRESS" == "::" ]; then + cmd+=" --listen-peer-urls http://[::]:2380 " + else + cmd+=" --listen-peer-urls http://0.0.0.0:2380 " + fi + cmd+=" --listen-client-urls http://$SERVICE_HOST:$ETCD_PORT" local unitfile="$SYSTEMD_DIR/$ETCD_SYSTEMD_SERVICE" write_user_unit_file $ETCD_SYSTEMD_SERVICE "$cmd" "" "root"