grafana / helm-charts

Apache License 2.0
1.6k stars 2.24k forks source link

[grafana] "/var/lib/grafana" defaults to emptyDir volume type #868

Open obesser opened 2 years ago

obesser commented 2 years ago

I use a custom grafana image built with custom plugins in /var/lib/grafana/plugins, but the path is overwritten by the empty volume. I can work around it by specifying a different plugins path in grafana.ini, but what is the reason for using empty volume?

QuinnBast commented 1 year ago

I agree with this.

I am doing the same thing, loading some plugins into a custom docker image at /var/lib/grafana/plugins but the helm chart defaults a volume mount at /var/lib/grafana which is an emptyDir. This ends up erasing the plugins directory that I setup in my custom docker image.

Workaround seems to be to upload the plugins to a different path and update the path in grafana.ini to point to a different plugin directory. But yes, this caused me a bit of headache to find out...

biljicmarko commented 5 months ago

Just to add comment that can help others here. In my case, I downloaded Trino Data Source from - https://grafana.com/grafana/plugins/trino-datasource/?tab=overview Then created new image with new Trino Data Source, here is Dockerfile:

FROM grafana/grafana:10.3.5-ubuntu

USER root

# Copying the Trino plugin to the appropriate directory inside the container
COPY trino-datasource /home/grafana-plugins/trino-datasource

#USER grafana
USER 472

Then in value.yaml file I changed:

grafana.ini:
  paths:
    data: /var/lib/grafana/
    logs: /var/log/grafana
    plugins: /home/grafana-plugins/trino-datasource

And for me most important thing is to change pullPolicy from default IfNotPresent to Always:

image:
  # -- The Docker registry
  #registry: docker.io
  registry: my-registry
  # -- Docker image repository
  repository: test/grafana-test
  # Overrides the Grafana image tag whose default is the chart appVersion
  tag: "10.2"
  sha: ""
  #pullPolicy: IfNotPresent
  pullPolicy: Always

Good way to check your image:

podman run --rm --entrypoint ls my-registry/test/grafana-test:10.2 -la /home/grafana-plugins/trino-datasource