Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grafana] feat: adds multi-org support to sidecar dashboards #3240

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/grafana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: grafana
version: 8.5.2
version: 8.5.3
appVersion: 11.2.1
kubeVersion: "^1.8.0-0"
description: The leading tool for querying and visualizing time series and metrics.
Expand Down
43 changes: 31 additions & 12 deletions charts/grafana/templates/_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,41 @@ download_dashboards.sh: |
Generate dashboard json config map data
*/}}
{{- define "grafana.configDashboardProviderData" -}}
{{- $values := .Values -}}
provider.yaml: |-
apiVersion: 1
providers:
- name: '{{ .Values.sidecar.dashboards.provider.name }}'
orgId: {{ .Values.sidecar.dashboards.provider.orgid }}
{{- if not .Values.sidecar.dashboards.provider.foldersFromFilesStructure }}
folder: '{{ .Values.sidecar.dashboards.provider.folder }}'
folderUid: '{{ .Values.sidecar.dashboards.provider.folderUid }}'
{{- if .Values.sidecar.dashboards.provider }}
{{- with .Values.sidecar.dashboards.provider }}
- name: '{{ .name }}'
orgId: {{ .orgid }}
{{- if not .foldersFromFilesStructure }}
folder: '{{ .folder }}'
folderUid: '{{ .folderUid }}'
{{- end }}
type: {{ .Values.sidecar.dashboards.provider.type }}
disableDeletion: {{ .Values.sidecar.dashboards.provider.disableDelete }}
allowUiUpdates: {{ .Values.sidecar.dashboards.provider.allowUiUpdates }}
updateIntervalSeconds: {{ .Values.sidecar.dashboards.provider.updateIntervalSeconds | default 30 }}
type: {{ .type }}
disableDeletion: {{ .disableDelete }}
allowUiUpdates: {{ .allowUiUpdates }}
updateIntervalSeconds: {{ .updateIntervalSeconds | default 30 }}
options:
foldersFromFilesStructure: {{ .Values.sidecar.dashboards.provider.foldersFromFilesStructure }}
path: {{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}
foldersFromFilesStructure: {{ .foldersFromFilesStructure }}
path: {{ $values.sidecar.dashboards.folder }}{{- with $values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}
{{- end }}
{{- end }}
{{- if .Values.sidecar.dashboards.providers }}
{{- range .Values.sidecar.dashboards.providers }}
- name: '{{ .name }}'
orgId: {{ .orgid | default 1 }}
folder: '{{ .folder | default .name }}'
type: {{ .type | default "file" }}
disableDeletion: {{ .disableDelete | default "false" }}
allowUiUpdates: {{ .allowUiUpdates | default "false"}}
updateIntervalSeconds: {{ .updateIntervalSeconds | default 30 }}
options:
foldersFromFilesStructure: {{ .foldersFromFilesStructure | default false}}
path: {{ $values.sidecar.dashboards.folder }}{{- with $values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }}{{- with .folder }}/{{ . }}{{- end }}
{{- end }}
{{- end }}
{{- end -}}

{{- define "grafana.secretsData" -}}
Expand All @@ -169,4 +188,4 @@ admin-password: {{ include "grafana.password" . }}
{{- if not .Values.ldap.existingSecret }}
ldap-toml: {{ tpl .Values.ldap.config $ | b64enc | quote }}
{{- end }}
{{- end -}}
{{- end -}}
32 changes: 14 additions & 18 deletions charts/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -983,24 +983,20 @@ sidecar:
# defaults to 66sec (sic!)
# watchClientTimeout: 60
#
# provider configuration that lets grafana manage the dashboards
provider:
# name of the provider, should be unique
name: sidecarProvider
# orgid as configured in grafana
orgid: 1
# folder in which the dashboards should be imported in grafana
folder: ''
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# type of the provider
type: file
# disableDelete to activate a import-only behaviour
disableDelete: false
# allow updating provisioned dashboards from the UI
allowUiUpdates: false
# allow Grafana to replicate dashboard structure from filesystem
foldersFromFilesStructure: false
# providers configuration that lets grafana manage the dashboards
providers:
- name: sidecarProvider # name of the provider, should be unique
orgid: 1 # orgid as configured in grafana
# optional: folder in which the dashboards should be imported in grafana defaults to 'name' of provider
# folder: ''
# optional: type of the provider, defaults to "file"
# type: file
# optional disableDelete to activate a import-only behaviour, defaults to false
# disableDelete: false
# optional: allow updating provisioned dashboards from the UI, defaults to false
# allowUiUpdates: false
# optional allow Grafana to replicate dashboard structure from filesystem, defaults to false
# foldersFromFilesStructure: false
# Additional dashboard sidecar volume mounts
extraMounts: []
# Sets the size limit of the dashboard sidecar emptyDir volume
Expand Down
Loading