2

正如标题所示,我正在尝试使用带有默认仪表板的 helmfile 通过值设置 grafana。

我的 helmfile 的相关部分在这里

releases:
...
  - name: grafana
    namespace: grafana
    chart: stable/grafana
    values:
      - datasources:
          datasources.yaml:
            apiVersion: 1
            datasources:
              - name: Prometheus
                type: prometheus
                access: proxy
                url: http://prometheus-server.prometheus.svc.cluster.local
                isDefault: true
      - dashboardProviders:
          dashboardproviders.yaml:
            apiVersion: 1
            providers:
            - name: 'default'
              orgId: 1
              folder: ''
              type: file
              disableDeletion: false
              editable: true
              options:
                path: /var/lib/grafana/dashboards
      - dashboards:
            default:
              k8s:
                url: https://grafana.com/api/dashboards/8588/revisions/1/download

据我在这里阅读可以理解,我需要一个提供程序,然后我可以通过 url 引用仪表板。但是,当我按照上面所示进行操作时,没有安装仪表板并且当我按照以下方式进行操作时(其中 as )

      - dashboards:
          default:
            url: https://grafana.com/api/dashboards/8588/revisions/1/download

我收到以下错误消息

Error: render error in "grafana/templates/deployment.yaml": template: grafana/templates/deployment.yaml:148:20: executing "grafana/templates/deployment.yaml" at <$value>: wrong type for value; expected map[string]interface {}; got string

关于我做错了什么的任何线索?

4

1 回答 1

2

我认为问题在于您将数据源、仪表板提供者和仪表板定义为列表而不是地图,因此您需要删除连字符,这意味着值部分变为:

values:
  datasources:
    datasources.yaml:
      apiVersion: 1
      datasources:
      - name: Prometheus
        type: prometheus
        url: http://prometheus-prometheus-server
        access: proxy
        isDefault: true
  dashboardProviders:
    dashboardproviders.yaml:
      apiVersion: 1
      providers:
      - name: 'default'
        orgId: 1
        folder: ''
        type: file
        disableDeletion: false
        editable: true
        options:
          path: /var/lib/grafana/dashboards
  dashboards:
    default:
      k8s:
        url: https://grafana.com/api/dashboards/8588/revisions/1/download

grafana 图表将它们作为地图使用 helmfile 不会改变这一点

于 2019-01-14T10:20:23.263 回答