Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Dec 14, 2023
1 parent 1e232d2 commit f661eb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions charts/kubedb-grafana-dashboards/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ data:
{{- range $k, $v := $.Values.dashboard.replacements }}
{{- $dashtpl = $dashtpl | replace $k $v }}
{{- end }}
{{- $dasboard := omit (tpl $dashtpl $ | mustFromJson) "id" "uid" -}}
{{- $dashboard := omit (tpl $dashtpl $ | mustFromJson) "id" "uid" -}}
{{ $path | replace "/" "-" | nindent 2 }}: |
{{- dict
"dashboard" $dasboard
"dashboard" $dashboard
"folderId" $.Values.dashboard.folderID
"overwrite" $.Values.dashboard.overwrite | toJson | nindent 4 -}}
{{- end }}
Expand Down
15 changes: 9 additions & 6 deletions charts/kubedb-grafana-dashboards/templates/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
{{- $gkr := .Files.Get "data/resources.yaml" | fromYaml -}}
{{ range $r := .Values.resources }}
{{ range $path, $_ := $.Files.Glob (printf "dashboards/%s/**.json" $r) }}

{{- $dashtpl := $.Files.Get $path }}
{{- range $k, $v := $.Values.dashboard.replacements }}
{{- $dashtpl = $dashtpl | replace $k $v }}
{{- end }}
{{- $dashboard := omit (tpl $dashtpl $ | mustFromJson) "id" "uid" -}}

apiVersion: openviz.dev/v1alpha1
kind: GrafanaDashboard
metadata:
name: {{ prepend ((get ($.Files.Get $path | mustFromJson) "title") | lower | nospace | splitList "/" ) $.Values.grafana.name | compact | join "-" | trunc 63 | trimSuffix "-" }}
name: {{ prepend ((get $dashboard "title") | lower | nospace | splitList "/" ) $.Values.grafana.name | compact | join "-" | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Release.Namespace }}
labels:
k8s.io/group: kubedb.com
Expand All @@ -24,12 +31,8 @@ spec:
namespace: {{ . }}
{{- end }}
{{- end }}
{{- $dashtpl := $.Files.Get $path }}
{{- range $k, $v := $.Values.dashboard.replacements }}
{{- $dashtpl = $dashtpl | replace $k $v }}
{{- end }}
model:
{{- omit (tpl $dashtpl $ | mustFromJson) "id" "uid" | toYaml | nindent 4 }}
{{- $dashboard | toYaml | nindent 4 }}
{{- with $.Values.dashboard.folderID }}
folderID: {{ . }}
{{- end }}
Expand Down

0 comments on commit f661eb5

Please sign in to comment.