Skip to content

Support Gateway HTTP listener isolation#14234

Merged
danehans merged 2 commits into
kgateway-dev:mainfrom
danehans:gateway-http-listener-isolation
Jun 15, 2026
Merged

Support Gateway HTTP listener isolation#14234
danehans merged 2 commits into
kgateway-dev:mainfrom
danehans:gateway-http-listener-isolation

Conversation

@danehans

@danehans danehans commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Adds HTTP listener isolation for same-port HTTP listeners by filtering route hostnames owned by more-specific sibling listeners before building shared virtual hosts. This lets kgateway advertise the GatewayHTTPListenerIsolation feature.

Change Type

/kind feature

Changelog

Added support for GatewayHTTPListenerIsolation conformance behavior for HTTP listeners.

Additional Notes

Tested with:

  • go test -tags e2e ./pkg/kgateway/translator/listener ./pkg/deployer

Signed-off-by: Daneyon Hansen <[email protected]>
Copilot AI review requested due to automatic review settings June 11, 2026 16:52
@gateway-bot gateway-bot added do-not-merge/description-invalid kind/feature Categorizes issue or PR as related to a new feature. release-note labels Jun 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Gateway API GatewayHTTPListenerIsolation behavior for same-port HTTP listeners by preventing routes on less-specific listeners from contributing hostnames that are “owned” by more-specific sibling listeners when building shared virtual hosts. This enables kgateway to advertise HTTP listener isolation conformance.

Changes:

  • Introduced hostname filtering logic to implement HTTP listener isolation when multiple HTTP listeners share the same port.
  • Refactored route-to-hostname aggregation to support an optional hostname filter and to avoid falling back to "*" after filtering removes all hostnames.
  • Updated GatewayClass supported-features logic/tests to advertise SupportGatewayHTTPListenerIsolation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/kgateway/translator/listener/gateway_listener_translator.go Adds listener-hostname precedence/coverage helpers and applies filtering while building routes-per-host for shared HTTP filter chains.
pkg/kgateway/translator/listener/gateway_listener_translator_internal_test.go Adds focused unit tests for hostname isolation filtering and the new route-hostname filtering behavior.
pkg/deployer/gatewayclass.go Stops exempting HTTP listener isolation so it can be advertised as supported.
pkg/deployer/gatewayclass_test.go Asserts SupportGatewayHTTPListenerIsolation is included in supported features.

Signed-off-by: Daneyon Hansen <[email protected]>
@puertomontt

Copy link
Copy Markdown
Contributor

AI review uncovered existing minor issue in translateHttpFilterChain:

Latent inconsistency between two specificity metrics (worth a note). The new filter
ranks specificity by (rank, dot-count), but the existing vhost→listener
policy-attachment loop in translateHttpFilterChain still picks the owning listener by
raw hostname string length (maxHostnameLen). These can disagree — e.g. an exact bb.com
(len 6) vs wildcard *.aaaaaaaa.com (len 14): the filter says exact wins, the length
heuristic says the wildcard wins. In practice the two listeners usually cover disjoint
route hostnames so they don't collide, but it's a latent divergence. Consider unifying
both on listenerHostnamePrecedence so a single specificity model governs both filtering
and policy attachment.

@danehans
danehans added this pull request to the merge queue Jun 15, 2026
Merged via the queue into kgateway-dev:main with commit 999d4d6 Jun 15, 2026
34 checks passed
@danehans
danehans deleted the gateway-http-listener-isolation branch June 15, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants