Charts: stable/prometheus-operator alertmanager templateFiles property issue

Created on 10 Jul 2019  Â·  8Comments  Â·  Source: helm/charts

Describe the bug
In prometheus-operator, for alertmanager we have property templateFiles which is not well documented. I am not able to understand how the template files defined here will be loaded into alert manager.
The templateFiles properly is present in values.yaml file and in alertmanager secret template files

For alertmanager config, templates property is missing. The config should be like

alertmanager:
  templateFiles: {}
  config:
    route:
    templates:

Version of Helm and Kubernetes:
Helm Version: 2.11

Which chart:
prometheus-operator

What happened:
Alertmanager templateFiles property is not defined properly

What you expected to happen:
The templates defined here should be picked up by alert manager

How to reproduce it (as minimally and precisely as possible):
Add an inline template file with custom strings and use the strings when raising alerts for slack

Anything else we need to know:

lifecyclstale

Most helpful comment

try adding templates: ["*.tmpl"] into config section. Something like this:

alertmanager:
  config:
    templates: ["*.tmpl"]

All 8 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

I found this issue through google, while trying to figure out exactly how to get the templateFiles property to work for me. I want to pass my entire configuration through helm install stable/prometheus-operator -f config.yaml where config.yaml contains alertmanager.templateFiles=
(multi-line template). However, this seems not to work. If anyone reading this has a suggestion other than editing the generated alertmanager secret manually, I'd be very grateful!

I use the example given in the chart and still it will not work for me.

` template_1.tmpl: |-
{{ define "cluster" }}{{ .ExternalURL | reReplaceAll ".alertmanager\.(.)" "$1" }}{{ end }}

  {{ define "slack.myorg.text" }}
  {{- $root := . -}}
  {{ range .Alerts }}
    *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
    *Cluster:*  {{ template "cluster" $root }}
    *Description:* {{ .Annotations.description }}
    *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:>
    *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
    *Details:*
      {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
      {{ end }}

`

I keep getting an error:
at <{{template \"slack.my...>: template \"slack.myorg.text\" not defined"

try adding templates: ["*.tmpl"] into config section. Something like this:

alertmanager:
  config:
    templates: ["*.tmpl"]

I think this is the way to add it in prometheus-operator chart
alertmanager: config: templates: - /etc/alertmanager/config/template*.tmpl templateFiles: template_1.tmpl: |- {{ define "cluster" }}{{ .ExternalURL | reReplaceAll ".alertmanager\.(.)" "$1" }}{{ end }}

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

This issue is being automatically closed due to inactivity.

try adding templates: ["*.tmpl"] into config section. Something like this:

alertmanager:
  config:
    templates: ["*.tmpl"]

massively helpful!

Was this page helpful?
0 / 5 - 0 ratings