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

Grafana provisioning configuration is not generated correctly #27

Closed
dunse opened this issue Jul 16, 2019 · 3 comments · Fixed by #28
Closed

Grafana provisioning configuration is not generated correctly #27

dunse opened this issue Jul 16, 2019 · 3 comments · Fixed by #28

Comments

@dunse
Copy link

dunse commented Jul 16, 2019

Tested using grafana-operator:latest sha 2a564282916d with Grafana 6.2.5.

Found multiple issues when trying to create new datasources using CRD...

1. Casing of keys are not correct

When providing:

kind: GrafanaDataSource
...
      basicAuth: true

The generated config becomes:

      basicauth: true

From what I can tell, Grafana's provisioning config version 0 had snake_case and version 1 has camelCase.
Issue appears to in: pkg/apis/integreatly/v1alpha1/grafanadatasource_types.go
Where the yaml formatting is missing:

BasicAuth         bool   `json:"basicAuth,omitempty"`

Should be:

BasicAuth         bool   `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"`

2. Missing apiVersion

Documentation shows apiVersion as part of the provisioning file: https://grafana.com/docs/administration/provisioning/#example-datasource-config-file
When not specifying apiVersion 1, the parsing of the provisioning file does not follow documentation and does not work as expected.

3. jsonData and secureJsonData is not generated correctly

Documentation shows both should be generated as a map: https://grafana.com/docs/administration/provisioning/#example-datasource-config-file
However, the CRD expects a JSON string, which Grafana will reject when using apiVersion: 1.

@pb82
Copy link
Collaborator

pb82 commented Jul 17, 2019

@dunse thanks for testing the operator and reporting those bugs! I'm looking into that. I've noticed that Grafana has a warning in the log about the current provisioning configuration, this might be related.

@dunse
Copy link
Author

dunse commented Jul 17, 2019

@pb82 yes, it says something along the line of "config is deprecated" which disappears when mentioned issues are corrected.

@pb82
Copy link
Collaborator

pb82 commented Jul 17, 2019

@dunse that's good to know. I'm currently working on overhauling the Grafana configuration itself (generating grafana.ini) and will take the datasources on afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants