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

NodeJS Auto instrumentation overrides NODE_OPTIONS when defined from ConfigMap #1393

Open
edenkoveshi opened this issue Jan 24, 2023 · 2 comments

Comments

@edenkoveshi
Copy link

Description

I have a node container for which I use the env var NODE_OPTIONS
However, it is defined via a ConfigMap under containers[0].envFrom and not containers[0].env
The NodeJS auto instrumentation modifies the pod to and sets NODE_OPTIONS value under containers[0].env to the default value (--require /otel-auto-instrumentation/autoinstrumentation.js) instead of concatenating it like it should.
I have found [https://github.com//issues/1094](this issue). To my understanding, the operator checks only the containers.env property and not envFrom, which results in this conjestion.
Though I know I can manually set the NODE_OPTIONS env under containers.env and it would probably work, I need my env variables to be managed with envFrom, and I don't think overriding these vars is the right behaviour for the operator.

Steps to Reproduce

Create a NodeJS pod and a ConfigMap containing NODE_OPTIONS key and some value in it.
Instrument the pod using the operator auto instrumentation.

Expected Result

The instrumentation NODE_OPTIONS should be concatenated with mine.

Actual Result

The instrumentation NODE_OPTIONS overrides mine.

@shovelend
Copy link

We need to enable the --openssl-legacy-provider option for some of our services since when auto-instrumentation is enabled, legacy encryption/decryption algorithms don't work.
However, the NODE_OPTIONS environment variable is overridden by the injector, so we have to pass the option down to the node command manually inside the pod. Would be a lot better to have the NODE_OPTIONS env vars concatenated instead.

@oldium
Copy link
Contributor

oldium commented Oct 19, 2024

Our workaround was to define such variables directly in the POD's Env, not in EnvFrom ConfigMap, this is what OTEL Operator could read.

I prepared a fix for this in #3373. OTEL Operator is now able to see environment variables also in ConfigMaps and Secrets, so it can correctly append to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants