Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unable to use grafana-sentry-datasource plugin #776

Closed
bukovjanmic opened this issue Jun 13, 2022 · 2 comments
Closed

[Bug] Unable to use grafana-sentry-datasource plugin #776

bukovjanmic opened this issue Jun 13, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@bukovjanmic
Copy link

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 bukovjanmic added bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 13, 2022
@pb82
Copy link
Collaborator

pb82 commented Jun 14, 2022

@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.

@pb82 pb82 added triage/needs-information Indicates an issue needs more information in order to work on it. and removed bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 21, 2022
@pb82 pb82 added enhancement New feature or request good first issue Good for newcomers and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Jul 5, 2022
@pb82
Copy link
Collaborator

pb82 commented Jul 26, 2022

will be fixed by #803

@pb82 pb82 closed this as completed Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants