Improve monitoring for prod
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
---
|
||||
# InitContainer to substitute secrets into AlertManager config
|
||||
# This allows us to use environment variables from secrets in the config file
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: alertmanager-init-script
|
||||
namespace: monitoring
|
||||
data:
|
||||
init-config.sh: |
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Read the template config
|
||||
TEMPLATE=$(cat /etc/alertmanager-template/alertmanager.yml)
|
||||
|
||||
# Substitute environment variables
|
||||
echo "$TEMPLATE" | \
|
||||
sed "s|{{ .smtp_host }}|${SMTP_HOST}|g" | \
|
||||
sed "s|{{ .smtp_from }}|${SMTP_FROM}|g" | \
|
||||
sed "s|{{ .smtp_username }}|${SMTP_USERNAME}|g" | \
|
||||
sed "s|{{ .smtp_password }}|${SMTP_PASSWORD}|g" | \
|
||||
sed "s|{{ .slack_webhook_url }}|${SLACK_WEBHOOK_URL}|g" \
|
||||
> /etc/alertmanager-final/alertmanager.yml
|
||||
|
||||
echo "AlertManager config initialized successfully"
|
||||
cat /etc/alertmanager-final/alertmanager.yml
|
||||
Reference in New Issue
Block a user