[INT] various updates to AKS deployment scripts
[integration.git] / deployment / aks / create_onap.sh
1 #!/bin/bash
2 # Copyright 2019 AT&T Intellectual Property. All rights reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -x
17
18 BUILD_NAME=$1
19 KUBECONFIG=$2
20 OOM_BRANCH=$3
21 BUILD_DIR=$4
22 CHART_VERSION=$5
23 OOM_OVERRIDES=$6
24
25 pushd .
26
27 cd $BUILD_DIR
28
29 export KUBECONFIG="$KUBECONFIG"
30 kubectl get nodes
31
32 COUNTER=0
33 until [ $COUNTER -ge 10 ]; do
34
35 echo "overriding default storage class for AKS"
36 kubectl delete sc default
37 sleep 1
38 cat  <<EOF | kubectl apply -f -
39 apiVersion: storage.k8s.io/v1
40 kind: StorageClass
41 metadata:
42   annotations:
43     storageclass.beta.kubernetes.io/is-default-class: "false"
44   labels:
45     kubernetes.io/cluster-service: "true"
46   name: default
47 provisioner: kubernetes.io/no-provisioner
48 reclaimPolicy: Delete
49 volumeBindingMode: Immediate
50 EOF
51
52 if [ $? -eq 0 ]; then
53   COUNTER=10
54 else
55   COUNTER=$((COUNTER +1))
56 fi
57
58 sleep 5
59 done
60
61 git clone -b "$OOM_BRANCH" http://gerrit.onap.org/r/oom --recurse-submodules
62
63 #mv requirements.yaml oom/kubernetes/onap/
64 cd oom/kubernetes
65
66 ls -l
67
68 helmpid=`ps -ef | grep -v grep | grep helm | awk '{print $2}'`
69 if [ ! -z $helmpid ]; then
70   kill $helmpid
71 fi
72
73 helm init
74 echo "initializing tiller..."
75 sleep 3
76
77 helm serve &
78 echo "started helm..."
79 sleep 3
80
81 helm repo add local http://127.0.0.1:8879
82 helm repo add stable "https://kubernetes-charts.storage.googleapis.com/"
83
84 cp -R helm/plugins/ ~/.helm
85
86 make all
87 if [ $? -ne 0 ]; then
88   echo "Failed building helm charts, exiting..."
89   exit 1
90 fi
91
92 make onap
93 if [ $? -ne 0 ]; then
94   echo "Failed building helm charts, exiting..."
95   exit 1
96 fi
97
98 TEMPLATE_OVERRIDES="-f onap/resources/overrides/onap-all.yaml -f onap/resources/overrides/openstack.yaml --timeout 900"
99 if [ -f "$BUILD_DIR/integration-override.yaml" ]; then
100   TEMPLATE_OVERRIDES="$TEMPLATE_OVERRIDES -f $BUILD_DIR/integration-override.yaml"
101 fi
102
103 helm repo remove stable
104 build_name=`echo "$BUILD_NAME" | tr '[:upper:]' '[:lower:]'`
105 helm deploy "$build_name" local/onap --version v"$CHART_VERSION" "$OOM_OVERRIDES" --namespace onap "$TEMPLATE_OVERRIDES"
106
107 kubectl get pods --namespace onap
108  
109 popd