Allow overrides for ETCD ports
This will enable us to run one etcd for devstack and another
for kubernetes in the same box if necessary
Change-Id: Ib71ded24727b80afd4d98eb68bade0f8c0f72311
diff --git a/lib/cinder b/lib/cinder
index 07f82a1..2851966 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -327,7 +327,7 @@
if [[ ! -z "$CINDER_COORDINATION_URL" ]]; then
iniset $CINDER_CONF coordination backend_url "$CINDER_COORDINATION_URL"
elif is_service_enabled etcd3; then
- iniset $CINDER_CONF coordination backend_url "etcd3+http://${SERVICE_HOST}:2379"
+ iniset $CINDER_CONF coordination backend_url "etcd3+http://${SERVICE_HOST}:$ETCD_PORT"
fi
}
diff --git a/lib/etcd3 b/lib/etcd3
index 51df8e4..dc68524 100644
--- a/lib/etcd3
+++ b/lib/etcd3
@@ -27,7 +27,6 @@
ETCD_DATA_DIR="$DATA_DIR/etcd"
ETCD_SYSTEMD_SERVICE="devstack@etcd.service"
ETCD_BIN_DIR="$DEST/bin"
-ETCD_PORT=2379
if is_ubuntu ; then
UBUNTU_RELEASE_BASE_NUM=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1`
@@ -38,13 +37,13 @@
local cmd="$ETCD_BIN_DIR/etcd"
cmd+=" --name $HOSTNAME --data-dir $ETCD_DATA_DIR"
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+=" --initial-cluster $HOSTNAME=http://$SERVICE_HOST:$ETCD_PEER_PORT"
+ cmd+=" --initial-advertise-peer-urls http://$SERVICE_HOST:$ETCD_PEER_PORT"
cmd+=" --advertise-client-urls http://$SERVICE_HOST:$ETCD_PORT"
if [ "$SERVICE_LISTEN_ADDRESS" == "::" ]; then
- cmd+=" --listen-peer-urls http://[::]:2380 "
+ cmd+=" --listen-peer-urls http://[::]:$ETCD_PEER_PORT "
else
- cmd+=" --listen-peer-urls http://0.0.0.0:2380 "
+ cmd+=" --listen-peer-urls http://0.0.0.0:$ETCD_PEER_PORT "
fi
cmd+=" --listen-client-urls http://$SERVICE_HOST:$ETCD_PORT"
diff --git a/stackrc b/stackrc
index ffe4050..ed356ee 100644
--- a/stackrc
+++ b/stackrc
@@ -748,6 +748,8 @@
else
exit_distro_not_supported "invalid hardware type - $ETCD_ARCH"
fi
+ETCD_PORT=${ETCD_PORT:-2379}
+ETCD_PEER_PORT=${ETCD_PEER_PORT:-2380}
ETCD_DOWNLOAD_URL=${ETCD_DOWNLOAD_URL:-https://github.com/coreos/etcd/releases/download}
ETCD_NAME=etcd-$ETCD_VERSION-linux-$ETCD_ARCH
ETCD_DOWNLOAD_FILE=$ETCD_NAME.tar.gz