-
Notifications
You must be signed in to change notification settings - Fork 0
/
one-start.sh
74 lines (59 loc) · 2 KB
/
one-start.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
#!/bin/bash
declare -A services=(
[1]='config'
[2]='giftcard'
[3]='auth'
[4]='delivery'
[5]='notification'
[6]='order'
[7]='payment'
[8]='product'
[9]='store'
[10]='user'
[12]='wishlist'
[13]='apigateway'
[14]='discovery'
[15]='config'
)
selected_services=("${!services[@]}")
while true; do
# Display the menu for choosing a service
echo "Choose one service:"
# Display the available services
for key in "${selected_services[@]}"; do
echo "$key) ${services[$key]}"
done
echo "0) Quit"
# Prompt the user to choose a service
read -p "> " service_choice
case $service_choice in
0)
echo "Exiting the script"
exit 0
;;
[0-9]|1[0-5])
selected_service=${services[$service_choice]}
echo "$selected_service service running start"
# Add your code for the selected service here
# kubectl delete service $selected_service-db
# kubectl delete statefulset $selected_service-db
# kubectl delete pvc pvc-$selected_service
# kubectl delete pv pv-$selected_service
# kubectl delete service $selected_service-service
# kubectl delete deployment $selected_service-service
sleep 5
# kubectl apply -f database/$selected_service/initdb-config.yml
# kubectl apply -f database/$selected_service/pv-pvc.yml
# kubectl apply -f database/$selected_service/statefulset.yml
kubectl apply -f database/$selected_service/service.yml
# kubectl apply -f service/$selected_service/deployment.yml
# kubectl apply -f service/$selected_service/service.yml
# Update the available services for the next iteration
unset "services[$service_choice]"
selected_services=("${!services[@]}")
;;
*)
echo "Invalid selection. Please choose a valid option."
;;
esac
done