【问题标题】:Grafana helm notification configurationGrafana helm 通知配置
【发布时间】:2019-12-31 03:31:29
【问题描述】:

我正在尝试安装带有 opsgenie 通知的 grafana helm chart

   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"

当我检查配置映射时,我看到值在开头设置了一个额外的管道 --> |-

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

检查源代码 - https://github.com/helm/charts/blob/master/stable/grafana/templates/configmap.yaml,我不知道为什么。下面的源代码应该逐字打印这些值,但它添加了一个额外的行 --> |-,导致 grafana 服务器由于无法读取配置而崩溃。

{{- if .Values.notifiers }}
  {{- range $key, $value := .Values.notifiers }}
  {{ $key }}: |
{{ toYaml $value | indent 4 }}
  {{- end -}}
{{- end -}}

我尝试过使用--set、--set-file 和--set-string。它的行为相同。

【问题讨论】:

    标签: kubernetes grafana kubernetes-helm grafana-alerts


    【解决方案1】:

    实现这一点的简单方法是使用如下的 values.yaml 文件

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

    并安装为

    helm install stable/grafana -n grafana --namespace monitoring --values values.yaml

    你可以通过下面的 --set/--set-string 标志来做

    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"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-02
      • 2023-02-15
      • 2020-05-04
      • 2020-03-28
      • 2021-05-07
      • 1970-01-01
      • 2021-12-28
      相关资源
      最近更新 更多