diff --git a/stable/grafana/Chart.yaml b/stable/grafana/Chart.yaml index 353494aa9c..a2b0f9c03a 100755 --- a/stable/grafana/Chart.yaml +++ b/stable/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: grafana -version: 2.0.1 +version: 2.0.2 appVersion: 5.4.3 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. diff --git a/stable/grafana/README.md b/stable/grafana/README.md index ec1013556d..98efab0488 100644 --- a/stable/grafana/README.md +++ b/stable/grafana/README.md @@ -93,6 +93,38 @@ The command removes all the Kubernetes components associated with the chart and | `rbac.pspEnabled` | Create PodSecurityPolicy (with `rbac.create`, grant roles permissions as well) | `true` | | `rbac.pspUseAppArmor` | Enforce AppArmor in created PodSecurityPolicy (requires `rbac.pspEnabled`) | `true` | +## Import dashboards + +There are a few methods to import dashboards to Grafana. Below are some examples and explanations as to how to use each method: + +```yaml +dashboards: + default: + some-dashboard: + json: | + { + "annotations": + + ... + # Complete json file here + ... + + "title": "Some Dashboard", + "uid": "abcd1234", + "version": 1 + } + custom-dashboard: + # This is a path to a file inside the dashboards directory inside the chart directory + file: dashboards/custom-dashboard.json + prometheus-stats: + # Ref: https://grafana.com/dashboards/2 + gnetId: 2 + revision: 2 + datasource: Prometheus + local-dashboard: + url: https://raw.githubusercontent.com/user/repository/master/dashboards/dashboard.json +``` + ## BASE64 dashboards Dashboards could be storaged in a server that does not return JSON directly and instead of it returns a Base64 encoded file (e.g. Gerrit) diff --git a/stable/grafana/templates/dashboards-json-configmap.yaml b/stable/grafana/templates/dashboards-json-configmap.yaml index a72cde53d7..8e08aef435 100644 --- a/stable/grafana/templates/dashboards-json-configmap.yaml +++ b/stable/grafana/templates/dashboards-json-configmap.yaml @@ -14,9 +14,14 @@ metadata: dashboard-provider: {{ $provider }} data: {{- range $key, $value := $dashboards }} -{{- if hasKey $value "json" }} +{{- if (or (hasKey $value "json") (hasKey $value "file")) }} {{ print $key | indent 2 }}.json: -{{ toYaml ( $files.Get $value.json ) | indent 4}} +{{- if hasKey $value "json" }} +{{ $value.json | indent 4 }} +{{- end }} +{{- if hasKey $value "file" }} +{{ toYaml ( $files.Get $value.file ) | indent 4}} +{{- end }} {{- end }} {{- end }} {{- end }} diff --git a/stable/grafana/values.yaml b/stable/grafana/values.yaml index b39f69012f..f1dbc0bcd8 100644 --- a/stable/grafana/values.yaml +++ b/stable/grafana/values.yaml @@ -210,18 +210,21 @@ dashboardProviders: {} ## dashboards per provider, use provider name as key. ## dashboards: {} -# default: -# some-dashboard: -# json: dashboards/custom-dashboard.json -# prometheus-stats: -# gnetId: 2 -# revision: 2 -# datasource: Prometheus -# local-dashboard: -# url: https://example.com/repository/test.json -# local-dashboard-base64: -# url: https://example.com/repository/test-b64.json -# b64content: true + # default: + # some-dashboard: + # json: | + # $RAW_JSON + # custom-dashboard: + # file: dashboards/custom-dashboard.json + # prometheus-stats: + # gnetId: 2 + # revision: 2 + # datasource: Prometheus + # local-dashboard: + # url: https://example.com/repository/test.json + # local-dashboard-base64: + # url: https://example.com/repository/test-b64.json + # b64content: true ## Reference to external ConfigMap per provider. Use provider name as key and ConfiMap name as value. ## A provider dashboards must be defined either by external ConfigMaps or in values.yaml, not in both.