aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/heat/onap-oom/k8s_vm_init.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-11-14 10:01:37 -0800
committerGary Wu <gary.i.wu@huawei.com>2018-11-14 12:57:11 -0800
commitb718998b544f4922bbace252477f74f1e3c76763 (patch)
treea93595a736d6567a739eb64c14d6cc85ef8303bf /deployment/heat/onap-oom/k8s_vm_init.sh
parent50fe3bb96fd34355aea2ec50199e328f59d16596 (diff)
Refactor k8s VM init script to use cloud-init
Refactor k8s VM init script to use cloud-init to do apt dist-upgrade and reboot first before installing rancher agent. Change-Id: Id3d58d276673aff1d0d14bee103d1cdd9f7a3d3e Issue-ID: INT-586 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'deployment/heat/onap-oom/k8s_vm_init.sh')
-rw-r--r--deployment/heat/onap-oom/k8s_vm_init.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/deployment/heat/onap-oom/k8s_vm_init.sh b/deployment/heat/onap-oom/k8s_vm_init.sh
new file mode 100644
index 000000000..5d162cb87
--- /dev/null
+++ b/deployment/heat/onap-oom/k8s_vm_init.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -x
+# Copyright 2018 Huawei Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+RANCHER_IMAGES=$(docker images | grep rancher | wc -l)
+if [ $RANCHER_IMAGES -eq 0 ]; then
+ while [ ! -e /dockerdata-nfs/rancher_agent_cmd.sh ]; do
+ mount /dockerdata-nfs
+ sleep 10
+ done
+
+ cd ~
+ cp /dockerdata-nfs/rancher_agent_cmd.sh .
+ sed -i "s/docker run/docker run -e CATTLE_HOST_LABELS='__host_label__=true' -e CATTLE_AGENT_IP=__host_private_ip_addr__/g" rancher_agent_cmd.sh
+ source rancher_agent_cmd.sh
+fi