Use 2.0.0-ONAP tag instead beijing branch
[integration.git] / deployment / heat / onap-oom / rancher_vm_entrypoint.sh
index 2babb28..5a27c26 100644 (file)
@@ -1,9 +1,29 @@
 #!/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
+#
+
 printenv
 
 mkdir -p /opt/config
 echo "__rancher_ip_addr__" > /opt/config/rancher_ip_addr.txt
 echo "__k8s_vm_ips__" > /opt/config/k8s_vm_ips.txt
+echo "__oam_network_id__" > /opt/config/oam_network_id.txt
+echo "__oam_subnet_id__" > /opt/config/oam_subnet_id.txt
+
+cat <<EOF > /opt/config/integration-override.yaml
+__integration_override_yaml__
+EOF
+sed -i 's/\_\_oam_network_id__/__oam_network_id__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_oam_subnet_id__/__oam_subnet_id__/g' /opt/config/integration-override.yaml
+sed -i 's/\_\_k8s_1_vm_ip__/__k8s_1_vm_ip__/g' /opt/config/integration-override.yaml
+cp /opt/config/integration-override.yaml /root
 
 echo `hostname -I` `hostname` >> /etc/hosts
 mkdir -p /etc/docker
@@ -30,7 +50,7 @@ chmod 777 /dockerdata-nfs/
 chown nobody:nogroup /dockerdata-nfs/
 cd /dockerdata-nfs/
 git init
-git config user.email "root@k8s"
+git config user.email "root@onap"
 git config user.name "root"
 git add -A
 git commit -m "initial commit"
@@ -54,7 +74,7 @@ usermod -aG docker ubuntu
 
 docker run --restart unless-stopped -d -p 8080:8080  -e CATTLE_BOOTSTRAP_REQUIRED_IMAGE=__docker_proxy__/rancher/agent:v1.2.9 __docker_proxy__/rancher/server:v1.6.14
 
-# install kubernetes 1.8.6
+# install kubernetes 1.8.10
 curl -s -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.10/bin/linux/amd64/kubectl
 chmod +x ./kubectl
 sudo mv ./kubectl /usr/local/bin/kubectl
@@ -118,6 +138,10 @@ done
 jq -r .command token.json > rancher_agent_cmd.sh
 chmod +x rancher_agent_cmd.sh
 cp rancher_agent_cmd.sh /dockerdata-nfs
+cd /dockerdata-nfs
+git add -A
+git commit -a -m "Add rancher agent command file"
+cd ~
 
 
 KUBETOKEN=$(echo -n 'Basic '$(echo -n "$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | base64 -w 0) | base64 -w 0)
@@ -157,36 +181,22 @@ done
 # Install using OOM
 export HOME=/root
 
+# update and initialize git
+apt-get -y install git
+git config --global user.email root@rancher
+git config --global user.name root@rancher
+git config --global log.decorate auto
+
 # Clone OOM:
 cd ~
-git clone -b master http://gerrit.onap.org/r/oom
+git clone -b 2.0.0-ONAP http://gerrit.onap.org/r/oom
 cd oom
 git log -1
-
-# Update values.yaml to point to docker-proxy instead of nexus3:
-cd ~/oom/kubernetes
-#perl -p -i -e 's/nexus3.onap.org:10001/__docker_proxy__/g' `find ./ -name values.yaml`
-sed -i 's/nexus3.onap.org:10001/__docker_proxy__/g' onap/values.yaml
-sed -i 's/#repository:/repository:/g' onap/values.yaml
-sed -i 's/#repositorySecret:/repositorySecret:/g' onap/values.yaml
-git diff
-
-
-# Clone integration:
-cd ~
-git clone -b master http://gerrit.onap.org/r/integration
-cd integration
-git log -1
-
-cd ~
-ln -s ~/integration/deployment/heat/onap-oom/env/__lab_name__/integration-override.yaml
-sed -i 's/nexus3.onap.org:10001/__docker_proxy__/g' integration-override.yaml
-
+git tag -a "deploy0" -m "initial deployment"
+git checkout -b workarounds
 
 # Run ONAP:
 cd ~/oom/kubernetes/
-# verify version
-helm version
 helm init --client-only
 helm init --upgrade
 helm serve &
@@ -195,12 +205,10 @@ helm repo add local http://127.0.0.1:8879
 helm repo list
 make all
 helm search -l | grep local
-if [ -e ~/integration-override.yaml ]; then
-    helm install local/onap -n dev --namespace onap -f ~/integration-override.yaml
-else
-    helm install local/onap -n dev --namespace onap
-fi
+helm install local/onap -n dev --namespace onap -f ~/integration-override.yaml
 
+# Enable auto-completion for kubectl
+echo "source <(kubectl completion bash)" >> ~/.bashrc
 
 # Check ONAP status:
 sleep 3