Escaping of backslashes in helmfile files changed in helmfile 1.0.0-rc0
Opened this issue · 8 comments
Operating system
Ubuntu 24.04
Helmfile Version
1.0.0-rc0
Helm Version
3.14.3
Bug description
I wanted to prepare for the 1.0.0 release and tried out the rc0.
I noticed that backslashes in strings now get escaped.
This is an issue for me, as a use readFile to read dashboard json files for Grafana, and Grafana can't read some dashboards anymore which have \ in them (especially PromQL has a lot of \"word\"
)
Was this change intentional? can i work around it? not sure if it's actually a bug. Couldn't find the behaviour change in https://github.com/helmfile/helmfile/blob/main/docs/proposals/towards-1.0.md
Example helmfile.yaml
-
Create a Helmfile template (
helmfile.yaml.gotmpl
) with the following content:apiVersion: v1 data: testjson: '{ "test": "test{\"escapecheck\"}" } ' kind: ConfigMap metadata: labels: app.kubernetes.io/instance: jsonreadfiletest app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: jsonreadfiletest-raw app.kubernetes.io/version: 1.0.0 helm.sh/chart: raw-2.0.0 name: jsonreadfiletest
-
Render the template using Helmfile
v0.163.1
:helmfile_0.163.1_linux_amd64/helmfile template -f helmfile.yaml.gotmpl
The rendered output will be:
apiVersion: v1 data: testjson: '{ "test": "test{\"escapecheck\"}" } ' kind: ConfigMap metadata: labels: app.kubernetes.io/instance: jsonreadfiletest app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: jsonreadfiletest-raw app.kubernetes.io/version: 1.0.0 helm.sh/chart: raw-2.0.0 name: jsonreadfiletest
-
Render the template using Helmfile
v1.0.0-rc.0
:helmfile_1.0.0-rc.0_linux_amd64/helmfile template -f helmfile.yaml.gotmpl
The rendered output will be:
apiVersion: v1 data: testjson: '{ "test": "test{\\"escapecheck\\"}" } ' kind: ConfigMap metadata: labels: app.kubernetes.io/instance: jsonreadfiletest app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: jsonreadfiletest-raw app.kubernetes.io/version: 1.0.0 helm.sh/chart: raw-2.0.0 name: jsonreadfiletest
Error message you've seen (if any)
Just a Grafana error caused by the escaping, but error in helmfile itself.
Steps to reproduce
https://github.com/Mahagon/helmfile_json_escaping_issue
Working Helmfile Version
0.163.1
Relevant discussion
No response
HELMFILE_GOCCY_GOYAML=false seems to work for me :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Setting HELMFILE_GOCCY_GOYAML=false
isn't a solution, it's workaround at best. At worst this is a blocker. Unless there fix available in helmfile, goccy/go-yaml shouldn't be used by default.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I hate this bot. https://x.com/BenTheElder/status/1407774856033181696