-
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
Conversation
- rename manifest to align with helm create - remove unnecessary manifests
/assign @unguiculus |
/assign @foxish |
- 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
image: busybox | ||
command: ['sh', '-c', 'cp /tmp/config-volume-configmap/* /tmp/config-volume 2>/dev/null || true; cp /tmp/dashboard-volume-configmap/* /tmp/dashboard-volume 2>/dev/null || true'] | ||
- name: download-dashboards | ||
image: appropriate/curl |
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.
Could this also be a setting in values.yaml? Use case there: using a private mirror for deployment
Another little thing: this init container is gonna launch even if we have 0 dashboards to download (perhaps you only provide them via config or retrieve them from grafana via ID). Would be nice if there was some simple way to disable this container or have it only launch when it's necessary.
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.
@DaytonG Sure. I can make the download-dashboard image a setting in values.yaml
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.
Re: the init container: It was my intention to have it only run when there were dashboards to download, but I haven't been able to figure out how. I will restructure .Values.dashboards to hopefully make it a bit easier.
Any help would be appreciated!
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.
Hm. The simplest change could be to just move the downloaded dashboards to its own variable and process it independently of the dashboards provided locally. Could potentially increase configuration complexity a little, but it may also simplify some of the template code.
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.
I thought about that, but I'd like to avoid the configuration complexity. I'll ruminate on it for a while. Even if the initContainer runs unnecessarily, the image is light (~7mb) and with nothing to download the script is benign.
# disableDeletion: false | ||
# editable: true | ||
# options: | ||
# path: /var/lib/grafana/dashboards |
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.
Perhaps it's just me, but I find that I always need to provision dashboards. It would be ideal if provisioning was enabled by default, so I just needed to fill in dashboards
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.
@DaytonG I think its a general best practice to have minimal sane defaults in values.yaml
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.
Yea, I can see that. My only concern is if someone tried to set dashboards
but didn't know they also needed to configure providioners it may be difficult to figure out what to do. Perhaps a comment would do for dashboards
saying "if you need this, you must uncomment the providers configuration"?
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.
Added comment to values.yaml
stable/grafana/values.yaml
Outdated
level: info | ||
dashboards.json: | ||
enabled: true | ||
path: /var/lib/grafana/dashboards |
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.
In G5, dashboards.json
is deprecated. Since this change is not backwards compatible with G4, could we just nuke the section, for clarity?
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.
@DaytonG Good catch. Fixed
{{ $key }}: | | ||
{{ toYaml $value | indent 4 }} | ||
{{- 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.
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 comment
The 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.
stable/grafana/Chart.yaml
Outdated
@@ -1,5 +1,5 @@ | |||
name: grafana | |||
version: 0.8.5 | |||
version: 0.9.0 |
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.
(Sorry, I think I may have posted review comments a little wrong. Not used to making them much here on github). Overall, I think your PR is much better than mine. We should approve yours. |
@DaytonG in that case, I recommend you close the other one in favour of this one? |
- 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
/ok-to-test |
/lgtm |
@DaytonG: changing LGTM is restricted to assignees, and only kubernetes org members may be assigned issues. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
stable/grafana/templates/NOTES.txt
Outdated
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@timstoop good catch! fixed.
- remove unnecessary echo - fix service.port references
/lgtm |
stable/grafana/Chart.yaml
Outdated
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
{{- 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use the default
function. Default values should come from values.yaml
. Apply everywhere.
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.
{{ toYaml . | indent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if (or (eq .Values.service.type "ClusterIP" "") (empty .Values.service.type)) }} |
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.
Why would this make sense? eq .Values.service.type "ClusterIP" ""
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.
It really doesn't-- it was a relic from refactor. Fixed.
- use default when using templated value for pv name when existingClaim is not defined
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: DaytonG, rtluckie, timstoop, unguiculus The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@rtluckie I always get EDIT: I figured the workaround. Basically, |
@amnk can you post your values.yaml and I will try to help. |
@rtluckie Thanks for reply :) yeah, I have that all done. And I've figured out the problem - all dashboards definitions should be one-liners in |
@rtluckie Also faced with the same error. |
If one-liner solution works, it's really not very convenient |
Think I got a fix. In the json-configmap:
Basically, the json needed to be indented properly so the YAML could be parsed. Will make a PR shortly. |
@DaytonG thanks! |
Is there any working example of values.yaml? Grafana even does not load dashboards from grafana.net |
@monotek It does not work. See my example https://gist.github.com/Jokero/abd444598e819c961fc773ca7bccd69d |
I use it for a week like this. Edit: Seems you're using Minikube. |
Ok. Figured out that I have to use exactly |
…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
…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
…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]>
helm create
NOTE: This change is not backwards compatible with grafana < 5.0.0
Tested on:
k8s 1.8.10, 1.9.6 and 1.10.0
Limitations: