forked from helm/charts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable/grafana] Utilize 5.x datasource and dashboard import tooling …
…and general refactor (helm#4713) * Refactor grafana - rename manifest to align with helm create - remove unnecessary manifests * Grafana refactor - utilize new features of grafana 5.x to configure datasources and dashboards - remove all jobs - update ingress manifest to align with helm create - consolidate configmaps - cleanup and refactor values.yaml - remove unnecessary nesting from values.yaml - add initContainer to download dashboards - update labels and selectors to align with helm best practices - general cleanup to align with helm best practices/patterns observed in `helm create` - update values, NOTES, README and _helpers accordingly - cleanup service manifest to allow more flexibility - add rtluckie to maintainers - bump chart version Tested on: k8s 1.8.10, 1.9.6 and 1.10.0 Limitations: - Imported dashboards only support a single datasource * Changes from comments - remove deprecated grafana.ini option - rework .Values.dashboards to make triggering download initContainer easier - make initContainer image configurable - add note to values.yaml regarding dashboards' dependency on dashboardProviders - bump chart version to 1.0.0 * NOTES fixes - remove unnecessary echo - fix service.port references * More changes from comments - update name to gh username in Charts.yaml - cleanup plugins install - cleanup dashboards install -- don't rely on `defaults` - cleanup reusing pv claim -- don't reply on `defaults` - cleanup secrets -- don't rely on `defaults` - cleanup service manifest -- don't rely `defaults` - use storageClassName instead of storageClass (don't rely on `defaults`) - remove redundant defaults from grafana.ini configmap * Fix small regression - use default when using templated value for pv name when existingClaim is not defined Signed-off-by: voron <[email protected]>
- Loading branch information
Showing
18 changed files
with
446 additions
and
886 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: grafana | ||
version: 0.8.5 | ||
version: 1.0.0 | ||
appVersion: 5.0.4 | ||
description: The leading tool for querying and visualizing time series and metrics. | ||
home: https://grafana.net | ||
|
@@ -9,4 +9,6 @@ sources: | |
maintainers: | ||
- name: Ming Hsieh | ||
email: [email protected] | ||
- name: rtluckie | ||
email: [email protected] | ||
engine: gotpl |
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
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
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
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 |
---|---|---|
@@ -1,15 +1,52 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "grafana.fullname" . }} | ||
labels: | ||
app: {{ template "grafana.fullname" . }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
component: "{{ .Values.server.name }}" | ||
heritage: "{{ .Release.Service }}" | ||
release: "{{ .Release.Name }}" | ||
name: {{ template "grafana.server.fullname" . }}-config | ||
app: {{ template "grafana.name" . }} | ||
chart: {{ template "grafana.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
{{- if .Values.server.installPlugins }} | ||
grafana-install-plugins: {{ .Values.server.installPlugins | quote }} | ||
{{- with .Values.plugins }} | ||
plugins: {{ . | quote }} | ||
{{- end }} | ||
grafana.ini: | | ||
{{- range $key, $value := index .Values "grafana.ini" }} | ||
[{{ $key }}] | ||
{{- range $elem, $elemVal := $value }} | ||
{{ $elem }} = {{ $elemVal }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .Values.datasources }} | ||
{{- range $key, $value := .Values.datasources }} | ||
{{ $key }}: | | ||
{{ toYaml $value | indent 4 }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- if .Values.dashboardProviders }} | ||
{{- range $key, $value := .Values.dashboardProviders }} | ||
{{ $key }}: | | ||
{{ toYaml $value | indent 4 }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- if .Values.dashboards }} | ||
download_dashboards.sh: | | ||
#!/usr/bin/env sh | ||
set -euf | ||
mkdir -p /var/lib/grafana/dashboards | ||
{{- range $key, $value := .Values.dashboards }} | ||
{{ if hasKey $value "gnetId" }} | ||
curl -sk \ | ||
--connect-timeout 60 \ | ||
--max-time 60 \ | ||
-H "Accept: application/json" \ | ||
-H "Content-Type: application/json;charset=UTF-8" \ | ||
https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download {{ if $value.datasource }}| sed 's|\"datasource\":[^,]*|\"datasource\": \"{{ $value.datasource }}\"|g'{{ end }} \ | ||
> /var/lib/grafana/dashboards/{{ $key }}.json | ||
{{- end }} | ||
{{- end }} | ||
{{ toYaml .Values.serverConfigFile | indent 2 }} | ||
{{- end }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
stable/grafana/templates/dashboards-import-job-configmap.yaml
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "grafana.fullname" . }}-dashboards-json | ||
labels: | ||
app: {{ template "grafana.name" . }} | ||
chart: {{ template "grafana.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
{{- if .Values.dashboards }} | ||
{{- range $key, $value := .Values.dashboards }} | ||
{{ if hasKey $value "json" }} | ||
{{ $key }}.json: | | ||
{{ $value.json }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} |
Oops, something went wrong.