diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-11-14 10:01:37 -0800 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2018-11-14 12:57:11 -0800 |
commit | b718998b544f4922bbace252477f74f1e3c76763 (patch) | |
tree | a93595a736d6567a739eb64c14d6cc85ef8303bf /deployment/heat/onap-oom/k8s_vm_entrypoint.sh | |
parent | 50fe3bb96fd34355aea2ec50199e328f59d16596 (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_entrypoint.sh')
-rw-r--r-- | deployment/heat/onap-oom/k8s_vm_entrypoint.sh | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh b/deployment/heat/onap-oom/k8s_vm_entrypoint.sh deleted file mode 100644 index 62340c11c..000000000 --- a/deployment/heat/onap-oom/k8s_vm_entrypoint.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/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 -HOST_IP=$(hostname -I) -echo $HOST_IP `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 - -mkdir -p /etc/docker -if [ ! -z "__docker_proxy__" ]; then - cat > /etc/docker/daemon.json <<EOF -{ - "insecure-registries" : ["__docker_proxy__"] -} -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 - -# tune ext4 for performance -sed -i 's/defaults/defaults,noatime,commit=60,barrier=0/' /etc/fstab - -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 linux-image-extra-$(uname -r) apt-transport-https ca-certificates curl software-properties-common jq nfs-common - sleep 10 -done - -# install docker 17.03 -while ! hash docker &> /dev/null; do - curl -s https://releases.rancher.com/install-docker/__docker_version__.sh | sh - usermod -aG docker ubuntu - sleep 10 -done -apt-mark hold docker-ce - -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_IP}/g" rancher_agent_cmd.sh -source rancher_agent_cmd.sh -sleep 1m - -reboot |