使用grafana运算符,如何创建Opensearch数据源并在Yaml中设置withCredentials = true?

问题描述 投票:0回答:1

我正在使用 grafana 运算符来设置 Opensearch 数据源。根据 api 文档,该字段不能在规范下设置如下:

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
spec:
  datasource:
    withCredentials: true

但是,如果您在单击

Save & Test
时检查数据源配置页面,您可以看到这个
withCredentials
字段:

datasource fields

我尝试将其放入 jsonData (参见屏幕)和 secureJsonData (给我一个错误)中,看看是否会被考虑在内,但事实并非如此:

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
spec:
  datasource:
    jsonData:
      withCredentials: true
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
spec:
  datasource:
    secureJsonData:
      withCredentials: true

有谁知道如何使用 grafana 运算符将此字段设置为 true ?

yaml kubernetes-helm grafana grafana-api grafana-operator
1个回答
0
投票

也许这会有所帮助,请尝试一下。

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
spec:
  valuesFrom:
    - targetPath: "basicAuthUser"
      valueFrom:
        secretKeyRef:
          name: "grafana-opensearch-secrets"
          key: "OPENSEARCH_USERNAME"
    - targetPath: "secureJsonData.basicAuthPassword"
      valueFrom:
        secretKeyRef:
          name: "grafana-opensearch-secrets"
          key: "OPENSEARCH_PASSWORD"
  datasource:
    basicAuthUser: ${OPENSEARCH_USERNAME}
    securejsonData:
      "basicAuthPassword": ${OPENSEARCH_PASSWORD}

© www.soinside.com 2019 - 2024. All rights reserved.