Skip to content

Commit 84a8806

Browse files
kflynnk8s-ci-robot
authored andcommitted
chore: useDefaultGateway -> useDefaultGateways (plural), support scope None as explicitly disabling defaulting
Signed-off-by: Flynn <[email protected]>
1 parent a2bbf16 commit 84a8806

21 files changed

+280
-213
lines changed

apis/v1/gateway_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,11 @@ type GatewaySpec struct {
299299
// meaning it will dynamically and implicitly have Routes (e.g. HTTPRoute)
300300
// attached to it, according to the scope configured here.
301301
//
302-
// If unset or set to an empty string `""` (the default), the Gateway
303-
// will not act as a default Gateway; if set, the Gateway will claim any
304-
// Route with a matching scope set in its UseDefaultGateway field, subject
305-
// to the usual rules about which routes the Gateway can attach to.
302+
// If unset (the default), set to an empty string (`""`), or set to None,
303+
// the Gateway will not act as a default Gateway; if set, the Gateway will
304+
// claim any Route with a matching scope set in its UseDefaultGateway
305+
// field, subject to the usual rules about which routes the Gateway can
306+
// attach to.
306307
//
307308
// Think carefully before using this functionality! While the normal rules
308309
// about which Route can apply are still enforced, it is simply easier for

apis/v1/shared_types.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,21 @@ type ParentReference struct {
155155
Port *PortNumber `json:"port,omitempty"`
156156
}
157157

158-
// GatewayDefaultScope defines the set of default scopes that a Gateway can
159-
// claim, for configuring default Gateways and selecting default Gateways in
160-
// any Route type. At present the only supported scope is "All".
158+
// GatewayDefaultScope defines the set of default scopes that a Gateway
159+
// can claim, for use in any Route type. At present the only supported
160+
// scopes are "All" and "None". "None" is a special scope which
161+
// explicitly means that the Route MUST NOT be defaulted.
162+
// +kubebuilder:validation:Enum=All;None
161163
type GatewayDefaultScope string
162164

163165
const (
164166
// GatewayDefaultScopeAll indicates that a Gateway can claim absolutely
165167
// any Route asking for a default Gateway.
166168
GatewayDefaultScopeAll GatewayDefaultScope = "All"
169+
170+
// GatewayDefaultScopeNone indicates that a Gateway MUST NOT claim
171+
// any Route asking for a default Gateway.
172+
GatewayDefaultScopeNone GatewayDefaultScope = "None"
167173
)
168174

169175
// CommonRouteSpec defines the common attributes that all Routes MUST include
@@ -241,21 +247,22 @@ type CommonRouteSpec struct {
241247
// <gateway:experimental:validation:XValidation:message="sectionName or port must be unique when parentRefs includes 2 or more references to the same parent",rule="self.all(p1, self.exists_one(p2, p1.group == p2.group && p1.kind == p2.kind && p1.name == p2.name && (((!has(p1.__namespace__) || p1.__namespace__ == '') && (!has(p2.__namespace__) || p2.__namespace__ == '')) || (has(p1.__namespace__) && has(p2.__namespace__) && p1.__namespace__ == p2.__namespace__ )) && (((!has(p1.sectionName) || p1.sectionName == '') && (!has(p2.sectionName) || p2.sectionName == '')) || ( has(p1.sectionName) && has(p2.sectionName) && p1.sectionName == p2.sectionName)) && (((!has(p1.port) || p1.port == 0) && (!has(p2.port) || p2.port == 0)) || (has(p1.port) && has(p2.port) && p1.port == p2.port))))">
242248
ParentRefs []ParentReference `json:"parentRefs,omitempty"`
243249

244-
// UseDefaultGateway indicates the default Gateway scope to use for this
245-
// Route. If unset (the default), the Route will not be attached to any
246-
// default Gateway; if set, it will be attached to any default Gateway
247-
// supporting the named scope, subject to the usual rules about which
248-
// Routes a Gateway is allowed to claim.
250+
// UseDefaultGateways indicates the default Gateway scope to use for this
251+
// Route. If unset (the default), set to an empty string (`""`), or set to
252+
// None, the Route will not be attached to any default Gateway; if set, it
253+
// will be attached to any default Gateway supporting the named scope,
254+
// subject to the usual rules about which Routes a Gateway is allowed to
255+
// claim.
249256
//
250257
// Think carefully before using this functionality! The set of default
251258
// Gateways supporting the requested scope can change over time without
252259
// any notice to the Route author, and in many situations it will not be
253260
// appropriate to request a default Gateway for a given Route -- for
254-
// example, a Route with specific security requirements should almost certainly
255-
// not use a default Gateway.
261+
// example, a Route with specific security requirements should almost
262+
// certainly not use a default Gateway.
256263
//
257264
// +optional <gateway:experimental>
258-
UseDefaultGateway GatewayDefaultScope `json:"useDefaultGateway,omitempty"`
265+
UseDefaultGateways GatewayDefaultScope `json:"useDefaultGateways,omitempty"`
259266
}
260267

261268
// PortNumber defines a network port.

applyconfiguration/apis/v1/commonroutespec.go

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

applyconfiguration/apis/v1/grpcroutespec.go

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

applyconfiguration/apis/v1/httproutespec.go

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

applyconfiguration/apis/v1alpha2/tcproutespec.go

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

applyconfiguration/apis/v1alpha2/tlsroutespec.go

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

applyconfiguration/apis/v1alpha2/udproutespec.go

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

applyconfiguration/apis/v1alpha3/tlsroutespec.go

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

applyconfiguration/internal/internal.go

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

0 commit comments

Comments
 (0)