fix: ConfigMap rendering to use YAML block format instead of JSON encoding #910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Fix ConfigMap rendering to use YAML block format instead of JSON encoding
Problem
When running
kustomize build --enable-helm, the APISIX ConfigMap was being rendered with JSON-encoded strings (containing\nescape sequences) instead of clean YAML block format with the pipe (|) operator. This made the rendered output extremely difficult to read and debug.Before:
After:
Root Cause
The issue was caused by inconsistent Helm template whitespace control in the
trustedAddressesconditional block. The template used{{ ifand{{ end }}without the dash (-) modifier, which preserved extra whitespace and newlines in the output.When these extra characters were present, the YAML serializer switched to JSON encoding mode to preserve the literal whitespace, resulting in the unreadable escaped format.
Solution
Changed the conditional block from:
To:
The
{{-syntax tells Helm to trim leading whitespace, preventing extra newlines from being added to the rendered output. This keeps the YAML formatting consistent with the rest of the template.Impact
kustomize buildTesting
Verified that
kustomize build --enable-helm .now produces properly formatted YAML output with clean line breaks instead of JSON-encoded strings.