-
Notifications
You must be signed in to change notification settings - Fork 0
/
lifecycle.sh
executable file
·77 lines (66 loc) · 1.42 KB
/
lifecycle.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
76
77
#!/bin/bash
function buildItem() {
cd $1
./lifecycle.sh build
cd ..
}
function build() {
buildItem consumer-billing
buildItem consumer-notification
buildItem producer
}
function deployItem() {
cd $1
./lifecycle.sh deploy
cd ..
}
function deployDapr() {
kubectl create -f dapr-resources/dapr-pubsub-order-$1.yaml
kubectl create -f dapr-resources/dapr-subscription-order-created.yaml
}
function deploy() {
if [ ! -z "$1" ]; then
deployDapr "$1"
fi
deployItem producer
deployItem consumer-billing
deployItem consumer-notification
}
function redeployItem() {
cd $1
./lifecycle.sh redeploy
cd ..
}
function redeploy() {
redeployItem producer
redeployItem consumer-billing
redeployItem consumer-notification
}
function undeployItem() {
cd $1
./lifecycle.sh undeploy
cd ..
}
function undeploy() {
undeployItem producer
undeployItem consumer-billing
undeployItem consumer-notification
}
function clean() {
undeploy
kubectl delete component.dapr.io/order --ignore-not-found
kubectl delete subscription.dapr.io/order-created-subscription --ignore-not-found
}
if [ "$1" == "deploy" ]; then
deploy "$2"
elif [ "$1" == "redeploy" ]; then
redeploy
elif [ "$1" == "build" ]; then
build
elif [ "$1" == "undeploy" ]; then
undeploy
elif [ "$1" == "clean" ]; then
clean
else
echo "No command found"
fi