@@ -112,6 +112,8 @@ type GatewaySpec struct {
112
112
//
113
113
// Support: Core
114
114
//
115
+ // +listType=map
116
+ // +listMapKey=name
115
117
// +kubebuilder:validation:MinItems=1
116
118
// +kubebuilder:validation:MaxItems=64
117
119
Listeners []Listener `json:"listeners"`
@@ -141,6 +143,15 @@ type GatewaySpec struct {
141
143
// combination of Hostname, Port, and Protocol. This will be enforced by a
142
144
// validating webhook.
143
145
type Listener struct {
146
+ // Name is the name of the Listener. If more than one Listener is present
147
+ // each Listener MUST specify a name. The names of Listeners MUST be unique
148
+ // within a Gateway.
149
+ //
150
+ // Support: Core
151
+ //
152
+ // +kubebuilder:validation:MaxLength=253
153
+ Name string `json:"name"`
154
+
144
155
// Hostname specifies the virtual hostname to match for protocol types that
145
156
// define this concept. When unspecified, "", or `*`, all hostnames are
146
157
// matched. This field can be omitted for protocols that don't require
@@ -198,18 +209,7 @@ type Listener struct {
198
209
// +optional
199
210
TLS * GatewayTLSConfig `json:"tls,omitempty"`
200
211
201
- // Routes specifies a schema for associating routes with the
202
- // Listener using selectors. A Route is a resource capable of
203
- // servicing a request and allows a cluster operator to expose
204
- // a cluster resource (i.e. Service) by externally-reachable
205
- // URL, load-balance traffic and terminate SSL/TLS. Typically,
206
- // a route is a "HTTPRoute" or "TCPRoute" in group
207
- // "gateway.networking.k8s.io", however, an implementation may support
208
- // other types of resources.
209
- //
210
- // The Routes selector MUST select a set of objects that
211
- // are compatible with the application protocol specified in
212
- // the Protocol field.
212
+ // Routes specifies which Routes may be attached to this Listener.
213
213
//
214
214
// Although a client request may technically match multiple route rules,
215
215
// only one rule may ultimately receive the request. Matching precedence
@@ -232,7 +232,9 @@ type Listener struct {
232
232
// invalid, the rest of the Route should still be supported.
233
233
//
234
234
// Support: Core
235
- Routes RouteBindingSelector `json:"routes"`
235
+ // +kubebuilder:default={namespaces:{from: Same}}
236
+ // +optional
237
+ Routes * ListenerRoutes `json:"routes,omitempty"`
236
238
}
237
239
238
240
// ProtocolType defines the application protocol accepted by a Listener.
@@ -374,59 +376,33 @@ const (
374
376
TLSModePassthrough TLSModeType = "Passthrough"
375
377
)
376
378
377
- // RouteBindingSelector defines a schema for associating routes with the Gateway.
378
- // If Namespaces and Selector are defined, only routes matching both selectors are
379
- // associated with the Gateway.
380
- type RouteBindingSelector struct {
381
- // Namespaces indicates in which namespaces Routes should be selected
382
- // for this Gateway. This is restricted to the namespace of this Gateway by
379
+ // ListenerRoutes defines which Routes may be attached to this Listener.
380
+ type ListenerRoutes struct {
381
+ // Namespaces indicates which namespaces Routes may be attached to this
382
+ // Listener from. This is restricted to the namespace of this Gateway by
383
383
// default.
384
384
//
385
385
// Support: Core
386
386
//
387
387
// +optional
388
388
// +kubebuilder:default={from: Same}
389
389
Namespaces * RouteNamespaces `json:"namespaces,omitempty"`
390
- // Selector specifies a set of route labels used for selecting
391
- // routes to associate with the Gateway. If this Selector is defined,
392
- // only routes matching the Selector are associated with the Gateway.
393
- // An empty Selector matches all routes.
394
- //
395
- // Support: Core
396
- //
397
- // +optional
398
- Selector * metav1.LabelSelector `json:"selector,omitempty"`
399
- // Group is the group of the route resource to select. Omitting the value
400
- // indicates the gateway.networking.k8s.io API group.
401
- // For example, use the following to select an HTTPRoute:
402
- //
403
- // routes:
404
- // kind: HTTPRoute
405
- //
406
- // Otherwise, if an alternative API group is desired, specify the desired
407
- // group:
390
+
391
+ // Kinds specifies the groups and kinds of Routes that are allowed to bind
392
+ // to this Gateway Listener. When unspecified or empty, the kinds of Routes
393
+ // selected are determined using the Listener protocol.
408
394
//
409
- // routes:
410
- // group: acme.io
411
- // kind: FooRoute
395
+ // A RouteGroupKind MUST correspond to kinds of Routes that are compatible
396
+ // with the application protocol specified in the Listener's Protocol field.
397
+ // If an implementation does not support or recognize this resource type, it
398
+ // MUST set the "ResolvedRefs" condition to false for this Listener with the
399
+ // "InvalidRoutesRef" reason.
412
400
//
413
401
// Support: Core
414
402
//
415
403
// +optional
416
- // +kubebuilder:default=gateway.networking.k8s.io
417
- // +kubebuilder:validation:MaxLength=253
418
- Group * string `json:"group,omitempty"`
419
- // Kind is the kind of the route resource to select.
420
- //
421
- // Kind MUST correspond to kinds of routes that are compatible with the
422
- // application protocol specified in the Listener's Protocol field.
423
- //
424
- // If an implementation does not support or recognize this
425
- // resource type, it SHOULD set the "ResolvedRefs" condition to false for
426
- // this listener with the "InvalidRoutesRef" reason.
427
- //
428
- // Support: Core
429
- Kind string `json:"kind"`
404
+ // +kubebuilder:validation:MaxItems=8
405
+ Kinds []RouteGroupKind `json:"kinds,omitempty"`
430
406
}
431
407
432
408
// RouteSelectType specifies where Routes should be selected by a Gateway.
@@ -468,6 +444,22 @@ type RouteNamespaces struct {
468
444
Selector * metav1.LabelSelector `json:"selector,omitempty"`
469
445
}
470
446
447
+ // RouteGroupKind indicates the group and kind of a Route resource.
448
+ type RouteGroupKind struct {
449
+ // Group is the group of the Route.
450
+ //
451
+ // +optional
452
+ // +kubebuilder:default=gateway.networking.k8s.io
453
+ // +kubebuilder:validation:MaxLength=253
454
+ Group * string `json:"group,omitempty"`
455
+
456
+ // Kind is the kind of the Route.
457
+ //
458
+ // +kubebuilder:validation:MinLength=1
459
+ // +kubebuilder:validation:MaxLength=253
460
+ Kind string `json:"kind"`
461
+ }
462
+
471
463
// GatewayAddress describes an address that can be bound to a Gateway.
472
464
type GatewayAddress struct {
473
465
// Type of the address.
@@ -558,7 +550,7 @@ type GatewayStatus struct {
558
550
//
559
551
// +optional
560
552
// +listType=map
561
- // +listMapKey=port
553
+ // +listMapKey=name
562
554
// +kubebuilder:validation:MaxItems=64
563
555
Listeners []ListenerStatus `json:"listeners,omitempty"`
564
556
}
@@ -663,19 +655,26 @@ const (
663
655
664
656
// ListenerStatus is the status associated with a Listener.
665
657
type ListenerStatus struct {
666
- // Port is the unique Listener port value for which this message is
667
- // reporting the status.
668
- Port PortNumber `json:"port"`
669
-
670
- // Protocol is the Listener protocol value for which this message is
671
- // reporting the status.
672
- Protocol ProtocolType `json:"protocol"`
658
+ // Name is the name of the Listener. If the Gateway has more than one
659
+ // Listener present, each ListenerStatus MUST specify a name. The names of
660
+ // ListenerStatus objects MUST be unique within a Gateway.
661
+ //
662
+ // +kubebuilder:validation:MaxLength=253
663
+ Name string `json:"name"`
673
664
674
- // Hostname is the Listener hostname value for which this message is
675
- // reporting the status.
665
+ // SupportedKinds is the list indicating the Kinds supported by this
666
+ // listener. When this is not specified on the Listener, this MUST represent
667
+ // the kinds an implementation supports for the specified protocol. When
668
+ // there are kinds specified on the Listener, this MUST represent the
669
+ // intersection of those kinds and the kinds supported by the implementation
670
+ // for the specified protocol.
676
671
//
677
- // +optional
678
- Hostname * Hostname `json:"hostname,omitempty"`
672
+ // +kubebuilder:validation:MaxItems=8
673
+ SupportedKinds []RouteGroupKind `json:"supportedKinds"`
674
+
675
+ // AttachedRoutes represents the total number of Routes that have been
676
+ // successfully attached to this Listener.
677
+ AttachedRoutes int32 `json:"attachedRoutes"`
679
678
680
679
// Conditions describe the current condition of this listener.
681
680
//
0 commit comments