{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1/AlertmanagerConfig") }} --- apiVersion: "monitoring.coreos.com/v1alpha1" kind: "AlertmanagerConfig" metadata: name: "global-alertmanager-conf" spec: receivers: - name: "null" {{- range $i, $receiver := ( concat (keys .Values.alertmanager.receiver.customs) (keys .Values.alertmanager.receiver.matrix.rooms) | uniq) }} - name: "{{ $receiver }}" 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" sendResolved: {{ .sendResolved }} {{- if and .enabled (.config.user) }} httpConfig: basicAuth: username: name: global-alertmanager-ntfy-auth key: username password: name: global-alertmanager-ntfy-auth key: password {{- end }} {{- end }} {{- end }} {{- with .Values.alertmanager.receiver.matrix }} {{- if .enabled }} - url: "http://alertmanager-matrix:4051/{{ .default }}" sendResolved: {{ .sendResolved }} {{- end }} {{- end }} inhibitRules: - sourceMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "severity" matchType: "=" value: "critical" targetMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "severity" matchType: "=~" value: "warning|info" equal: - "namespace" - "alertname" - sourceMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "severity" matchType: "=" value: "warning" targetMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "severity" matchType: "=" value: "info" equal: - "namespace" - "alertname" - sourceMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "alertname" matchType: "=" value: "InfoInhibitor" targetMatch: - name: "alertmanagerInhibitDisable" matchType: "!=" value: "true" - name: "severity" matchType: "=" value: "info" equal: - "namespace" {{- with .Values.alertmanager.inhibitRules }} {{- toYaml . | nindent 4 }} {{- end }} route: groupWait: "30s" groupInterval: "10m" {{- with .Values.alertmanager.route.groupBy }} groupBy: {{- toYaml . | nindent 6 }} {{- end }} receiver: "null" repeatInterval: {{ .Values.alertmanager.route.repeatInterval }} routes: - receiver: "null" matchers: - name: "alertname" matchType: "=~" value: "InfoInhibitor|Watchdog" {{- with .Values.alertmanager.route.routes }} {{- toYaml . | nindent 6 }} {{- end }}{{/* end-with routes */}} - receiver: "default" {{- end }}