Skip to content

Commit d851d24

Browse files
dprotasoshaneutt
andauthored
Support attaching ListenerSets across namespaces (#3632)
* Add support for cross-namespace gateway attachment * drop 'Support: Core' from the listener set go types * update GEP to match go types * move some goals that are now addressed by the GEP * Update gateway_types.go Co-authored-by: Shane Utt <[email protected]> * Make ListenerSets opt-in and remove extra ':w' --------- Co-authored-by: Shane Utt <[email protected]>
1 parent 5183726 commit d851d24

File tree

12 files changed

+225
-66
lines changed

12 files changed

+225
-66
lines changed

apis/v1/gateway_types.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,22 @@ type ListenerNamespaces struct {
307307
// values are:
308308
//
309309
// * Same: Only ListenerSets in the same namespace may be attached to this Gateway.
310+
// * Selector: ListenerSets in namespaces selected by the selector may be attached to this Gateway.
311+
// * All: ListenerSets in all namespaces may be attached to this Gateway.
310312
// * None: Only listeners defined in the Gateway's spec are allowed
311313
//
312314
// While this feature is experimental, the default value None
313315
//
314316
// +optional
315317
// +kubebuilder:default=None
316-
// +kubebuilder:validation:Enum=Same;None
317318
From *FromNamespaces `json:"from,omitempty"`
319+
320+
// Selector must be specified when From is set to "Selector". In that case,
321+
// only ListenerSets in Namespaces matching this Selector will be selected by this
322+
// Gateway. This field is ignored for other values of "From".
323+
//
324+
// +optional
325+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
318326
}
319327

320328
// Listener embodies the concept of a logical endpoint where a Gateway accepts

apis/v1/zz_generated.deepcopy.go

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

apisx/v1alpha1/listenerset_types.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ type ListenerEntry struct {
9595
// Name is not required to be unique across a Gateway and ListenerSets.
9696
// Routes can attach to a Listener by having a ListenerSet as a parentRef
9797
// and setting the SectionName
98-
//
99-
// Support: Core
10098
Name SectionName `json:"name"`
10199

102100
// Hostname specifies the virtual hostname to match for protocol types that
@@ -124,22 +122,16 @@ type ListenerEntry struct {
124122
// as a suffix match. That means that a match for `*.example.com` would match
125123
// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
126124
//
127-
// Support: Core
128-
//
129125
// +optional
130126
Hostname *Hostname `json:"hostname,omitempty"`
131127

132128
// Port is the network port. Multiple listeners may use the
133129
// same port, subject to the Listener compatibility rules.
134130
//
135-
// Support: Core
136-
//
137131
// +optional
138132
Port PortNumber `json:"port,omitempty"`
139133

140134
// Protocol specifies the network protocol this listener expects to receive.
141-
//
142-
// Support: Core
143135
Protocol ProtocolType `json:"protocol"`
144136

145137
// TLS is the TLS configuration for the Listener. This field is required if
@@ -152,8 +144,6 @@ type ListenerEntry struct {
152144
// The GatewayClass MUST use the longest matching SNI out of all
153145
// available certificates for any TLS handshake.
154146
//
155-
// Support: Core
156-
//
157147
// +optional
158148
TLS *GatewayTLSConfig `json:"tls,omitempty"`
159149

@@ -180,7 +170,6 @@ type ListenerEntry struct {
180170
// example, even if a filter specified by a Route rule is invalid, the rest
181171
// of the rules within that Route should still be supported.
182172
//
183-
// Support: Core
184173
// +kubebuilder:default={namespaces:{from: Same}}
185174
// +optional
186175
AllowedRoutes *AllowedRoutes `json:"allowedRoutes,omitempty"`

apisx/v1alpha1/shared_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type (
3939
RouteGroupKind = v1.RouteGroupKind
4040
// +k8s:deepcopy-gen=false
4141
SectionName = v1.SectionName
42+
// +k8s:deepcopy-gen=false
43+
Namespace = v1.Namespace
4244
)
4345

4446
// ParentGatewayReference identifies an API object including its namespace,
@@ -58,4 +60,11 @@ type ParentGatewayReference struct {
5860

5961
// Name is the name of the referent.
6062
Name ObjectName `json:"name"`
63+
64+
// Namespace is the namespace of the referent. If not present,
65+
// the namespace of the referent is assumed to be the same as
66+
// the namespace of the referring object.
67+
//
68+
// +optional
69+
Namespace *Namespace `json:"namespace,omitempty"`
6170
}

apisx/v1alpha1/zz_generated.deepcopy.go

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

applyconfiguration/apis/v1/listenernamespaces.go

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfiguration/apisx/v1alpha1/parentgatewayreference.go

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

applyconfiguration/internal/internal.go

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

config/crd/experimental/gateway.networking.k8s.io_gateways.yaml

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

0 commit comments

Comments
 (0)