Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions apis/v1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ type GatewaySpec struct {
// Implementations MAY merge separate Gateways onto a single set of
// Addresses if all Listeners across all Gateways are compatible.
//
// In a future release the MinItems=1 requirement MAY be dropped.
//
// Support: Core
//
// +listType=map
Expand Down Expand Up @@ -279,6 +281,40 @@ type GatewaySpec struct {
// +optional
// <gateway:experimental>
BackendTLS *GatewayBackendTLS `json:"backendTLS,omitempty"`

// AllowedListeners defines which ListenerSets can be attached to this Gateway.
// While this feature is experimental, the default value is to allow no ListenerSets.
//
// <gateway:experimental>
//
// +optional
AllowedListeners *AllowedListeners `json:"allowedListeners,omitempty"`
}

// AllowedListeners defines which ListenerSets can be attached to this Gateway.
type AllowedListeners struct {
// Namespaces defines which namespaces ListenerSets can be attached to this Gateway.
// While this feature is experimental, the default value is to allow no ListenerSets.
//
// +optional
// +kubebuilder:default={from: None}
Namespaces *ListenerNamespaces `json:"namespaces,omitempty"`
}

// ListenerNamespaces indicate which namespaces ListenerSets should be selected from.
type ListenerNamespaces struct {
// From indicates where ListenerSets can attach to this Gateway. Possible
// values are:
//
// * Same: Only ListenerSets in the same namespace may be attached to this Gateway.
// * None: Only listeners defined in the Gateway's spec are allowed
//
// While this feature is experimental, the default value None
//
// +optional
// +kubebuilder:default=None
// +kubebuilder:validation:Enum=Same;None
From *FromNamespaces `json:"from,omitempty"`
}

// Listener embodies the concept of a logical endpoint where a Gateway accepts
Expand Down Expand Up @@ -602,21 +638,23 @@ type AllowedRoutes struct {
Kinds []RouteGroupKind `json:"kinds,omitempty"`
}

// FromNamespaces specifies namespace from which Routes may be attached to a
// FromNamespaces specifies namespace from which Routes/ListenerSets may be attached to a
// Gateway.
//
// +kubebuilder:validation:Enum=All;Selector;Same
// +kubebuilder:validation:Enum=All;Selector;Same;None
type FromNamespaces string

const (
// Routes in all namespaces may be attached to this Gateway.
// Routes/ListenerSets in all namespaces may be attached to this Gateway.
NamespacesFromAll FromNamespaces = "All"
// Only Routes in namespaces selected by the selector may be attached to
// Only Routes/ListenerSets in namespaces selected by the selector may be attached to
// this Gateway.
NamespacesFromSelector FromNamespaces = "Selector"
// Only Routes in the same namespace as the Gateway may be attached to this
// Only Routes/ListenerSets in the same namespace as the Gateway may be attached to this
// Gateway.
NamespacesFromSame FromNamespaces = "Same"
// No Routes/ListenerSets may be attached to this Gateway.
NamespacesFromNone FromNamespaces = "None"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dprotaso what's the user case for None?

)

// RouteNamespaces indicate which namespaces Routes should be selected from.
Expand Down
45 changes: 45 additions & 0 deletions apis/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions apisx/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package apisx
24 changes: 24 additions & 0 deletions apisx/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2025 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the gateway.networking.k8s-x.io
// API group.
//
// +k8s:openapi-gen=true
// +kubebuilder:object:generate=true
// +groupName=gateway.networking.x-k8s.io
// +groupGoName=Experimental
package v1alpha1
Loading