aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/heat/onap-rke/k8s_vm_install.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2019-03-26 13:08:29 -0700
committerGary Wu <gary.i.wu@huawei.com>2019-03-26 14:55:16 -0700
commit950a3237302a9cc5040354083099bce42e8f2436 (patch)
tree27a60f3dcd083193ec66700689624de8c4461829 /deployment/heat/onap-rke/k8s_vm_install.sh
parent54a0cae5a7d672285a02c64e1f98baa9b221a6f7 (diff)
First draft of k8s deployment using RKE
Change-Id: Ifa0eb52b64438df64692aaf58b9ef8e5dd7fd32c Issue-ID: INT-993 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'deployment/heat/onap-rke/k8s_vm_install.sh')
-rw-r--r--deployment/heat/onap-rke/k8s_vm_install.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/deployment/heat/onap-rke/k8s_vm_install.sh b/deployment/heat/onap-rke/k8s_vm_install.sh
new file mode 100644
index 000000000..bc538f8d3
--- /dev/null
+++ b/deployment/heat/onap-rke/k8s_vm_install.sh
@@ -0,0 +1,60 @@
+#!/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
+#
+export DEBIAN_FRONTEND=noninteractive
+echo "__host_private_ip_addr__ $(hostname)" >> /etc/hosts
+printenv
+
+mkdir -p /opt/config
+echo "__docker_version__" > /opt/config/docker_version.txt
+echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
+echo "__rancher_private_ip_addr__" > /opt/config/rancher_private_ip_addr.txt
+echo "__host_private_ip_addr__" > /opt/config/host_private_ip_addr.txt
+echo "__mtu__" > /opt/config/mtu.txt
+
+mkdir -p /etc/docker
+if [ ! -z "__docker_proxy__" ]; then
+ cat > /etc/docker/daemon.json <<EOF
+{
+ "mtu": __mtu__,
+ "insecure-registries" : ["__docker_proxy__"]
+}
+EOF
+else
+ cat > /etc/docker/daemon.json <<EOF
+{
+ "mtu": __mtu__
+}
+EOF
+fi
+if [ ! -z "__apt_proxy__" ]; then
+ cat > /etc/apt/apt.conf.d/30proxy <<EOF
+Acquire::http { Proxy "http://__apt_proxy__"; };
+Acquire::https::Proxy "DIRECT";
+EOF
+fi
+
+
+mkdir -p /dockerdata-nfs
+echo "__rancher_private_ip_addr__:/dockerdata-nfs /dockerdata-nfs nfs noauto,noatime,fg,retry=1,x-systemd.automount,_netdev,soft,nolock,intr,tcp,actimeo=1800 0 0" | tee -a /etc/fstab
+
+# workaround for OpenStack intermittent failure to change default apt mirrors
+sed -i 's|http://archive.ubuntu.com|http://nova.clouds.archive.ubuntu.com|g' /etc/apt/sources.list
+
+while ! hash jq &> /dev/null; do
+ apt-get -y update
+ # apt-get -y dist-upgrade
+ apt-get -y install apt-transport-https ca-certificates curl software-properties-common jq nfs-common docker.io
+ systemctl enable docker
+ usermod -aG docker ubuntu
+ sleep 10
+done
+
+# Enable autorestart when VM reboots
+update-rc.d k8s_vm_init_serv defaults