Skip to content

Commit cb72805

Browse files
kflynnk8s-ci-robot
authored andcommitted
feat(gateway): API for default Gateways
Signed-off-by: Flynn <[email protected]>
1 parent aa3208f commit cb72805

19 files changed

+276
-7
lines changed

apis/v1/gateway_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,16 @@ type GatewaySpec struct {
294294
// +optional
295295
// <gateway:experimental>
296296
TLS *GatewayTLSConfig `json:"tls,omitempty"`
297+
298+
// DefaultScope defines the default scope for this Gateway. If unset (the
299+
// default), the Gateway will not act as a default Gateway; if set, the
300+
// Gateway will claim any Route with a matching scope set in its
301+
// UseDefaultGateway field, subject to the usual rules about which routes
302+
// the Gateway can attach to.
303+
//
304+
// +optional
305+
// <gateway:experimental>
306+
DefaultScope GatewayDefaultScope `json:"defaultScope,omitempty"`
297307
}
298308

299309
// AllowedListeners defines which ListenerSets can be attached to this Gateway.

apis/v1/shared_types.go

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

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+
// scope is "All".
161+
type GatewayDefaultScope string
162+
163+
const (
164+
// GatewayDefaultScopeAll indicates that a Gateway can claim absolutely
165+
// any Route asking for a default Gateway.
166+
GatewayDefaultScopeAll GatewayDefaultScope = "All"
167+
)
168+
158169
// CommonRouteSpec defines the common attributes that all Routes MUST include
159170
// within their spec.
160171
type CommonRouteSpec struct {
@@ -229,6 +240,16 @@ type CommonRouteSpec struct {
229240
// <gateway:experimental:validation:XValidation:message="sectionName or port must be specified when parentRefs includes 2 or more references to the same parent",rule="self.all(p1, self.all(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.port) || p1.port == 0) == (!has(p2.port) || p2.port == 0)): true))">
230241
// <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))))">
231242
ParentRefs []ParentReference `json:"parentRefs,omitempty"`
243+
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.
249+
//
250+
// +optional
251+
// <gateway:experimental>
252+
UseDefaultGateway GatewayDefaultScope `json:"useDefaultGateway,omitempty"`
232253
}
233254

234255
// PortNumber defines a network port.

applyconfiguration/apis/v1/commonroutespec.go

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

applyconfiguration/apis/v1/gatewayspec.go

Lines changed: 9 additions & 0 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: 8 additions & 0 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: 8 additions & 0 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: 9 additions & 0 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: 8 additions & 0 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: 9 additions & 0 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: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)