AlinsRan commented on code in PR #2804:
URL:
https://github.com/apache/apisix-ingress-controller/pull/2804#discussion_r3656225727
##########
internal/adc/translator/translator.go:
##########
@@ -66,6 +66,27 @@ func hasExplicitListenerTarget(parentRefs
[]gatewayv1.ParentReference) bool {
return false
}
+// collectServerPortMatchPorts returns the set of listener ports that should be
+// enforced through a server_port var.
+//
+// Listeners carrying a hostname are isolated by that hostname (service.hosts),
+// which is the correct discriminator when several listeners share a single
port.
+// A server_port var adds no isolation for them and actively breaks routing: it
+// pins the route to the Gateway's declared listener port, which need not equal
+// the port APISIX actually accepts the connection on (node_listen), turning
+// every request into a 404. Only hostname-less listeners rely on port-based
+// isolation, so only their ports contribute here.
+func collectServerPortMatchPorts(listeners []gatewayv1.Listener)
map[int32]struct{} {
+ ports := make(map[int32]struct{})
+ for _, listener := range listeners {
+ if listener.Hostname != nil && *listener.Hostname != "" {
Review Comment:
You are right, and `explicit` is no better than `auto` here — a
`sectionName` parentRef is the normal way to bind a route to a listener, so
both modes take the same failure path. Deriving the data-plane listen port is
not something the controller can do reliably (it cannot see `node_listen`), so
the mode is now opt-in.
Fixed in 61c2bd58:
- default is `off`, and an unset or unrecognised value resolves to `off`
rather than `auto`, so nothing starts injecting predicates behind the
operator's back;
- docs updated — the troubleshoot entry no longer describes `off` as a
workaround for the default, and the config reference/sample explain why
`server_port` is not the declared listener port;
- the e2e manifest opts in explicitly, since its Gateway listeners declare
APISIX's own node_listen ports, so the port-based routing specs still exercise
the feature.
Same change in api7/api7-ingress-controller#419.
--
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]