opentelemetry-helm-charts icon indicating copy to clipboard operation
opentelemetry-helm-charts copied to clipboard

Provide ability to Load an Existing Secret or Create a New Secret to Datadog.

Open usrlocalang opened this issue 4 years ago • 3 comments

Need a way to load the api-key into the config. Dont want to stick an api-key into the config section of the values file.

usrlocalang avatar Feb 02 '21 01:02 usrlocalang

Preferably https://github.com/external-secrets/kubernetes-external-secrets

usrlocalang avatar Feb 02 '21 16:02 usrlocalang

If we could mount a Kubernetes Secret into the collector pod as a volume, we could then define environment variables using "spec.containers.env.valueFrom.secretKeyRef" and "spec.containers.envFrom."

seh avatar Mar 18 '21 15:03 seh

There is a way to mount secrets with secretMounts option, but we need to make it possible to mount as env var, not only as a file

dmitryax avatar Mar 04 '22 01:03 dmitryax

hi folks

I saw that #133 is closed. Is my assumption correct that it's currently not possible to mount the secrets as env vars?

We're aware that we can solve the issue by creating the config file in a secret ourselves and mounting it (instead of having the helm chart create it), but ideally we would want to reuse the helm charts config generation: https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-collector/templates/_config.tpl

would you welcome a PR for that (i.e. adding extraEnvFrom)?

I think it's the last missing piece to inject secrets into the otel config while still reusing the helm chart config .

MatthiasWinzeler avatar Sep 12 '22 14:09 MatthiasWinzeler

nevermind - it is actually already possible. one can use the combination of extraEnvs with secretKeyRef:

values.yaml:
mode: "deployment"
...
config:
  exporters:
    otlphttp:
      headers:
        Authorization: "Api-Token $OPEN_TELEMETRY_COLLECTOR_DYNATRACE_TOKEN"
...

extraEnvs:
  - name: OPEN_TELEMETRY_COLLECTOR_DYNATRACE_TOKEN
    valueFrom:
      secretKeyRef:
        name: dynatraceapitoken
        key: OPEN_TELEMETRY_COLLECTOR_DYNATRACE_TOKEN 

with a secret (manually created):

apiVersion: v1
kind: Secret
metadata:
  name: dynatraceapitoken
type: Opaque
stringData:
  OPEN_TELEMETRY_COLLECTOR_DYNATRACE_TOKEN: "<my dynatrace token>"

MatthiasWinzeler avatar Sep 13 '22 14:09 MatthiasWinzeler

Thanks @MatthiasWinzeler!

TylerHelmuth avatar Sep 14 '22 15:09 TylerHelmuth