Skip to content

ConfigMap template fails to quote IPv6 addresses causing YAML parsing errors #920

@twellck

Description

@twellck

Description

When configuring APISIX to bind to IPv6 addresses using [::] in values.yaml, the generated ConfigMap contains unquoted values which causes YAML parsing errors in APISIX.

Environment

  • Helm Chart Version: 2.12.4
  • Kubernetes Version: 1.34
  • Helm Version: 3.18.4 (Through terraform's helm provider)

Steps to Reproduce

  1. Set in values.yaml:
    apisix:
      admin:
        ip: "[::]"
        allow:
          ipList:
            - "::/0"
  2. Deploy the chart: helm install apisix apisix/apisix -f values.yaml
  3. Check APISIX pod logs or ConfigMap
  4. Observe YAML parsing error

Expected Behavior

IPv6 addresses should be properly quoted in the generated ConfigMap:

ip: "[::]"
admin:
  allow_admin:
    - "::/0"

Actual Behavior

ConfigMap contains unquoted values that fail YAML parsing:

ip: [::]  # Invalid YAML - interpreted as flow sequence
admin:
  allow_admin:
    - ::/0

Root Cause

The ConfigMap template does not force quotation of IP addresses in listeners or the admin allow list. YAML interprets [ as the start of a flow sequence, making [::] invalid syntax without quotes.

Examples from the template:

ip: {{ .Values.apisix.admin.ip }}
{{- range $ips := .Values.apisix.admin.allow.ipList }}
  - {{ $ips }}
{{- end }}

Current Workaround

Manually add escaped quotes in values.yaml:

apisix:
  admin:
    ip: "\"[::]\""
    allow:
      ipList:
        - "\"::/0\""

Or use the --set-string flag:

helm install apisix apisix/apisix --set-string apisix.admin.ip='[::]'

Proposed Solution

Wrap relevant configmap sections such as IP address template values with quotes:

ip: {{ .Values.apisix.admin.ip | quote }}
{{- range $ips := .Values.apisix.admin.allow.ipList }}
  - {{ $ips | quote }}
{{- end }}

I'm happy to submit a PR for this fix if helpful. This may be combined with my other issue (#921) which also touches the ConfigMap template file.


Note: AI helped format this issue. The issue identification and proposed solutions are my own work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions