@@ -30,13 +30,8 @@ import (
3030// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
3131// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
3232
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.
4035type Gateway struct {
4136 metav1.TypeMeta `json:",inline"`
4237 metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -52,7 +47,7 @@ type Gateway struct {
5247
5348// +kubebuilder:object:root=true
5449
55- // GatewayList contains a list of Gateway .
50+ // GatewayList contains a list of Gateways .
5651type GatewayList struct {
5752 metav1.TypeMeta `json:",inline"`
5853 metav1.ListMeta `json:"metadata,omitempty"`
@@ -118,18 +113,17 @@ type GatewaySpec struct {
118113 // +kubebuilder:validation:MaxItems=64
119114 Listeners []Listener `json:"listeners"`
120115
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.
126120 //
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.
130124 //
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.
133127 //
134128 // Support: Core
135129 //
@@ -143,26 +137,21 @@ type GatewaySpec struct {
143137// combination of Hostname, Port, and Protocol. This will be enforced by a
144138// validating webhook.
145139type 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.
149141 //
150142 // Support: Core
151143 Name SectionName `json:"name"`
152144
153145 // 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.
157149 //
158- // For HTTPRoute objects , there is an interaction with the
150+ // For HTTPRoute and TLSRoute resources , there is an interaction with the
159151 // `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.
166155 //
167156 // Support: Core
168157 //
@@ -192,9 +181,9 @@ type Listener struct {
192181 // Support: Core
193182 Protocol ProtocolType `json:"protocol"`
194183
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" .
198187 //
199188 // The association of SNIs to Certificate defined in GatewayTLSConfig is
200189 // defined based on the Hostname field for this listener.
@@ -207,32 +196,33 @@ type Listener struct {
207196 // +optional
208197 TLS * GatewayTLSConfig `json:"tls,omitempty"`
209198
210- // Routes specifies which Routes may be attached to this Listener.
199+ // AllowedRoutes specifies which Routes may be attached to this Listener.
211200 //
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:
215204 //
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.
218208 // * The oldest Route based on creation timestamp. For example, a Route with
219209 // a creation timestamp of "2020-09-08 01:02:03" is given precedence over
220210 // a Route with a creation timestamp of "2020-09-08 01:02:04".
221211 // * If everything else is equivalent, the Route appearing first in
222212 // alphabetical order (namespace/name) should be given precedence. For
223213 // example, foo/bar is given precedence over foo/baz.
224214 //
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.
231221 //
232222 // Support: Core
233223 // +kubebuilder:default={namespaces:{from: Same}}
234224 // +optional
235- Routes * ListenerRoutes `json:"routes ,omitempty"`
225+ AllowedRoutes * AllowedRoutes `json:"allowedRoutes ,omitempty"`
236226}
237227
238228// ProtocolType defines the application protocol accepted by a Listener.
@@ -293,7 +283,7 @@ type GatewayTLSConfig struct {
293283 // References to a resource in different namespace are invalid UNLESS there
294284 // is a ReferencePolicy in the target namespace that allows the certificate
295285 // 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
297287 // "InvalidCertificateRef" reason.
298288 //
299289 // This field is required when mode is set to "Terminate" (default) and
@@ -339,11 +329,10 @@ const (
339329 TLSModePassthrough TLSModeType = "Passthrough"
340330)
341331
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.
347336 //
348337 // Support: Core
349338 //
@@ -358,7 +347,7 @@ type ListenerRoutes struct {
358347 // A RouteGroupKind MUST correspond to kinds of Routes that are compatible
359348 // with the application protocol specified in the Listener's Protocol field.
360349 // 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
362351 // "InvalidRoutesRef" reason.
363352 //
364353 // Support: Core
@@ -368,18 +357,21 @@ type ListenerRoutes struct {
368357 Kinds []RouteGroupKind `json:"kinds,omitempty"`
369358}
370359
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.
372362//
373363// +kubebuilder:validation:Enum=All;Selector;Same
374- type RouteSelectType string
364+ type NamespacesFrom string
375365
376366const (
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"
383375)
384376
385377// RouteNamespaces indicate which namespaces Routes should be selected from.
@@ -395,7 +387,7 @@ type RouteNamespaces struct {
395387 //
396388 // +optional
397389 // +kubebuilder:default=Same
398- From * RouteSelectType `json:"from,omitempty"`
390+ From * NamespacesFrom `json:"from,omitempty"`
399391
400392 // Selector must be specified when From is set to "Selector". In that case,
401393 // only Routes in Namespaces matching this Selector will be selected by this
@@ -532,10 +524,9 @@ const (
532524 //
533525 // * "Scheduled"
534526 //
535- // Possible reasons for this condition to be false are:
527+ // Possible reasons for this condition to be False are:
536528 //
537529 // * "NotReconciled"
538- // * "NoSuchGatewayClass"
539530 // * "NoResources"
540531 //
541532 // Controllers may raise this condition with other reasons,
@@ -551,13 +542,6 @@ const (
551542 // been recently created and no controller has reconciled it yet.
552543 GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled"
553544
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-
561545 // This reason is used with the "Scheduled" condition when the
562546 // Gateway is not scheduled because insufficient infrastructure
563547 // resources are available.
@@ -579,7 +563,7 @@ const (
579563 //
580564 // * "Ready"
581565 //
582- // Possible reasons for this condition to be false are:
566+ // Possible reasons for this condition to be False are:
583567 //
584568 // * "ListenersNotValid"
585569 // * "ListenersNotReady"
@@ -614,9 +598,7 @@ const (
614598
615599// ListenerStatus is the status associated with a Listener.
616600type 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.
620602 Name SectionName `json:"name"`
621603
622604 // SupportedKinds is the list indicating the Kinds supported by this
@@ -662,7 +644,7 @@ const (
662644 // * "ProtocolConflict"
663645 // * "RouteConflict"
664646 //
665- // Possible reasons for this condition to be false are:
647+ // Possible reasons for this condition to be False are:
666648 //
667649 // * "NoConflicts"
668650 //
@@ -674,7 +656,7 @@ const (
674656 // This reason is used with the "Conflicted" condition when
675657 // the Listener conflicts with hostnames in other Listeners. For
676658 // 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.
678660 ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict"
679661
680662 // This reason is used with the "Conflicted" condition when
@@ -690,7 +672,7 @@ const (
690672 ListenerReasonRouteConflict ListenerConditionReason = "RouteConflict"
691673
692674 // This reason is used with the "Conflicted" condition when the condition
693- // is false .
675+ // is False .
694676 ListenerReasonNoConflicts ListenerConditionReason = "NoConflicts"
695677)
696678
@@ -712,7 +694,7 @@ const (
712694 // * "UnsupportedProtocol"
713695 // * "UnsupportedAddress"
714696 //
715- // Possible reasons for this condition to be false are:
697+ // Possible reasons for this condition to be False are:
716698 //
717699 // * "Attached"
718700 //
@@ -742,7 +724,7 @@ const (
742724 ListenerReasonUnsupportedAddress ListenerConditionReason = "UnsupportedAddress"
743725
744726 // This reason is used with the "Detached" condition when the condition is
745- // false .
727+ // False .
746728 ListenerReasonAttached ListenerConditionReason = "Attached"
747729)
748730
@@ -754,11 +736,10 @@ const (
754736 //
755737 // * "ResolvedRefs"
756738 //
757- // Possible reasons for this condition to be false are:
739+ // Possible reasons for this condition to be False are:
758740 //
759- // * "DegradedRoutes"
760741 // * "InvalidCertificateRef"
761- // * "InvalidRoutesRef "
742+ // * "InvalidRouteKinds "
762743 // * "RefNotPermitted"
763744 //
764745 // Controllers may raise this condition with other reasons,
@@ -770,23 +751,14 @@ const (
770751 // is true.
771752 ListenerReasonResolvedRefs ListenerConditionReason = "ResolvedRefs"
772753
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-
779754 // This reason is used with the "ResolvedRefs" condition when the
780755 // Listener has a TLS configuration with a TLS CertificateRef
781756 // that is invalid or cannot be resolved.
782757 ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef"
783758
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"
790762
791763 // This reason is used with the "ResolvedRefs" condition when
792764 // one of the Listener's Routes has a BackendRef to an object in
@@ -803,7 +775,7 @@ const (
803775 //
804776 // * "Ready"
805777 //
806- // Possible reasons for this condition to be false are:
778+ // Possible reasons for this condition to be False are:
807779 //
808780 // * "Invalid"
809781 // * "Pending"
0 commit comments