forked from buildbuddy-io/buildbuddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s_on_prem.sh
executable file
·62 lines (53 loc) · 1.25 KB
/
k8s_on_prem.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
#!/bin/bash
set -e
function die() {
msg=$1
echo "$msg"
exit 1
}
# args: $1 == message
function confirmOrExit() {
msg=$1
if [ -z "$msg" ]; then
msg="Are you sure?"
fi
read -p "$msg " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
}
configMapFile="config/buildbuddy.release.yaml" # Default config file.
useEnterprise="false"
while test $# -gt 0; do
case "$1" in
-config)
shift
if test $# -gt 0; then
configMapFile=$1
else
die "no config file specified"
fi
shift
;;
-enterprise)
useEnterprise="true"
shift
;;
*)
die "$1 is not a recognized flag!"
;;
esac
done
deploymentFile="deployment/buildbuddy-app.onprem.yaml"
if [ "$useEnterprise" = "true" ]; then
confirmOrExit "You've selected the enterprise version. Please confirm you've agreed to the BuildBuddy Enterprise Terms: Y/n"
deploymentFile=deployment/buildbuddy-app.enterprise.yaml
fi
if [ ! -z "$configMapFile" ]; then
cp "$configMapFile" /tmp/config.yaml
kubectl create namespace buildbuddy
kubectl --namespace=buildbuddy create configmap config --from-file "config.yaml=/tmp/config.yaml" --dry-run=client -o yaml | kubectl apply -f -
fi
kubectl apply -f "$deploymentFile"