Description
The Helm chart template produces a trailing comma in TOML inline tables, which is invalid per the TOML spec.
Generated output (invalid)
env = { GH_TOKEN = "xxx", }
Expected output
env = { GH_TOKEN = "xxx" }
Root Cause
The Go template range loop appends a , after every key-value pair, including the last one. TOML inline tables do not allow trailing commas, causing the TOML parser to fail and pods to crash on startup.
Suggested Fix
Use a $first flag pattern to only insert commas between items:
env = { {{ $first := true }}{{ range $k, $v := .Values.env }}{{ if not $first }}, {{ end }}{{ $k }} = "{{ $v }}"{{ $first = false }}{{ end }} }
Description
The Helm chart template produces a trailing comma in TOML inline tables, which is invalid per the TOML spec.
Generated output (invalid)
Expected output
Root Cause
The Go template
rangeloop appends a,after every key-value pair, including the last one. TOML inline tables do not allow trailing commas, causing the TOML parser to fail and pods to crash on startup.Suggested Fix
Use a
$firstflag pattern to only insert commas between items: