hanzhenfang opened a new pull request, #14077:
URL: https://github.com/apache/apisix/pull/14077

   ### Description
   
   With `apisix.enable_ipv6: true`, gateway listeners support IPv6, but the 
generated Admin API, Control API, status, and Prometheus export listeners 
remain IPv4-only. Add the corresponding IPv6 listener when each server uses its 
default IP, retaining its configured port and listen options.
   
   This continues @twellck's implementation in 
https://github.com/apache/apisix/pull/13144, which was closed as stale without 
merging. The issue remains on current master. This new PR starts from current 
master so the fix can be maintained and validated independently; it credits the 
original work rather than treating it as a new discovery.
   
   Compared with #13144:
   
   - Preserve the original scope and address-selection behavior: Admin API 
`0.0.0.0` gets `[::]`; internal `127.0.0.1` endpoints get `[::1]`. A 
non-default configured IPv4 or IPv6 address remains the sole listener, and 
`enable_ipv6: false` suppresses automatic additions.
   - Return the complete IPv6 `address:port` from the existing validation 
helper, avoiding four additional template port variables. No general listener 
refactor or proxy-protocol changes.
   - Put regression tests in a focused CLI script rather than expanding 
`test_main.sh`. Cover configured ports, default/explicit default IPs, custom 
IPv4, explicit IPv6 with the flag both on and off, HTTPS Admin API, HTTP and 
stream-only Prometheus templates, and disabled endpoints.
   - Document in English and Chinese the IPv6 behavior, unchanged Admin API 
access restrictions, and removing equivalent snippet-based workarounds to avoid 
duplicate listeners.
   
   Loopback-only services remain loopback-only in both address families. TLS, 
`reuseport`, and the status listener's `enable_process=privileged_agent` option 
are preserved. Existing IPv4 listeners remain in place.
   
   #### Which issue(s) this PR fixes:
   
   Fixes #13112
   
   ### Validation
   
   On current master before the fix, the new CLI test fails with `failed: 
missing listen [::]:9181;`.
   
   Using current checkout sources with the Linux `apache/apisix:3.19.0-debian` 
runtime in an isolated container:
   
   - `bash t/cli/test_internal_listener_ipv6.sh`: all 12 configuration 
scenarios pass.
   - `openresty -t` additionally run after each configuration render: all 12 
pass, including binding validation and the Admin API TLS certificate fixture.
   - ShellCheck and `bash -n` on the new test: pass.
   - `luacheck -q apisix t/lib`: 0 warnings/errors in 412 files.
   - `lj-releng apisix/cli/ops.lua`, test-style checks, and `git diff --check`: 
pass.
   - Full `make lint` reaches existing Unicode separator line-length failures 
in unchanged Consul, Kubernetes, and Nacos discovery files. Those unrelated 
files are not modified here.
   
   The complete service-backed CLI suite was not run locally; this focused test 
is picked up by the existing `t/cli/test_*.sh` CI loop.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (existing IPv4 
listeners, explicit addresses, and endpoint options are preserved; automatic 
IPv6 listeners now honor the existing flag)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to