Merge "Sample consumer to get kafka broker from ICS"
[nonrtric.git] / service-exposure / keycloak.sh
1 #!/bin/bash
2 #
3 # ============LICENSE_START=======================================================
4 #  Copyright (C) 2022 Nordix Foundation.
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 #
18 # SPDX-License-Identifier: Apache-2.0
19 # ============LICENSE_END=========================================================
20 #
21
22 if [ -z "$1" ]
23   then
24     echo "No argument supplied"
25     exit 1
26 fi
27
28 OPERATION=$1
29
30 if [ "$OPERATION" == "deploy" ]; then
31         echo "Deploying applications..."
32         echo "-------------------------"
33         istioctl kube-inject -f postgres.yaml | kubectl apply -f -
34         sleep 10
35         istioctl kube-inject -f keycloak.yaml | kubectl apply -f -
36         echo ""
37         echo "Waiting for pods to start..."
38         echo "----------------------------"
39         kubectl wait deployment -n default postgres --for=condition=available --timeout=90s
40         kubectl wait deployment -n default keycloak --for=condition=available --timeout=300s
41         echo ""
42         echo "Checking pod status..."
43         echo "----------------------"
44         kubectl get pods -n default
45 elif [ "$OPERATION" == "undeploy" ]; then
46         echo "Undeploying applications..."
47         echo "---------------------------"
48         kubectl delete -f keycloak.yaml
49         kubectl delete -f postgres.yaml
50 else
51         echo "Unrecogized operation ${OPERATION}"
52         exit 1
53 fi
54
55 exit 0