<p>I am trying to install grafana helm chart with opsgenie notification like so</p>

<pre><code>   helm install stable/grafana -n grafana --namespace monitoring --set-string notifiers."notifiers\.yaml"="notifiers:
- name: opsgenie-notifier
  type: opsgenie
  uid: notifier-1
  settings:
    apiKey: some-key
    apiUrl: https://some-server/alerts"
</code></pre>

<p>When I check the config map I see the value is set with an extra pipe at the begining --> <strong>|-</strong></p>

<pre><code>apiVersion: v1
data:
  notifiers.yaml: |
    |-
      notifiers:
      - name: opsgenie-notifier
        type: opsgenie
        uid: notifier-1
        settings:
          apiKey: some-key
          apiUrl: https://some-server/alerts
kind: ConfigMap
metadata:
  creationTimestamp: "2019-08-27T00:32:40Z"
  labels:
    app: grafana
    chart: grafana-3.5.10
    heritage: Tiller
    release: grafana
  name: grafana
  namespace: monitoring
</code></pre>

<p>Checking the source code - <a href="https://github.com/helm/charts/blob/master/stable/grafana/templates/configmap.yaml" rel="nofollow noreferrer">https://github.com/helm/charts/blob/master/stable/grafana/templates/configmap.yaml</a>, I can't figure out why. The below source code should print the values verbatim but its adding an extra line --> |-, causing grafana server to crash as it is unable to read the configuration.</p>

<pre><code>{{- if .Values.notifiers }}
  {{- range $key, $value := .Values.notifiers }}
  {{ $key }}: |
{{ toYaml $value | indent 4 }}
  {{- end -}}
{{- end -}}
</code></pre>

<p>I have tried with --set, --set-file and --set-string. Its the same behavio.</p>

<p>Easy way to achieve this is by using a values.yaml file as below</p>

<pre><code>notifiers:
  notifiers.yaml:
    notifiers:
    - name: opsgenie-notifier
      type: opsgenie
      uid: notifier-1
      settings:
        apiKey: some-key
        apiUrl: https://some-server/alerts
</code></pre>

<p>and by installing as</p>

<p><code>helm install stable/grafana -n grafana --namespace monitoring --values values.yaml</code></p>

<p>You can do via the --set/--set-string flag as below</p>

<pre><code>helm install stable/grafana -n grafana --namespace monitoring \
    --set notifiers."notifiers\.yaml".notifiers[0].name="opsgenie-notifier" \
    --set notifiers."notifiers\.yaml".notifiers[0].type="opsgenie" \
    --set notifiers."notifiers\.yaml".notifiers[0].uid="notifier-1" \
    --set notifiers."notifiers\.yaml".notifiers[0].settings.apiKey="some-key" \
    --set notifiers."notifiers\.yaml".notifiers[0].settings.apiUrl="https://some-server/alerts"
</code></pre>
