Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: don't quote container command args passed via *.extraArgs values #10029

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Nov 26, 2024

What this PR does

This PR fixes how the chart's templates handle extraArgs values. Right now the chart fails to render the manifests if the passed flag contains a JSON value. E.g. flags like -ruler.max-rule-groups-per-tenant-by-namespace, etc accept a JSON string. If a user sets the values via the ruler.extraArgs value — similar to how we use it in Jsonnet — the chart fails with an obscure error:

Error: YAML parse error on mimir-distributed/templates/ruler/ruler-dep.yaml: error converting YAML to JSON: yaml: line 61: did not find expected '-' indicator

Note: I tried fairly hard to find a way how to handle that in better way but failed. After looking around for how other popular Helm charts solve it didn't help either. Everyone seem to just unquote the command args.

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo requested a review from a team as a code owner November 26, 2024 20:33
@dimitarvdimitrov
Copy link
Contributor

another idea is to use something like printf "-{{key}}={{value}}" | quote

but i also can't think of a good reason why these values were quoted in the first place - are we introducing a breaking change by removing the quotes?

@narqo
Copy link
Contributor Author

narqo commented Nov 27, 2024

another idea is to use something like printf "-{{key}}={{value}}" | quote

I tried {{ printf "-%s=%v" key value | quote }} but printf converts the value to its string representation. This breaks values like nil (and maybe others). I didn't find a knob to force printf to output the value as-is, like {{ value }} does.

are we introducing a breaking change by removing the quotes?

I think, with Helm templating there is always a chance that someone passes a weird value, constructed to bypass the template's behaviour. But it's not an obviously breaking change.

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

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

LGTM

@narqo narqo merged commit b1ae3b9 into main Nov 28, 2024
31 checks passed
@narqo narqo deleted the vldmr/helm-extra-args-unquote branch November 28, 2024 09:19
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