gateway_api/apis/experimental/gateways.rs
1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium --schema=derived --derive=JsonSchema --derive=Default --derive=PartialEq --docs -f -
3// kopium version: 0.22.5
4
5#[allow(unused_imports)]
6mod prelude {
7 pub use std::collections::BTreeMap;
8
9 pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
10 pub use kube::CustomResource;
11 pub use schemars::JsonSchema;
12 pub use serde::{Deserialize, Serialize};
13}
14use self::prelude::*;
15
16/// Spec defines the desired state of Gateway.
17#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
18#[kube(
19 group = "gateway.networking.k8s.io",
20 version = "v1",
21 kind = "Gateway",
22 plural = "gateways"
23)]
24#[kube(namespaced)]
25#[kube(status = "GatewayStatus")]
26#[kube(derive = "Default")]
27#[kube(derive = "PartialEq")]
28pub struct GatewaySpec {
29 /// Addresses requested for this Gateway. This is optional and behavior can
30 /// depend on the implementation. If a value is set in the spec and the
31 /// requested address is invalid or unavailable, the implementation MUST
32 /// indicate this in an associated entry in GatewayStatus.Conditions.
33 ///
34 /// The Addresses field represents a request for the address(es) on the
35 /// "outside of the Gateway", that traffic bound for this Gateway will use.
36 /// This could be the IP address or hostname of an external load balancer or
37 /// other networking infrastructure, or some other address that traffic will
38 /// be sent to.
39 ///
40 /// If no Addresses are specified, the implementation MAY schedule the
41 /// Gateway in an implementation-specific manner, assigning an appropriate
42 /// set of Addresses.
43 ///
44 /// The implementation MUST bind all Listeners to every GatewayAddress that
45 /// it assigns to the Gateway and add a corresponding entry in
46 /// GatewayStatus.Addresses.
47 ///
48 /// Support: Extended
49 #[serde(default, skip_serializing_if = "Option::is_none")]
50 pub addresses: Option<Vec<GatewayAddresses>>,
51 /// AllowedListeners defines which ListenerSets can be attached to this Gateway.
52 /// The default value is to allow no ListenerSets.
53 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedListeners")]
54 pub allowed_listeners: Option<GatewayAllowedListeners>,
55 /// DefaultScope, when set, configures the Gateway as a default Gateway,
56 /// meaning it will dynamically and implicitly have Routes (e.g. HTTPRoute)
57 /// attached to it, according to the scope configured here.
58 ///
59 /// If unset (the default) or set to None, the Gateway will not act as a
60 /// default Gateway; if set, the Gateway will claim any Route with a
61 /// matching scope set in its UseDefaultGateway field, subject to the usual
62 /// rules about which routes the Gateway can attach to.
63 ///
64 /// Think carefully before using this functionality! While the normal rules
65 /// about which Route can apply are still enforced, it is simply easier for
66 /// the wrong Route to be accidentally attached to this Gateway in this
67 /// configuration. If the Gateway operator is not also the operator in
68 /// control of the scope (e.g. namespace) with tight controls and checks on
69 /// what kind of workloads and Routes get added in that scope, we strongly
70 /// recommend not using this just because it seems convenient, and instead
71 /// stick to direct Route attachment.
72 #[serde(default, skip_serializing_if = "Option::is_none", rename = "defaultScope")]
73 pub default_scope: Option<GatewayDefaultScope>,
74 /// GatewayClassName used for this Gateway. This is the name of a
75 /// GatewayClass resource.
76 #[serde(rename = "gatewayClassName")]
77 pub gateway_class_name: String,
78 /// Infrastructure defines infrastructure level attributes about this Gateway instance.
79 ///
80 /// Support: Extended
81 #[serde(default, skip_serializing_if = "Option::is_none")]
82 pub infrastructure: Option<GatewayInfrastructure>,
83 /// Listeners associated with this Gateway. Listeners define
84 /// logical endpoints that are bound on this Gateway's addresses.
85 /// At least one Listener MUST be specified.
86 ///
87 /// ## Distinct Listeners
88 ///
89 /// Each Listener in a set of Listeners (for example, in a single Gateway)
90 /// MUST be _distinct_, in that a traffic flow MUST be able to be assigned to
91 /// exactly one listener. (This section uses "set of Listeners" rather than
92 /// "Listeners in a single Gateway" because implementations MAY merge configuration
93 /// from multiple Gateways onto a single data plane, and these rules _also_
94 /// apply in that case).
95 ///
96 /// Practically, this means that each listener in a set MUST have a unique
97 /// combination of Port, Protocol, and, if supported by the protocol, Hostname.
98 ///
99 /// Some combinations of port, protocol, and TLS settings are considered
100 /// Core support and MUST be supported by implementations based on the objects
101 /// they support:
102 ///
103 /// HTTPRoute
104 ///
105 /// 1. HTTPRoute, Port: 80, Protocol: HTTP
106 /// 2. HTTPRoute, Port: 443, Protocol: HTTPS, TLS Mode: Terminate, TLS keypair provided
107 ///
108 /// TLSRoute
109 ///
110 /// 1. TLSRoute, Port: 443, Protocol: TLS, TLS Mode: Passthrough
111 ///
112 /// "Distinct" Listeners have the following property:
113 ///
114 /// **The implementation can match inbound requests to a single distinct
115 /// Listener**.
116 ///
117 /// When multiple Listeners share values for fields (for
118 /// example, two Listeners with the same Port value), the implementation
119 /// can match requests to only one of the Listeners using other
120 /// Listener fields.
121 ///
122 /// When multiple listeners have the same value for the Protocol field, then
123 /// each of the Listeners with matching Protocol values MUST have different
124 /// values for other fields.
125 ///
126 /// The set of fields that MUST be different for a Listener differs per protocol.
127 /// The following rules define the rules for what fields MUST be considered for
128 /// Listeners to be distinct with each protocol currently defined in the
129 /// Gateway API spec.
130 ///
131 /// The set of listeners that all share a protocol value MUST have _different_
132 /// values for _at least one_ of these fields to be distinct:
133 ///
134 /// * **HTTP, HTTPS, TLS**: Port, Hostname
135 /// * **TCP, UDP**: Port
136 ///
137 /// One **very** important rule to call out involves what happens when an
138 /// implementation:
139 ///
140 /// * Supports TCP protocol Listeners, as well as HTTP, HTTPS, or TLS protocol
141 /// Listeners, and
142 /// * sees HTTP, HTTPS, or TLS protocols with the same `port` as one with TCP
143 /// Protocol.
144 ///
145 /// In this case all the Listeners that share a port with the
146 /// TCP Listener are not distinct and so MUST NOT be accepted.
147 ///
148 /// If an implementation does not support TCP Protocol Listeners, then the
149 /// previous rule does not apply, and the TCP Listeners SHOULD NOT be
150 /// accepted.
151 ///
152 /// Note that the `tls` field is not used for determining if a listener is distinct, because
153 /// Listeners that _only_ differ on TLS config will still conflict in all cases.
154 ///
155 /// ### Listeners that are distinct only by Hostname
156 ///
157 /// When the Listeners are distinct based only on Hostname, inbound request
158 /// hostnames MUST match from the most specific to least specific Hostname
159 /// values to choose the correct Listener and its associated set of Routes.
160 ///
161 /// Exact matches MUST be processed before wildcard matches, and wildcard
162 /// matches MUST be processed before fallback (empty Hostname value)
163 /// matches. For example, `"foo.example.com"` takes precedence over
164 /// `"*.example.com"`, and `"*.example.com"` takes precedence over `""`.
165 ///
166 /// Additionally, if there are multiple wildcard entries, more specific
167 /// wildcard entries must be processed before less specific wildcard entries.
168 /// For example, `"*.foo.example.com"` takes precedence over `"*.example.com"`.
169 ///
170 /// The precise definition here is that the higher the number of dots in the
171 /// hostname to the right of the wildcard character, the higher the precedence.
172 ///
173 /// The wildcard character will match any number of characters _and dots_ to
174 /// the left, however, so `"*.example.com"` will match both
175 /// `"foo.bar.example.com"` _and_ `"bar.example.com"`.
176 ///
177 /// ## Handling indistinct Listeners
178 ///
179 /// If a set of Listeners contains Listeners that are not distinct, then those
180 /// Listeners are _Conflicted_, and the implementation MUST set the "Conflicted"
181 /// condition in the Listener Status to "True".
182 ///
183 /// The words "indistinct" and "conflicted" are considered equivalent for the
184 /// purpose of this documentation.
185 ///
186 /// Implementations MAY choose to accept a Gateway with some Conflicted
187 /// Listeners only if they only accept the partial Listener set that contains
188 /// no Conflicted Listeners.
189 ///
190 /// Specifically, an implementation MAY accept a partial Listener set subject to
191 /// the following rules:
192 ///
193 /// * The implementation MUST NOT pick one conflicting Listener as the winner.
194 /// ALL indistinct Listeners must not be accepted for processing.
195 /// * At least one distinct Listener MUST be present, or else the Gateway effectively
196 /// contains _no_ Listeners, and must be rejected from processing as a whole.
197 ///
198 /// The implementation MUST set a "ListenersNotValid" condition on the
199 /// Gateway Status when the Gateway contains Conflicted Listeners whether or
200 /// not they accept the Gateway. That Condition SHOULD clearly
201 /// indicate in the Message which Listeners are conflicted, and which are
202 /// Accepted. Additionally, the Listener status for those listeners SHOULD
203 /// indicate which Listeners are conflicted and not Accepted.
204 ///
205 /// ## General Listener behavior
206 ///
207 /// Note that, for all distinct Listeners, requests SHOULD match at most one Listener.
208 /// For example, if Listeners are defined for "foo.example.com" and "*.example.com", a
209 /// request to "foo.example.com" SHOULD only be routed using routes attached
210 /// to the "foo.example.com" Listener (and not the "*.example.com" Listener).
211 ///
212 /// This concept is known as "Listener Isolation", and it is an Extended feature
213 /// of Gateway API. Implementations that do not support Listener Isolation MUST
214 /// clearly document this, and MUST NOT claim support for the
215 /// `GatewayHTTPListenerIsolation` feature.
216 ///
217 /// Implementations that _do_ support Listener Isolation SHOULD claim support
218 /// for the Extended `GatewayHTTPListenerIsolation` feature and pass the associated
219 /// conformance tests.
220 ///
221 /// ## Compatible Listeners
222 ///
223 /// A Gateway's Listeners are considered _compatible_ if:
224 ///
225 /// 1. They are distinct.
226 /// 2. The implementation can serve them in compliance with the Addresses
227 /// requirement that all Listeners are available on all assigned
228 /// addresses.
229 ///
230 /// Compatible combinations in Extended support are expected to vary across
231 /// implementations. A combination that is compatible for one implementation
232 /// may not be compatible for another.
233 ///
234 /// For example, an implementation that cannot serve both TCP and UDP listeners
235 /// on the same address, or cannot mix HTTPS and generic TLS listens on the same port
236 /// would not consider those cases compatible, even though they are distinct.
237 ///
238 /// Implementations MAY merge separate Gateways onto a single set of
239 /// Addresses if all Listeners across all Gateways are compatible.
240 ///
241 /// In a future release the MinItems=1 requirement MAY be dropped.
242 ///
243 /// Support: Core
244 pub listeners: Vec<GatewayListeners>,
245 /// TLS specifies frontend and backend tls configuration for entire gateway.
246 ///
247 /// Support: Extended
248 #[serde(default, skip_serializing_if = "Option::is_none")]
249 pub tls: Option<GatewayTls>,
250}
251
252/// GatewaySpecAddress describes an address that can be bound to a Gateway.
253#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
254pub struct GatewayAddresses {
255 /// Type of the address.
256 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
257 pub r#type: Option<String>,
258 /// When a value is unspecified, an implementation SHOULD automatically
259 /// assign an address matching the requested type if possible.
260 ///
261 /// If an implementation does not support an empty value, they MUST set the
262 /// "Programmed" condition in status to False with a reason of "AddressNotAssigned".
263 ///
264 /// Examples: `1.2.3.4`, `128::1`, `my-ip-address`.
265 #[serde(default, skip_serializing_if = "Option::is_none")]
266 pub value: Option<String>,
267}
268
269/// AllowedListeners defines which ListenerSets can be attached to this Gateway.
270/// The default value is to allow no ListenerSets.
271#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
272pub struct GatewayAllowedListeners {
273 /// Namespaces defines which namespaces ListenerSets can be attached to this Gateway.
274 /// The default value is to allow no ListenerSets.
275 #[serde(default, skip_serializing_if = "Option::is_none")]
276 pub namespaces: Option<GatewayAllowedListenersNamespaces>,
277}
278
279/// Namespaces defines which namespaces ListenerSets can be attached to this Gateway.
280/// The default value is to allow no ListenerSets.
281#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
282pub struct GatewayAllowedListenersNamespaces {
283 /// From indicates where ListenerSets can attach to this Gateway. Possible
284 /// values are:
285 ///
286 /// * Same: Only ListenerSets in the same namespace may be attached to this Gateway.
287 /// * Selector: ListenerSets in namespaces selected by the selector may be attached to this Gateway.
288 /// * All: ListenerSets in all namespaces may be attached to this Gateway.
289 /// * None: Only listeners defined in the Gateway's spec are allowed
290 ///
291 /// The default value None
292 #[serde(default, skip_serializing_if = "Option::is_none")]
293 pub from: Option<GatewayAllowedListenersNamespacesFrom>,
294 /// Selector must be specified when From is set to "Selector". In that case,
295 /// only ListenerSets in Namespaces matching this Selector will be selected by this
296 /// Gateway. This field is ignored for other values of "From".
297 #[serde(default, skip_serializing_if = "Option::is_none")]
298 pub selector: Option<GatewayAllowedListenersNamespacesSelector>,
299}
300
301/// Namespaces defines which namespaces ListenerSets can be attached to this Gateway.
302/// The default value is to allow no ListenerSets.
303#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
304pub enum GatewayAllowedListenersNamespacesFrom {
305 All,
306 Selector,
307 Same,
308 None,
309}
310
311/// Selector must be specified when From is set to "Selector". In that case,
312/// only ListenerSets in Namespaces matching this Selector will be selected by this
313/// Gateway. This field is ignored for other values of "From".
314#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
315pub struct GatewayAllowedListenersNamespacesSelector {
316 /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
317 #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
318 pub match_expressions: Option<Vec<GatewayAllowedListenersNamespacesSelectorMatchExpressions>>,
319 /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
320 /// map is equivalent to an element of matchExpressions, whose key field is "key", the
321 /// operator is "In", and the values array contains only "value". The requirements are ANDed.
322 #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
323 pub match_labels: Option<BTreeMap<String, String>>,
324}
325
326/// A label selector requirement is a selector that contains values, a key, and an operator that
327/// relates the key and values.
328#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
329pub struct GatewayAllowedListenersNamespacesSelectorMatchExpressions {
330 /// key is the label key that the selector applies to.
331 pub key: String,
332 /// operator represents a key's relationship to a set of values.
333 /// Valid operators are In, NotIn, Exists and DoesNotExist.
334 pub operator: String,
335 /// values is an array of string values. If the operator is In or NotIn,
336 /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
337 /// the values array must be empty. This array is replaced during a strategic
338 /// merge patch.
339 #[serde(default, skip_serializing_if = "Option::is_none")]
340 pub values: Option<Vec<String>>,
341}
342
343/// Spec defines the desired state of Gateway.
344#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
345pub enum GatewayDefaultScope {
346 All,
347 None,
348}
349
350/// Infrastructure defines infrastructure level attributes about this Gateway instance.
351///
352/// Support: Extended
353#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
354pub struct GatewayInfrastructure {
355 /// Annotations that SHOULD be applied to any resources created in response to this Gateway.
356 ///
357 /// For implementations creating other Kubernetes objects, this should be the `metadata.annotations` field on resources.
358 /// For other implementations, this refers to any relevant (implementation specific) "annotations" concepts.
359 ///
360 /// An implementation may chose to add additional implementation-specific annotations as they see fit.
361 ///
362 /// Support: Extended
363 #[serde(default, skip_serializing_if = "Option::is_none")]
364 pub annotations: Option<BTreeMap<String, String>>,
365 /// Labels that SHOULD be applied to any resources created in response to this Gateway.
366 ///
367 /// For implementations creating other Kubernetes objects, this should be the `metadata.labels` field on resources.
368 /// For other implementations, this refers to any relevant (implementation specific) "labels" concepts.
369 ///
370 /// An implementation may chose to add additional implementation-specific labels as they see fit.
371 ///
372 /// If an implementation maps these labels to Pods, or any other resource that would need to be recreated when labels
373 /// change, it SHOULD clearly warn about this behavior in documentation.
374 ///
375 /// Support: Extended
376 #[serde(default, skip_serializing_if = "Option::is_none")]
377 pub labels: Option<BTreeMap<String, String>>,
378 /// ParametersRef is a reference to a resource that contains the configuration
379 /// parameters corresponding to the Gateway. This is optional if the
380 /// controller does not require any additional configuration.
381 ///
382 /// This follows the same semantics as GatewayClass's `parametersRef`, but on a per-Gateway basis
383 ///
384 /// The Gateway's GatewayClass may provide its own `parametersRef`. When both are specified,
385 /// the merging behavior is implementation specific.
386 /// It is generally recommended that GatewayClass provides defaults that can be overridden by a Gateway.
387 ///
388 /// If the referent cannot be found, refers to an unsupported kind, or when
389 /// the data within that resource is malformed, the Gateway SHOULD be
390 /// rejected with the "Accepted" status condition set to "False" and an
391 /// "InvalidParameters" reason.
392 ///
393 /// Support: Implementation-specific
394 #[serde(default, skip_serializing_if = "Option::is_none", rename = "parametersRef")]
395 pub parameters_ref: Option<GatewayInfrastructureParametersRef>,
396}
397
398/// ParametersRef is a reference to a resource that contains the configuration
399/// parameters corresponding to the Gateway. This is optional if the
400/// controller does not require any additional configuration.
401///
402/// This follows the same semantics as GatewayClass's `parametersRef`, but on a per-Gateway basis
403///
404/// The Gateway's GatewayClass may provide its own `parametersRef`. When both are specified,
405/// the merging behavior is implementation specific.
406/// It is generally recommended that GatewayClass provides defaults that can be overridden by a Gateway.
407///
408/// If the referent cannot be found, refers to an unsupported kind, or when
409/// the data within that resource is malformed, the Gateway SHOULD be
410/// rejected with the "Accepted" status condition set to "False" and an
411/// "InvalidParameters" reason.
412///
413/// Support: Implementation-specific
414#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
415pub struct GatewayInfrastructureParametersRef {
416 /// Group is the group of the referent.
417 pub group: String,
418 /// Kind is kind of the referent.
419 pub kind: String,
420 /// Name is the name of the referent.
421 pub name: String,
422}
423
424/// Listener embodies the concept of a logical endpoint where a Gateway accepts
425/// network connections.
426#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
427pub struct GatewayListeners {
428 /// AllowedRoutes defines the types of routes that MAY be attached to a
429 /// Listener and the trusted namespaces where those Route resources MAY be
430 /// present.
431 ///
432 /// Although a client request may match multiple route rules, only one rule
433 /// may ultimately receive the request. Matching precedence MUST be
434 /// determined in order of the following criteria:
435 ///
436 /// * The most specific match as defined by the Route type.
437 /// * The oldest Route based on creation timestamp. For example, a Route with
438 /// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
439 /// a Route with a creation timestamp of "2020-09-08 01:02:04".
440 /// * If everything else is equivalent, the Route appearing first in
441 /// alphabetical order (namespace/name) should be given precedence. For
442 /// example, foo/bar is given precedence over foo/baz.
443 ///
444 /// All valid rules within a Route attached to this Listener should be
445 /// implemented. Invalid Route rules can be ignored (sometimes that will mean
446 /// the full Route). If a Route rule transitions from valid to invalid,
447 /// support for that Route rule should be dropped to ensure consistency. For
448 /// example, even if a filter specified by a Route rule is invalid, the rest
449 /// of the rules within that Route should still be supported.
450 ///
451 /// Support: Core
452 #[serde(default, skip_serializing_if = "Option::is_none", rename = "allowedRoutes")]
453 pub allowed_routes: Option<GatewayListenersAllowedRoutes>,
454 /// Hostname specifies the virtual hostname to match for protocol types that
455 /// define this concept. When unspecified, all hostnames are matched. This
456 /// field is ignored for protocols that don't require hostname based
457 /// matching.
458 ///
459 /// Implementations MUST apply Hostname matching appropriately for each of
460 /// the following protocols:
461 ///
462 /// * TLS: The Listener Hostname MUST match the SNI.
463 /// * HTTP: The Listener Hostname MUST match the Host header of the request.
464 /// * HTTPS: The Listener Hostname SHOULD match both the SNI and Host header.
465 /// Note that this does not require the SNI and Host header to be the same.
466 /// The semantics of this are described in more detail below.
467 ///
468 /// To ensure security, Section 11.1 of RFC-6066 emphasizes that server
469 /// implementations that rely on SNI hostname matching MUST also verify
470 /// hostnames within the application protocol.
471 ///
472 /// Section 9.1.2 of RFC-7540 provides a mechanism for servers to reject the
473 /// reuse of a connection by responding with the HTTP 421 Misdirected Request
474 /// status code. This indicates that the origin server has rejected the
475 /// request because it appears to have been misdirected.
476 ///
477 /// To detect misdirected requests, Gateways SHOULD match the authority of
478 /// the requests with all the SNI hostname(s) configured across all the
479 /// Gateway Listeners on the same port and protocol:
480 ///
481 /// * If another Listener has an exact match or more specific wildcard entry,
482 /// the Gateway SHOULD return a 421.
483 /// * If the current Listener (selected by SNI matching during ClientHello)
484 /// does not match the Host:
485 /// * If another Listener does match the Host, the Gateway SHOULD return a
486 /// 421.
487 /// * If no other Listener matches the Host, the Gateway MUST return a
488 /// 404.
489 ///
490 /// For HTTPRoute and TLSRoute resources, there is an interaction with the
491 /// `spec.hostnames` array. When both listener and route specify hostnames,
492 /// there MUST be an intersection between the values for a Route to be
493 /// accepted. For more information, refer to the Route specific Hostnames
494 /// documentation.
495 ///
496 /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
497 /// as a suffix match. That means that a match for `*.example.com` would match
498 /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
499 ///
500 /// Support: Core
501 #[serde(default, skip_serializing_if = "Option::is_none")]
502 pub hostname: Option<String>,
503 /// Name is the name of the Listener. This name MUST be unique within a
504 /// Gateway.
505 ///
506 /// Support: Core
507 pub name: String,
508 /// Port is the network port. Multiple listeners may use the
509 /// same port, subject to the Listener compatibility rules.
510 ///
511 /// Support: Core
512 pub port: i32,
513 /// Protocol specifies the network protocol this listener expects to receive.
514 ///
515 /// Support: Core
516 pub protocol: String,
517 /// TLS is the TLS configuration for the Listener. This field is required if
518 /// the Protocol field is "HTTPS" or "TLS". It is invalid to set this field
519 /// if the Protocol field is "HTTP", "TCP", or "UDP".
520 ///
521 /// The association of SNIs to Certificate defined in ListenerTLSConfig is
522 /// defined based on the Hostname field for this listener.
523 ///
524 /// The GatewayClass MUST use the longest matching SNI out of all
525 /// available certificates for any TLS handshake.
526 ///
527 /// Support: Core
528 #[serde(default, skip_serializing_if = "Option::is_none")]
529 pub tls: Option<GatewayListenersTls>,
530}
531
532/// AllowedRoutes defines the types of routes that MAY be attached to a
533/// Listener and the trusted namespaces where those Route resources MAY be
534/// present.
535///
536/// Although a client request may match multiple route rules, only one rule
537/// may ultimately receive the request. Matching precedence MUST be
538/// determined in order of the following criteria:
539///
540/// * The most specific match as defined by the Route type.
541/// * The oldest Route based on creation timestamp. For example, a Route with
542/// a creation timestamp of "2020-09-08 01:02:03" is given precedence over
543/// a Route with a creation timestamp of "2020-09-08 01:02:04".
544/// * If everything else is equivalent, the Route appearing first in
545/// alphabetical order (namespace/name) should be given precedence. For
546/// example, foo/bar is given precedence over foo/baz.
547///
548/// All valid rules within a Route attached to this Listener should be
549/// implemented. Invalid Route rules can be ignored (sometimes that will mean
550/// the full Route). If a Route rule transitions from valid to invalid,
551/// support for that Route rule should be dropped to ensure consistency. For
552/// example, even if a filter specified by a Route rule is invalid, the rest
553/// of the rules within that Route should still be supported.
554///
555/// Support: Core
556#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
557pub struct GatewayListenersAllowedRoutes {
558 /// Kinds specifies the groups and kinds of Routes that are allowed to bind
559 /// to this Gateway Listener. When unspecified or empty, the kinds of Routes
560 /// selected are determined using the Listener protocol.
561 ///
562 /// A RouteGroupKind MUST correspond to kinds of Routes that are compatible
563 /// with the application protocol specified in the Listener's Protocol field.
564 /// If an implementation does not support or recognize this resource type, it
565 /// MUST set the "ResolvedRefs" condition to False for this Listener with the
566 /// "InvalidRouteKinds" reason.
567 ///
568 /// Support: Core
569 #[serde(default, skip_serializing_if = "Option::is_none")]
570 pub kinds: Option<Vec<GatewayListenersAllowedRoutesKinds>>,
571 /// Namespaces indicates namespaces from which Routes may be attached to this
572 /// Listener. This is restricted to the namespace of this Gateway by default.
573 ///
574 /// Support: Core
575 #[serde(default, skip_serializing_if = "Option::is_none")]
576 pub namespaces: Option<GatewayListenersAllowedRoutesNamespaces>,
577}
578
579/// RouteGroupKind indicates the group and kind of a Route resource.
580#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
581pub struct GatewayListenersAllowedRoutesKinds {
582 /// Group is the group of the Route.
583 #[serde(default, skip_serializing_if = "Option::is_none")]
584 pub group: Option<String>,
585 /// Kind is the kind of the Route.
586 pub kind: String,
587}
588
589/// Namespaces indicates namespaces from which Routes may be attached to this
590/// Listener. This is restricted to the namespace of this Gateway by default.
591///
592/// Support: Core
593#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
594pub struct GatewayListenersAllowedRoutesNamespaces {
595 /// From indicates where Routes will be selected for this Gateway. Possible
596 /// values are:
597 ///
598 /// * All: Routes in all namespaces may be used by this Gateway.
599 /// * Selector: Routes in namespaces selected by the selector may be used by
600 /// this Gateway.
601 /// * Same: Only Routes in the same namespace may be used by this Gateway.
602 ///
603 /// Support: Core
604 #[serde(default, skip_serializing_if = "Option::is_none")]
605 pub from: Option<GatewayListenersAllowedRoutesNamespacesFrom>,
606 /// Selector must be specified when From is set to "Selector". In that case,
607 /// only Routes in Namespaces matching this Selector will be selected by this
608 /// Gateway. This field is ignored for other values of "From".
609 ///
610 /// Support: Core
611 #[serde(default, skip_serializing_if = "Option::is_none")]
612 pub selector: Option<GatewayListenersAllowedRoutesNamespacesSelector>,
613}
614
615/// Namespaces indicates namespaces from which Routes may be attached to this
616/// Listener. This is restricted to the namespace of this Gateway by default.
617///
618/// Support: Core
619#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
620pub enum GatewayListenersAllowedRoutesNamespacesFrom {
621 All,
622 Selector,
623 Same,
624}
625
626/// Selector must be specified when From is set to "Selector". In that case,
627/// only Routes in Namespaces matching this Selector will be selected by this
628/// Gateway. This field is ignored for other values of "From".
629///
630/// Support: Core
631#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
632pub struct GatewayListenersAllowedRoutesNamespacesSelector {
633 /// matchExpressions is a list of label selector requirements. The requirements are ANDed.
634 #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchExpressions")]
635 pub match_expressions: Option<Vec<GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions>>,
636 /// matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
637 /// map is equivalent to an element of matchExpressions, whose key field is "key", the
638 /// operator is "In", and the values array contains only "value". The requirements are ANDed.
639 #[serde(default, skip_serializing_if = "Option::is_none", rename = "matchLabels")]
640 pub match_labels: Option<BTreeMap<String, String>>,
641}
642
643/// A label selector requirement is a selector that contains values, a key, and an operator that
644/// relates the key and values.
645#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
646pub struct GatewayListenersAllowedRoutesNamespacesSelectorMatchExpressions {
647 /// key is the label key that the selector applies to.
648 pub key: String,
649 /// operator represents a key's relationship to a set of values.
650 /// Valid operators are In, NotIn, Exists and DoesNotExist.
651 pub operator: String,
652 /// values is an array of string values. If the operator is In or NotIn,
653 /// the values array must be non-empty. If the operator is Exists or DoesNotExist,
654 /// the values array must be empty. This array is replaced during a strategic
655 /// merge patch.
656 #[serde(default, skip_serializing_if = "Option::is_none")]
657 pub values: Option<Vec<String>>,
658}
659
660/// TLS is the TLS configuration for the Listener. This field is required if
661/// the Protocol field is "HTTPS" or "TLS". It is invalid to set this field
662/// if the Protocol field is "HTTP", "TCP", or "UDP".
663///
664/// The association of SNIs to Certificate defined in ListenerTLSConfig is
665/// defined based on the Hostname field for this listener.
666///
667/// The GatewayClass MUST use the longest matching SNI out of all
668/// available certificates for any TLS handshake.
669///
670/// Support: Core
671#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
672pub struct GatewayListenersTls {
673 /// CertificateRefs contains a series of references to Kubernetes objects that
674 /// contains TLS certificates and private keys. These certificates are used to
675 /// establish a TLS handshake for requests that match the hostname of the
676 /// associated listener.
677 ///
678 /// A single CertificateRef to a Kubernetes Secret has "Core" support.
679 /// Implementations MAY choose to support attaching multiple certificates to
680 /// a Listener, but this behavior is implementation-specific.
681 ///
682 /// References to a resource in different namespace are invalid UNLESS there
683 /// is a ReferenceGrant in the target namespace that allows the certificate
684 /// to be attached. If a ReferenceGrant does not allow this reference, the
685 /// "ResolvedRefs" condition MUST be set to False for this listener with the
686 /// "RefNotPermitted" reason.
687 ///
688 /// This field is required to have at least one element when the mode is set
689 /// to "Terminate" (default) and is optional otherwise.
690 ///
691 /// CertificateRefs can reference to standard Kubernetes resources, i.e.
692 /// Secret, or implementation-specific custom resources.
693 ///
694 /// Support: Core - A single reference to a Kubernetes Secret of type kubernetes.io/tls
695 ///
696 /// Support: Implementation-specific (More than one reference or other resource types)
697 #[serde(default, skip_serializing_if = "Option::is_none", rename = "certificateRefs")]
698 pub certificate_refs: Option<Vec<GatewayListenersTlsCertificateRefs>>,
699 /// Mode defines the TLS behavior for the TLS session initiated by the client.
700 /// There are two possible modes:
701 ///
702 /// - Terminate: The TLS session between the downstream client and the
703 /// Gateway is terminated at the Gateway. This mode requires certificates
704 /// to be specified in some way, such as populating the certificateRefs
705 /// field.
706 /// - Passthrough: The TLS session is NOT terminated by the Gateway. This
707 /// implies that the Gateway can't decipher the TLS stream except for
708 /// the ClientHello message of the TLS protocol. The certificateRefs field
709 /// is ignored in this mode.
710 ///
711 /// Support: Core
712 #[serde(default, skip_serializing_if = "Option::is_none")]
713 pub mode: Option<GatewayListenersTlsMode>,
714 /// Options are a list of key/value pairs to enable extended TLS
715 /// configuration for each implementation. For example, configuring the
716 /// minimum TLS version or supported cipher suites.
717 ///
718 /// A set of common keys MAY be defined by the API in the future. To avoid
719 /// any ambiguity, implementation-specific definitions MUST use
720 /// domain-prefixed names, such as `example.com/my-custom-option`.
721 /// Un-prefixed names are reserved for key names defined by Gateway API.
722 ///
723 /// Support: Implementation-specific
724 #[serde(default, skip_serializing_if = "Option::is_none")]
725 pub options: Option<BTreeMap<String, String>>,
726}
727
728/// SecretObjectReference identifies an API object including its namespace,
729/// defaulting to Secret.
730///
731/// The API object must be valid in the cluster; the Group and Kind must
732/// be registered in the cluster for this reference to be valid.
733///
734/// References to objects with invalid Group and Kind are not valid, and must
735/// be rejected by the implementation, with appropriate Conditions set
736/// on the containing object.
737#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
738pub struct GatewayListenersTlsCertificateRefs {
739 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
740 /// When unspecified or empty string, core API group is inferred.
741 #[serde(default, skip_serializing_if = "Option::is_none")]
742 pub group: Option<String>,
743 /// Kind is kind of the referent. For example "Secret".
744 #[serde(default, skip_serializing_if = "Option::is_none")]
745 pub kind: Option<String>,
746 /// Name is the name of the referent.
747 pub name: String,
748 /// Namespace is the namespace of the referenced object. When unspecified, the local
749 /// namespace is inferred.
750 ///
751 /// Note that when a namespace different than the local namespace is specified,
752 /// a ReferenceGrant object is required in the referent namespace to allow that
753 /// namespace's owner to accept the reference. See the ReferenceGrant
754 /// documentation for details.
755 ///
756 /// Support: Core
757 #[serde(default, skip_serializing_if = "Option::is_none")]
758 pub namespace: Option<String>,
759}
760
761/// TLS is the TLS configuration for the Listener. This field is required if
762/// the Protocol field is "HTTPS" or "TLS". It is invalid to set this field
763/// if the Protocol field is "HTTP", "TCP", or "UDP".
764///
765/// The association of SNIs to Certificate defined in ListenerTLSConfig is
766/// defined based on the Hostname field for this listener.
767///
768/// The GatewayClass MUST use the longest matching SNI out of all
769/// available certificates for any TLS handshake.
770///
771/// Support: Core
772#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
773pub enum GatewayListenersTlsMode {
774 Terminate,
775 Passthrough,
776}
777
778/// TLS specifies frontend and backend tls configuration for entire gateway.
779///
780/// Support: Extended
781#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
782pub struct GatewayTls {
783 /// Backend describes TLS configuration for gateway when connecting
784 /// to backends.
785 ///
786 /// Note that this contains only details for the Gateway as a TLS client,
787 /// and does _not_ imply behavior about how to choose which backend should
788 /// get a TLS connection. That is determined by the presence of a BackendTLSPolicy.
789 ///
790 /// Support: Core
791 #[serde(default, skip_serializing_if = "Option::is_none")]
792 pub backend: Option<GatewayTlsBackend>,
793 /// Frontend describes TLS config when client connects to Gateway.
794 /// Support: Core
795 #[serde(default, skip_serializing_if = "Option::is_none")]
796 pub frontend: Option<GatewayTlsFrontend>,
797}
798
799/// Backend describes TLS configuration for gateway when connecting
800/// to backends.
801///
802/// Note that this contains only details for the Gateway as a TLS client,
803/// and does _not_ imply behavior about how to choose which backend should
804/// get a TLS connection. That is determined by the presence of a BackendTLSPolicy.
805///
806/// Support: Core
807#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
808pub struct GatewayTlsBackend {
809 /// ClientCertificateRef references an object that contains a client certificate
810 /// and its associated private key. It can reference standard Kubernetes resources,
811 /// i.e., Secret, or implementation-specific custom resources.
812 ///
813 /// A ClientCertificateRef is considered invalid if:
814 ///
815 /// * It refers to a resource that cannot be resolved (e.g., the referenced resource
816 /// does not exist) or is misconfigured (e.g., a Secret does not contain the keys
817 /// named `tls.crt` and `tls.key`). In this case, the `ResolvedRefs` condition
818 /// on the Gateway MUST be set to False with the Reason `InvalidClientCertificateRef`
819 /// and the Message of the Condition MUST indicate why the reference is invalid.
820 ///
821 /// * It refers to a resource in another namespace UNLESS there is a ReferenceGrant
822 /// in the target namespace that allows the certificate to be attached.
823 /// If a ReferenceGrant does not allow this reference, the `ResolvedRefs` condition
824 /// on the Gateway MUST be set to False with the Reason `RefNotPermitted`.
825 ///
826 /// Implementations MAY choose to perform further validation of the certificate
827 /// content (e.g., checking expiry or enforcing specific formats). In such cases,
828 /// an implementation-specific Reason and Message MUST be set.
829 ///
830 /// Support: Core - Reference to a Kubernetes TLS Secret (with the type `kubernetes.io/tls`).
831 /// Support: Implementation-specific - Other resource kinds or Secrets with a
832 /// different type (e.g., `Opaque`).
833 #[serde(default, skip_serializing_if = "Option::is_none", rename = "clientCertificateRef")]
834 pub client_certificate_ref: Option<GatewayTlsBackendClientCertificateRef>,
835}
836
837/// ClientCertificateRef references an object that contains a client certificate
838/// and its associated private key. It can reference standard Kubernetes resources,
839/// i.e., Secret, or implementation-specific custom resources.
840///
841/// A ClientCertificateRef is considered invalid if:
842///
843/// * It refers to a resource that cannot be resolved (e.g., the referenced resource
844/// does not exist) or is misconfigured (e.g., a Secret does not contain the keys
845/// named `tls.crt` and `tls.key`). In this case, the `ResolvedRefs` condition
846/// on the Gateway MUST be set to False with the Reason `InvalidClientCertificateRef`
847/// and the Message of the Condition MUST indicate why the reference is invalid.
848///
849/// * It refers to a resource in another namespace UNLESS there is a ReferenceGrant
850/// in the target namespace that allows the certificate to be attached.
851/// If a ReferenceGrant does not allow this reference, the `ResolvedRefs` condition
852/// on the Gateway MUST be set to False with the Reason `RefNotPermitted`.
853///
854/// Implementations MAY choose to perform further validation of the certificate
855/// content (e.g., checking expiry or enforcing specific formats). In such cases,
856/// an implementation-specific Reason and Message MUST be set.
857///
858/// Support: Core - Reference to a Kubernetes TLS Secret (with the type `kubernetes.io/tls`).
859/// Support: Implementation-specific - Other resource kinds or Secrets with a
860/// different type (e.g., `Opaque`).
861#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
862pub struct GatewayTlsBackendClientCertificateRef {
863 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
864 /// When unspecified or empty string, core API group is inferred.
865 #[serde(default, skip_serializing_if = "Option::is_none")]
866 pub group: Option<String>,
867 /// Kind is kind of the referent. For example "Secret".
868 #[serde(default, skip_serializing_if = "Option::is_none")]
869 pub kind: Option<String>,
870 /// Name is the name of the referent.
871 pub name: String,
872 /// Namespace is the namespace of the referenced object. When unspecified, the local
873 /// namespace is inferred.
874 ///
875 /// Note that when a namespace different than the local namespace is specified,
876 /// a ReferenceGrant object is required in the referent namespace to allow that
877 /// namespace's owner to accept the reference. See the ReferenceGrant
878 /// documentation for details.
879 ///
880 /// Support: Core
881 #[serde(default, skip_serializing_if = "Option::is_none")]
882 pub namespace: Option<String>,
883}
884
885/// Frontend describes TLS config when client connects to Gateway.
886/// Support: Core
887#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
888pub struct GatewayTlsFrontend {
889 /// Default specifies the default client certificate validation configuration
890 /// for all Listeners handling HTTPS traffic, unless a per-port configuration
891 /// is defined.
892 ///
893 /// support: Core
894 pub default: GatewayTlsFrontendDefault,
895 /// PerPort specifies tls configuration assigned per port.
896 /// Per port configuration is optional. Once set this configuration overrides
897 /// the default configuration for all Listeners handling HTTPS traffic
898 /// that match this port.
899 /// Each override port requires a unique TLS configuration.
900 ///
901 /// support: Core
902 #[serde(default, skip_serializing_if = "Option::is_none", rename = "perPort")]
903 pub per_port: Option<Vec<GatewayTlsFrontendPerPort>>,
904}
905
906/// Default specifies the default client certificate validation configuration
907/// for all Listeners handling HTTPS traffic, unless a per-port configuration
908/// is defined.
909///
910/// support: Core
911#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
912pub struct GatewayTlsFrontendDefault {
913 /// Validation holds configuration information for validating the frontend (client).
914 /// Setting this field will result in mutual authentication when connecting to the gateway.
915 /// In browsers this may result in a dialog appearing
916 /// that requests a user to specify the client certificate.
917 /// The maximum depth of a certificate chain accepted in verification is Implementation specific.
918 ///
919 /// Support: Core
920 #[serde(default, skip_serializing_if = "Option::is_none")]
921 pub validation: Option<GatewayTlsFrontendDefaultValidation>,
922}
923
924/// Validation holds configuration information for validating the frontend (client).
925/// Setting this field will result in mutual authentication when connecting to the gateway.
926/// In browsers this may result in a dialog appearing
927/// that requests a user to specify the client certificate.
928/// The maximum depth of a certificate chain accepted in verification is Implementation specific.
929///
930/// Support: Core
931#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
932pub struct GatewayTlsFrontendDefaultValidation {
933 /// CACertificateRefs contains one or more references to Kubernetes
934 /// objects that contain a PEM-encoded TLS CA certificate bundle, which
935 /// is used as a trust anchor to validate the certificates presented by
936 /// the client.
937 ///
938 /// A CACertificateRef is invalid if:
939 ///
940 /// * It refers to a resource that cannot be resolved (e.g., the
941 /// referenced resource does not exist) or is misconfigured (e.g., a
942 /// ConfigMap does not contain a key named `ca.crt`). In this case, the
943 /// Reason on all matching HTTPS listeners must be set to `InvalidCACertificateRef`
944 /// and the Message of the Condition must indicate which reference is invalid and why.
945 ///
946 /// * It refers to an unknown or unsupported kind of resource. In this
947 /// case, the Reason on all matching HTTPS listeners must be set to
948 /// `InvalidCACertificateKind` and the Message of the Condition must explain
949 /// which kind of resource is unknown or unsupported.
950 ///
951 /// * It refers to a resource in another namespace UNLESS there is a
952 /// ReferenceGrant in the target namespace that allows the CA
953 /// certificate to be attached. If a ReferenceGrant does not allow this
954 /// reference, the `ResolvedRefs` on all matching HTTPS listeners condition
955 /// MUST be set with the Reason `RefNotPermitted`.
956 ///
957 /// Implementations MAY choose to perform further validation of the
958 /// certificate content (e.g., checking expiry or enforcing specific formats).
959 /// In such cases, an implementation-specific Reason and Message MUST be set.
960 ///
961 /// In all cases, the implementation MUST ensure that the `ResolvedRefs`
962 /// condition is set to `status: False` on all targeted listeners (i.e.,
963 /// listeners serving HTTPS on a matching port). The condition MUST
964 /// include a Reason and Message that indicate the cause of the error. If
965 /// ALL CACertificateRefs are invalid, the implementation MUST also ensure
966 /// the `Accepted` condition on the listener is set to `status: False`, with
967 /// the Reason `NoValidCACertificate`.
968 /// Implementations MAY choose to support attaching multiple CA certificates
969 /// to a listener, but this behavior is implementation-specific.
970 ///
971 /// Support: Core - A single reference to a Kubernetes ConfigMap, with the
972 /// CA certificate in a key named `ca.crt`.
973 ///
974 /// Support: Implementation-specific - More than one reference, other kinds
975 /// of resources, or a single reference that includes multiple certificates.
976 #[serde(rename = "caCertificateRefs")]
977 pub ca_certificate_refs: Vec<GatewayTlsFrontendDefaultValidationCaCertificateRefs>,
978 /// FrontendValidationMode defines the mode for validating the client certificate.
979 /// There are two possible modes:
980 ///
981 /// - AllowValidOnly: In this mode, the gateway will accept connections only if
982 /// the client presents a valid certificate. This certificate must successfully
983 /// pass validation against the CA certificates specified in `CACertificateRefs`.
984 /// - AllowInsecureFallback: In this mode, the gateway will accept connections
985 /// even if the client certificate is not presented or fails verification.
986 ///
987 /// This approach delegates client authorization to the backend and introduce
988 /// a significant security risk. It should be used in testing environments or
989 /// on a temporary basis in non-testing environments.
990 ///
991 /// Defaults to AllowValidOnly.
992 ///
993 /// Support: Core
994 #[serde(default, skip_serializing_if = "Option::is_none")]
995 pub mode: Option<GatewayTlsFrontendDefaultValidationMode>,
996}
997
998/// ObjectReference identifies an API object including its namespace.
999///
1000/// The API object must be valid in the cluster; the Group and Kind must
1001/// be registered in the cluster for this reference to be valid.
1002///
1003/// References to objects with invalid Group and Kind are not valid, and must
1004/// be rejected by the implementation, with appropriate Conditions set
1005/// on the containing object.
1006#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1007pub struct GatewayTlsFrontendDefaultValidationCaCertificateRefs {
1008 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1009 /// When set to the empty string, core API group is inferred.
1010 pub group: String,
1011 /// Kind is kind of the referent. For example "ConfigMap" or "Service".
1012 pub kind: String,
1013 /// Name is the name of the referent.
1014 pub name: String,
1015 /// Namespace is the namespace of the referenced object. When unspecified, the local
1016 /// namespace is inferred.
1017 ///
1018 /// Note that when a namespace different than the local namespace is specified,
1019 /// a ReferenceGrant object is required in the referent namespace to allow that
1020 /// namespace's owner to accept the reference. See the ReferenceGrant
1021 /// documentation for details.
1022 ///
1023 /// Support: Core
1024 #[serde(default, skip_serializing_if = "Option::is_none")]
1025 pub namespace: Option<String>,
1026}
1027
1028/// Validation holds configuration information for validating the frontend (client).
1029/// Setting this field will result in mutual authentication when connecting to the gateway.
1030/// In browsers this may result in a dialog appearing
1031/// that requests a user to specify the client certificate.
1032/// The maximum depth of a certificate chain accepted in verification is Implementation specific.
1033///
1034/// Support: Core
1035#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1036pub enum GatewayTlsFrontendDefaultValidationMode {
1037 AllowValidOnly,
1038 AllowInsecureFallback,
1039}
1040
1041#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1042pub struct GatewayTlsFrontendPerPort {
1043 /// The Port indicates the Port Number to which the TLS configuration will be
1044 /// applied. This configuration will be applied to all Listeners handling HTTPS
1045 /// traffic that match this port.
1046 ///
1047 /// Support: Core
1048 pub port: i32,
1049 /// TLS store the configuration that will be applied to all Listeners handling
1050 /// HTTPS traffic and matching given port.
1051 ///
1052 /// Support: Core
1053 pub tls: GatewayTlsFrontendPerPortTls,
1054}
1055
1056/// TLS store the configuration that will be applied to all Listeners handling
1057/// HTTPS traffic and matching given port.
1058///
1059/// Support: Core
1060#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1061pub struct GatewayTlsFrontendPerPortTls {
1062 /// Validation holds configuration information for validating the frontend (client).
1063 /// Setting this field will result in mutual authentication when connecting to the gateway.
1064 /// In browsers this may result in a dialog appearing
1065 /// that requests a user to specify the client certificate.
1066 /// The maximum depth of a certificate chain accepted in verification is Implementation specific.
1067 ///
1068 /// Support: Core
1069 #[serde(default, skip_serializing_if = "Option::is_none")]
1070 pub validation: Option<GatewayTlsFrontendPerPortTlsValidation>,
1071}
1072
1073/// Validation holds configuration information for validating the frontend (client).
1074/// Setting this field will result in mutual authentication when connecting to the gateway.
1075/// In browsers this may result in a dialog appearing
1076/// that requests a user to specify the client certificate.
1077/// The maximum depth of a certificate chain accepted in verification is Implementation specific.
1078///
1079/// Support: Core
1080#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1081pub struct GatewayTlsFrontendPerPortTlsValidation {
1082 /// CACertificateRefs contains one or more references to Kubernetes
1083 /// objects that contain a PEM-encoded TLS CA certificate bundle, which
1084 /// is used as a trust anchor to validate the certificates presented by
1085 /// the client.
1086 ///
1087 /// A CACertificateRef is invalid if:
1088 ///
1089 /// * It refers to a resource that cannot be resolved (e.g., the
1090 /// referenced resource does not exist) or is misconfigured (e.g., a
1091 /// ConfigMap does not contain a key named `ca.crt`). In this case, the
1092 /// Reason on all matching HTTPS listeners must be set to `InvalidCACertificateRef`
1093 /// and the Message of the Condition must indicate which reference is invalid and why.
1094 ///
1095 /// * It refers to an unknown or unsupported kind of resource. In this
1096 /// case, the Reason on all matching HTTPS listeners must be set to
1097 /// `InvalidCACertificateKind` and the Message of the Condition must explain
1098 /// which kind of resource is unknown or unsupported.
1099 ///
1100 /// * It refers to a resource in another namespace UNLESS there is a
1101 /// ReferenceGrant in the target namespace that allows the CA
1102 /// certificate to be attached. If a ReferenceGrant does not allow this
1103 /// reference, the `ResolvedRefs` on all matching HTTPS listeners condition
1104 /// MUST be set with the Reason `RefNotPermitted`.
1105 ///
1106 /// Implementations MAY choose to perform further validation of the
1107 /// certificate content (e.g., checking expiry or enforcing specific formats).
1108 /// In such cases, an implementation-specific Reason and Message MUST be set.
1109 ///
1110 /// In all cases, the implementation MUST ensure that the `ResolvedRefs`
1111 /// condition is set to `status: False` on all targeted listeners (i.e.,
1112 /// listeners serving HTTPS on a matching port). The condition MUST
1113 /// include a Reason and Message that indicate the cause of the error. If
1114 /// ALL CACertificateRefs are invalid, the implementation MUST also ensure
1115 /// the `Accepted` condition on the listener is set to `status: False`, with
1116 /// the Reason `NoValidCACertificate`.
1117 /// Implementations MAY choose to support attaching multiple CA certificates
1118 /// to a listener, but this behavior is implementation-specific.
1119 ///
1120 /// Support: Core - A single reference to a Kubernetes ConfigMap, with the
1121 /// CA certificate in a key named `ca.crt`.
1122 ///
1123 /// Support: Implementation-specific - More than one reference, other kinds
1124 /// of resources, or a single reference that includes multiple certificates.
1125 #[serde(rename = "caCertificateRefs")]
1126 pub ca_certificate_refs: Vec<GatewayTlsFrontendPerPortTlsValidationCaCertificateRefs>,
1127 /// FrontendValidationMode defines the mode for validating the client certificate.
1128 /// There are two possible modes:
1129 ///
1130 /// - AllowValidOnly: In this mode, the gateway will accept connections only if
1131 /// the client presents a valid certificate. This certificate must successfully
1132 /// pass validation against the CA certificates specified in `CACertificateRefs`.
1133 /// - AllowInsecureFallback: In this mode, the gateway will accept connections
1134 /// even if the client certificate is not presented or fails verification.
1135 ///
1136 /// This approach delegates client authorization to the backend and introduce
1137 /// a significant security risk. It should be used in testing environments or
1138 /// on a temporary basis in non-testing environments.
1139 ///
1140 /// Defaults to AllowValidOnly.
1141 ///
1142 /// Support: Core
1143 #[serde(default, skip_serializing_if = "Option::is_none")]
1144 pub mode: Option<GatewayTlsFrontendPerPortTlsValidationMode>,
1145}
1146
1147/// ObjectReference identifies an API object including its namespace.
1148///
1149/// The API object must be valid in the cluster; the Group and Kind must
1150/// be registered in the cluster for this reference to be valid.
1151///
1152/// References to objects with invalid Group and Kind are not valid, and must
1153/// be rejected by the implementation, with appropriate Conditions set
1154/// on the containing object.
1155#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1156pub struct GatewayTlsFrontendPerPortTlsValidationCaCertificateRefs {
1157 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1158 /// When set to the empty string, core API group is inferred.
1159 pub group: String,
1160 /// Kind is kind of the referent. For example "ConfigMap" or "Service".
1161 pub kind: String,
1162 /// Name is the name of the referent.
1163 pub name: String,
1164 /// Namespace is the namespace of the referenced object. When unspecified, the local
1165 /// namespace is inferred.
1166 ///
1167 /// Note that when a namespace different than the local namespace is specified,
1168 /// a ReferenceGrant object is required in the referent namespace to allow that
1169 /// namespace's owner to accept the reference. See the ReferenceGrant
1170 /// documentation for details.
1171 ///
1172 /// Support: Core
1173 #[serde(default, skip_serializing_if = "Option::is_none")]
1174 pub namespace: Option<String>,
1175}
1176
1177/// Validation holds configuration information for validating the frontend (client).
1178/// Setting this field will result in mutual authentication when connecting to the gateway.
1179/// In browsers this may result in a dialog appearing
1180/// that requests a user to specify the client certificate.
1181/// The maximum depth of a certificate chain accepted in verification is Implementation specific.
1182///
1183/// Support: Core
1184#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1185pub enum GatewayTlsFrontendPerPortTlsValidationMode {
1186 AllowValidOnly,
1187 AllowInsecureFallback,
1188}
1189
1190/// Status defines the current state of Gateway.
1191#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1192pub struct GatewayStatus {
1193 /// Addresses lists the network addresses that have been bound to the
1194 /// Gateway.
1195 ///
1196 /// This list may differ from the addresses provided in the spec under some
1197 /// conditions:
1198 ///
1199 /// * no addresses are specified, all addresses are dynamically assigned
1200 /// * a combination of specified and dynamic addresses are assigned
1201 /// * a specified address was unusable (e.g. already in use)
1202 #[serde(default, skip_serializing_if = "Option::is_none")]
1203 pub addresses: Option<Vec<GatewayStatusAddresses>>,
1204 /// AttachedListenerSets represents the total number of ListenerSets that have been
1205 /// successfully attached to this Gateway.
1206 ///
1207 /// A ListenerSet is successfully attached to a Gateway when all the following conditions are met:
1208 /// - The ListenerSet is selected by the Gateway's AllowedListeners field
1209 /// - The ListenerSet has a valid ParentRef selecting the Gateway
1210 /// - The ListenerSet's status has the condition "Accepted: true"
1211 ///
1212 /// Uses for this field include troubleshooting AttachedListenerSets attachment and
1213 /// measuring blast radius/impact of changes to a Gateway.
1214 #[serde(default, skip_serializing_if = "Option::is_none", rename = "attachedListenerSets")]
1215 pub attached_listener_sets: Option<i32>,
1216 /// Conditions describe the current conditions of the Gateway.
1217 ///
1218 /// Implementations should prefer to express Gateway conditions
1219 /// using the `GatewayConditionType` and `GatewayConditionReason`
1220 /// constants so that operators and tools can converge on a common
1221 /// vocabulary to describe Gateway state.
1222 ///
1223 /// Known condition types are:
1224 ///
1225 /// * "Accepted"
1226 /// * "Programmed"
1227 /// * "Ready"
1228 #[serde(default, skip_serializing_if = "Option::is_none")]
1229 pub conditions: Option<Vec<Condition>>,
1230 /// Listeners provide status for each unique listener port defined in the Spec.
1231 #[serde(default, skip_serializing_if = "Option::is_none")]
1232 pub listeners: Option<Vec<GatewayStatusListeners>>,
1233}
1234
1235/// GatewayStatusAddress describes a network address that is bound to a Gateway.
1236#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1237pub struct GatewayStatusAddresses {
1238 /// Type of the address.
1239 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
1240 pub r#type: Option<String>,
1241 /// Value of the address. The validity of the values will depend
1242 /// on the type and support by the controller.
1243 ///
1244 /// Examples: `1.2.3.4`, `128::1`, `my-ip-address`.
1245 pub value: String,
1246}
1247
1248/// ListenerStatus is the status associated with a Listener.
1249#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1250pub struct GatewayStatusListeners {
1251 /// AttachedRoutes represents the total number of Routes that have been
1252 /// successfully attached to this Listener.
1253 ///
1254 /// Successful attachment of a Route to a Listener is based solely on the
1255 /// combination of the AllowedRoutes field on the corresponding Listener
1256 /// and the Route's ParentRefs field. A Route is successfully attached to
1257 /// a Listener when it is selected by the Listener's AllowedRoutes field
1258 /// AND the Route has a valid ParentRef selecting the whole Gateway
1259 /// resource or a specific Listener as a parent resource (more detail on
1260 /// attachment semantics can be found in the documentation on the various
1261 /// Route kinds ParentRefs fields). Listener or Route status does not impact
1262 /// successful attachment, i.e. the AttachedRoutes field count MUST be set
1263 /// for Listeners, even if the Accepted condition of an individual Listener is set
1264 /// to "False". The AttachedRoutes number represents the number of Routes with
1265 /// the Accepted condition set to "True" that have been attached to this Listener.
1266 /// Routes with any other value for the Accepted condition MUST NOT be included
1267 /// in this count.
1268 ///
1269 /// Uses for this field include troubleshooting Route attachment and
1270 /// measuring blast radius/impact of changes to a Listener.
1271 #[serde(rename = "attachedRoutes")]
1272 pub attached_routes: i32,
1273 /// Conditions describe the current condition of this listener.
1274 pub conditions: Vec<Condition>,
1275 /// Name is the name of the Listener that this status corresponds to.
1276 pub name: String,
1277 /// SupportedKinds is the list indicating the Kinds supported by this
1278 /// listener. This MUST represent the kinds supported by an implementation for
1279 /// that Listener configuration.
1280 ///
1281 /// If kinds are specified in Spec that are not supported, they MUST NOT
1282 /// appear in this list and an implementation MUST set the "ResolvedRefs"
1283 /// condition to "False" with the "InvalidRouteKinds" reason. If both valid
1284 /// and invalid Route kinds are specified, the implementation MUST
1285 /// reference the valid Route kinds that have been specified.
1286 #[serde(default, skip_serializing_if = "Option::is_none", rename = "supportedKinds")]
1287 pub supported_kinds: Option<Vec<GatewayStatusListenersSupportedKinds>>,
1288}
1289
1290/// RouteGroupKind indicates the group and kind of a Route resource.
1291#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1292pub struct GatewayStatusListenersSupportedKinds {
1293 /// Group is the group of the Route.
1294 #[serde(default, skip_serializing_if = "Option::is_none")]
1295 pub group: Option<String>,
1296 /// Kind is the kind of the Route.
1297 pub kind: String,
1298}