Skip to content

fix: escape inner double quotes in helm --set to preserve annotation key quoting#151

Merged
vigneshrajsb merged 3 commits intomainfrom
fix/helm-set-quoting
Mar 31, 2026
Merged

fix: escape inner double quotes in helm --set to preserve annotation key quoting#151
vigneshrajsb merged 3 commits intomainfrom
fix/helm-set-quoting

Conversation

@vigneshrajsb
Copy link
Copy Markdown
Contributor

@vigneshrajsb vigneshrajsb commented Mar 30, 2026

Summary

  • Helm --set keys for Kubernetes annotations use inner double quotes to prevent / from being interpreted as a nested path separator (e.g., ingress.extraAnnotations."app\.kubernetes\.io/name")
  • The outer double-quote wrapping on the --set argument caused the shell to break on these inner quotes, stripping them before Helm could process them
  • This resulted in Helm creating nested objects instead of flat annotation keys, causing: cannot unmarshal object into Go struct field .metadata.annotations of type string
  • Fix: escape inner " as \" within the outer double-quoted --set argument so they pass through to Helm untouched

Test plan

  • Added test verifying quoted annotation key segments are preserved in the generated helm command
  • Added test verifying quoted values are escaped correctly
  • All nativeHelm tests pass
  • Lint passes

Helm --set keys containing annotation paths like
ingress.extraAnnotations."app\.kubernetes\.io/name" use inner double
quotes to prevent / from being interpreted as a path separator.
Wrapping with outer double quotes caused the shell to break on the
inner quotes, stripping them before Helm could see them.
@vigneshrajsb vigneshrajsb requested a review from a team as a code owner March 30, 2026 22:02
Escape inner " as \" within the outer double-quoted --set argument
instead of switching to single quotes. This preserves the double-quote
wrapping for all values while still passing inner quotes through to Helm.
@vigneshrajsb vigneshrajsb changed the title fix: use single quotes for helm --set to preserve annotation key quoting fix: escape inner double quotes in helm --set to preserve annotation key quoting Mar 31, 2026
@vigneshrajsb vigneshrajsb merged commit 724f89f into main Mar 31, 2026
1 check passed
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.

1 participant