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