-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helm): Grafana dashboard using configmap and Grafana Operator (#213
- Loading branch information
1 parent
34ff919
commit 074311e
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../monitoring/grafana-dashboard.json |
47 changes: 47 additions & 0 deletions
47
charts/dragonfly-operator/templates/grafanadashboards.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{ if .Values.grafanaDashboard.enabled -}} | ||
{{- $files := .Files.Glob "dashboards/*.json" }} | ||
{{- if $files }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMapList | ||
items: | ||
{{- range $path, $fileContents := $files }} | ||
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" | lower }} | ||
- apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
annotations: | ||
{{ $.Values.grafanaDashboard.annotations.name }}: {{ $.Values.grafanaDashboard.folder }} | ||
labels: | ||
{{ $.Values.grafanaDashboard.labels.name }}: {{ $dashboardName }} | ||
{{- include "dragonfly-operator.labels" $ | nindent 6 }} | ||
app.kubernetes.io/component: dashboard | ||
name: {{ printf "dashboard-dragonfly-operator-%s" $dashboardName | trunc 63 | trimSuffix "-" }} | ||
data: | ||
{{ $dashboardName }}.json: |- | ||
{{ $.Files.Get $path | indent 6}} | ||
{{- end }} | ||
{{ if $.Values.grafanaDashboard.grafanaOperator.enabled -}} | ||
{{- range $path, $fileContents := $files }} | ||
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" | lower }} | ||
--- | ||
apiVersion: grafana.integreatly.org/v1beta1 | ||
kind: GrafanaDashboard | ||
metadata: | ||
labels: | ||
{{- include "dragonfly-operator.labels" $ | nindent 4 }} | ||
app.kubernetes.io/component: dashboard | ||
name: {{ printf "dragonfly-operator-%s" $dashboardName | trunc 63 | trimSuffix "-" }} | ||
spec: | ||
allowCrossNamespaceImport: {{ $.Values.grafanaDashboard.grafanaOperator.allowCrossNamespaceImport }} | ||
folder: {{ $.Values.grafanaDashboard.folder }} | ||
instanceSelector: | ||
matchLabels: | ||
{{- toYaml $.Values.grafanaDashboard.grafanaOperator.matchLabels | nindent 6 }} | ||
configMapRef: | ||
name: {{ printf "dashboard-dragonfly-operator-%s" $dashboardName | trunc 63 | trimSuffix "-" }} | ||
key: {{ $dashboardName }}.json | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters