summaryrefslogtreecommitdiffstats
path: root/kube2consul/src/main/docker/start.sh
diff options
context:
space:
mode:
authorHuabingZhao <zhao.huabing@zte.com.cn>2017-08-11 09:16:22 +0000
committerHuabingZhao <zhao.huabing@zte.com.cn>2017-08-11 09:19:23 +0000
commit3736aafdb168d76483a42acb552098244ceee034 (patch)
treeddd22127094ba06bd1dd74c6f3b23b437eae4066 /kube2consul/src/main/docker/start.sh
parent012e88c913f39706fa6ae1b79c1fe0924ac1d2df (diff)
Initial commit for registrator source codes
Change-Id: I0cdd285d6228f0a1b6a6b27787be09d2d7af3579 Issue-Id: OOM-61 Signed-off-by: HuabingZhao <zhao.huabing@zte.com.cn>
Diffstat (limited to 'kube2consul/src/main/docker/start.sh')
-rw-r--r--kube2consul/src/main/docker/start.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/kube2consul/src/main/docker/start.sh b/kube2consul/src/main/docker/start.sh
new file mode 100644
index 0000000..033c50b
--- /dev/null
+++ b/kube2consul/src/main/docker/start.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+if [ -z "${KUBE_MASTER_IP}" ]; then
+ echo "kube master node ip is required."
+ exit 1
+fi
+
+if [ -n "${JOIN_IP}" ]; then
+ echo "### Starting consul client"
+ if [ -z "${ALL_IN_ONE}" ]; then
+ /consul/consul agent -data-dir /consul-works/data-dir -node kube2consul_${KUBE_MASTER_IP} -bind ${KUBE_MASTER_IP} -client 0.0.0.0 -retry-join ${JOIN_IP} -retry-interval 5s &
+ else
+ /consul/consul agent -data-dir /consul-works/data-dir -node kube2consul_${KUBE_MASTER_IP} -bind 0.0.0.0 -client 0.0.0.0 -retry-join ${JOIN_IP} -retry-interval 5s &
+ fi
+fi
+
+if [ -z "${RUN_MODE}" ]; then
+ echo "non-HA scenario."
+else
+ echo "\n\n### Starting consul agent"
+ cd ./consul
+ ./entry.sh &
+fi
+
+kube_url="http://${KUBE_MASTER_IP}:8080"
+
+if [ "${CLUSTER_TYPE}" == "openshift" ]; then
+ kube_url="https://${KUBE_MASTER_IP}:8443"
+fi
+
+echo "\n\n### Starting kube2consul"
+if [ -z "${PDM_CONTROLLER_IP}" ]; then
+ /bin/kube2consul --kube_master_url ${kube_url}
+else
+ echo "in Paas mode."
+ /bin/kube2consul --kube_master_url ${kube_url} --pdm_controller_url http://${PDM_CONTROLLER_IP}:9527
+fi \ No newline at end of file