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 #2939

Closed
wants to merge 10 commits into from
2 changes: 1 addition & 1 deletion charts/grafana/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: grafana
version: 7.3.0
appVersion: 10.3.1
appVersion: 10.3.2
kubeVersion: "^1.8.0-0"
description: The leading tool for querying and visualizing time series and metrics.
home: https://grafana.com
Expand Down
39 changes: 29 additions & 10 deletions charts/grafana/templates/_config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,40 @@ 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 }}'
{{- if .Values.sidecar.dashboards.provider }}
{{- with .Values.sidecar.dashboards.provider }}
- name: '{{ .name }}'
orgId: {{ .orgid }}
{{- if not .foldersFromFilesStructure }}
folder: '{{ .folder }}'
{{- 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 Down
30 changes: 14 additions & 16 deletions charts/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -942,22 +942,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: ''
# 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