Skip to content

handle null values in helm values correctly - #515

Open
cbarbian-sap wants to merge 2 commits into
mainfrom
coalesce-helm-values
Open

cbarbian-sap wants to merge 2 commits into
mainfrom
coalesce-helm-values

Conversation

@cbarbian-sap

@cbarbian-sap cbarbian-sap commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

CAVEAT: THIS PR contains an incompatible change

In general, when merging JSON/YAML objects, component-operator-runtime does not use any special logic for null values.

That is, for example, merging

a:
  b: 1
  c: 2

and

a:
  b: null
  c: 3
  d: 4
  e: null

would result in

a:
  b: null
  c: 3
  d: 4
  e: null

However, helm uses a slightly different approach, in order to allow 'unsetting' default values (to really delete keys, instead of just nullifying them). To be precise: When

  • merging user-specified values over the chart's default values or
  • merging parent chart default values over a sub chart's default values

helm deletes keys which exist in the underlying values and are null-valued in the incoming values. It is worth to note that an incoming null value is preserved if the key does not exist in the underlying values.

In the above example, the helm logic would return:

a:
  c: 3
  d: 4
  e: null

Note that

  • b: is gone (because it exists in the underlying data, and was provided with null value in the incoming data)
  • e: is there (because it didn't exist in the underlying data).

This PR makes the HelmGenerator mimic the original helm behaviour. Which could mean an incompatible change in rare cases.

This branch has not been deployed

No deployments
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.

2 participants