summaryrefslogtreecommitdiffstats
path: root/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-10-31 12:30:54 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-10-31 14:42:33 -0700
commit895a4acfea7afa608b6b0762355fb6b014707df3 (patch)
tree6cfcf8936936d7e70b9697ca4e958c4532482e8a /deployment/heat/onap-oom/rancher_vm_entrypoint.sh
parent5b074b87335a98ba08b41f1e89d36f25fd25d798 (diff)
Reduce OOM k8s footprint further
Reduce OOM k8s footprint by using the Rancher VM as the orchestration node. Also cleaned up the rancher deployment script. Change-Id: Ic5594eac2830d83d58d2b0a1fa5eee770d97063d Issue-ID: INT-586 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'deployment/heat/onap-oom/rancher_vm_entrypoint.sh')
-rw-r--r--deployment/heat/onap-oom/rancher_vm_entrypoint.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
index 3bc811b8f..e8aae2ea1 100644
--- a/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
+++ b/deployment/heat/onap-oom/rancher_vm_entrypoint.sh
@@ -10,6 +10,8 @@
#
export DEBIAN_FRONTEND=noninteractive
+HOST_IP=$(hostname -I)
+echo $HOST_IP `hostname` >> /etc/hosts
printenv
mkdir -p /opt/config
@@ -114,10 +116,15 @@ sudo mv ./kubectl /usr/local/bin/kubectl
mkdir ~/.kube
# install helm __helm_version__
+mkdir -p helm
+pushd helm
wget -q http://storage.googleapis.com/kubernetes-helm/helm-v__helm_version__-linux-amd64.tar.gz
tar -zxvf helm-v__helm_version__-linux-amd64.tar.gz
-sudo mv linux-amd64/helm /usr/local/bin/helm
+sudo cp linux-amd64/helm /usr/local/bin/helm
+popd
+mkdir -p rancher
+pushd rancher
echo export RANCHER_IP=__rancher_private_ip_addr__ > api-keys-rc
source api-keys-rc
@@ -178,11 +185,18 @@ done
jq -r .command token.json > rancher_agent_cmd.sh
chmod +x rancher_agent_cmd.sh
cp rancher_agent_cmd.sh /dockerdata-nfs
+popd
+
cd /dockerdata-nfs
git add -A
git commit -a -m "Add rancher agent command file"
cd ~
+cp /dockerdata-nfs/rancher_agent_cmd.sh .
+sed -i "s/docker run/docker run -e CATTLE_HOST_LABELS='orchestration=true' -e CATTLE_AGENT_IP=${HOST_IP}/g" rancher_agent_cmd.sh
+source rancher_agent_cmd.sh
+
+
KUBETOKEN=$(echo -n 'Basic '$(echo -n "$CATTLE_ACCESS_KEY:$CATTLE_SECRET_KEY" | base64 -w 0) | base64 -w 0)
@@ -211,6 +225,8 @@ EOF
export KUBECONFIG=/root/.kube/config
kubectl config view
+
+
# Enable auto-completion for kubectl
echo "source <(kubectl completion bash)" >> ~/.bashrc