opentelemetry-operator icon indicating copy to clipboard operation
opentelemetry-operator copied to clipboard

NodeJS Auto instrumentation overrides NODE_OPTIONS when defined from ConfigMap

Open edenkoveshi opened this issue 2 years ago • 2 comments

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/open-telemetry/opentelemetry-operator/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.

edenkoveshi avatar Jan 24 '23 11:01 edenkoveshi