@@ -30,13 +30,8 @@ import (
30
30
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
31
31
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
32
32
33
- // Gateway represents an instantiation of a service-traffic handling
34
- // infrastructure by binding Listeners to a set of IP addresses.
35
- //
36
- // Implementations should add the `gateway-exists-finalizer.gateway.networking.k8s.io`
37
- // finalizer on the associated GatewayClass whenever Gateway(s) is running.
38
- // This ensures that a GatewayClass associated with a Gateway(s) is not
39
- // deleted while in use.
33
+ // Gateway represents an instance of a service-traffic handling infrastructure
34
+ // by binding Listeners to a set of IP addresses.
40
35
type Gateway struct {
41
36
metav1.TypeMeta `json:",inline"`
42
37
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -52,7 +47,7 @@ type Gateway struct {
52
47
53
48
// +kubebuilder:object:root=true
54
49
55
- // GatewayList contains a list of Gateway .
50
+ // GatewayList contains a list of Gateways .
56
51
type GatewayList struct {
57
52
metav1.TypeMeta `json:",inline"`
58
53
metav1.ListMeta `json:"metadata,omitempty"`
@@ -118,18 +113,17 @@ type GatewaySpec struct {
118
113
// +kubebuilder:validation:MaxItems=64
119
114
Listeners []Listener `json:"listeners"`
120
115
121
- // Addresses requested for this gateway. This is optional and
122
- // behavior can depend on the GatewayClass. If a value is set
123
- // in the spec and the requested address is invalid, the
124
- // GatewayClass MUST indicate this in the associated entry in
125
- // GatewayStatus.Addresses.
116
+ // Addresses requested for this Gateway. This is optional and behavior can
117
+ // depend on the implementation. If a value is set in the spec and the
118
+ // requested address is invalid or unavailable, the implementation MUST
119
+ // indicate this in the associated entry in GatewayStatus.Addresses.
126
120
//
127
- // If no Addresses are specified, the GatewayClass may
128
- // schedule the Gateway in an implementation-defined manner,
129
- // assigning an appropriate set of Addresses.
121
+ // If no Addresses are specified, the implementation MAY schedule the
122
+ // Gateway in an implementation-specific manner, assigning an appropriate
123
+ // set of Addresses.
130
124
//
131
- // The GatewayClass MUST bind all Listeners to every
132
- // GatewayAddress that it assigns to the Gateway.
125
+ // The implementation MUST bind all Listeners to every GatewayAddress that
126
+ // it assigns to the Gateway.
133
127
//
134
128
// Support: Core
135
129
//
@@ -143,26 +137,21 @@ type GatewaySpec struct {
143
137
// combination of Hostname, Port, and Protocol. This will be enforced by a
144
138
// validating webhook.
145
139
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.
140
+ // Name is the name of the Listener.
149
141
//
150
142
// Support: Core
151
143
Name SectionName `json:"name"`
152
144
153
145
// Hostname specifies the virtual hostname to match for protocol types that
154
- // define this concept. When unspecified, "", or `*`, all hostnames are
155
- // matched. This field can be omitted for protocols that don't require
156
- // hostname based matching.
146
+ // define this concept. When unspecified, all hostnames are matched. This
147
+ // field is ignored for protocols that don't require hostname based
148
+ // matching.
157
149
//
158
- // For HTTPRoute objects , there is an interaction with the
150
+ // For HTTPRoute and TLSRoute resources , there is an interaction with the
159
151
// `spec.hostnames` array. When both listener and route specify hostnames,
160
- // there must be an intersection between the values for a Route to be admitted.
161
- // For example, a Gateway with `*.example.com` would admit a Route that included
162
- // `foo.example.com` as a hostname, but not a Route that *only* included
163
- // `foo.acme.io` as a hostname. A Route that included both `foo.example.com`
164
- // and `foo.acme.io` would be admitted, but the `foo.acme.io` hostname would
165
- // be silently ignored.
152
+ // there must be an intersection between the values for a Route to be
153
+ // admitted. For more information, refer to the Route specific Hostnames
154
+ // documentation.
166
155
//
167
156
// Support: Core
168
157
//
@@ -192,9 +181,9 @@ type Listener struct {
192
181
// Support: Core
193
182
Protocol ProtocolType `json:"protocol"`
194
183
195
- // TLS is the TLS configuration for the Listener. This field
196
- // is required if the Protocol field is "HTTPS" or "TLS" and
197
- // ignored otherwise .
184
+ // TLS is the TLS configuration for the Listener. This field is required if
185
+ // the Protocol field is "HTTPS" or "TLS". It MUST be ignored when the
186
+ // Protocol field is "HTTP", "TCP", or "UDP" .
198
187
//
199
188
// The association of SNIs to Certificate defined in GatewayTLSConfig is
200
189
// defined based on the Hostname field for this listener.
@@ -207,32 +196,33 @@ type Listener struct {
207
196
// +optional
208
197
TLS * GatewayTLSConfig `json:"tls,omitempty"`
209
198
210
- // Routes specifies which Routes may be attached to this Listener.
199
+ // AllowedRoutes specifies which Routes may be attached to this Listener.
211
200
//
212
- // Although a client request may technically match multiple route rules,
213
- // only one rule may ultimately receive the request. Matching precedence
214
- // MUST be determined in order of the following criteria:
201
+ // Although a client request may match multiple route rules, only one rule
202
+ // may ultimately receive the request. Matching precedence MUST be
203
+ // determined in order of the following criteria:
215
204
//
216
- // * The most specific match. For example, the most specific HTTPRoute match
217
- // is determined by the longest matching combination of hostname and path.
205
+ // * The most specific match as defined by the Route type. For example, the
206
+ // most specific HTTPRoute match is determined by the longest matching
207
+ // combination of hostname and path.
218
208
// * The oldest Route based on creation timestamp. For example, a Route with
219
209
// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
220
210
// a Route with a creation timestamp of "2020-09-08 01:02:04".
221
211
// * If everything else is equivalent, the Route appearing first in
222
212
// alphabetical order (namespace/name) should be given precedence. For
223
213
// example, foo/bar is given precedence over foo/baz.
224
214
//
225
- // All valid portions of a Route selected by this field should be supported.
226
- // Invalid portions of a Route can be ignored (sometimes that will mean the
227
- // full Route). If a portion of a Route transitions from valid to invalid,
228
- // support for that portion of the Route should be dropped to ensure
229
- // consistency. For example, even if a filter specified by a Route is
230
- // invalid, the rest of the Route should still be supported.
215
+ // All valid rules within a Route attached to this Listener should be
216
+ // supported. Invalid Route rules can be ignored (sometimes that will mean
217
+ // the full Route). If a Route rule transitions from valid to invalid,
218
+ // support for that Route rule should be dropped to ensure consistency. For
219
+ // example, even if a filter specified by a Route rule is invalid, the rest
220
+ // of the rules within that Route should still be supported.
231
221
//
232
222
// Support: Core
233
223
// +kubebuilder:default={namespaces:{from: Same}}
234
224
// +optional
235
- Routes * ListenerRoutes `json:"routes ,omitempty"`
225
+ AllowedRoutes * AllowedRoutes `json:"allowedRoutes ,omitempty"`
236
226
}
237
227
238
228
// ProtocolType defines the application protocol accepted by a Listener.
@@ -293,7 +283,7 @@ type GatewayTLSConfig struct {
293
283
// References to a resource in different namespace are invalid UNLESS there
294
284
// is a ReferencePolicy in the target namespace that allows the certificate
295
285
// to be attached. If a ReferencePolicy does not allow this reference, the
296
- // "ResolvedRefs" condition MUST be set to false for this listener with the
286
+ // "ResolvedRefs" condition MUST be set to False for this listener with the
297
287
// "InvalidCertificateRef" reason.
298
288
//
299
289
// This field is required when mode is set to "Terminate" (default) and
@@ -339,11 +329,10 @@ const (
339
329
TLSModePassthrough TLSModeType = "Passthrough"
340
330
)
341
331
342
- // ListenerRoutes defines which Routes may be attached to this Listener.
343
- type ListenerRoutes struct {
344
- // Namespaces indicates which namespaces Routes may be attached to this
345
- // Listener from. This is restricted to the namespace of this Gateway by
346
- // default.
332
+ // AllowedRoutes defines which Routes may be attached to this Listener.
333
+ type AllowedRoutes struct {
334
+ // Namespaces indicates namespaces from which Routes may be attached to this
335
+ // Listener. This is restricted to the namespace of this Gateway by default.
347
336
//
348
337
// Support: Core
349
338
//
@@ -358,7 +347,7 @@ type ListenerRoutes struct {
358
347
// A RouteGroupKind MUST correspond to kinds of Routes that are compatible
359
348
// with the application protocol specified in the Listener's Protocol field.
360
349
// If an implementation does not support or recognize this resource type, it
361
- // MUST set the "ResolvedRefs" condition to false for this Listener with the
350
+ // MUST set the "ResolvedRefs" condition to False for this Listener with the
362
351
// "InvalidRoutesRef" reason.
363
352
//
364
353
// Support: Core
@@ -368,18 +357,21 @@ type ListenerRoutes struct {
368
357
Kinds []RouteGroupKind `json:"kinds,omitempty"`
369
358
}
370
359
371
- // RouteSelectType specifies where Routes should be selected by a Gateway.
360
+ // NamespacesFrom specifies namespace from which Routes may be attached to a
361
+ // Gateway.
372
362
//
373
363
// +kubebuilder:validation:Enum=All;Selector;Same
374
- type RouteSelectType string
364
+ type NamespacesFrom string
375
365
376
366
const (
377
- // Routes in all namespaces may be used by this Gateway.
378
- RouteSelectAll RouteSelectType = "All"
379
- // Only Routes in namespaces selected by the selector may be used by this Gateway.
380
- RouteSelectSelector RouteSelectType = "Selector"
381
- // Only Routes in the same namespace as the Gateway may be used by this Gateway.
382
- RouteSelectSame RouteSelectType = "Same"
367
+ // Routes in all namespaces may be attached to this Gateway.
368
+ NamespacesFromAll NamespacesFrom = "All"
369
+ // Only Routes in namespaces selected by the selector may be attached to
370
+ // this Gateway.
371
+ NamespacesFromSelector NamespacesFrom = "Selector"
372
+ // Only Routes in the same namespace as the Gateway may be attached to this
373
+ // Gateway.
374
+ NamespacesFromSame NamespacesFrom = "Same"
383
375
)
384
376
385
377
// RouteNamespaces indicate which namespaces Routes should be selected from.
@@ -395,7 +387,7 @@ type RouteNamespaces struct {
395
387
//
396
388
// +optional
397
389
// +kubebuilder:default=Same
398
- From * RouteSelectType `json:"from,omitempty"`
390
+ From * NamespacesFrom `json:"from,omitempty"`
399
391
400
392
// Selector must be specified when From is set to "Selector". In that case,
401
393
// only Routes in Namespaces matching this Selector will be selected by this
@@ -532,10 +524,9 @@ const (
532
524
//
533
525
// * "Scheduled"
534
526
//
535
- // Possible reasons for this condition to be false are:
527
+ // Possible reasons for this condition to be False are:
536
528
//
537
529
// * "NotReconciled"
538
- // * "NoSuchGatewayClass"
539
530
// * "NoResources"
540
531
//
541
532
// Controllers may raise this condition with other reasons,
@@ -551,13 +542,6 @@ const (
551
542
// been recently created and no controller has reconciled it yet.
552
543
GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled"
553
544
554
- // This reason is used with the "Scheduled" condition when the Gateway is
555
- // not scheduled because there is no controller that recognizes the
556
- // GatewayClassName. This reason has been deprecated and will be removed in
557
- // a future release.
558
- // +deprecated
559
- GatewayReasonNoSuchGatewayClass GatewayConditionReason = "NoSuchGatewayClass"
560
-
561
545
// This reason is used with the "Scheduled" condition when the
562
546
// Gateway is not scheduled because insufficient infrastructure
563
547
// resources are available.
@@ -579,7 +563,7 @@ const (
579
563
//
580
564
// * "Ready"
581
565
//
582
- // Possible reasons for this condition to be false are:
566
+ // Possible reasons for this condition to be False are:
583
567
//
584
568
// * "ListenersNotValid"
585
569
// * "ListenersNotReady"
@@ -614,9 +598,7 @@ const (
614
598
615
599
// ListenerStatus is the status associated with a Listener.
616
600
type ListenerStatus struct {
617
- // Name is the name of the Listener. If the Gateway has more than one
618
- // Listener present, each ListenerStatus MUST specify a name. The names of
619
- // ListenerStatus objects MUST be unique within a Gateway.
601
+ // Name is the name of the Listener that this status corresponds to.
620
602
Name SectionName `json:"name"`
621
603
622
604
// SupportedKinds is the list indicating the Kinds supported by this
@@ -662,7 +644,7 @@ const (
662
644
// * "ProtocolConflict"
663
645
// * "RouteConflict"
664
646
//
665
- // Possible reasons for this condition to be false are:
647
+ // Possible reasons for this condition to be False are:
666
648
//
667
649
// * "NoConflicts"
668
650
//
@@ -674,7 +656,7 @@ const (
674
656
// This reason is used with the "Conflicted" condition when
675
657
// the Listener conflicts with hostnames in other Listeners. For
676
658
// example, this reason would be used when multiple Listeners on
677
- // the same port use `* ` in the hostname field.
659
+ // the same port use `example.com ` in the hostname field.
678
660
ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict"
679
661
680
662
// This reason is used with the "Conflicted" condition when
@@ -690,7 +672,7 @@ const (
690
672
ListenerReasonRouteConflict ListenerConditionReason = "RouteConflict"
691
673
692
674
// This reason is used with the "Conflicted" condition when the condition
693
- // is false .
675
+ // is False .
694
676
ListenerReasonNoConflicts ListenerConditionReason = "NoConflicts"
695
677
)
696
678
@@ -712,7 +694,7 @@ const (
712
694
// * "UnsupportedProtocol"
713
695
// * "UnsupportedAddress"
714
696
//
715
- // Possible reasons for this condition to be false are:
697
+ // Possible reasons for this condition to be False are:
716
698
//
717
699
// * "Attached"
718
700
//
@@ -742,7 +724,7 @@ const (
742
724
ListenerReasonUnsupportedAddress ListenerConditionReason = "UnsupportedAddress"
743
725
744
726
// This reason is used with the "Detached" condition when the condition is
745
- // false .
727
+ // False .
746
728
ListenerReasonAttached ListenerConditionReason = "Attached"
747
729
)
748
730
@@ -754,11 +736,10 @@ const (
754
736
//
755
737
// * "ResolvedRefs"
756
738
//
757
- // Possible reasons for this condition to be false are:
739
+ // Possible reasons for this condition to be False are:
758
740
//
759
- // * "DegradedRoutes"
760
741
// * "InvalidCertificateRef"
761
- // * "InvalidRoutesRef "
742
+ // * "InvalidRouteKinds "
762
743
// * "RefNotPermitted"
763
744
//
764
745
// Controllers may raise this condition with other reasons,
@@ -770,23 +751,14 @@ const (
770
751
// is true.
771
752
ListenerReasonResolvedRefs ListenerConditionReason = "ResolvedRefs"
772
753
773
- // This reason is used with the "ResolvedRefs" condition
774
- // when not all of the routes selected by this Listener could be
775
- // configured. The specific reason for the degraded route should
776
- // be indicated in the route's .Status.Conditions field.
777
- ListenerReasonDegradedRoutes ListenerConditionReason = "DegradedRoutes"
778
-
779
754
// This reason is used with the "ResolvedRefs" condition when the
780
755
// Listener has a TLS configuration with a TLS CertificateRef
781
756
// that is invalid or cannot be resolved.
782
757
ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef"
783
758
784
- // This reason is used with the "ResolvedRefs" condition when
785
- // the Listener's Routes selector or kind is invalid or cannot
786
- // be resolved. Note that it is not an error for this selector to
787
- // not resolve any Routes, and the "ResolvedRefs" status condition
788
- // should not be raised in that case.
789
- ListenerReasonInvalidRoutesRef ListenerConditionReason = "InvalidRoutesRef"
759
+ // This reason is used with the "ResolvedRefs" condition when an invalid or
760
+ // unsupported Route kind is specified by the Listener.
761
+ ListenerReasonInvalidRoutesRef ListenerConditionReason = "InvalidRouteKinds"
790
762
791
763
// This reason is used with the "ResolvedRefs" condition when
792
764
// one of the Listener's Routes has a BackendRef to an object in
@@ -803,7 +775,7 @@ const (
803
775
//
804
776
// * "Ready"
805
777
//
806
- // Possible reasons for this condition to be false are:
778
+ // Possible reasons for this condition to be False are:
807
779
//
808
780
// * "Invalid"
809
781
// * "Pending"
0 commit comments