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