forked from cfpb/consumerfinance.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm-install.sh
executable file
·55 lines (48 loc) · 1.57 KB
/
helm-install.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
#!/bin/bash
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
# Ensure helm is installed and available via PATH
if ! command -v helm &> /dev/null; then
echo "Helm not found in PATH. Please install helm (brew install helm) or add it to PATH."
exit 1
fi
# Build Dependency Charts
if [ ! -d ./helm/cfgov/charts ]; then
echo "Building dependency charts..."
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add elastic https://helm.elastic.co/
helm repo update
helm dependency build ./helm/cfgov
else
helm dependency update ./helm/cfgov
fi
# Parse overrides list
export PROJECT_DIR="$(dirname "$(realpath "$0")")"
if [ $# -eq 0 ]; then
ARGS="$PROJECT_DIR/helm/overrides/local.yaml $PROJECT_DIR/helm/overrides/services.yaml $PROJECT_DIR/helm/overrides/cfgov-lb.yaml"
else
ARGS=$@
fi
# Substitute Environment Variables in override files
tempFiles=()
OVERRIDES=""
for i in $ARGS; do
tempFile=$(mktemp)
envsubst < ${i} > "$tempFile"
OVERRIDES="$OVERRIDES -f $tempFile"
tempFiles+=($tempFile)
done
# Set release name
RELEASE=${RELEASE:-cfgov}
# Install/Upgrade cfgov release to current context namespace
# To install to different namespace, set context with namespace
# kubectl config set-context --current --namespace=<insert-namespace-name-here>
helm upgrade --install --wait --timeout=10m0s "${RELEASE}" $OVERRIDES \
--set elasticsearch.clusterName="${RELEASE}-elasticsearch" \
--set kibana.elasticsearchHosts="http://${RELEASE}-elasticsearch-master:9200" \
./helm/cfgov
# Cleanup temp files
for i in "${tempFiles[@]}"; do
rm "$i"
done