stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 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 |
stark, steven | f351942 | 2019-12-05 14:14:32 -0800 | [diff] [blame] | 20 | OOM_BRANCH=$3 |
| 21 | BUILD_DIR=$4 |
| 22 | CHART_VERSION=$5 |
| 23 | OOM_OVERRIDES=$6 |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame] | 24 | MASTER_PASSWORD=$7 |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 25 | |
| 26 | pushd . |
| 27 | |
| 28 | cd $BUILD_DIR |
| 29 | |
| 30 | export KUBECONFIG="$KUBECONFIG" |
| 31 | kubectl get nodes |
| 32 | |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 33 | echo "overriding default storage class for AKS" |
| 34 | kubectl delete sc default |
| 35 | sleep 1 |
stark, steven | 0e11171 | 2020-01-29 17:01:48 -0800 | [diff] [blame] | 36 | cat > "$BUILD_DIR/tmp-sc.yaml" <<EOF |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 37 | apiVersion: storage.k8s.io/v1 |
| 38 | kind: StorageClass |
| 39 | metadata: |
| 40 | annotations: |
| 41 | storageclass.beta.kubernetes.io/is-default-class: "false" |
| 42 | labels: |
| 43 | kubernetes.io/cluster-service: "true" |
| 44 | name: default |
| 45 | provisioner: kubernetes.io/no-provisioner |
| 46 | reclaimPolicy: Delete |
| 47 | volumeBindingMode: Immediate |
| 48 | EOF |
| 49 | |
stark, steven | 0e11171 | 2020-01-29 17:01:48 -0800 | [diff] [blame] | 50 | kubectl replace -f "$BUILD_DIR/tmp-sc.yaml" --force |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 51 | |
| 52 | git clone -b "$OOM_BRANCH" http://gerrit.onap.org/r/oom --recurse-submodules |
| 53 | |
| 54 | #mv requirements.yaml oom/kubernetes/onap/ |
| 55 | cd oom/kubernetes |
| 56 | |
| 57 | ls -l |
| 58 | |
| 59 | helmpid=`ps -ef | grep -v grep | grep helm | awk '{print $2}'` |
| 60 | if [ ! -z $helmpid ]; then |
| 61 | kill $helmpid |
| 62 | fi |
| 63 | |
| 64 | helm init |
| 65 | echo "initializing tiller..." |
| 66 | sleep 3 |
| 67 | |
| 68 | helm serve & |
| 69 | echo "started helm..." |
| 70 | sleep 3 |
| 71 | |
| 72 | helm repo add local http://127.0.0.1:8879 |
| 73 | helm repo add stable "https://kubernetes-charts.storage.googleapis.com/" |
| 74 | |
| 75 | cp -R helm/plugins/ ~/.helm |
| 76 | |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame] | 77 | make all -e SKIP_LINT=TRUE |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 78 | if [ $? -ne 0 ]; then |
| 79 | echo "Failed building helm charts, exiting..." |
| 80 | exit 1 |
| 81 | fi |
| 82 | |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame] | 83 | make onap -e SKIP_LINT=TRUE |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 84 | if [ $? -ne 0 ]; then |
| 85 | echo "Failed building helm charts, exiting..." |
| 86 | exit 1 |
| 87 | fi |
| 88 | |
| 89 | TEMPLATE_OVERRIDES="-f onap/resources/overrides/onap-all.yaml -f onap/resources/overrides/openstack.yaml --timeout 900" |
| 90 | if [ -f "$BUILD_DIR/integration-override.yaml" ]; then |
| 91 | TEMPLATE_OVERRIDES="$TEMPLATE_OVERRIDES -f $BUILD_DIR/integration-override.yaml" |
| 92 | fi |
| 93 | |
| 94 | helm repo remove stable |
| 95 | build_name=`echo "$BUILD_NAME" | tr '[:upper:]' '[:lower:]'` |
stark, steven | d5d74c7 | 2020-04-21 15:28:13 -0700 | [diff] [blame] | 96 | helm deploy "$build_name" local/onap --version v"$CHART_VERSION" --set "global.masterPassword=$MASTER_PASSWORD" "$OOM_OVERRIDES" --namespace onap "$TEMPLATE_OVERRIDES" |
stark, steven | 6754bc1 | 2019-09-19 15:43:00 -0700 | [diff] [blame] | 97 | |
| 98 | kubectl get pods --namespace onap |
| 99 | |
| 100 | popd |