blob: 6e00633ed0a453aec7786dd7573e219ba6d1bdc3 [file] [log] [blame]
BjornMagnussonXAc5655db2023-03-17 14:55:16 +01001#!/bin/bash
2
3# ============LICENSE_START===============================================
4# Copyright (C) 2023 Nordix Foundation. All rights reserved.
5# ========================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17# ============LICENSE_END=================================================
18#
19
20
21
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020022echo "Installing pmrapp"
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010023
24. scripts/kube_get_controlplane_host.sh
25. scripts/kube_get_nodeport.sh
26. scripts/create_topic.sh
27
28# Generic error printout function
29# args: <numeric-response-code> <descriptive-string>
30check_error() {
31 if [ $1 -ne 0 ]; then
32 echo "Failed: $2"
33 echo "Exiting..."
34 exit 1
35 fi
36}
37
38echo "Creating client in keycloak"
39
40# Find host and port to keycloak
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020041export KUBERNETESHOST=$(kube_get_controlplane_host)
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010042if [ $? -ne 0 ]; then
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020043 echo $KUBERNETESHOST
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010044 echo "Exiting"
45 exit 1
46fi
47
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020048create_topic kafka-1-kafka-bootstrap.nonrtric:9092 rapp-topic 10
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010049
50. scripts/populate_keycloak.sh
51
52cid="pm-rapp"
53create_clients nonrtric-realm $cid
54check_error $?
55generate_client_secrets nonrtric-realm $cid
56check_error $?
57
58export PMRAPP_CLIENT_SECRET=$(< .sec_nonrtric-realm_$cid)
59
60envsubst < helm/nrt-pm-rapp/values-template.yaml > helm/nrt-pm-rapp/values.yaml
61
62echo " helm install..."
BjornMagnussonXA6ab531b2023-05-15 11:23:35 +020063helm install --wait -f helm/global-values.yaml -n nonrtric nrt-pm-rapp helm/nrt-pm-rapp
BjornMagnussonXAc5655db2023-03-17 14:55:16 +010064
65echo "done"
66