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

GrafanaDatasource: support gateway and HTTPS #707

Open
andreasgerstmayr opened this issue Dec 11, 2023 · 7 comments
Open

GrafanaDatasource: support gateway and HTTPS #707

andreasgerstmayr opened this issue Dec 11, 2023 · 7 comments
Assignees

Comments

@andreasgerstmayr
Copy link
Collaborator

Support gateway and HTTPS when creating the GrafanaDatasource:

URL: fmt.Sprintf("http://%s:%d", naming.ServiceFqdn(params.Tempo.Namespace, params.Tempo.Name, component), manifestutils.PortHTTPServer),
JSONData: json.RawMessage(fmt.Sprintf(`{"tlsSkipVerify": %t}`, tlsSkipVerify)),

@ritaCanavarro
Copy link
Contributor

ritaCanavarro commented Dec 11, 2023

Hi @andreasgerstmayr, I would like to work on this issue could you please assign it to me?
Is there anything I need to take into account while solving it?
E.G the /ping endpoint we need for Gateway as mentioned on #423 (comment)?

@andreasgerstmayr
Copy link
Collaborator Author

Hi @andreasgerstmayr, I would like to work on this issue could you please assign it to me?

Great, I've assigned it to you.

Is there anything I need to take into account while solving it? E.G the /ping endpoint we need for Gateway as mentioned on #423 (comment)?

This is already implemented: observatorium/api#575

@xmj
Copy link

xmj commented Apr 26, 2024

How can we help move this forward?

@andreasgerstmayr
Copy link
Collaborator Author

How can we help move this forward?

Do you use the gateway in static (OIDC) or OpenShift mode?

For the static mode it should be straightforward to implement, the operator can create a datasource for each tenant and enable the "Forward OAuth identity" feature in the datasource. Note however, this will only work if you configure OAuth to log in to your Grafana instance.

For the OpenShift mode, which ServiceAccount token should be used to access the tenants? Grafana cannot be configured to use the OpenShift OAuth server to login, because the OpenShift OAuth server does not support OIDC.

@xmj
Copy link

xmj commented Apr 26, 2024

Do you use the gateway in static (OIDC) or OpenShift mode?

Openshift, via the Multitenancy config listed in https://docs.openshift.com/container-platform/4.13/observability/distr_tracing/distr_tracing_tempo/distr-tracing-tempo-configuring.html#distr-tracing-tempo-config-multitenancy_distr-tracing-tempo-configuring - we've deviated from this setup in putting Tempo, Minio and OTLP into a single namespace (openshift-distributed-tracing) and renamed the tenants, but otherwise it's fairly static.

For the OpenShift mode, which ServiceAccount token should be used to access the tenants? Grafana cannot be configured to use the OpenShift OAuth server to login, because the OpenShift OAuth server does not support OIDC.

We have a grafana-sa service-account which we already use to integrate Grafana and the Prometheus datasource. That service-account is role-bound to a tempo-reader role, so I'd expect it to work.

The only things I don't yet know:

  • How do I pass the X-Scope-OrgID of the tenant to Tempo?
  • Which suffix do I use with the tempo-<instance-name>-gateway.openshift-distributed-tracing.svc.cluster.local:8080 URL through the gateway?

What I've also tried was passing grafana.createDatasource: true to the instance, until I saw the feature-gate hint and the warnings in ArgoCD.

@andreasgerstmayr
Copy link
Collaborator Author

andreasgerstmayr commented Apr 26, 2024

For the OpenShift mode, which ServiceAccount token should be used to access the tenants? Grafana cannot be configured to use the OpenShift OAuth server to login, because the OpenShift OAuth server does not support OIDC.

We have a grafana-sa service-account which we already use to integrate Grafana and the Prometheus datasource. That service-account is role-bound to a tempo-reader role, so I'd expect it to work.

That'll give everyone who can access Grafana (read) access to all tenants? It does work technically, but I don't think it's great from a security point of view.

The only things I don't yet know:

  • How do I pass the X-Scope-OrgID of the tenant to Tempo?

  • Which suffix do I use with the tempo-<instance-name>-gateway.openshift-distributed-tracing.svc.cluster.local:8080 URL through the gateway?

For the ingest path I suggest OTEL, described in the link above.
For the Tempo API, it's https://<route-to-gateway>/api/traces/v1/<tenantName>/tempo

In the Grafana Tempo docs there's a page on how to setup the datasource manually: https://grafana.com/docs/tempo/latest/setup/operator/grafana_datasource/#manual-data-source-configuration

@xmj
Copy link

xmj commented Apr 29, 2024

For the OpenShift mode, which ServiceAccount token should be used to access the tenants? Grafana cannot be configured to use the OpenShift OAuth server to login, because the OpenShift OAuth server does not support OIDC.

We have a grafana-sa service-account which we already use to integrate Grafana and the Prometheus datasource. That service-account is role-bound to a tempo-reader role, so I'd expect it to work.

That'll give everyone who can access Grafana (read) access to all tenants? It does work technically, but I don't think it's great from a security point of view.

Understood, but that's what we have rbac for ... in Grafana ;-)

The only things I don't yet know:

  • How do I pass the X-Scope-OrgID of the tenant to Tempo?
  • Which suffix do I use with the tempo-<instance-name>-gateway.openshift-distributed-tracing.svc.cluster.local:8080 URL through the gateway?

For the ingest path I suggest OTEL, described in the link above. For the Tempo API, it's https://<route-to-gateway>/api/traces/v1/<tenantName>/tempo

In the Grafana Tempo docs there's a page on how to setup the datasource manually: https://grafana.com/docs/tempo/latest/setup/operator/grafana_datasource/#manual-data-source-configuration

Sweet - we now have this working using the GrafanaDatasource with the Tempo Gateway behind an HTTPS endpoint.

I'm attaching the GrafanaDatasource in case someone can make good use on OpenShift (while noting the security caveats), maybe we can come up with some better solution in the future ;-)

tempodatasource.yaml.txt

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

No branches or pull requests

3 participants