Add alertmanager kubernetes sd into prometheus conf template
Change-Id: I60189136bcf7bc63346714f8c3f911cc6f863e09
Related-PROD: PROD-23277
diff --git a/prometheus/files/server/prometheus.yml b/prometheus/files/server/prometheus.yml
index d7b2fa3..b461629 100644
--- a/prometheus/files/server/prometheus.yml
+++ b/prometheus/files/server/prometheus.yml
@@ -42,6 +42,15 @@
- names: {{ alertmanager.dns_sd_configs.get('domain', [])|yaml }}
type: {{ alertmanager.dns_sd_configs.type }}
port: {{ alertmanager.dns_sd_configs.port }}
+ {%- elif alertmanager.kubernetes_sd_configs is defined %}
+ - kubernetes_sd_configs:
+ - role: {{ alertmanager.kubernetes_sd_configs.role }}
+ namespaces:
+ names: ['{{ alertmanager.kubernetes_sd_configs.namespace }}']
+ relabel_configs:
+ - source_labels: [__meta_kubernetes_pod_name]
+ action: keep
+ regex: {{ alertmanager.kubernetes_sd_configs.pod_name_regex }}
{%- endif %}
{%- endif %}
{%- endfor %}