Replace hyphens with underscores in Helm environment variable keys #10839
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace hyphens with underscores in Helm environment variable keys, adjust relevant test to properly validate this scenario.
Description
Take this configMap example, taken from issue #10820
While hyphens are allowed in the
data
keys, and invalues
environment variable names, they are NOT allowed in the Helm expressions. This for example:{{ .Values.config.xx_yy_xx_webspa.services__xx-yy-xx-bookings__https__0 }}
fails when ran through thehelm template
command.Replacing the hyphens with underscores only in the Helm expression is not an option, because that makes the 'link' invalid, as there are no
services__xx_yy_xx_bookings__https__0
environment variable keys with that name, if they don't also get changed there.Therefore, it has to be changed this way, so they are reflected both places.
Unit test
PublishAsync_HandlesSpecialResourceName()
was also changed, to properly test this scenario by adding a container resources, and adding a reference to it in the project resource, so it adds theservices__xx-yy-xx-bookings__https__0
reference, allowing us to properly test it.Fixes #10820
NOTE!!
This also makes any connectionstrings for example
ConnectionStrings__some-service
->ConnectionStrings__some_service
but I think that's fine, usually environment variables don't contain hyphens in most systems anyway.Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template