open-telemetry / opentelemetry-operator

Kubernetes Operator for OpenTelemetry Collector
Apache License 2.0
1.12k stars 394 forks source link

Provide secrets in config scopes #3085

Closed PandeoF1 closed 1 day ago

PandeoF1 commented 3 days ago

Component(s)

collector

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

My problem is that i can't put secrets in the config scopes of my collector.

apiVersion: opentelemetry.io/v1beta1
kind: OpenTelemetryCollector
metadata:
  name: cos # Otel add -collector to the name
  labels:
    app.kubernetes.io/name: otel
    app.kubernetes.io/component: otel-collector
spec:
  mode: deployment
  serviceAccount: opentelemetry-operator
  config:
[...]
    extensions:
      basicauth/client:
        client_auth:
          password: my-incredible-password
          username: admin
[...]

I want to provide a secrets to the key password, because i don't want to have a clear password in my deployment. We can't use the valuesFrom / passwordFrom because the key are directly passed into the configuration of the collector

Describe the solution you'd like

I want to have a way to provide secrets to this key (or to any key that exist).

Describe alternatives you've considered

Have a clear password in the deployment ( :( )

Additional context

I have made some research and test a lot of way to put the secrets. It's really possible that there is already a way to put the secrets in this fields but i didn't find it..

jaronoff97 commented 2 days ago

you should be able to mount the secret in the collector and then use that value in an environment variable reference. example This is done in a helm chart, but should be able to be used verbatim in the collector definition.

PandeoF1 commented 2 days ago

Oh damn i feel stupid for not having thought of the environment variable.. I will test that tomorrow !

jaronoff97 commented 2 days ago

no problem :) if that works please let me know so we can close this issue.

pavolloffay commented 1 day ago

Please re-open if there are any action items that need to be done