-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy-openshift-v2.sh
executable file
·46 lines (39 loc) · 1.68 KB
/
deploy-openshift-v2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# -c = cluster name
# -p = want to create new project (Y/y values)
# -d database (postgres/mongodb/couchdb values)
SERVICE_VERSION=2
CREATE_PROJECT="n"
INGRESS_SUBDOMAIN=""
DATABASE=""
while getopts c:p:d: option
do
case "${option}"
in
c) INGRESS_SUBDOMAIN=$(ibmcloud ks cluster get ${OPTARG} | grep -i "Ingress Subdomain" | awk '{print $3}');;
p) CREATE_PROJECT=${OPTARG};;
d) DATABASE=${OPTARG};;
esac
done
if [ "$CREATE_PROJECT" = "Y" ] || [ "$CREATE_PROJECT" = "y" ]; then
oc apply -f openshift/oc-project.yaml
sleep 2s
fi
oc project bee-travels
oc apply -f openshift/destination-v2-deploy.yaml -f openshift/destination-v2-service.yaml
oc apply -f openshift/hotel-v2-deploy.yaml -f openshift/hotel-v2-service.yaml
oc apply -f openshift/carrental-v2-deploy.yaml -f openshift/carrental-v2-service.yaml
oc apply -f openshift/flight-v2-deploy.yaml -f openshift/flight-v2-service.yaml
oc apply -f openshift/currencyexchange-deploy.yaml -f openshift/currencyexchange-service.yaml
sed "s/\${SERVICE_VERSION}/${SERVICE_VERSION}/" openshift/ui-deploy.yaml > openshift/ui-deploy-temp.yaml
oc apply -f openshift/ui-deploy-temp.yaml -f openshift/ui-service.yaml
rm -rf openshift/ui-deploy-temp.yaml
if [ "$DATABASE" = "postgres" ]; then
oc apply -f openshift/postgres/pg-csv.yaml -f openshift/postgres/pg-sub.yaml -f openshift/postgres/pg-og.yaml -f openshift/postgres/pg-deploy.yaml -f openshift/postgres/pg-db.yaml
fi
if [ "$INGRESS_SUBDOMAIN" != "" ]; then
sed "s/\${INGRESS_SUBDOMAIN}/${INGRESS_SUBDOMAIN}/" openshift/ui-route.yaml > openshift/ui-route-temp.yaml
oc apply -f openshift/ui-route.yaml
rm -rf openshift/ui-route-temp.yaml
fi
oc status