grafana-operator
grafana-operator copied to clipboard
[Bug] Unable to use grafana-sentry-datasource plugin
Describe the bug When testing grafana-sentry-datasource plugin, we ran into several problems, two of which our showstoppers:
- the operator does not parse plugins from data sources. Contrary to the documentation (and as we studied from source code), the plugins names seem not to be automatically parsed from the GrafanaDatasource CR. It seems only GrafanaDashboard are processed.
- the necessary params for this plugins are thrown out from CR, as such fields are not defined in CRDs.
We worked around the first problen by manually specifiying GF_INSTALL_PLUGINS env variable as stated in documentation.
However,, for the second problem, the datasource needs to be specified like this:
https://grafana.com/grafana/plugins/grafana-sentry-datasource/
datasources:
- name: Sentry
type: grafana-sentry-datasource
access: proxy
orgId: 1
version: 1
editable: false
jsonData:
url: https://sentry.io
orgSlug: xxxxxxxxxxxxx
secureJsonData:
authToken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Both jsonData.orgSlug and secureJsonData.authToken are not defined in the CRD, and thus are pruned from CR. As a result, the datasource does not work.
Version Grafana Operartor 4.4.1
To Reproduce Try to create the datasource
Expected behavior
- plugin is parsed from the DataSource definition
- jsonData and secureJsonData are preserved and passed to plugin
For the second problem, it should be enough to add:
x-kubernetes-preserve-unknown-fields: true
to the jsonData and secureJsonData properties in the CRD definiton, as it would be quite costly to synthetize all possible Json values for all plugins that are available for Grafana (per Kubernetes documentaion https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/).
For the first problem, I believe similar logic should be implemented as with Datasources, either via explicit plugin section in GrafanaDatasource spec or derive it from the spec.datasources.type property.
Thanks,
Michal
@bukovjanmic the documentation is misleading here and should be updated: https://github.com/grafana-operator/grafana-operator/blob/master/documentation/plugins.md#install-plugins-as-dependencies-of-datasources-or-dashboards
We don't support plugins defined in data sources. You'll have to add them to a dashboard. Regarding the other issue, x-kubernetes-preserve-unknown-fields: true
might be worth trying. We currently whitelist every param explicitely and quite a few of them are missing.
will be fixed by #803