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