blob: 984eda145203a33e98a6cdfcf97e387b2badd8aa [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
garciadeblasb9a84e42024-05-31 15:06:40 +020032 helm upgrade mongodb-k8s bitnami/mongodb -n ${OSM_NAMESPACE} --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"
zamre4db5d532023-10-16 16:47:10 +000033 [ -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"
garciadeblasb9a84e42024-05-31 15:06:40 +020043OSM_NAMESPACE="osm"
zamre4db5d532023-10-16 16:47:10 +000044
garciadeblasb9a84e42024-05-31 15:06:40 +020045while getopts ":D:d:s:t:r:U:-: " o; do
zamre4db5d532023-10-16 16:47:10 +000046 case "${o}" in
47 D)
48 OSM_DEVOPS="${OPTARG}"
49 ;;
50 d)
51 OSM_HELM_WORK_DIR="${OPTARG}"
52 ;;
garciadeblasb9a84e42024-05-31 15:06:40 +020053 s)
54 OSM_NAMESPACE="${OPTARG}"
55 ;;
zamre4db5d532023-10-16 16:47:10 +000056 t)
57 OSM_DOCKER_TAG="${OPTARG}"
58 ;;
59 r)
60 DOCKER_REGISTRY_URL="${OPTARG}"
61 ;;
62 U)
63 DOCKER_USER="${OPTARG}"
64 ;;
65 -)
66 [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue
67 echo -e "Invalid option: '--$OPTARG'\n" >&2
68 exit 1
69 ;;
70 :)
71 echo "Option -$OPTARG requires an argument" >&2
72 exit 1
73 ;;
74 \?)
75 echo -e "Invalid option: '-$OPTARG'\n" >&2
76 exit 1
77 ;;
78 *)
79 exit 1
80 ;;
81 esac
82done
83
84source $OSM_DEVOPS/common/logging
85source $OSM_DEVOPS/common/track
86
87echo "DEBUG_INSTALL=$DEBUG_INSTALL"
88echo "OSM_DEVOPS=$OSM_DEVOPS"
89echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG"
90echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
garciadeblasb9a84e42024-05-31 15:06:40 +020091echo "OSM_NAMESPACE=$OSM_NAMESPACE"
zamre4db5d532023-10-16 16:47:10 +000092
93install_mongodb