Browse code

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

Davanum Srinivas authored on 2017/11/28 22:20:48
Showing 3 changed files
... ...
@@ -327,7 +327,7 @@ function configure_cinder {
327 327
     if [[ ! -z "$CINDER_COORDINATION_URL" ]]; then
328 328
         iniset $CINDER_CONF coordination backend_url "$CINDER_COORDINATION_URL"
329 329
     elif is_service_enabled etcd3; then
330
-        iniset $CINDER_CONF coordination backend_url "etcd3+http://${SERVICE_HOST}:2379"
330
+        iniset $CINDER_CONF coordination backend_url "etcd3+http://${SERVICE_HOST}:$ETCD_PORT"
331 331
     fi
332 332
 }
333 333
 
... ...
@@ -27,7 +27,6 @@ set +o xtrace
27 27
 ETCD_DATA_DIR="$DATA_DIR/etcd"
28 28
 ETCD_SYSTEMD_SERVICE="devstack@etcd.service"
29 29
 ETCD_BIN_DIR="$DEST/bin"
30
-ETCD_PORT=2379
31 30
 
32 31
 if is_ubuntu ; then
33 32
     UBUNTU_RELEASE_BASE_NUM=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1`
... ...
@@ -38,13 +37,13 @@ function start_etcd3 {
38 38
     local cmd="$ETCD_BIN_DIR/etcd"
39 39
     cmd+=" --name $HOSTNAME --data-dir $ETCD_DATA_DIR"
40 40
     cmd+=" --initial-cluster-state new --initial-cluster-token etcd-cluster-01"
41
-    cmd+=" --initial-cluster $HOSTNAME=http://$SERVICE_HOST:2380"
42
-    cmd+=" --initial-advertise-peer-urls http://$SERVICE_HOST:2380"
41
+    cmd+=" --initial-cluster $HOSTNAME=http://$SERVICE_HOST:$ETCD_PEER_PORT"
42
+    cmd+=" --initial-advertise-peer-urls http://$SERVICE_HOST:$ETCD_PEER_PORT"
43 43
     cmd+=" --advertise-client-urls http://$SERVICE_HOST:$ETCD_PORT"
44 44
     if [ "$SERVICE_LISTEN_ADDRESS" == "::" ]; then
45
-        cmd+=" --listen-peer-urls http://[::]:2380 "
45
+        cmd+=" --listen-peer-urls http://[::]:$ETCD_PEER_PORT "
46 46
     else
47
-        cmd+=" --listen-peer-urls http://0.0.0.0:2380 "
47
+        cmd+=" --listen-peer-urls http://0.0.0.0:$ETCD_PEER_PORT "
48 48
     fi
49 49
     cmd+=" --listen-client-urls http://$SERVICE_HOST:$ETCD_PORT"
50 50
 
... ...
@@ -748,6 +748,8 @@ elif is_arch "s390x"; then
748 748
 else
749 749
     exit_distro_not_supported "invalid hardware type - $ETCD_ARCH"
750 750
 fi
751
+ETCD_PORT=${ETCD_PORT:-2379}
752
+ETCD_PEER_PORT=${ETCD_PEER_PORT:-2380}
751 753
 ETCD_DOWNLOAD_URL=${ETCD_DOWNLOAD_URL:-https://github.com/coreos/etcd/releases/download}
752 754
 ETCD_NAME=etcd-$ETCD_VERSION-linux-$ETCD_ARCH
753 755
 ETCD_DOWNLOAD_FILE=$ETCD_NAME.tar.gz