Skip to content

Conversation

edimarlnx
Copy link
Contributor

Summary

Fix environment variable parsing in Helm chart template to properly handle values containing equals signs.

The previous implementation used split "=" . which would incorrectly parse environment variables with values containing = characters (e.g., VAR=value=with=equals). Changed to use splitn "=" 2 . which limits the split to 2 parts, treating everything after the first = as the value.

Proof of Work

The fix changes the parsing logic in helm_chart/templates/operator.yaml:280-281:

  • Before: split "=" . - splits on all = characters
  • After: splitn "=" 2 . - splits only on the first =, preserving = in values

This ensures custom environment variables with values containing = characters are correctly parsed when using .Values.customEnvVars.

Validation:

helm template helm_chart --set customEnvVars='CLUSTER_DOMAIN=mydomain.local&MY_VAR1=mylabel=abc&MY_VAR2=any'

The rendered output correctly shows:

- name: CLUSTER_DOMAIN
  value: 'mydomain.local'
- name: MY_VAR1
  value: 'mylabel=abc'  # Correctly preserves '=' in the value
- name: MY_VAR2
  value: 'any'

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you added changelog file?

@edimarlnx edimarlnx marked this pull request as ready for review October 10, 2025 18:30
@edimarlnx edimarlnx requested review from a team and vinilage as code owners October 10, 2025 18:30
Copy link
Contributor

@m1kola m1kola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edimarlnx good catch! I just pushed a small change to the release note and kicked in our CI, but I'm happy with the change.

Thanks for contributing this fix.

Copy link
Collaborator

@vinilage vinilage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

date: 2025-10-10
---

* Fixed parsing of the `customEnvVars` Helm value when values contain `=` characters.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@m1kola m1kola merged commit 9f297b9 into mongodb:master Oct 14, 2025
37 checks passed
@m1kola
Copy link
Contributor

m1kola commented Oct 14, 2025

Merged. Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants