AlinsRan commented on PR #13666: URL: https://github.com/apache/apisix/pull/13666#issuecomment-4978585567
Fixed. You're right that "multi-node already breaks" doesn't make expanding it to the single-node path acceptable. I traced where a bare IPv6 host actually reaches the balancer unbracketed. It's **service discovery**: a discovery node goes through neither the Admin API's `check_schema` (which rejects bare IPv6) nor `check_upstream_conf`'s bracketing (which handles configured upstreams), so `::1` arrives raw and `transform_node` builds the ambiguous key `::1:1980`. So rather than patch the balancer key, I bracket the host once at the source, in `fill_node_info` — the single point every node passes through before the balancer *and* the health checker consume it, for all seven discovery types. That's more complete than fixing the balancer key alone (the health checker takes host/port separately, so a key-only fix would leave it seeing bare `::1`), and it reuses the same normalization `check_upstream_conf` already applies. `original_nodes` keeps the bare host, so a discovery re-fetch isn't mistaken for a node change (no spurious picker rebuild). One deliberate narrowing: only a node that **carries its own port** is bracketed. A bare host with no port is genuinely ambiguous — the map key `"::1:1980"` is as much a valid IPv6 literal as it is `host ::1 port 1980` — so it's left to the existing malformed-config handling (this keeps `upstream-ipv6.t` TEST 10 intact). Discovery endpoints always carry a port, so nothing real is missed. Regression coverage in `t/node/upstream-discovery-ipv6.t`: single- and multi-node bare-IPv6 discovery nodes (both crash on master without the fix), plus a re-fetch case asserting the picker is built only once. -- 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]
