Skip to content

api: add Literal field to ValuesReference (CRD schema + docs)#1503

Open
gecube wants to merge 1 commit into
fluxcd:mainfrom
gecube:feat/valuesfrom-literal
Open

api: add Literal field to ValuesReference (CRD schema + docs)#1503
gecube wants to merge 1 commit into
fluxcd:mainfrom
gecube:feat/valuesfrom-literal

Conversation

@gecube
Copy link
Copy Markdown

@gecube gecube commented May 25, 2026

Exposes the new literal field on valuesFrom entries, mirroring the addition to meta.ValuesReference in fluxcd/pkg#1218.

Motivation

valuesFrom with targetPath runs the referenced value through strvals.ParseInto — the same parser as helm --set. Anything containing ,, [, ], {, } or unescaped = is interpreted as Helm-set syntax, so arbitrary file content (Spring application.yml with flow sequences, HOCON application.conf, JSON blobs, multi-line YAML, …) is misparsed or fails outright. Examples in the wild:

error parsing index: strconv.Atoi: parsing " \"prometheus\", \"health\", \"info\" ": invalid syntax
key "efm" has no value (cannot end with ,)

The quote-wrap workaround from #298 is impractical when content arrives via Kustomize configMapGenerator/secretGenerator (raw file → raw bytes in the CM, no opportunity to wrap). Flux's kustomize-controller disables Kustomize plugins so a generator/transformer-based wrap is also off the table.

What this PR does

  • CRD: adds literal (bool, optional) to the valuesFrom[] entries in helmreleases.helm.toolkit.fluxcd.io. Validated by the API server.
  • Docs: extends the valuesFrom section of docs/spec/v2/helmreleases.md with a new bullet, a concrete YAML example, and a note about when to reach for it.

What this PR does not do

  • No runtime/controller code changes. The Literal-aware code path is in fluxcd/pkg/chartutil (PR #1218).
  • No bump of the fluxcd/pkg dependency. Once pkg merges and ships a release, a follow-up here will pick it up — at that point setting literal: true will start actually doing something. Until then the field is accepted-but-ignored — forward-compatible behaviour.

Resolves

fluxcd/helm-controller#1317. Addresses parts of #460, #853, flux2#1756.

Verified

  • make manifests regenerates the CRD with the new field (kubebuilder annotation comes from the pkg PR via the meta.ValuesReference = type alias in api/v2/reference_types.go).
  • Locally built helm-controller image with the pkg PR's chartutil change picks up the new field end-to-end on a test cluster (chart-owned CM ends up with byte-identical content to the source, no strvals.ParseInto mangling).

Exposes the new `literal` field on `valuesFrom` entries, mirroring the
addition to `meta.ValuesReference` in fluxcd/pkg#1218. When set together
with `targetPath`, the referenced value is passed to Helm verbatim
(equivalent of `helm --set-literal`) instead of being parsed by
`strvals.ParseInto`, so file content containing commas, brackets, braces
or equal signs survives the round-trip intact.

This commit ships only the OpenAPI schema (so the field is validated by
the API server) and the user-facing documentation. The runtime support
lives in fluxcd/pkg/chartutil; once that PR merges and a `fluxcd/pkg`
release is cut, a follow-up will bump the dependency here so
helm-controller actually honours the field. Until then, setting
`literal: true` is accepted by the API but has no effect — the field is
forward-compatible.

Addresses fluxcd#1317.

Signed-off-by: George Gaál <gb12335@gmail.com>
@gecube gecube force-pushed the feat/valuesfrom-literal branch from 5b1c0b8 to 564f026 Compare May 25, 2026 10:23
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