forked from swisscom/kubeone-dcs-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-chart.sh
More file actions
executable file
·51 lines (44 loc) · 1.15 KB
/
Copy pathinstall-chart.sh
File metadata and controls
executable file
·51 lines (44 loc) · 1.15 KB
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
#!/bin/bash
set -e
set -u
set -o pipefail
if [[ "$(basename ${PWD})" == "deployments" ]]; then
cd ..
fi
set +u
if [[ -z "${KUBECONFIG}" ]]; then
KUBECONFIG="kubeone-kubeconfig"
fi
set -u
if [[ "$#" -ne 5 ]]; then
echo "usage: ./install-chart.sh <repo> <chart> <namespace> <version> <values>"
exit 1
fi
repository=$1
chart=$2
namespace=$3
version=$4
values=$5
echo " "
if helm history --kubeconfig "${KUBECONFIG}" --max 1 --namespace "${namespace}" "${chart}" 2>/dev/null | grep "FAILED" | cut -f1 | grep -q 1; then
helm uninstall --kubeconfig "${KUBECONFIG}" --wait --namespace "${namespace}" "${chart}"
fi
REPO_URL=""
if [[ "${repository}" != "-" ]]; then
REPO_URL="--repo ${repository}"
fi
CHART_NAME="${chart}"
if [[ "${repository}" == "-" ]]; then
CHART_NAME="./deployments/${chart}"
fi
echo "installing chart [${chart}] ..."
helm upgrade --kubeconfig "${KUBECONFIG}" \
--install --create-namespace --dependency-update \
--cleanup-on-fail --atomic --wait --timeout "15m" \
--values "${values}" \
--namespace "${namespace}" \
${REPO_URL} \
--version "${version}" \
"${chart}" "${CHART_NAME}"
echo " "
helm list --all --namespace "${namespace}"