Skip to content

fix(controller): keep user env vars over controller defaults#2327

Open
mesutoezdil wants to merge 2 commits into
kagent-dev:mainfrom
mesutoezdil:fix/agent-env-precedence
Open

fix(controller): keep user env vars over controller defaults#2327
mesutoezdil wants to merge 2 commits into
kagent-dev:mainfrom
mesutoezdil:fix/agent-env-precedence

Conversation

@mesutoezdil

Copy link
Copy Markdown
Contributor

Agent env was built as user env then shared env appended after it. Same name in both means the shared value wins on the pod, since k8s takes the last entry for duplicate names. A user setting OTEL_SERVICE_NAME or KAGENT_NAME on their own agent got silently overwritten by the controller default, no error or warning.

Now shared entries are only added if the user did not already set that name, so the user's own value always wins.

Added a unit test covering the collision case.

Agent env was built as user env then shared env appended after it.
Same name in both means the shared value wins on the pod, since k8s
takes the last entry. A user setting OTEL_SERVICE_NAME or similar on
their own agent got silently overwritten by the controller default.

Now shared entries are only added if the user did not already set
that name.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@mesutoezdil
mesutoezdil requested a review from a team as a code owner July 25, 2026 10:06
@github-actions github-actions Bot added the bug Something isn't working label Jul 25, 2026
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant