blob: 1611d77c43f060ed635f1267e649927d10479645 [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
zamre4db5d532023-10-16 16:47:10 +000021# Install MongoDB helm chart
22function install_mongodb() {
23 [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
24 # copy mongodb-values.yaml to the destination folder
25 sudo mkdir -p ${OSM_HELM_WORK_DIR}
26 sudo cp ${OSM_DEVOPS}/installers/helm/values/mongodb-values.yaml ${OSM_HELM_WORK_DIR}
27 # update mongodb-values.yaml to use the right tag
28
29 helm repo add bitnami https://charts.bitnami.com/bitnami
30 helm repo update
garciadeblasb9a84e42024-05-31 15:06:40 +020031 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 +000032 [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
33}
34
35# main
garciadeblasa9cab1f2025-01-13 12:04:42 +010036while getopts ":D:d:s:r:U:-: " o; do
zamre4db5d532023-10-16 16:47:10 +000037 case "${o}" in
38 D)
39 OSM_DEVOPS="${OPTARG}"
40 ;;
41 d)
42 OSM_HELM_WORK_DIR="${OPTARG}"
43 ;;
garciadeblasb9a84e42024-05-31 15:06:40 +020044 s)
45 OSM_NAMESPACE="${OPTARG}"
46 ;;
zamre4db5d532023-10-16 16:47:10 +000047 r)
48 DOCKER_REGISTRY_URL="${OPTARG}"
49 ;;
50 U)
51 DOCKER_USER="${OPTARG}"
52 ;;
53 -)
54 [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue
55 echo -e "Invalid option: '--$OPTARG'\n" >&2
56 exit 1
57 ;;
58 :)
59 echo "Option -$OPTARG requires an argument" >&2
60 exit 1
61 ;;
62 \?)
63 echo -e "Invalid option: '-$OPTARG'\n" >&2
64 exit 1
65 ;;
66 *)
67 exit 1
68 ;;
69 esac
70done
71
garciadeblas82981162024-07-23 15:24:00 +020072DEBUG_INSTALL=${DEBUG_INSTALL:-}
73OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"}
garciadeblas82981162024-07-23 15:24:00 +020074OSM_HELM_WORK_DIR=${OSM_HELM_WORK_DIR:-"/etc/osm/helm"}
75OSM_NAMESPACE=${OSM_NAMESPACE:-"osm"}
76DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-}
77DOCKER_USER=${DOCKER_USER:-"opensourcemano"}
zamre4db5d532023-10-16 16:47:10 +000078echo "DEBUG_INSTALL=$DEBUG_INSTALL"
79echo "OSM_DEVOPS=$OSM_DEVOPS"
zamre4db5d532023-10-16 16:47:10 +000080echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
garciadeblasb9a84e42024-05-31 15:06:40 +020081echo "OSM_NAMESPACE=$OSM_NAMESPACE"
garciadeblas82981162024-07-23 15:24:00 +020082echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL"
83echo "DOCKER_USER=$DOCKER_USER"
84
85source $OSM_DEVOPS/common/logging
86source $OSM_DEVOPS/common/track
zamre4db5d532023-10-16 16:47:10 +000087
88install_mongodb