{"action":"closed","issue":{"url":"https://api.github.com/repos/helm/charts/issues/5608","repository_url":"https://api.github.com/repos/helm/charts","labels_url":"https://api.github.com/repos/helm/charts/issues/5608/labels{/name}","comments_url":"https://api.github.com/repos/helm/charts/issues/5608/comments","events_url":"https://api.github.com/repos/helm/charts/issues/5608/events","html_url":"https://github.com/helm/charts/issues/5608","id":323789543,"node_id":"MDU6SXNzdWUzMjM3ODk1NDM=","number":5608,"title":"[stable/prometheus]: impossible to add custom templates to alertmanager via alertmanagerFiles","user":{"login":"hairyhenderson","id":2037086,"node_id":"MDQ6VXNlcjIwMzcwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/2037086?v=4","gravatar_id":"","url":"https://api.github.com/users/hairyhenderson","html_url":"https://github.com/hairyhenderson","followers_url":"https://api.github.com/users/hairyhenderson/followers","following_url":"https://api.github.com/users/hairyhenderson/following{/other_user}","gists_url":"https://api.github.com/users/hairyhenderson/gists{/gist_id}","starred_url":"https://api.github.com/users/hairyhenderson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hairyhenderson/subscriptions","organizations_url":"https://api.github.com/users/hairyhenderson/orgs","repos_url":"https://api.github.com/users/hairyhenderson/repos","events_url":"https://api.github.com/users/hairyhenderson/events{/privacy}","received_events_url":"https://api.github.com/users/hairyhenderson/received_events","type":"User","site_admin":false},"labels":[{"id":778124484,"node_id":"MDU6TGFiZWw3NzgxMjQ0ODQ=","url":"https://api.github.com/repos/helm/charts/labels/lifecycle/stale","name":"lifecycle/stale","color":"795548","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-16T21:15:18Z","updated_at":"2018-09-02T01:08:00Z","closed_at":"2018-09-02T01:08:00Z","author_association":"NONE","body":"**Is this a request for help?**: Yes\r\n\r\n---\r\n\r\n**Is this a BUG REPORT or FEATURE REQUEST?** (choose one): Bug report\r\n\r\n**Version of Helm and Kubernetes**: 2.9.1, 1.9.6\r\n\r\n**Which chart**: stable/prometheus\r\n\r\n**What happened**: I attempted to add an alertmanager [notification template file](https://prometheus.io/docs/alerting/notification_examples/) to the `alertmanagerFiles` section, and it was interpreted not as the literal content of a file, but as YAML - this behaviour would've changed in #3777\r\n\r\n**What you expected to happen**: The file should've been interpreted as a literal string, as given.\r\n\r\n**How to reproduce it** (as minimally and precisely as possible):\r\n\r\n- create a file `v.yaml`:\r\n    ```yaml\r\n    alertmanagerFiles:\r\n      alertmanager.yml:\r\n        templates:\r\n          - /etc/config/custom-template.tmpl\r\n      custom-template.tmpl: |\r\n        {{ define \"slack.myorg.text\" -}}\r\n        https://internal.myorg.net/wiki/alerts/{{ .GroupLabels.app }}/{{ .GroupLabels.alertname }}\r\n        {{- end}}\r\n    ```\r\n- deploy the chart with the values:\r\n    ```console\r\n    $ helm upgrade --install foo stable/prometheus -f v.yaml \r\n    ...\r\n    ```\r\n- have a look at the ConfigMap created for alertmanager's use:\r\n    ```console\r\n    $ kubectl get configmap foo-prometheus-alertmanager -o yaml                  \r\n    ```\r\n    ```yaml\r\n    apiVersion: v1\r\n    data:\r\n      alertmanager.yml: |\r\n        global: null\r\n        receivers:\r\n        - name: default-receiver\r\n        route:\r\n          group_interval: 5m\r\n          group_wait: 10s\r\n          receiver: default-receiver\r\n          repeat_interval: 3h\r\n        templates:\r\n        - /etc/config/custom-template.tmpl\r\n      custom-template.tmpl: |\r\n        |\r\n          {{ define \"slack.myorg.text\" -}}\r\n          https://internal.myorg.net/wiki/alerts/{{ .GroupLabels.app }}/{{ .GroupLabels.alertname }}\r\n          {{- end}}\r\n    kind: ConfigMap\r\n    metadata: <a bunch of metadata that's irrelevant>\r\n    ```\r\n\r\nThe issue is that the `custom-template.tmpl` entry ends up with an extra `|` on the first line.\r\n\r\n**Anything else we need to know**:\r\n\r\nI think a reasonable solution could be to detect the key name to see if the suffix is `.yaml` or `.yml` (with `hasSuffix`) and only parse it as YAML in that situation. Otherwise leave it as a string.\r\n\r\nFor now, we're getting around this by duplicating the template content in-line in the alertmanager config, but that's not ideal..."}}
{"actor":{"display_login":"stale"}}