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

Feature - Support X-Grafana-Org-Id Header #1726

Open
alefray opened this issue Oct 24, 2024 · 3 comments
Open

Feature - Support X-Grafana-Org-Id Header #1726

alefray opened this issue Oct 24, 2024 · 3 comments
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@alefray
Copy link

alefray commented Oct 24, 2024

Is your feature request related to a problem? Please describe.

On our self-hosted Grafana Enterprise instance, we use Organisations to isolate our clients dashboards and Teams to structure internal teams permissions (viewer/editor) and client teams permissions (mostly viewer).

We want to be able to specify for each dashboard and/or datasource the organisation id where to provision them on our Grafana instance.

Note: we use grafana-operator with external grafana configuration (grafana is provisioned using the helm chart, not the operator)

Describe the solution you'd like

Allow to pass the X-Grafana-Org-Id header when the operator requests Grafana HTTP API for any resource type e.g. folder, dashboards or datasources.

This could be done in multiple ways:

With the first 2 solutions, we would declare multiple Grafana instances with different X-Grafana-Org-Id values and rely on InstanceSelector in GrafanaDashboard spec to select the correct instance/orgid url.
With the latest, we would have a single Grafana resource and rely on the new orgId parameter in GrafanaDashboard spec to select the correct organisation.

Describe alternatives you've considered

We plan to build a solution using a proxy to set the header attribute depending on the url e.g. curl -X GET grafana.org-1.example.com/api = curl -X GET -H "X-Grafana-Org-Id: 1" grafana.example.com
But this feels a bit hackish, a proper build-in solution would be much more simpler.

Additional context

We are aware that Organisations are not a feature Grafana plans to invest in according to https://grafana.com/blog/2022/03/14/how-to-best-organize-your-teams-and-resources-in-grafana/.

However, we pay a licence which allow us to propose a single instance for our team and our client instead of the cumbersome management of multiple instances (that we already have experienced and don't want to go back to).

We do use organisations for the very reasons detailed as limitations here:

  • We want all orgs to share the same configuration & auth. We do not want to manage/configure/upgrade ~20 instances.
  • We want strict data isolations (on folders, dashboards and datasources) to prevent a client to see another client data. It seems too easy to misconfigure a datasource policy. It is easier to audit when permission policies are very simple.
  • Managing users per organisation is very simple to comprehend and thus delegate to non-technical client/account managers.
@alefray alefray added enhancement New feature or request needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 24, 2024
@theSuess
Copy link
Member

Thanks for the feature request! As you mentioned, organizations are not something we're likely to support directly based off the complexity they introduce and edge cases that need to be considered.

That being said, adding a generic header field to the client is something we can add, as it's also useful for some other configurations.

If you're up to implementing this, we're happy to merge a PR with a generic header field. Otherwise, you'll have to wait some time for us to implement this

@theSuess theSuess added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 28, 2024
@MaoMaoCake
Copy link

I've started some work on my fork today but I'm not a golang dev I can't seem to figure out why this is not working. I'll update if I get it to work or some kind soul can help me figure it out.

MaoMaoCake@747a960

@MaoMaoCake
Copy link

After some more digging around the client has OrgID already built in, it is just a matter of adding a configuration for in the external client, while it would not be a generic header implementation, it would satisfy the current feature request.

please check out the implementation here https://github.com/MaoMaoCake/grafana-operator/tree/add-x-grafana-orgid. If you are open to merging it I'll open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants