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 Bearer Token Authentication to Instrumentation Exporter #3390

Open
JotaCe14 opened this issue Oct 24, 2024 · 2 comments
Open

Add Bearer Token Authentication to Instrumentation Exporter #3390

JotaCe14 opened this issue Oct 24, 2024 · 2 comments
Labels
area:auto-instrumentation Issues for auto-instrumentation enhancement New feature or request needs triage

Comments

@JotaCe14
Copy link

Component(s)

auto-instrumentation

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

I have an open telemetry collector which has bearertokenauth for receivers, I need that in the Instrumentation I can configurate the bearertokenauth for the exporter (preferably reading it from a secret) in order to send the appropiate OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer ${OTEL_COLLECTOR_TOKEN} when an application is instrumented.

Describe the solution you'd like

I'd like to have something like this in the CRD:

apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: instrumentation
spec:
exporter:
endpoint: http://${OTEL_COLLECTOR_ENDPOINT}:4317
auth:
bearertokenauth:
token: ${OTEL_COLLECTOR_TOKEN}

And also that the token can be read from a secret that will not be mounted in the pod since the secret is only in the instrumentation namespace.

Describe alternatives you've considered

Only read the token from a secret to use it to authentication, not mount it since it can cause problems for the namespace.

Additional context

No response

@JotaCe14 JotaCe14 added enhancement New feature or request needs triage labels Oct 24, 2024
@pavolloffay pavolloffay added the area:auto-instrumentation Issues for auto-instrumentation label Oct 25, 2024
@pavolloffay
Copy link
Member

The SDK only supports OTEL_EXPORTER_OTLP_HEADERS env var - https://opentelemetry.io/docs/specs/otel/protocol/exporter/ . There is not a specific env var for the token.

I think the following setup might work:

apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
  name: instrumentation
spec:
  exporter:
    endpoint: http://my-collector:4317
  env:
  -  name: TOKEN
     valueFrom:
     secretKeyRef: 
       name: my-secret
     key: token
  - name: OTEL_EXPORTER_OTLP_HEADERS
    value: Authorization=Bearer $(TOKEN)

@JotaCe14
Copy link
Author

Okey, it means the secret must be in the same namespace as the instrumented applications, because if it is in another namespace the pod could'n find it.
That's a problem I faced when I tried the above approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:auto-instrumentation Issues for auto-instrumentation enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

2 participants