forked from sorintlab/stolon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch.sh
31 lines (22 loc) · 1.14 KB
/
launch.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
#!/usr/bin/env bash
[ -z $NAMESPACE ] && { echo "Need to set NAMESPACE"; exit 1; }
[ -z $PGPASS ] && { echo "Need to set PG_PASS"; exit 1; }
[ -z $CONSUL_TOKEN ] && { echo "Need to set CONSUL_TOKEN"; exit 1; }
ct=$(printf $CONSUL_TOKEN|base64 -w 0)
ps=$(printf $PGPASS|base64 -w 0)
# create secret
if kubectl get secrets --namespace $NAMESPACE | grep -q "stolon-credentials"; then
echo "stolon-credentials already exists"
else
sigil -p -f secrets.yml namespace=$NAMESPACE password=$ps CONSUL_HTTP_TOKEN=$ct | kubectl apply --validate=false --overwrite -f -
fi
kubectl -n=$NAMESPACE create configmap stolon-keeper-init --from-file=init-keeper.sh
# sentinel
sigil -p -f stolon-sentinel.yaml namespace=$NAMESPACE| kubectl apply --validate --overwrite -f -
# launch keeper
sigil -p -f stolon-keeper.yaml namespace=$NAMESPACE| kubectl apply --validate --overwrite -f -
# proxy
sigil -p -f stolon-proxy.yaml namespace=$NAMESPACE| kubectl apply --validate --overwrite -f -
# service
# kubectl apply -f service-proxy.yaml --validate --overwrite
sigil -p -f stolon-proxy-service.yaml namespace=$NAMESPACE| kubectl apply --validate=false --overwrite -f -