-
Notifications
You must be signed in to change notification settings - Fork 9
/
deploy-openshift-v1.sh
executable file
·39 lines (33 loc) · 1.33 KB
/
deploy-openshift-v1.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
#!/bin/bash
# -c = cluster name
# -p = want to create new project (Y/y values)
SERVICE_VERSION=1
CREATE_PROJECT="n"
INGRESS_SUBDOMAIN=""
while getopts c:p:r: option
do
case "${option}"
in
c) INGRESS_SUBDOMAIN=$(ibmcloud ks cluster get ${OPTARG} | grep -i "Ingress Subdomain" | awk '{print $3}');;
p) CREATE_PROJECT=${OPTARG};;
r) CREATE_ROUTE=${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-v1-deploy.yaml -f openshift/destination-v1-service.yaml
oc apply -f openshift/hotel-v1-deploy.yaml -f openshift/hotel-v1-service.yaml
oc apply -f openshift/carrental-v1-deploy.yaml -f openshift/carrental-v1-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 [ "$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