Skip to content

Commit 800024e

Browse files
rainestrobscott
andauthored
Expand and clarify Listeners definition (#2288)
* Expand and clarify Listeners definition Explicitly define Listener compatibility as definitively routable and allowed on the same address by the implementation. Narrow language about collapsing compatible Listeners to mean assigning multiple Gateways the same addresses if their Listeners are compatible, Expand Listeners examples to include mixed TCP and UDP and indicate that they are not compatible if an implementation does not support that combination. Add language about Gateway-level conditions for incompatible Listeners. * chore: run make generate * Apply suggestions from code review Co-authored-by: Rob Scott <[email protected]> * pr: add hostname precedence example * chore: make generate * pr: rename collapse to merge * Use more generic rule for distinct Listeners * Add advice for cascading matches * Revert "Add advice for cascading matches" This reverts commit 5af8b65. --------- Co-authored-by: Rob Scott <[email protected]>
1 parent c7b6b57 commit 800024e

File tree

3 files changed

+197
-120
lines changed

3 files changed

+197
-120
lines changed

apis/v1beta1/gateway_types.go

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -85,38 +85,55 @@ type GatewaySpec struct {
8585
//
8686
// Port and protocol combinations not listed above are considered Extended.
8787
//
88-
// An implementation MAY group Listeners by Port and then collapse each
89-
// group of Listeners into a single Listener if the implementation
90-
// determines that the Listeners in the group are "compatible". An
91-
// implementation MAY also group together and collapse compatible
92-
// Listeners belonging to different Gateways.
93-
//
94-
// For example, an implementation might consider Listeners to be
95-
// compatible with each other if all of the following conditions are
96-
// met:
97-
//
98-
// 1. Either each Listener within the group specifies the "HTTP"
99-
// Protocol or each Listener within the group specifies either
100-
// the "HTTPS" or "TLS" Protocol.
101-
//
102-
// 2. Each Listener within the group specifies a Hostname that is unique
103-
// within the group.
104-
//
105-
// 3. As a special case, one Listener within a group may omit Hostname,
106-
// in which case this Listener matches when no other Listener
107-
// matches.
108-
//
109-
// If the implementation does collapse compatible Listeners, the
110-
// hostname provided in the incoming client request MUST be
111-
// matched to a Listener to find the correct set of Routes.
112-
// The incoming hostname MUST be matched using the Hostname
113-
// field for each Listener in order of most to least specific.
114-
// That is, exact matches must be processed before wildcard
115-
// matches.
116-
//
117-
// If this field specifies multiple Listeners that have the same
118-
// Port value but are not compatible, the implementation must raise
119-
// a "Conflicted" condition in the Listener status.
88+
// A Gateway's Listeners are considered "compatible" if:
89+
//
90+
// 1. The implementation can serve them in compliance with the Addresses
91+
// requirement that all Listeners are available on all assigned
92+
// addresses.
93+
// 2. The implementation can match inbound requests to a single distinct
94+
// Listener. When multiple Listeners share values for fields (for
95+
// example, two Listeners with the same Port value), the implementation
96+
// can can match requests to only one of the Listeners using other
97+
// Listener fields.
98+
//
99+
// Compatible combinations in Extended support are expected to vary across
100+
// implementations. A combination that is compatible for one implementation
101+
// may not be compatible for another.
102+
//
103+
// If this field specifies multiple Listeners that are not compatible, the
104+
// implementation MUST set the "Conflicted" condition in the Listener
105+
// Status to "True".
106+
//
107+
// Implementations MAY choose to still accept a Gateway with conflicted
108+
// Listeners if they accept a partial Listener set that contains no
109+
// incompatible Listeners. They MUST set a "ListenersNotValid" condition
110+
// the Gateway Status when the Gateway contains incompatible Listeners
111+
// whether or not they accept the Gateway.
112+
//
113+
// For example, the following Listener scenarios may be compatible
114+
// depending on implementation capabilities:
115+
//
116+
// 1. Multiple Listeners with the same Port that all use the "HTTP"
117+
// Protocol that all have unique Hostname values.
118+
// 2. Multiple Listeners with the same Port that use either the "HTTPS" or
119+
// "TLS" Protocol that all have unique Hostname values.
120+
// 3. A mixture of "TCP" and "UDP" Protocol Listeners, where no Listener
121+
// with the same Protocol has the same Port value.
122+
//
123+
// An implementation that cannot serve both TCP and UDP listeners on the same
124+
// address, or cannot mix HTTPS and generic TLS listens on the same port
125+
// would not consider those cases compatible.
126+
//
127+
// Implementations using the Hostname value to select between same-Port
128+
// Listeners MUST match inbound request hostnames from the most specific
129+
// to least specific Hostname values to find the correct set of Routes.
130+
// Exact matches must be processed before wildcard matches, and wildcard
131+
// matches must be processed before fallback (empty Hostname value)
132+
// matches. For example, `"foo.example.com"` takes precedence over
133+
// `"*.example.com"`, and `"*.example.com"` takes precedence over `""`.
134+
//
135+
// Implementations MAY merge separate Gateways onto a single set of
136+
// Addresses if all Listeners across all Gateways are compatible.
120137
//
121138
// Support: Core
122139
//

config/crd/experimental/gateway.networking.k8s.io_gateways.yaml

Lines changed: 74 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)