blob: 213d2f45fc5f38dcd4a06875e96477cc9874db17 [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
garciadeblasb9a84e42024-05-31 15:06:40 +020036while getopts ":D:d:s:t: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 t)
48 OSM_DOCKER_TAG="${OPTARG}"
49 ;;
50 r)
51 DOCKER_REGISTRY_URL="${OPTARG}"
52 ;;
53 U)
54 DOCKER_USER="${OPTARG}"
55 ;;
56 -)
57 [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="y" && continue
58 echo -e "Invalid option: '--$OPTARG'\n" >&2
59 exit 1
60 ;;
61 :)
62 echo "Option -$OPTARG requires an argument" >&2
63 exit 1
64 ;;
65 \?)
66 echo -e "Invalid option: '-$OPTARG'\n" >&2
67 exit 1
68 ;;
69 *)
70 exit 1
71 ;;
72 esac
73done
74
garciadeblas82981162024-07-23 15:24:00 +020075DEBUG_INSTALL=${DEBUG_INSTALL:-}
76OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"}
77OSM_DOCKER_TAG=${OSM_DOCKER_TAG:-"testing-daily"}
78OSM_HELM_WORK_DIR=${OSM_HELM_WORK_DIR:-"/etc/osm/helm"}
79OSM_NAMESPACE=${OSM_NAMESPACE:-"osm"}
80DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-}
81DOCKER_USER=${DOCKER_USER:-"opensourcemano"}
zamre4db5d532023-10-16 16:47:10 +000082echo "DEBUG_INSTALL=$DEBUG_INSTALL"
83echo "OSM_DEVOPS=$OSM_DEVOPS"
84echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG"
85echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
garciadeblasb9a84e42024-05-31 15:06:40 +020086echo "OSM_NAMESPACE=$OSM_NAMESPACE"
garciadeblas82981162024-07-23 15:24:00 +020087echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL"
88echo "DOCKER_USER=$DOCKER_USER"
89
90source $OSM_DEVOPS/common/logging
91source $OSM_DEVOPS/common/track
zamre4db5d532023-10-16 16:47:10 +000092
93install_mongodb