Skip to content

Commit b1cc891

Browse files
committed
Update Listener condition types.
Update the condition types and reasons for the Listener condition type. Signed-off-by: James Peach <[email protected]>
1 parent a639f55 commit b1cc891

13 files changed

+496
-230
lines changed

apis/v1alpha1/gateway_types.go

Lines changed: 142 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type GatewaySpec struct {
8787
//
8888
// If this field specifies multiple Listeners that have the same
8989
// Port value but are not compatible, the GatewayClass must raise
90-
// a "PortConflict" condition on the Gateway.
90+
// a "Conflicted" condition in the Listener status.
9191
//
9292
// Support: Core
9393
//
@@ -284,11 +284,11 @@ const (
284284
HostnameMatchAny HostnameMatchType = "Any"
285285
)
286286

287-
// ProtocolType defines the application protocol accepted by a
288-
// Listener. Implementations are not required to accept all the
289-
// defined protocols. If an implementation does not support a
290-
// specified protocol, it should raise a "ConditionUnsupportedProtocol"
291-
// condition for the affected Listener.
287+
// ProtocolType defines the application protocol accepted by a Listener.
288+
// Implementations are not required to accept all the defined protocols.
289+
// If an implementation does not support a specified protocol, it
290+
// should raise a "Detached" condition for the affected Listener with
291+
// a reason of "UnsupportedProtocol".
292292
//
293293
// Valid ProtocolType values are:
294294
//
@@ -591,6 +591,8 @@ type GatewayStatus struct {
591591
// Listeners provide status for each unique listener port defined in the Spec.
592592
//
593593
// +optional
594+
// +listType=map
595+
// +listMapKey=port
594596
// +kubebuilder:validation:MaxItems=64
595597
Listeners []ListenerStatus `json:"listeners,omitempty"`
596598
}
@@ -618,7 +620,7 @@ const (
618620
//
619621
// Controllers may raise this condition with other reasons,
620622
// but should prefer to use the reasons listed above to improve
621-
// interoperability.`
623+
// interoperability.
622624
GatewayConditionScheduled GatewayConditionType = "Scheduled"
623625

624626
// GatewayReasonNotReconciled is used when the Gateway is
@@ -708,38 +710,138 @@ type ListenerStatus struct {
708710
// field.
709711
type ListenerConditionType string
710712

713+
// ListenerConditionReason defines the set of reasons that explain
714+
// why a particular Listener condition type has been raised.
715+
type ListenerConditionReason string
716+
711717
const (
712-
// ConditionInvalidListener is a generic condition that is a catch all for
713-
// unsupported configurations that do not match a more specific condition.
714-
// Implementers should try to use a more specific condition instead of this
715-
// one to give users and automation more information.
716-
ConditionInvalidListener ListenerConditionType = "InvalidListener"
717-
718-
// ConditionListenerNotReady indicates the listener is not ready.
719-
ConditionListenerNotReady ListenerConditionType = "ListenerNotReady"
720-
721-
// ConditionPortConflict indicates that two or more Listeners with
722-
// the same port were bound to this gateway and they could not be
723-
// collapsed into a single configuration.
724-
ConditionPortConflict ListenerConditionType = "PortConflict"
725-
726-
// ConditionInvalidCertificateRef indicates the certificate reference of the
727-
// listener's TLS configuration is invalid.
728-
ConditionInvalidCertificateRef ListenerConditionType = "InvalidCertificateRef"
729-
730-
// ConditionRoutesNotReady indicates that at least one of the specified
731-
// routes is not ready.
732-
ConditionRoutesNotReady ListenerConditionType = "RoutesNotReady"
733-
734-
// ConditionInvalidRoutes indicates that at least one of the specified
735-
// routes is invalid.
736-
ConditionInvalidRoutes ListenerConditionType = "InvalidRoutes"
737-
738-
// ConditionForbiddenRoutesForClass indicates that at least one of the
739-
// routes is in a namespace forbidden by the GatewayClass.
740-
ConditionForbiddenRoutesForClass ListenerConditionType = "ForbiddenRoutesForClass"
741-
742-
// ConditionUnsupportedProtocol indicates that an invalid
743-
// or unsupported protocol type was requested.
744-
ConditionUnsupportedProtocol ListenerConditionType = "UnsupportedProtocol"
718+
// ListenerConditionConflicted indicates that the controller
719+
// was unable to resolve conflicting specification requirements
720+
// for this Listener. If a Listener is conflicted, its network
721+
// port should not be configured on any network elements.
722+
//
723+
// Possible reasons for this condition to be true are:
724+
//
725+
// * "HostnameConflict"
726+
// * "ProtocolConflict"
727+
// * "RouteConflict"
728+
//
729+
// Controllers may raise this condition with other reasons,
730+
// but should prefer to use the reasons listed above to improve
731+
// interoperability.
732+
ListenerConditionConflicted ListenerConditionType = "Conflicted"
733+
734+
// ListenerReasonHostnameConflict is used when the Listener
735+
// violates the Hostname match constraints that allow collapsing
736+
// Listeners. For example, this reason would be used when multiple
737+
// Listeners on the same port use the "Any" hostname match type.
738+
ListenerReasonHostnameConflict ListenerConditionReason = "HostnameConflict"
739+
740+
// ListenerReasonProtocolConflict is used when multiple
741+
// Listeners are specified with the same Listener port number,
742+
// but have conflicting protocol specifications.
743+
ListenerReasonProtocolConflict ListenerConditionReason = "ProtocolConflict"
744+
745+
// ListenerReasonRouteConflict is used when the route
746+
// resources selected for this Listener conflict with other
747+
// specified properties of the Listener (e.g. Protocol).
748+
// For example, a Listener that specifies "UDP" as the protocol
749+
// but a route selector that resolves "TCPRoute" objects.
750+
ListenerReasonRouteConflict ListenerConditionReason = "RouteConflict"
751+
)
752+
753+
const (
754+
// ListenerConditionDetached indicates that, even though
755+
// the listener is syntactically and semantically valid, the
756+
// controller is not able to configure it on the underlying
757+
// Gateway infrastructure.
758+
//
759+
// A Listener is specified as a logical requirement, but needs to be
760+
// configured on a network endpoint (i.e. address and port) by a
761+
// controller. The controller may be unable to attach the Listener
762+
// if it specifies an unsupported requirement, or prerequisite
763+
// resources are not available.
764+
//
765+
// Possible reasons for this condition to be true are:
766+
//
767+
// * "PortUnavailable"
768+
// * "UnsupportedExtension"
769+
// * "UnsupportedProtocol"
770+
//
771+
// Controllers may raise this condition with other reasons,
772+
// but should prefer to use the reasons listed above to improve
773+
// interoperability.
774+
ListenerConditionDetached ListenerConditionType = "Detached"
775+
776+
// ListenerReasonPortUnavailable is used when the Listener
777+
// requests a port that cannot be used on the Gateway.
778+
ListenerReasonPortUnavailable ListenerConditionReason = "PortUnavailable"
779+
780+
// ListenerReasonUnsupportedExtension is used when the
781+
// controller detects that an implementation-specific Listener
782+
// extension is being requested, but is not able to support
783+
// the extension.
784+
ListenerReasonUnsupportedExtension ListenerConditionReason = "UnsupportedExtension"
785+
786+
// ListenerReasonUnsupportedProtocol is used when the
787+
// Listener could not be attached to be Gateway because its
788+
// protocol type is not supported.
789+
ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol"
790+
)
791+
792+
const (
793+
// ListenerConditionResolvedRefs indicates whether the
794+
// controller was able to resolve all the object references
795+
// for the Listener.
796+
//
797+
// Possible reasons for this condition to be false are:
798+
//
799+
// * "DroppedRoutes"
800+
// * "InvalidCertificateRef"
801+
// * "InvalidRoutesRef"
802+
//
803+
// Controllers may raise this condition with other reasons,
804+
// but should prefer to use the reasons listed above to improve
805+
// interoperability.
806+
ListenerConditionResolvedRefs ListenerConditionType = "ResolvedRefs"
807+
808+
// ListenerReasonDroppedRoutes indicates that not all of the routes
809+
// selected by this Listener could be configured. The specific
810+
// reason why each route was dropped should be indicated in the
811+
// route's .Status.Conditions field.
812+
ListenerReasonDroppedRoutes ListenerConditionReason = "DroppedRoutes"
813+
814+
// ListenerReasonInvalidCertificateRef is used when the
815+
// Listener has a TLS configuration with a TLS CertificateRef
816+
// that is invalid or cannot be resolved.
817+
ListenerReasonInvalidCertificateRef ListenerConditionReason = "InvalidCertificateRef"
818+
819+
// ListenerReasonInvalidRoutesRef is used when the Listener's Routes
820+
// selector is invalid or cannot be resolved. Note that it is not
821+
// an error for this selector to not resolve any Routes, and the
822+
// "ResolvedRefs" status condition should not be raised in that case.
823+
ListenerReasonInvalidRoutesRef ListenerConditionReason = "InvalidRoutesRef"
824+
)
825+
826+
const (
827+
// ListenerConditionReady indicates whether the Listener
828+
// has been configured on the Gateway.
829+
//
830+
// Possible reasons for this condition to be false are:
831+
//
832+
// * "Invalid"
833+
// * "Pending"
834+
//
835+
// Controllers may raise this condition with other reasons,
836+
// but should prefer to use the reasons listed above to improve
837+
// interoperability.
838+
ListenerConditionReady ListenerConditionType = "Ready"
839+
840+
// ListenerReasonInvalid is used when the Listener is
841+
// syntactically or semantically invalid.
842+
ListenerReasonInvalid ListenerConditionReason = "Invalid"
843+
844+
// ListenerReasonPending is used when the Listener is not
845+
// yet not online and ready to accept client traffic.
846+
ListenerReasonPending ListenerConditionReason = "Pending"
745847
)

apis/v1alpha1/httproute_types.go

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,13 @@ type HTTPRouteMatch struct {
312312
// string for the group) or an implementation-defined resource (for
313313
// example, resource "myroutematchers" in group "networking.acme.io").
314314
// Omitting or specifying the empty string for both the resource and
315-
// group indicates that the resource is "configmaps". If the referent
316-
// cannot be found, the "InvalidRoutes" status condition on any Gateway
317-
// that includes the HTTPRoute will be true.
315+
// group indicates that the resource is "configmaps".
316+
//
317+
// If the referent cannot be found, the route must be dropped
318+
// from the Gateway. The controller should raise the "ResolvedRefs"
319+
// condition on the Gateway with the "DroppedRoutes" reason.
320+
// The gateway status for this route should be updated with a
321+
// condition that describes the error more specifically.
318322
//
319323
// Support: custom
320324
//
@@ -440,9 +444,13 @@ type HTTPRequestMirrorFilter struct {
440444
// ServiceName refers to the name of the Service to mirror matched requests
441445
// to. When specified, this takes the place of BackendRef. If both
442446
// BackendRef and ServiceName are specified, ServiceName will be given
443-
// precedence. If the referent cannot be found, controllers must set the
444-
// "InvalidRoutes" status condition on any Gateway that includes this
445-
// Route to true.
447+
// precedence.
448+
//
449+
// If the referent cannot be found, the route must be dropped
450+
// from the Gateway. The controller should raise the "ResolvedRefs"
451+
// condition on the Gateway with the "DroppedRoutes" reason.
452+
// The gateway status for this route should be updated with a
453+
// condition that describes the error more specifically.
446454
//
447455
// Support: Core
448456
//
@@ -452,22 +460,33 @@ type HTTPRequestMirrorFilter struct {
452460

453461
// BackendRef is a local object reference to mirror matched requests to. If
454462
// both BackendRef and ServiceName are specified, ServiceName will be given
455-
// precedence. If the referent cannot be found, controllers must set the
456-
// "InvalidRoutes" status condition on any Gateway that includes this Route
457-
// to true.
463+
// precedence.
464+
//
465+
// If the referent cannot be found, the route must be dropped
466+
// from the Gateway. The controller should raise the "ResolvedRefs"
467+
// condition on the Gateway with the "DroppedRoutes" reason.
468+
// The gateway status for this route should be updated with a
469+
// condition that describes the error more specifically.
458470
//
459471
// Support: Custom
460472
//
461473
// +optional
462474
BackendRef *LocalObjectReference `json:"backendRef,omitempty"`
463475

464-
// Port specifies the destination port number to use for the backend
465-
// referenced by the ServiceName or BackendRef field. If unspecified and a
466-
// Service object consisting of a single port definition is the backend,
467-
// that port will be used. If unspecified and the backend is a Service
468-
// object consisting of multiple port definitions, controllers must set the
469-
// "InvalidRoutes" status condition on any Gateway that includes this Route
470-
// to true.
476+
// Port specifies the destination port number to use for the
477+
// backend referenced by the ServiceName or BackendRef field.
478+
//
479+
// If the port is unspecified and a Service object consisting
480+
// of a single port definition is the backend, that port will
481+
// be used.
482+
//
483+
// If the port is unspecified and the backend is a Service
484+
// object consisting of multiple port definitions, the route
485+
// must be dropped from the Gateway. The controller should
486+
// raise the "ResolvedRefs" condition on the Gateway with the
487+
// "DroppedRoutes" reason. The gateway status for this route
488+
// should be updated with a condition that describes the error
489+
// more specifically.
471490
//
472491
// Support: Core
473492
//
@@ -482,9 +501,13 @@ type HTTPRouteForwardTo struct {
482501
// ServiceName refers to the name of the Service to forward matched requests
483502
// to. When specified, this takes the place of BackendRef. If both
484503
// BackendRef and ServiceName are specified, ServiceName will be given
485-
// precedence. If the referent cannot be found, controllers must set the
486-
// "InvalidRoutes" status condition on any Gateway that includes this
487-
// Route to true.
504+
// precedence.
505+
//
506+
// If the referent cannot be found, the route must be dropped
507+
// from the Gateway. The controller should raise the "ResolvedRefs"
508+
// condition on the Gateway with the "DroppedRoutes" reason.
509+
// The gateway status for this route should be updated with a
510+
// condition that describes the error more specifically.
488511
//
489512
// Support: Core
490513
//
@@ -494,22 +517,33 @@ type HTTPRouteForwardTo struct {
494517

495518
// BackendRef is a reference to a backend to forward matched requests to. If
496519
// both BackendRef and ServiceName are specified, ServiceName will be given
497-
// precedence. If the referent cannot be found, controllers must set the
498-
// "InvalidRoutes" status condition on any Gateway that includes this Route
499-
// to true.
520+
// precedence.
521+
//
522+
// If the referent cannot be found, the route must be dropped
523+
// from the Gateway. The controller should raise the "ResolvedRefs"
524+
// condition on the Gateway with the "DroppedRoutes" reason.
525+
// The gateway status for this route should be updated with a
526+
// condition that describes the error more specifically.
500527
//
501528
// Support: Custom
502529
//
503530
// +optional
504531
BackendRef *LocalObjectReference `json:"backendRef,omitempty"`
505532

506-
// Port specifies the destination port number to use for the backend
507-
// referenced by the ServiceName or BackendRef field. If unspecified and a
508-
// Service object consisting of a single port definition is the backend,
509-
// that port will be used. If unspecified and the backend is a Service
510-
// object consisting of multiple port definitions, controllers must set the
511-
// "InvalidRoutes" status condition on any Gateway that includes this Route
512-
// to true.
533+
// Port specifies the destination port number to use for the
534+
// backend referenced by the ServiceName or BackendRef field.
535+
//
536+
// If the port is unspecified and a Service object consisting
537+
// of a single port definition is the backend, that port will
538+
// be used.
539+
//
540+
// If the port is unspecified and the backend is a Service
541+
// object consisting of multiple port definitions, the route
542+
// must be dropped from the Gateway. The controller should
543+
// raise the "ResolvedRefs" condition on the Gateway with the
544+
// "DroppedRoutes" reason. The gateway status for this route
545+
// should be updated with a condition that describes the error
546+
// more specifically.
513547
//
514548
// Support: Core
515549
//

0 commit comments

Comments
 (0)