Skip to content

Grafana CR Config OCP Secret/ConfigMap Reference (SMTP) #2128

@mhasz-wahbe

Description

@mhasz-wahbe

I am trying to externalize the Grafana CR configuration with my SMTP values so that I dont have to leave hardcoded values in my Grafana CR yaml.

If we could use valueFrom: that would be great, or envFrom:
However as it currently operates it only accepts string. I have tried every envFrom: valueFrom: setting i know, tryign to add it before spec.config, and then give it target path for the reference. Same approach is viable in Grafana datasource yamls. Example below.

Preferred Solution:

spec:
  config:
    log:
      level: warn
      mode: console
    smtp:
      enabled: 'true'
      from_address: 
      from_name: Grafana Alerts
      host: 'smtp.domain.com:587'
      user: 
      password: 
        valueFrom:
          secretKeyRef:
            key: grafana-smtp-secret
            key: GF_SMTP_PASSWORD

Grafana DataSource Example:

  valuesFrom:
    - targetPath: "secureJsonData.httpHeaderValue1"
      valueFrom:
        secretKeyRef:
          name: "secret-name"
          key: "token"
  allowCrossNamespaceImport: true
  datasource:
    access: proxy
    editable: true
    isDefault: true
    jsonData:
      httpHeaderName1: Authorization
      timeInterval: 5s
      tlsSkipVerify: true
    name: Prometheus1
    uid: prometheus-grafanadatasource1
    secureJsonData:
      httpHeaderValue1: Bearer ${token}
    type: prometheus
    url: 
  instanceSelector:
    matchLabels:
      dashboards: gragana-dashboards

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions