-
Notifications
You must be signed in to change notification settings - Fork 8
/
install
executable file
·81 lines (64 loc) · 1.98 KB
/
install
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
77
78
79
80
81
#!/usr/bin/env bash
set -eo pipefail
metrics_version="v0.3.6"
chart_version="0.1.0"
strimzi_version="0.17.0"
function usage {
echo "USAGE: ./scripts/install [RELEASE_NAME] [NAMESPACE] [aws|local] [<key=value>, ...]"
echo
echo "EXAMPLE"
echo " ./scripts/install foo bar local abc=123 x.y.z=42"
echo " ./scripts/install abc default aws image.tag=latest"
echo
exit 0
}
function info {
local -r message=${1:?MESSAGE REQUIRED}
echo "[INFO] $message"
}
function check_strimzi {
local timeout=${1:-10s}
kubectl wait pod \
--selector name=strimzi-cluster-operator \
--for condition=Ready \
--timeout=${timeout}
}
function metrics_server {
info "Installing Metrics Server"
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/${metrics_version}/components.yaml
}
function strimzi {
if [[ ! $(check_strimzi) ]]; then
info "Adding strimzi repo"
helm repo add strimzi https://strimzi.io/charts/
info "Installing Strimzi"
helm upgrade strimzi-kafka-operator strimzi/strimzi-kafka-operator \
--install \
--version ${strimzi_version} \
--set watchAnyNamespace=true
check_strimzi 300s
fi
}
function hindsight {
local -r release="${1:?Release name required.}"
local -r ns="${2:?Namespace required.}"
local -r location="${3:?Location required.}"
shift 3
if [ $# -gt 0 ]; then
local -r vals=$(IFS=, ; echo "$*")
local -r set_values="--set $vals"
fi
metrics_server
info "Installing Hindsight"
helm repo add inhindsight https://inhindsight.github.io/charts
helm repo update
helm upgrade ${release} inhindsight/hindsight \
--install \
--version ${chart_version} \
--namespace ${ns} \
--values ./helm/presets/${location}.yaml \
${set_values}
}
[[ "$1" == "-h" || "$1" == "--help" ]] && usage
strimzi
hindsight "${@}"