Closed Slach closed 3 years ago
Datasource plugins, like other types of plugins can be added via the plugins
section of the dashboard. If the dashboard has an __inputs
section, the inputs need to be mapped: https://github.com/integr8ly/grafana-operator/blob/master/documentation/dashboards.md#datasource-inputs
You should be able to create a datasource even if the type does not exist in Grafana (yet). You will see an error message in Grafana, but as soon as the data source plugin is installed (and Grafana restarted in the process) it should be fine.
I agree that defining plugins in the Grafana CR would be smoother.
@Slach does the suggested solution work for you?
My Current workaround I just install dummy dashboard with plugins: section before installation my real dashboard
so adding plugins
section to Grafana custom resource looks much better
If we can pass custom env vars to the grafana deployment via the operator then we can install the plugins using "GF_INSTALL_PLUGINS"
Any updates here ?
@ocervell The latest release (3.6.0) allows you to set env vars, so you can try the suggestion from @tlipatov-asapp
@pb82 thanks for the answer ! Could you help me on how to do it ? I've tried the following and it doesn't seem to work (still getting the message that plugin is not installed...):
Example:
spec:
...
deployment:
envFrom:
- secretRef:
name: grafana-env
apiVersion: v1
kind: Secret
metadata:
name: grafana-env
namespace: default
stringData:
GF_INSTALL_PLUGINS: doitintl-bigquery-datasource 1.0.8
Update: it is working ! I had to un-deploy / re-deploy though.
This is working perfectly, thank you!
@ocervell hmm, changing the env vars should automatically restart Grafana. Did you have to do something else to get it working?
@ocervell Also when providing custom env vars you should define the admin credentials in there too, see https://github.com/integr8ly/grafana-operator/blob/master/documentation/env_vars.md#requirements-when-providing-external-admin-credentials
Can we add a blob to the documentation on installing plugins ? Then we can close this :)
@ocervell yes, documentation makes sense here. Feel free to propose a PR if you have time
As I see, currently, we can only define
plugins:
section only onGrafanaDashboard
custom resourcebut, if I try to add
GrafanaDashboard
with "__inputs" contains DS_SOMETHING it should resolve to existsGrafanaDataSource
custom resource which can't be installed cause when we use.spec.datasources[*].type
which not exists in default grafana supported datasource plugins with errorCould not find plugin definition for data source: vertamedia-clickhouse-datasource
I propose to add
plugins:
section toGrafana
custom resource definition which will use same mechanics as we use inGrafanaDashboard
@pb82 could you look at this issue?