Skip to content

Commit 79af272

Browse files
authored
ListenerSet APIs + Generated Clients (#3588)
* add listenerset types * adjust GEP to match go type * run deepcopy-gen & register-gen * perform code generation * Add ListenerSetList type * remove TODO for cel validation that allows an optional port * add Gateway allowedListeners property * Add 'None' as an allowable option for FromNamespaces * combine into a single client * fix group name to be x-k8s.io * add a blurb about listener conflict * listener names don't need to be unique across listenersets and gateways * change use of ListenerSet conditions to a MUST requirement * add a Programmed Reason of ParentNotProgrammed * fix typo * parentRef is not optional * add a note about Gateway Listener list MAY drop MinItems=1 requirement * Update GEP to experimental * update GEP metadata * AllowedListeners is no longer a list
1 parent 000fcbc commit 79af272

File tree

166 files changed

+4203
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+4203
-131
lines changed

apis/v1/gateway_types.go

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ type GatewaySpec struct {
223223
// Implementations MAY merge separate Gateways onto a single set of
224224
// Addresses if all Listeners across all Gateways are compatible.
225225
//
226+
// In a future release the MinItems=1 requirement MAY be dropped.
227+
//
226228
// Support: Core
227229
//
228230
// +listType=map
@@ -279,6 +281,40 @@ type GatewaySpec struct {
279281
// +optional
280282
// <gateway:experimental>
281283
BackendTLS *GatewayBackendTLS `json:"backendTLS,omitempty"`
284+
285+
// AllowedListeners defines which ListenerSets can be attached to this Gateway.
286+
// While this feature is experimental, the default value is to allow no ListenerSets.
287+
//
288+
// <gateway:experimental>
289+
//
290+
// +optional
291+
AllowedListeners *AllowedListeners `json:"allowedListeners,omitempty"`
292+
}
293+
294+
// AllowedListeners defines which ListenerSets can be attached to this Gateway.
295+
type AllowedListeners struct {
296+
// Namespaces defines which namespaces ListenerSets can be attached to this Gateway.
297+
// While this feature is experimental, the default value is to allow no ListenerSets.
298+
//
299+
// +optional
300+
// +kubebuilder:default={from: None}
301+
Namespaces *ListenerNamespaces `json:"namespaces,omitempty"`
302+
}
303+
304+
// ListenerNamespaces indicate which namespaces ListenerSets should be selected from.
305+
type ListenerNamespaces struct {
306+
// From indicates where ListenerSets can attach to this Gateway. Possible
307+
// values are:
308+
//
309+
// * Same: Only ListenerSets in the same namespace may be attached to this Gateway.
310+
// * None: Only listeners defined in the Gateway's spec are allowed
311+
//
312+
// While this feature is experimental, the default value None
313+
//
314+
// +optional
315+
// +kubebuilder:default=None
316+
// +kubebuilder:validation:Enum=Same;None
317+
From *FromNamespaces `json:"from,omitempty"`
282318
}
283319

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

605-
// FromNamespaces specifies namespace from which Routes may be attached to a
641+
// FromNamespaces specifies namespace from which Routes/ListenerSets may be attached to a
606642
// Gateway.
607643
//
608-
// +kubebuilder:validation:Enum=All;Selector;Same
644+
// +kubebuilder:validation:Enum=All;Selector;Same;None
609645
type FromNamespaces string
610646

611647
const (
612-
// Routes in all namespaces may be attached to this Gateway.
648+
// Routes/ListenerSets in all namespaces may be attached to this Gateway.
613649
NamespacesFromAll FromNamespaces = "All"
614-
// Only Routes in namespaces selected by the selector may be attached to
650+
// Only Routes/ListenerSets in namespaces selected by the selector may be attached to
615651
// this Gateway.
616652
NamespacesFromSelector FromNamespaces = "Selector"
617-
// Only Routes in the same namespace as the Gateway may be attached to this
653+
// Only Routes/ListenerSets in the same namespace as the Gateway may be attached to this
618654
// Gateway.
619655
NamespacesFromSame FromNamespaces = "Same"
656+
// No Routes/ListenerSets may be attached to this Gateway.
657+
NamespacesFromNone FromNamespaces = "None"
620658
)
621659

622660
// RouteNamespaces indicate which namespaces Routes should be selected from.

apis/v1/zz_generated.deepcopy.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apisx/doc.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package apisx

apisx/v1alpha1/doc.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API Schema definitions for the gateway.networking.k8s-x.io
18+
// API group.
19+
//
20+
// +k8s:openapi-gen=true
21+
// +kubebuilder:object:generate=true
22+
// +groupName=gateway.networking.x-k8s.io
23+
// +groupGoName=Experimental
24+
package v1alpha1

0 commit comments

Comments
 (0)