Skip to content

v2.10.1 — ConfigMap YAML prettifier handles trailing whitespace

Choose a tag to compare

@vurulkan vurulkan released this 08 Oct 14:48
· 33 commits to main since this release

Follow-up to 2.10.0.

Symptom: ConfigMap values that contained trailing whitespace on any
line (common for Spring Boot application.yml snippets stored in a
data: entry) still rendered as the ugly "spring:\n kafka:\n…"
single-liner even though 2.10.0 wrapped the YAML in the prettifier.

Cause: yaml.v3 encoder silently falls back from LiteralStyle to
double-quoted when any line of the content ends with whitespace or the
string as a whole has trailing spaces — the YAML spec forbids trailing
whitespace inside a block scalar.

Fix: strip trailing whitespace from each line (and the string as a
whole) before setting Style = LiteralStyle. The encoder now emits a
real | block.

Trade-off: a handful of trailing spaces in the original value are lost in
the UI's YAML view. Byte-for-byte fidelity is still available via
kubectl get -o yaml.