forked from mojaloop/helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-central.sh
executable file
·76 lines (69 loc) · 1.53 KB
/
deploy-central.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
#!/bin/bash
usage() {
echo "Script to deploy Central via Helm";
echo "Usage: `basename $0` options -r <release-name> (-n <namespace>) (-o <options-file>) (-e) (-d)";
echo "-r <release-name>: set helm release name - required"
echo "-n <namespace>: kubernetes target namespace for deployment"
echo "-o <options-file>: helm variable option files"
echo "-e: execute helm command"
echo "-d: enable debug flags for helm"
echo "-h: display usage"
echo ""
}
# set an initial values
NAMESPACE='default'
OPT_ARGS=''
CHART='./central'
EXEC=false
DEBUG=false
# extract options and their arguments into variables.
while getopts ":n:r:o:edh" arg; do
case $arg in
n)
NAMESPACE=$OPTARG >&2
;;
r)
RELEASE=$OPTARG >&2
;;
o)
OPTIONS=$OPTARG >&2
;;
e)
EXEC=true >&2
;;
d)
DEBUG=true >&2
;;
h)
usage;
exit 0;
;;
\?)
usage;
echo "Invalid option: -$OPTARG" >&2;
exit 1;
break
;;
esac
done
if [ -z "$RELEASE" ];
then
usage;
echo "Missing option: -r" >&2;
exit 1
fi;
if [ ! -z "$OPTIONS" ];
then
OPT_ARGS=" -f $OPTIONS "
fi;
if $DEBUG;
then
OPT_ARGS=$OPT_ARGS" --debug --dry-run "
fi;
CMD="helm install --namespace=$NAMESPACE --name=$RELEASE $OPT_ARGS $CHART"
echo "Helm cmd: $CMD"
if $EXEC;
then
echo "executing command";
$CMD
fi;