3 # Copyright 2018 Huawei Technologies Co., Ltd.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
12 # This is meant to be run from within the Rancher VM to completely
13 # redeploy ONAP while reusing the existing k8s stack.
15 # This assumes that /root/integration-override.yaml is up-to-date.
17 # This script can also be used after a VM reboot, and will restart
18 # helm server accordingly.
20 export DEBIAN_FRONTEND=noninteractive
23 echo "Usage: $0 <namespace>" 1>&2;
24 echo "This will completely re-deploy ONAP, and delete and re-clone oom/ and integration/ directories."
28 if [ "$#" -ne 1 ]; then
34 OOM_GERRIT_BRANCH=master
35 OOM_GERRIT_REFSPEC=refs/heads/master
36 INTEGRATION_GERRIT_BRANCH=master
37 INTEGRATION_GERRIT_REFSPEC=refs/heads/master
40 # Verify that k8s works
41 if [ $(kubectl get pods --namespace kube-system | tail -n +2 | grep -c Running) -lt 6 ]; then
42 echo "[ERROR] Kubernetes is not healthy; aborting"
47 kubectl delete namespace $NS
48 for op in secrets configmaps pvc pv services deployments statefulsets clusterrolebinding; do
49 kubectl delete $op -n $NS --all
51 helm undeploy dev --purge
52 rm -rf /dockerdata-nfs/dev-*/
58 git clone -b $OOM_GERRIT_BRANCH https://gerrit.onap.org/r/oom
60 git fetch https://gerrit.onap.org/r/oom $OOM_GERRIT_REFSPEC
61 git checkout FETCH_HEAD
62 git checkout -b workarounds
68 git clone -b $INTEGRATION_GERRIT_BRANCH https://gerrit.onap.org/r/integration
70 git fetch https://gerrit.onap.org/r/integration $INTEGRATION_GERRIT_REFSPEC
71 git checkout FETCH_HEAD
72 git checkout -b workarounds
75 if [ ! -z "$DOCKER_MANIFEST" ]; then
76 cd version-manifest/src/main/scripts
77 ./update-oom-image-versions.sh ../resources/$DOCKER_MANIFEST ~/oom/
82 git commit -a -m "apply manifest versions"
83 git tag -a "deploy0" -m "initial deployment"
89 if [ $(curl -s -o /dev/null -w "%{http_code}" 127.0.0.1:8879) -ne 200 ]; then
90 helm init --client-only
94 helm repo add local http://127.0.0.1:8879
98 rsync -avt ~/oom/kubernetes/helm/plugins ~/.helm/
99 helm search -l | grep local
100 helm deploy dev local/onap -f ~/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f ~/integration-override.yaml --namespace onap | ts | tee -a ~/helm-deploy.log