From 93da17f8e8d2b2d5f100fde4dc77ebe43ab993b0 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Fri, 14 Apr 2017 14:31:52 -0700 Subject: [PATCH] Reintroduce network option Only for testing purpose, don't use it otherwise. --- deploy/deploy-example-nfs.sh | 25 ++++++++++++++++++++++++ deploy/longhorn-deploy-node.sh | 1 - deploy/longhorn-setup-single-node-env.sh | 17 +++++++++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/deploy/deploy-example-nfs.sh b/deploy/deploy-example-nfs.sh index b3dd37d..ee731c6 100755 --- a/deploy/deploy-example-nfs.sh +++ b/deploy/deploy-example-nfs.sh @@ -13,13 +13,38 @@ sleep 1 source ./common.sh +while [[ $# -gt 1 ]] +do + key="$1" + + case $key in + -n|--network) + network="$2" + shift # past argument + ;; + *) + # unknown + # option + echo ${USAGE} + break + ;; + esac + shift +done + NFS_SERVER=longhorn-nfs-server NFS_IMAGE=docker.io/erezhorev/dockerized_nfs_server BACKUPSTORE_PATH=/opt/backupstore +network_option= +if [ "$network" != "" ]; then + network_option="--network ${network}" +fi + docker run -d \ --name ${NFS_SERVER} \ + ${network_option} \ --privileged \ ${NFS_IMAGE} ${BACKUPSTORE_PATH} diff --git a/deploy/longhorn-deploy-node.sh b/deploy/longhorn-deploy-node.sh index 1375c63..a5d92b4 100755 --- a/deploy/longhorn-deploy-node.sh +++ b/deploy/longhorn-deploy-node.sh @@ -39,7 +39,6 @@ if [ "$etcd_ip" == "" ]; then fi network_option= - if [ "$network" != "" ]; then network_option="--network ${network}" fi diff --git a/deploy/longhorn-setup-single-node-env.sh b/deploy/longhorn-setup-single-node-env.sh index 6c6ed39..33bdaae 100755 --- a/deploy/longhorn-setup-single-node-env.sh +++ b/deploy/longhorn-setup-single-node-env.sh @@ -15,6 +15,10 @@ do port="$2" shift # past argument ;; + -n|--network) + network="$2" + shift # past argument + ;; *) # unknown # option @@ -25,9 +29,15 @@ do shift done -port_option= +options= if [ "$port" != "" ]; then - port_option="-p $port" + options="${options} -p $port" +fi + +network_option= +if [ "$network" != "" ]; then + options="${options} -n ${network}" + network_option="--network ${network}" fi ETCD_SERVER=longhorn-etcd-server @@ -38,6 +48,7 @@ cleanup $ETCD_SERVER docker run -d \ --name $ETCD_SERVER \ --volume /etcd-data \ + ${network_option} \ $ETCD_IMAGE \ /usr/local/bin/etcd \ --name longhorn-etcd-server \ @@ -49,4 +60,4 @@ etcd_ip=$(get_container_ip $ETCD_SERVER) echo etcd server is up at ${etcd_ip} echo -./longhorn-deploy-node.sh -e ${etcd_ip} $port_option +./longhorn-deploy-node.sh -e ${etcd_ip} ${options}