Skip to content

Commit 05b8bf2

Browse files
feat: support grafanadashboard CRD
1 parent bab1fa4 commit 05b8bf2

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{{- $g := $.Values.grafana -}}
2+
{{- if and $g.operatorDashboards $g.operatorDashboards.enabled -}}
3+
{{- $op := $g.operatorDashboards -}}
4+
{{- $files := .Files.Glob "dashboards/*" -}}
5+
{{- range $path, $_ := $files }}
6+
---
7+
apiVersion: grafana.integreatly.org/v1beta1
8+
kind: GrafanaDashboard
9+
metadata:
10+
name: {{ include "lighthouse.fullname" . }}-{{ base $path | replace "." "-" | trunc 63 | trimSuffix "-" }}
11+
{{- with $op.namespace }}
12+
{{- if . }}
13+
namespace: {{ . }}
14+
{{- end }}
15+
{{- end }}
16+
labels:
17+
{{- include "lighthouse.labels" . | nindent 4 }}
18+
{{- with $op.labels }}
19+
{{- toYaml . | nindent 4 }}
20+
{{- end }}
21+
{{- with $op.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
allowCrossNamespaceImport: {{ default false $op.allowCrossNamespaceImport }}
27+
{{- with $op.instanceSelector }}
28+
instanceSelector:
29+
{{- toYaml . | nindent 4 }}
30+
{{- end }}
31+
{{- with $op.folder }}
32+
folder: {{ . }}
33+
{{- end }}
34+
{{- with $op.folderUID }}
35+
folderUID: {{ . }}
36+
{{- end }}
37+
{{- with $op.uid }}
38+
uid: {{ . }}
39+
{{- end }}
40+
{{- with $op.resyncPeriod }}
41+
resyncPeriod: {{ . }}
42+
{{- end }}
43+
{{- if hasKey $op "suspend" }}
44+
suspend: {{ $op.suspend }}
45+
{{- end }}
46+
{{- with $op.extraSpec }}
47+
{{- toYaml . | nindent 2 }}
48+
{{- end }}
49+
json: |
50+
{{- $.Files.Get $path | nindent 4 }}
51+
{{- end }}
52+
{{- end }}
53+

charts/lighthouse/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,28 @@ grafana:
6666
dashboardsConfigMapLabel: grafana_dashboard
6767
# -- Must match `sidecar.dashboards.labelValue` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart)
6868
dashboardsConfigMapLabelValue: "1"
69+
# -- Create GrafanaDashboard CRDs via Grafana Operator from files in `dashboards/`
70+
operatorDashboards:
71+
enabled: false
72+
# -- Optional target namespace for the GrafanaDashboard CRDs (defaults to release namespace)
73+
namespace: ""
74+
# -- Extra labels and annotations on the GrafanaDashboard resources
75+
labels: {}
76+
annotations: {}
77+
# -- Selector to match Grafana instances managed by the operator
78+
instanceSelector:
79+
matchLabels: {}
80+
# -- Allow matching Grafana instances outside current namespace
81+
allowCrossNamespaceImport: false
82+
# -- Optional folder metadata
83+
folder: ""
84+
folderUID: ""
85+
uid: ""
86+
# -- Operator sync behavior
87+
resyncPeriod: ""
88+
suspend: false
89+
# -- Additional spec fields to merge into GrafanaDashboard.spec
90+
extraSpec: {}
6991

7092
lighthouse:
7193
# -- URL to the Execution Client Engine API. Will use configured JWT to authenticate.

0 commit comments

Comments
 (0)