diff --git a/grafana.yaml b/grafana.yaml index 4663edb..f345f31 100644 --- a/grafana.yaml +++ b/grafana.yaml @@ -34,6 +34,14 @@ data: editable: true options: path: /var/lib/grafana/dashboards + - name: 'Auto-Downloaded' + orgId: 1 + folder: 'Kubernetes' + type: file + disableDeletion: false + editable: true + options: + path: /etc/grafana/dashboards --- apiVersion: v1 kind: ConfigMap @@ -305,6 +313,22 @@ spec: spec: securityContext: fsGroup: 472 + initContainers: + - name: download-dashboards + image: curlimages/curl:latest + command: ["sh", "-c"] + args: + - | + set -e + mkdir -p /tmp/dashboards + # List of dashboard IDs to download + for id in 15757 15759 15760; do + echo "Downloading dashboard $id..." + curl -sL "https://grafana.com/api/dashboards/${id}/revisions/latest/download" -o "/tmp/dashboards/${id}.json" + done + volumeMounts: + - name: auto-dashboards + mountPath: /tmp/dashboards containers: - name: grafana image: grafana/grafana:latest @@ -383,6 +407,9 @@ spec: - name: grafana-dashboards mountPath: /var/lib/grafana/dashboards readOnly: true + - name: auto-dashboards + mountPath: /etc/grafana/dashboards + readOnly: true readinessProbe: httpGet: path: /api/health @@ -402,6 +429,8 @@ spec: - name: grafana-dashboards configMap: name: grafana-dashboards + - name: auto-dashboards + emptyDir: {} volumeClaimTemplates: - metadata: name: grafana-storage