apache / apache/apisix-helm-chart

ConfigMap template fails to quote IPv6 addresses causing YAML parsing errors

Open
#920 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go Template
Stars
289
Forks
282
Avg merge
2d 19h
Merged PRs (30d)
4

Description

## 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:
```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:
```yaml
ip: "[::]"
admin:
allow_admin:
- "::/0"
```

## Actual Behavior
ConfigMap contains unquoted values that fail YAML parsing:
```yaml
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:
```yaml
ip: {{ .Values.apisix.admin.ip }}
```
```yaml
{{- range $ips := .Values.apisix.admin.allow.ipList }}
- {{ $ips }}
{{- end }}
```

## Current Workaround
Manually add escaped quotes in values.yaml:
```yaml
apisix:
admin:
ip: "\"[::]\""
allow:
ipList:
- "\"::/0\""
```

Or use the `--set-string` flag:
```bash
helm install apisix apisix/apisix --set-string apisix.admin.ip='[::]'
```

## Proposed Solution
Wrap relevant configmap sections such as IP address template values with quotes:
```yaml
ip: {{ .Values.apisix.admin.ip | quote }}
```
```yaml
{{- 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.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the ConfigMap template sections that render apisix.admin.ip and apisix.admin.allow.ipList, using the examples in the issue as search terms. Render or install the chart with the supplied IPv6 values and confirm the generated ConfigMap quotes both the address and allow-list entries without YAML parsing errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.