Merge "NONRTRIC-980: Service Manager - SMO deployment"
[it/dep.git] / smo-install / scripts / sub-scripts / install-nonrtric.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START========================================================
5 # ORAN SMO Package
6 # =================================================================================
7 # Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
8 # Modification Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
9 # =================================================================================
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at
13 #
14 # http://www.apache.org/licenses/LICENSE-2.0
15 #
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 # ============LICENSE_END==========================================================
22 # =================================================================================
23 #
24 ###
25
26 kubectl create namespace nonrtric
27 echo  '### Installing ORAN NONRTRIC part ###'
28
29 OVERRIDEYAML=$1
30
31 if ! command -v yq > /dev/null 2>&1; then
32     echo "yq is not installed. Installing yq..."
33     sudo snap install yq --channel=v3/stable
34 fi
35
36 INSTALL_KONG=$(yq read "$OVERRIDEYAML" 'nonrtric.installKong')
37 if [ $? -ne 0 ] || [ -z "$INSTALL_KONG"  ]; then
38     echo "Error: failed to parse installKong from YAML with yq. Aborting install."
39     exit 1
40 fi
41
42 INSTALL_CAPIF=$(yq read "$OVERRIDEYAML" 'nonrtric.installCapifcore')
43 if [ $? -ne 0 ] || [ -z "$INSTALL_CAPIF"  ]; then
44     echo "Error: failed to parse installCapifcore from YAML with yq. Aborting install."
45     exit 1
46 fi
47
48 INSTALL_SERVICEMANAGER=$(yq read "$OVERRIDEYAML" 'nonrtric.installServicemanager')
49 if [ $? -ne 0 ] || [ -z "$INSTALL_SERVICEMANAGER"  ]; then
50     echo "Error: failed to parse installServicemanager from YAML with yq. Aborting install."
51     exit 1
52 fi
53
54 if [ "$INSTALL_SERVICEMANAGER" == "true" ]; then
55     if [ "$INSTALL_KONG" == "false" ]; then
56         echo "Error: INSTALL_KONG must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
57         exit 1
58     fi
59     if [ "$INSTALL_CAPIF" == "false" ]; then
60         echo "Error: INSTALL_CAPIF must be true if INSTALL_SERVICEMANAGER is true. Aborting install."
61         exit 1
62     fi
63 fi
64
65 helm install --debug oran-nonrtric local/nonrtric --namespace nonrtric -f $OVERRIDEYAML --set nonrtric.persistence.mountPath="/dockerdata-nfs/deployment-$2"