blob: d13fc1e2a967b089fee64927d307617436fb3fd2 [file] [log] [blame]
zamre4db5d532023-10-16 16:47:10 +00001#!/bin/bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16set +eux
17
18# Helm chart 13.9.4 correspondes to Mongo DB 6.0.5
19MONGODB_HELM_VERSION=13.9.4
20
21
22# Install MongoDB helm chart
23function install_mongodb() {
24 [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
25 # copy mongodb-values.yaml to the destination folder
26 sudo mkdir -p ${OSM_HELM_WORK_DIR}
27 sudo cp ${OSM_DEVOPS}/installers/helm/values/mongodb-values.yaml ${OSM_HELM_WORK_DIR}
28 # update mongodb-values.yaml to use the right tag
29
30 helm repo add bitnami https://charts.bitnami.com/bitnami
31 helm repo update
32 helm upgrade mongodb-k8s bitnami/mongodb -n osm --create-namespace --install -f ${OSM_HELM_WORK_DIR}/mongodb-values.yaml --version ${MONGODB_HELM_VERSION} --timeout 10m || FATAL_TRACK mongodb "Failed installing mongodb helm chart"
33 [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
34}
35
36# main
37
38DOCKER_REGISTRY_URL=
39DOCKER_USER="opensourcemano"
40OSM_DEVOPS="/usr/share/osm-devops"
41OSM_DOCKER_TAG="testing-daily"
42OSM_HELM_WORK_DIR="/etc/osm/helm"
43
44while getopts ":D:d:t:r:U:-: " o; do
45 case "${o}" in
46 D)
47 OSM_DEVOPS="${OPTARG}"
48 ;;
49 d)
50 OSM_HELM_WORK_DIR="${OPTARG}"
51 ;;
52 t)
53 OSM_DOCKER_TAG="${OPTARG}"
54 ;;
55 r)
56 DOCKER_REGISTRY_URL="${OPTARG}"
57 ;;
58 U)
59 DOCKER_USER="${OPTARG}"
60 ;;
61 -)
62 [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue
63 echo -e "Invalid option: '--$OPTARG'\n" >&2
64 exit 1
65 ;;
66 :)
67 echo "Option -$OPTARG requires an argument" >&2
68 exit 1
69 ;;
70 \?)
71 echo -e "Invalid option: '-$OPTARG'\n" >&2
72 exit 1
73 ;;
74 *)
75 exit 1
76 ;;
77 esac
78done
79
80source $OSM_DEVOPS/common/logging
81source $OSM_DEVOPS/common/track
82
83echo "DEBUG_INSTALL=$DEBUG_INSTALL"
84echo "OSM_DEVOPS=$OSM_DEVOPS"
85echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG"
86echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
87
88install_mongodb