| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 1 | #!/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 | |
| 16 | set +eux |
| 17 | |
| 18 | # Helm chart 13.9.4 correspondes to Mongo DB 6.0.5 |
| 19 | MONGODB_HELM_VERSION=13.9.4 |
| 20 | |
| 21 | |
| 22 | # Install MongoDB helm chart |
| 23 | function 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 |
| garciadeblas | b9a84e4 | 2024-05-31 15:06:40 +0200 | [diff] [blame] | 32 | 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" |
| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 33 | [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function |
| 34 | } |
| 35 | |
| 36 | # main |
| 37 | |
| 38 | DOCKER_REGISTRY_URL= |
| 39 | DOCKER_USER="opensourcemano" |
| 40 | OSM_DEVOPS="/usr/share/osm-devops" |
| 41 | OSM_DOCKER_TAG="testing-daily" |
| 42 | OSM_HELM_WORK_DIR="/etc/osm/helm" |
| garciadeblas | b9a84e4 | 2024-05-31 15:06:40 +0200 | [diff] [blame] | 43 | OSM_NAMESPACE="osm" |
| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 44 | |
| garciadeblas | b9a84e4 | 2024-05-31 15:06:40 +0200 | [diff] [blame] | 45 | while getopts ":D:d:s:t:r:U:-: " o; do |
| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 46 | case "${o}" in |
| 47 | D) |
| 48 | OSM_DEVOPS="${OPTARG}" |
| 49 | ;; |
| 50 | d) |
| 51 | OSM_HELM_WORK_DIR="${OPTARG}" |
| 52 | ;; |
| garciadeblas | b9a84e4 | 2024-05-31 15:06:40 +0200 | [diff] [blame] | 53 | s) |
| 54 | OSM_NAMESPACE="${OPTARG}" |
| 55 | ;; |
| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 56 | 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 |
| 82 | done |
| 83 | |
| 84 | source $OSM_DEVOPS/common/logging |
| 85 | source $OSM_DEVOPS/common/track |
| 86 | |
| 87 | echo "DEBUG_INSTALL=$DEBUG_INSTALL" |
| 88 | echo "OSM_DEVOPS=$OSM_DEVOPS" |
| 89 | echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" |
| 90 | echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" |
| garciadeblas | b9a84e4 | 2024-05-31 15:06:40 +0200 | [diff] [blame] | 91 | echo "OSM_NAMESPACE=$OSM_NAMESPACE" |
| zamre | 4db5d53 | 2023-10-16 16:47:10 +0000 | [diff] [blame] | 92 | |
| 93 | install_mongodb |