fix(infra-monitoring): support multiple receivers
This commit is contained in:
parent
d893d13c74
commit
092c943aef
5 changed files with 96 additions and 37 deletions
|
@ -110,6 +110,16 @@ image::https://img.shields.io/badge/Version-application-informational?style=flat
|
||||||
| `""`
|
| `""`
|
||||||
|
|
|
|
||||||
|
|
||||||
|
| alertmanager.receiver.customs
|
||||||
|
| object
|
||||||
|
| `{}`
|
||||||
|
| customs
|
||||||
|
|
||||||
|
| alertmanager.receiver.inhibitRules
|
||||||
|
| list
|
||||||
|
| `[]`
|
||||||
|
| additional inhibitRules
|
||||||
|
|
||||||
| alertmanager.receiver.matrix.default
|
| alertmanager.receiver.matrix.default
|
||||||
| string
|
| string
|
||||||
| `"!example-room:matrix.org"`
|
| `"!example-room:matrix.org"`
|
||||||
|
@ -135,6 +145,11 @@ image::https://img.shields.io/badge/Version-application-informational?style=flat
|
||||||
| `false`
|
| `false`
|
||||||
|
|
|
|
||||||
|
|
||||||
|
| alertmanager.receiver.matrix.token
|
||||||
|
| string
|
||||||
|
| `""`
|
||||||
|
| token of matrix reciever (use valuesFrom in flux for it)
|
||||||
|
|
||||||
| alertmanager.receiver.matrix.userID
|
| alertmanager.receiver.matrix.userID
|
||||||
| string
|
| string
|
||||||
| `"@alert:matrix.org"`
|
| `"@alert:matrix.org"`
|
||||||
|
@ -162,7 +177,7 @@ image::https://img.shields.io/badge/Version-application-informational?style=flat
|
||||||
|
|
||||||
| alertmanager.receiver.ntfy.enabled
|
| alertmanager.receiver.ntfy.enabled
|
||||||
| bool
|
| bool
|
||||||
| `true`
|
| `false`
|
||||||
|
|
|
|
||||||
|
|
||||||
| alertmanager.receiver.ntfy.ingress.annotations
|
| alertmanager.receiver.ntfy.ingress.annotations
|
||||||
|
@ -191,9 +206,9 @@ image::https://img.shields.io/badge/Version-application-informational?style=flat
|
||||||
| repeat Interval
|
| repeat Interval
|
||||||
|
|
||||||
| alertmanager.receiver.routes
|
| alertmanager.receiver.routes
|
||||||
| string
|
| list
|
||||||
| `nil`
|
| `[]`
|
||||||
| would overwrite defaults (like ntfy or matrix)
|
| would overwrite defaults (like ntfy or matrix) # send every alert to ntfy # (and continue to routing for that alert) - receiver: "ntfy-default" continue: true # send selected alerts to special matrix room # (and remove them for evaluation - no continue) - receiver: "matrix-room-name" matchers: - name: "team" matchType: "=" value: "room-name" # all reminig alerts to matrix default room - receiver: "matrix-default"
|
||||||
|
|
||||||
| commons.auth.authentik.backend
|
| commons.auth.authentik.backend
|
||||||
| string
|
| string
|
||||||
|
|
38
infra-monitoring/ci/ct-reciever-values.yaml
Normal file
38
infra-monitoring/ci/ct-reciever-values.yaml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
alertmanager:
|
||||||
|
receiver:
|
||||||
|
customs:
|
||||||
|
own-receiver:
|
||||||
|
webhookConfigs:
|
||||||
|
- url: "own"
|
||||||
|
multiple-receiver:
|
||||||
|
webhookConfigs:
|
||||||
|
- url: "not exists"
|
||||||
|
other: "support"
|
||||||
|
ntfy:
|
||||||
|
enabled: true
|
||||||
|
matrix:
|
||||||
|
enabled: true
|
||||||
|
rooms:
|
||||||
|
multiple-receiver:
|
||||||
|
- room: "!multi-test:matrix.org"
|
||||||
|
sendResolved: false
|
||||||
|
only-matrix:
|
||||||
|
- room: "!only-test:matrix.org"
|
||||||
|
sendResolved: false
|
||||||
|
routes:
|
||||||
|
- receiver: "multiple-receiver"
|
||||||
|
continue: true
|
||||||
|
matchers:
|
||||||
|
- name: "team"
|
||||||
|
matchType: "="
|
||||||
|
value: "multi"
|
||||||
|
- receiver: "own-receiver"
|
||||||
|
matchers:
|
||||||
|
- name: "namespace"
|
||||||
|
matchType: "="
|
||||||
|
value: "own"
|
||||||
|
- receiver: "only-matrix"
|
||||||
|
matchers:
|
||||||
|
- name: "namespace"
|
||||||
|
matchType: "=~"
|
||||||
|
value: "matrix-.*"
|
|
@ -7,10 +7,28 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
receivers:
|
receivers:
|
||||||
- name: "null"
|
- name: "null"
|
||||||
{{- with .Values.alertmanager.receiver.ntfy }}
|
{{- range $i, $receiver := ( concat (keys .Values.alertmanager.receiver.customs) (keys .Values.alertmanager.receiver.matrix.rooms) | uniq) }}
|
||||||
{{- if .enabled }}
|
- name: "{{ $receiver }}"
|
||||||
- name: "ntfy-default"
|
|
||||||
webhookConfigs:
|
webhookConfigs:
|
||||||
|
{{- with (get $.Values.alertmanager.receiver.matrix.rooms $receiver) }}
|
||||||
|
{{- range $item := . }}
|
||||||
|
- url: "http://alertmanager-matrix:4051/{{ $item.room }}"
|
||||||
|
sendResolved: {{ $item.sendResolved }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (get $.Values.alertmanager.receiver.customs $receiver) }}
|
||||||
|
{{- with .webhookConfigs }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with (omit . "webhookConfigs") }}
|
||||||
|
{{- toYaml . | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: "default"
|
||||||
|
webhookConfigs:
|
||||||
|
{{- with .Values.alertmanager.receiver.ntfy }}
|
||||||
|
{{- if .enabled }}
|
||||||
- url: "http://alertmanager-ntfy"
|
- url: "http://alertmanager-ntfy"
|
||||||
sendResolved: {{ .sendResolved }}
|
sendResolved: {{ .sendResolved }}
|
||||||
{{- if and .enabled (.config.user) }}
|
{{- if and .enabled (.config.user) }}
|
||||||
|
@ -23,22 +41,14 @@ spec:
|
||||||
name: global-alertmanager-ntfy-auth
|
name: global-alertmanager-ntfy-auth
|
||||||
key: password
|
key: password
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.alertmanager.receiver.matrix }}
|
{{- with .Values.alertmanager.receiver.matrix }}
|
||||||
{{- if .enabled }}
|
{{- if .enabled }}
|
||||||
- name: "matrix-default"
|
|
||||||
webhookConfigs:
|
|
||||||
- url: "http://alertmanager-matrix:4051/{{ .default }}"
|
- url: "http://alertmanager-matrix:4051/{{ .default }}"
|
||||||
sendResolved: {{ .sendResolved }}
|
sendResolved: {{ .sendResolved }}
|
||||||
{{- range $receiver, $conf := .rooms }}
|
{{- end }}
|
||||||
- name: "matrix-{{ $receiver }}"
|
{{- end }}
|
||||||
webhookConfigs:
|
|
||||||
- url: "http://alertmanager-matrix:4051/{{ $conf.room }}"
|
|
||||||
sendResolved: {{ $conf.sendResolved }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
inhibitRules:
|
inhibitRules:
|
||||||
- sourceMatch:
|
- sourceMatch:
|
||||||
- name: "alertmanagerInhibitDisable"
|
- name: "alertmanagerInhibitDisable"
|
||||||
|
@ -108,16 +118,6 @@ spec:
|
||||||
value: "InfoInhibitor|Watchdog"
|
value: "InfoInhibitor|Watchdog"
|
||||||
{{- with .Values.alertmanager.receiver.routes }}
|
{{- with .Values.alertmanager.receiver.routes }}
|
||||||
{{- toYaml . | nindent 6 }}
|
{{- toYaml . | nindent 6 }}
|
||||||
{{- else }}
|
|
||||||
{{- with .Values.alertmanager.receiver }}
|
|
||||||
{{- if .ntfy.enabled }}
|
|
||||||
- receiver: "ntfy-default"
|
|
||||||
continue: true
|
|
||||||
{{- end }}
|
|
||||||
{{- if .matrix.enabled }}
|
|
||||||
- receiver: "matrix-default"
|
|
||||||
continue: true
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}{{/* end-with receiver */}}
|
|
||||||
{{- end }}{{/* end-with routes */}}
|
{{- end }}{{/* end-with routes */}}
|
||||||
|
- receiver: "default"
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -38,9 +38,11 @@ spec:
|
||||||
userID: {{ .userID | quote }}
|
userID: {{ .userID | quote }}
|
||||||
rooms:
|
rooms:
|
||||||
- {{ .default | quote }}
|
- {{ .default | quote }}
|
||||||
{{- range $item := .rooms }}
|
{{- range $name, $conf := .rooms }}
|
||||||
|
{{- range $item := $conf }}
|
||||||
- {{ $item.room | quote }}
|
- {{ $item.room | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
alertmanager: "http://kube-prometheus-stack-alertmanager:9093"
|
alertmanager: "http://kube-prometheus-stack-alertmanager:9093"
|
||||||
showLabels: true
|
showLabels: true
|
||||||
{{`
|
{{`
|
||||||
|
|
|
@ -79,25 +79,29 @@ alertmanager:
|
||||||
# value: "room-name"
|
# value: "room-name"
|
||||||
# # all reminig alerts to matrix default room
|
# # all reminig alerts to matrix default room
|
||||||
# - receiver: "matrix-default"
|
# - receiver: "matrix-default"
|
||||||
routes:
|
routes: []
|
||||||
# -- additional inhibitRules
|
# -- additional inhibitRules
|
||||||
inhibitRules: []
|
inhibitRules: []
|
||||||
# -- repeat Interval
|
# -- repeat Interval
|
||||||
repeatInterval: "24h"
|
repeatInterval: "24h"
|
||||||
|
# -- customs
|
||||||
|
customs: {}
|
||||||
matrix:
|
matrix:
|
||||||
enabled: false
|
enabled: false
|
||||||
sendResolved: false
|
sendResolved: false
|
||||||
homeserver: "https://matrix.org"
|
homeserver: "https://matrix.org"
|
||||||
userID: "@alert:matrix.org"
|
userID: "@alert:matrix.org"
|
||||||
|
# -- token of matrix reciever (use valuesFrom in flux for it)
|
||||||
|
token: ""
|
||||||
default: "!example-room:matrix.org"
|
default: "!example-room:matrix.org"
|
||||||
#
|
#
|
||||||
rooms: {}
|
rooms: {}
|
||||||
# room-name:
|
# room-name:
|
||||||
# sendResolved: false
|
# - room: "!example-room-name:matrix.org"
|
||||||
# room: ""!example-room-name:matrix.org""
|
# sendResolved: false
|
||||||
#
|
#
|
||||||
ntfy:
|
ntfy:
|
||||||
enabled: true
|
enabled: false
|
||||||
sendResolved: false
|
sendResolved: false
|
||||||
ingress:
|
ingress:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
Loading…
Add table
Reference in a new issue