forked from SeldonIO/seldon-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalertmanager-create
executable file
·40 lines (29 loc) · 1.23 KB
/
alertmanager-create
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
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )"
function build_alertmanager_configmap {
if [ ! -f "${STARTUP_DIR}/alertmanager/config.yml" ]; then
cp -v ${STARTUP_DIR}/alertmanager/config.yml.example ${STARTUP_DIR}/alertmanager/config.yml
fi
kubectl create configmap alertmanager-server-conf \
--dry-run \
--from-file=${STARTUP_DIR}/alertmanager/config.yml \
--output yaml > ${STARTUP_DIR}/alertmanager/_configmap.yaml
}
function create_alertmanager_configmap {
kubectl apply -f ${STARTUP_DIR}/alertmanager/_configmap.yaml
}
function build_alertmanager_deployment {
CONFIG_HASH=$(cat ${STARTUP_DIR}/alertmanager/_configmap.yaml|openssl dgst -sha1 -binary | xxd -p)
cat ${STARTUP_DIR}/alertmanager/alertmanager-deployment.json.in | sed \
-e "s|%CONFIG_HASH%|${CONFIG_HASH}|" > ${STARTUP_DIR}/alertmanager/_alertmanager-deployment.json && echo "_alertmanager-deployment.json"
}
function create_alertmanager_deployment {
kubectl apply -f ${STARTUP_DIR}/alertmanager/_alertmanager-deployment.json
}
build_alertmanager_configmap
create_alertmanager_configmap
build_alertmanager_deployment
create_alertmanager_deployment