Skip to content

Commit 5b1c0b8

Browse files
author
Gaal
committed
api: add Literal field to ValuesReference (CRD schema + docs)
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 #1317. Signed-off-by: Gaal <g.gaal@salmon.group>
1 parent ca9234b commit 5b1c0b8

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,17 @@ spec:
10801080
- Secret
10811081
- ConfigMap
10821082
type: string
1083+
literal:
1084+
description: |-
1085+
Literal marks this ValuesReference as a literal value. When set in
1086+
combination with TargetPath, the referenced value is merged at the target
1087+
path without interpreting Helm's `--set` syntax (commas, brackets, dots,
1088+
equal signs, etc.), mirroring the behavior of `helm --set-literal`. This
1089+
is the only safe way to inject arbitrary file content (config files, JSON
1090+
blobs, multi-line strings containing special characters) through
1091+
`valuesFrom`. Has no effect when TargetPath is empty: in that mode the
1092+
referenced value is always YAML-merged at the root.
1093+
type: boolean
10831094
name:
10841095
description: |-
10851096
Name of the values referent. Should reside in the same namespace as the

docs/spec/v2/helmreleases.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,13 @@ An item on the list offers the following subkeys:
487487
`true`, a not found error for the values reference is ignored, but any
488488
`valuesKey`, `targetPath` or transient error will still result in a
489489
reconciliation failure. Defaults to `false` when omitted.
490+
- `literal` (Optional): When set together with `targetPath`, the referenced
491+
value is merged at the target path verbatim, without interpreting Helm's
492+
`--set` syntax (commas, brackets, dots, equal signs, etc.). Mirrors the
493+
behavior of `helm --set-literal`. Use this to inject arbitrary file content
494+
(config files, JSON blobs, multi-line strings containing special characters)
495+
through `valuesFrom`. Has no effect when `targetPath` is empty.
496+
Defaults to `false` when omitted.
490497

491498
```yaml
492499
spec:
@@ -499,6 +506,11 @@ spec:
499506
valuesKey: crt
500507
targetPath: tls.crt
501508
optional: true
509+
- kind: ConfigMap
510+
name: app-config-source
511+
valuesKey: application.yml
512+
targetPath: 'externalConfig.application\.yml.content'
513+
literal: true
502514
```
503515

504516
**Note:** The `targetPath` supports the same formatting as you would supply as
@@ -510,6 +522,11 @@ a list). You can read more about the available formats and limitations in the
510522
For JSON strings, the [limitations are the same as while using `helm`](https://github.com/helm/helm/issues/5618)
511523
and require you to escape the full JSON string (including `=`, `[`, `,`, `.`).
512524

525+
To skip the `--set`-style parsing entirely and pass the value as a raw string
526+
(useful for full config files or any content containing `,`, `[`, `]`, `{`,
527+
`}`, `=`), set `literal: true` together with `targetPath`. This mirrors
528+
`helm --set-literal`.
529+
513530
To make a HelmRelease react immediately to changes in the referenced Secret
514531
or ConfigMap see [this](#reacting-immediately-to-configuration-dependencies)
515532
section.

0 commit comments

Comments
 (0)