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

add optional secureJsonData to grafana datasources #297

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

lucabello
Copy link
Contributor

@lucabello lucabello commented Feb 6, 2024

Issue

Closes #295.

Some datasources, like Mimir, need custom HTTP Headers to be specified in the datasource configuration.

As seen here, header names can be specified under jsonData, which we currently build from the extra_data parameter in the GrafanaSourceProvider constructor.

However, the value for a header must be specified under secureJsonData, which we currently don't allow to specify in the grafana_source library.

Solution

This PR adds an optional secure_extra_data constructor argument, right next to extra_data, so that we can (in the same fashion as jsonData) specify secureJsonData for a datasource.

@lucabello
Copy link
Contributor Author

Headers are set successfully now:
Screenshot_20240206_144103

And the Mimir datasource is happy as a consequence:
Screenshot_20240206_144037

src/charm.py Show resolved Hide resolved
lib/charms/grafana_k8s/v0/grafana_source.py Show resolved Hide resolved
Copy link
Contributor

@PietroPasotti PietroPasotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks grafana to me

@lucabello lucabello merged commit f3d6109 into main Feb 15, 2024
13 checks passed
@lucabello lucabello deleted the feature/grafana-secure-json-data branch February 15, 2024 10:17
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 this pull request may close these issues.

Add custom headers to Grafana Datasource
2 participants