-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
75 lines (63 loc) · 1.34 KB
/
run.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Create the namespace to setup the project
createNS() {
kubectl create ns sd-exam3
}
# Select the correct namespace to be sure
Set-Context() {
kubectl config set-context --current --namespace=sd-exam3
}
# launch the deployments and services required for the DB
# in the sd-exam3 namespace
deployDB() {
Set-Context
kubectl apply -f ./database/deployments
kubectl apply -f ./database/services
}
# launch the deployment and service required for the APP
# in the sd-exam3 namespace
deployApp() {
Set-Context
kubectl apply -f './app-deployment'
}
# launch all in the sd-exam3 namespace
deploy() {
deployDB
deployApp
}
# halt the deployments and services required for the DB
# in the sd-exam3 namespace
haltDB() {
Set-Context
kubectl delete -f ./database/deployments
kubectl delete -f ./database/services
}
# halt the deployment and service required for the APP
# in the sd-exam3 namespace
haltApp() {
Set-Context
kubectl delete -f ./app-deployment
}
# halt all in the sd-exam3 namespace
halt() {
haltDB
haltApp
}
buildApp() {
docker rmi franjaresc/sd-exam3
docker build -t franjaresc/sd-exam3 ./app
}
pushApp() {
docker push franjaresc/sd-exam3
}
reloadChanges() {
Set-Context
haltApp
buildApp
pushApp
deployApp
}
for arg in "$@"
do
eval $arg
done