@@ -430,9 +430,7 @@ type RouteBindingSelector struct {
430430 // default.
431431 //
432432 // Support: Core
433- //
434- // +kubebuilder:default={onlySameNamespace:true}
435- RouteNamespaces RouteNamespaces `json:"routeNamespaces,omitempty"`
433+ RouteNamespaces RouteNamespaces `json:"routeNamespaces"`
436434 // RouteSelector specifies a set of route labels used for selecting
437435 // routes to associate with the Gateway. If RouteSelector is defined,
438436 // only routes matching the RouteSelector are associated with the Gateway.
@@ -475,36 +473,43 @@ type RouteBindingSelector struct {
475473 Kind string `json:"kind"`
476474}
477475
476+ // RouteSelectType specifies where Routes should be selected by a Gateway.
477+ // +kubebuilder:validation:Enum=All;Selector;Same
478+ // +kubebuilder:default=Same
479+ type RouteSelectType string
480+
481+ const (
482+ // RouteSelectAll indicates that Routes in all namespaces may be used by
483+ // this Gateway.
484+ RouteSelectAll RouteSelectType = "All"
485+ // RouteSelectSelector indicates that only Routes in namespaces selected by
486+ // the selector may be used by this Gateway.
487+ RouteSelectSelector RouteSelectType = "Selector"
488+ // RouteSelectSame indicates that Only Routes in the same namespace may be
489+ // used by this Gateway.
490+ RouteSelectSame RouteSelectType = "Same"
491+ )
492+
478493// RouteNamespaces indicate which namespaces Routes should be selected from.
479494type RouteNamespaces struct {
480- // NamespaceSelector is a selector of namespaces that Routes should be
481- // selected from. This is a standard Kubernetes LabelSelector, a label query
482- // over a set of resources. The result of matchLabels and matchExpressions
483- // are ANDed. Controllers must not support Routes in namespaces outside this
484- // selector.
485- //
486- // An empty selector (default) indicates that Routes in any namespace can be
487- // selected.
488- //
489- // The OnlySameNamespace field takes precedence over this field. This
490- // selector will only take effect when OnlySameNamespace is false.
495+ // From indicates where Routes will be selected for this Gateway. Possible
496+ // values are:
497+ // * All: Routes in all namespaces may be used by this Gateway.
498+ // * Selector: Routes in namespaces selected by the selector may be used by
499+ // this Gateway.
500+ // * Same: Only Routes in the same namespace may be used by this Gateway.
491501 //
492502 // Support: Core
493- //
494- // +optional
495- NamespaceSelector metav1.LabelSelector `json:"namespaceSelector,omitempty"`
503+ From RouteSelectType `json:"from,omitempty"`
496504
497- // OnlySameNamespace is a boolean used to indicate if Route references are
498- // limited to the same Namespace as the Gateway. When true, only Routes
499- // within the same Namespace as the Gateway should be selected.
500- //
501- // This field takes precedence over the NamespaceSelector field. That
502- // selector should only take effect when this field is set to false.
505+ // Selector must be specified when From is set to "Selector". In that case,
506+ // only Routes in Namespaces matching this Selector will be selected by this
507+ // Gateway. This field is ignored for other values of "From".
503508 //
504509 // Support: Core
505510 //
506- // +kubebuilder:default=true
507- OnlySameNamespace bool `json:"onlySameNamespace ,omitempty"`
511+ // +optional
512+ Selector metav1. LabelSelector `json:"selector ,omitempty"`
508513}
509514
510515// GatewayAddress describes an address that can be bound to a Gateway.
0 commit comments