billowy-apple-60989
04/13/2023, 2:22 PMAlertmanagerConfig
for use in the Monitoring V2 App but hitting a bit of a problem, hopefully someone can come to the rescue π
I have a config that look something like this:
apiVersion: <http://monitoring.coreos.com/v1alpha1|monitoring.coreos.com/v1alpha1>
kind: AlertmanagerConfig
metadata:
name: alertmanager-config
spec:
receivers:
- name: cloudops
pagerdutyConfigs:
- httpConfig: {}
routingKey:
key: routing-key
name: pagerduty-routing-key
sendResolved: true
- name: opt
slackConfigs:
- apiURL:
key: slack-webhook
name: slack-webhook
channel: '#...'
httpConfig: {}
sendResolved: true
text: '{{ template "slack.rancher.text" . }}'
- name: sws
slackConfigs:
- apiURL:
key: slack-webhook
name: slack-webhook
channel: '#...'
httpConfig: {}
sendResolved: true
text: '{{ template "slack.rancher.text" . }}'
route:
groupBy:
- job
groupInterval: 1m
groupWait: 30s
receiver: cloudops
routes:
- matchers:
- name: namespace
regex: true
value: foo|bar
receiver: sws
- matchers:
- name: namespace
value: foo-prod
receiver: opt
Which in turn results in this Routing tree:
/alertmanager $ amtool --alertmanager.url=<http://localhost:9093> config routes show
Routing tree:
.
βββ default-route receiver: null
βββ {namespace="cattle-monitoring-system"} continue: true receiver: cattle-monitoring-system-alertmanager-config-cloudops
β βββ {namespace=~"^(?:foo|bar)$"} receiver: cattle-monitoring-system-alertmanager-config-sws
β βββ {namespace="foo-prod"} receiver: cattle-monitoring-system-alertmanager-config-opt
βββ {alertname="Watchdog"} receiver: null
It seems the spec.route.receiver
is ignored and moved under the default-route node, and the other 2 routes becomes a child of that node which means i can't get the matching to act as expected:
/alertmanager $ amtool --alertmanager.url=<http://localhost:9093> config routes test namespace=foo-prod
null