-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[stable/grafana] Utilize 5.x datasource and dashboard import tooling and general refactor #4713
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: grafana | ||
version: 0.8.5 | ||
version: 0.9.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: Ryan Luckie | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Github usernames There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed. |
||
email: [email protected] | ||
engine: gotpl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
1. Get your '{{ .Values.server.adminUser }}' user password by running: | ||
1. Get your '{{ .Values.adminUser }}' user password by running: | ||
|
||
kubectl get secret --namespace {{ .Release.Namespace }} {{ template "grafana.server.fullname" . }} -o jsonpath="{.data.grafana-admin-password}" | base64 --decode ; echo | ||
kubectl get secret --namespace {{ .Release.Namespace }} {{ template "grafana.fullname" . }} -o jsonpath="{.data.admin-password}" | base64 --decode ; echo | ||
|
||
2. The Grafana server can be accessed via port {{ .Values.server.service.httpPort }} on the following DNS name from within your cluster: | ||
2. The Grafana server can be accessed via port {{ .Values.service.httpPort }} on the following DNS name from within your cluster: | ||
|
||
{{ template "grafana.server.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local | ||
{{ if .Values.server.ingress.enabled }} | ||
{{ template "grafana.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local | ||
{{ if .Values.ingress.enabled }} | ||
From outside the cluster, the server URL(s) are: | ||
{{- range .Values.server.ingress.hosts }} | ||
{{- range .Values.ingress.hosts }} | ||
http://{{ . }} | ||
{{- end }} | ||
{{ else }} | ||
Get the Grafana URL to visit by running these commands in the same shell: | ||
{{ if contains "NodePort" .Values.server.service.type -}} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana.server.fullname" . }}) | ||
{{ if contains "NodePort" .Values.service.type -}} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "grafana.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{ else if contains "LoadBalancer" .Values.server.service.type -}} | ||
{{ else if contains "LoadBalancer" .Values.service.type -}} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "grafana.server.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "grafana.server.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.server.httpPort -}} | ||
{{ else if contains "ClusterIP" .Values.server.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "grafana.fullname" . }},component={{ .Values.server.name }}" -o jsonpath="{.items[0].metadata.name}") | ||
You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "grafana.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "grafana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
echo http://$SERVICE_IP:{{ .Values.httpPort -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the "echo" in this line needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @timstoop good catch! fixed. |
||
{{ else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "grafana.fullname" . }},component={{ .Values.name }}" -o jsonpath="{.items[0].metadata.name}") | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 3000 | ||
{{- end }} | ||
{{- end }} | ||
|
||
3. Login with the password from step 1 and the username: {{ .Values.server.adminUser }} | ||
3. Login with the password from step 1 and the username: {{ .Values.adminUser }} | ||
|
||
{{- if .Values.server.persistentVolume.enabled }} | ||
{{- else }} | ||
{{- if not .Values.persistence.enabled }} | ||
################################################################################# | ||
###### WARNING: Persistence is disabled!!! You will lose your data when ##### | ||
###### the Grafana pod is terminated. ##### | ||
|
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 }} | ||
{{- if .Values.plugins }} | ||
plugins: {{ default "" .Values.plugins | quote }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed. |
||
{{- 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 -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The datasources configuration can contain passwords and other sensitive information. Seems like it should go into a Secret instead of a ConfigMap. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. grafana.ini should probably also be a secret. Will fix in follow-up PR. |
||
|
||
{{- 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 .Values.dashboards }} | ||
{{ if .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/{{ .gnetId }}/revisions/{{ default 1 .revision }}/download {{ if .datasource }}| sed 's|\"datasource\":[^,]*|\"datasource\": \"{{ .datasource }}\"|g'{{ end }} \ | ||
> /var/lib/grafana/dashboards/{{ .name }}.json | ||
{{- end }} | ||
{{- end }} | ||
{{ toYaml .Values.serverConfigFile | indent 2 }} | ||
{{- end }} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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 .Values.dashboards }} | ||
{{ if .json }} | ||
{{ .name }}.json: | | ||
{{ .json }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky: I would argue 1.0.0 is more appropriate here, since this is a backwards incompatible change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.