Skip to content

Conversation

wvdm1217
Copy link

@wvdm1217 wvdm1217 commented Jul 8, 2025

Description

Currently a user needs to add individual dashboard files as values to the charts/grafana chart. The proposed change allows the use of directories that add all JSON files in a directory to the current deployment.

Motivation

When deploying Grafana I often have a dashboards directory that I want all dashboards to be added, but each file needs to be referenced by name. I end up building a custom template each time to circumvent this.

Others have asked for similar implementations
https://community.grafana.com/t/how-to-upload-dashboards-as-json-files-to-kubernetes-via-helm/59731/31

Current State

Currently a user can add a custom dashboard JSON file using a config map in the values file as follows,

dashboards:
  default:
    - name: "Dashboard 1"
      file: "dashboards/custom-dashboard.json"
    - name: "Dashboard 2"
      file: "dashboards/another-dashboard.json"

Applying this template yields,

# Source: grafana/templates/dashboards-json-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: release-name-grafana-dashboards-default
  namespace: default
  labels:
    helm.sh/chart: grafana-9.2.10
    app.kubernetes.io/name: grafana
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "12.0.2"
    dashboard-provider: default
data:
  0.json:
    '{}'
  1.json:
    '{}'

Proposed State

The same can now be achieved using the following values,

dashboards:
  default:
    - name: Dashboards
      directory: "dashboards/"

The same configmap fromat is generated, but now using the filenames instead of index values

# Source: grafana/templates/dashboards-json-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: release-name-grafana-dashboards-default
  namespace: default
  labels:
    helm.sh/chart: grafana-9.2.10
    app.kubernetes.io/name: grafana
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "12.0.2"
    dashboard-provider: default
data:
  another-dashboard.json:
    '{}'
  custom-dashboard.json:
    '{}'

…ould be added as configmaps

Signed-off-by: Werner van der Merwe <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Jul 8, 2025

CLA assistant check
All committers have signed the CLA.

@wvdm1217 wvdm1217 changed the title Extend Grafana Chart: Dashboard Config Map Accepts Directories [grafana]: Dashboard Config Map Accepts Directories Jul 8, 2025
@tiaan720
Copy link

This would be super use-full

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants