gateway_api/apis/experimental/httproutes.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}
12use self::prelude::*;
13
14/// Spec defines the desired state of HTTPRoute.
15#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
16#[kube(
17 group = "gateway.networking.k8s.io",
18 version = "v1",
19 kind = "HTTPRoute",
20 plural = "httproutes"
21)]
22#[kube(namespaced)]
23#[kube(status = "HTTPRouteStatus")]
24#[kube(derive = "Default")]
25#[kube(derive = "PartialEq")]
26pub struct HTTPRouteSpec {
27 /// Hostnames defines a set of hostnames that should match against the HTTP Host
28 /// header to select a HTTPRoute used to process the request. Implementations
29 /// MUST ignore any port value specified in the HTTP Host header while
30 /// performing a match and (absent of any applicable header modification
31 /// configuration) MUST forward this header unmodified to the backend.
32 ///
33 /// Valid values for Hostnames are determined by RFC 1123 definition of a
34 /// hostname with 2 notable exceptions:
35 ///
36 /// 1. IPs are not allowed.
37 /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
38 /// label must appear by itself as the first label.
39 ///
40 /// If a hostname is specified by both the Listener and HTTPRoute, there
41 /// must be at least one intersecting hostname for the HTTPRoute to be
42 /// attached to the Listener. For example:
43 ///
44 /// * A Listener with `test.example.com` as the hostname matches HTTPRoutes
45 /// that have either not specified any hostnames, or have specified at
46 /// least one of `test.example.com` or `*.example.com`.
47 /// * A Listener with `*.example.com` as the hostname matches HTTPRoutes
48 /// that have either not specified any hostnames or have specified at least
49 /// one hostname that matches the Listener hostname. For example,
50 /// `*.example.com`, `test.example.com`, and `foo.test.example.com` would
51 /// all match. On the other hand, `example.com` and `test.example.net` would
52 /// not match.
53 ///
54 /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
55 /// as a suffix match. That means that a match for `*.example.com` would match
56 /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
57 ///
58 /// If both the Listener and HTTPRoute have specified hostnames, any
59 /// HTTPRoute hostnames that do not match the Listener hostname MUST be
60 /// ignored. For example, if a Listener specified `*.example.com`, and the
61 /// HTTPRoute specified `test.example.com` and `test.example.net`,
62 /// `test.example.net` must not be considered for a match.
63 ///
64 /// If both the Listener and HTTPRoute have specified hostnames, and none
65 /// match with the criteria above, then the HTTPRoute is not accepted. The
66 /// implementation must raise an 'Accepted' Condition with a status of
67 /// `False` in the corresponding RouteParentStatus.
68 ///
69 /// In the event that multiple HTTPRoutes specify intersecting hostnames (e.g.
70 /// overlapping wildcard matching and exact matching hostnames), precedence must
71 /// be given to rules from the HTTPRoute with the largest number of:
72 ///
73 /// * Characters in a matching non-wildcard hostname.
74 /// * Characters in a matching hostname.
75 ///
76 /// If ties exist across multiple Routes, the matching precedence rules for
77 /// HTTPRouteMatches takes over.
78 ///
79 /// Support: Core
80 #[serde(default, skip_serializing_if = "Option::is_none")]
81 pub hostnames: Option<Vec<String>>,
82 /// ParentRefs references the resources (usually Gateways) that a Route wants
83 /// to be attached to. Note that the referenced parent resource needs to
84 /// allow this for the attachment to be complete. For Gateways, that means
85 /// the Gateway needs to allow attachment from Routes of this kind and
86 /// namespace. For Services, that means the Service must either be in the same
87 /// namespace for a "producer" route, or the mesh implementation must support
88 /// and allow "consumer" routes for the referenced Service. ReferenceGrant is
89 /// not applicable for governing ParentRefs to Services - it is not possible to
90 /// create a "producer" route for a Service in a different namespace from the
91 /// Route.
92 ///
93 /// There are two kinds of parent resources with "Core" support:
94 ///
95 /// * Gateway (Gateway conformance profile)
96 /// * Service (Mesh conformance profile, ClusterIP Services only)
97 ///
98 /// This API may be extended in the future to support additional kinds of parent
99 /// resources.
100 ///
101 /// ParentRefs must be _distinct_. This means either that:
102 ///
103 /// * They select different objects. If this is the case, then parentRef
104 /// entries are distinct. In terms of fields, this means that the
105 /// multi-part key defined by `group`, `kind`, `namespace`, and `name` must
106 /// be unique across all parentRef entries in the Route.
107 /// * They do not select different objects, but for each optional field used,
108 /// each ParentRef that selects the same object must set the same set of
109 /// optional fields to different values. If one ParentRef sets a
110 /// combination of optional fields, all must set the same combination.
111 ///
112 /// Some examples:
113 ///
114 /// * If one ParentRef sets `sectionName`, all ParentRefs referencing the
115 /// same object must also set `sectionName`.
116 /// * If one ParentRef sets `port`, all ParentRefs referencing the same
117 /// object must also set `port`.
118 /// * If one ParentRef sets `sectionName` and `port`, all ParentRefs
119 /// referencing the same object must also set `sectionName` and `port`.
120 ///
121 /// It is possible to separately reference multiple distinct objects that may
122 /// be collapsed by an implementation. For example, some implementations may
123 /// choose to merge compatible Gateway Listeners together. If that is the
124 /// case, the list of routes attached to those resources should also be
125 /// merged.
126 ///
127 /// Note that for ParentRefs that cross namespace boundaries, there are specific
128 /// rules. Cross-namespace references are only valid if they are explicitly
129 /// allowed by something in the namespace they are referring to. For example,
130 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
131 /// generic way to enable other kinds of cross-namespace reference.
132 ///
133 ///
134 /// ParentRefs from a Route to a Service in the same namespace are "producer"
135 /// routes, which apply default routing rules to inbound connections from
136 /// any namespace to the Service.
137 ///
138 /// ParentRefs from a Route to a Service in a different namespace are
139 /// "consumer" routes, and these routing rules are only applied to outbound
140 /// connections originating from the same namespace as the Route, for which
141 /// the intended destination of the connections are a Service targeted as a
142 /// ParentRef of the Route.
143 ///
144 ///
145 ///
146 ///
147 ///
148 ///
149 #[serde(
150 default,
151 skip_serializing_if = "Option::is_none",
152 rename = "parentRefs"
153 )]
154 pub parent_refs: Option<Vec<HTTPRouteParentRefs>>,
155 /// Rules are a list of HTTP matchers, filters and actions.
156 ///
157 ///
158 #[serde(default, skip_serializing_if = "Option::is_none")]
159 pub rules: Option<Vec<HTTPRouteRules>>,
160}
161
162/// ParentReference identifies an API object (usually a Gateway) that can be considered
163/// a parent of this resource (usually a route). There are two kinds of parent resources
164/// with "Core" support:
165///
166/// * Gateway (Gateway conformance profile)
167/// * Service (Mesh conformance profile, ClusterIP Services only)
168///
169/// This API may be extended in the future to support additional kinds of parent
170/// resources.
171///
172/// The API object must be valid in the cluster; the Group and Kind must
173/// be registered in the cluster for this reference to be valid.
174#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
175pub struct HTTPRouteParentRefs {
176 /// Group is the group of the referent.
177 /// When unspecified, "gateway.networking.k8s.io" is inferred.
178 /// To set the core API group (such as for a "Service" kind referent),
179 /// Group must be explicitly set to "" (empty string).
180 ///
181 /// Support: Core
182 #[serde(default, skip_serializing_if = "Option::is_none")]
183 pub group: Option<String>,
184 /// Kind is kind of the referent.
185 ///
186 /// There are two kinds of parent resources with "Core" support:
187 ///
188 /// * Gateway (Gateway conformance profile)
189 /// * Service (Mesh conformance profile, ClusterIP Services only)
190 ///
191 /// Support for other resources is Implementation-Specific.
192 #[serde(default, skip_serializing_if = "Option::is_none")]
193 pub kind: Option<String>,
194 /// Name is the name of the referent.
195 ///
196 /// Support: Core
197 pub name: String,
198 /// Namespace is the namespace of the referent. When unspecified, this refers
199 /// to the local namespace of the Route.
200 ///
201 /// Note that there are specific rules for ParentRefs which cross namespace
202 /// boundaries. Cross-namespace references are only valid if they are explicitly
203 /// allowed by something in the namespace they are referring to. For example:
204 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
205 /// generic way to enable any other kind of cross-namespace reference.
206 ///
207 ///
208 /// ParentRefs from a Route to a Service in the same namespace are "producer"
209 /// routes, which apply default routing rules to inbound connections from
210 /// any namespace to the Service.
211 ///
212 /// ParentRefs from a Route to a Service in a different namespace are
213 /// "consumer" routes, and these routing rules are only applied to outbound
214 /// connections originating from the same namespace as the Route, for which
215 /// the intended destination of the connections are a Service targeted as a
216 /// ParentRef of the Route.
217 ///
218 ///
219 /// Support: Core
220 #[serde(default, skip_serializing_if = "Option::is_none")]
221 pub namespace: Option<String>,
222 /// Port is the network port this Route targets. It can be interpreted
223 /// differently based on the type of parent resource.
224 ///
225 /// When the parent resource is a Gateway, this targets all listeners
226 /// listening on the specified port that also support this kind of Route(and
227 /// select this Route). It's not recommended to set `Port` unless the
228 /// networking behaviors specified in a Route must apply to a specific port
229 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
230 /// and SectionName are specified, the name and port of the selected listener
231 /// must match both specified values.
232 ///
233 ///
234 /// When the parent resource is a Service, this targets a specific port in the
235 /// Service spec. When both Port (experimental) and SectionName are specified,
236 /// the name and port of the selected port must match both specified values.
237 ///
238 ///
239 /// Implementations MAY choose to support other parent resources.
240 /// Implementations supporting other types of parent resources MUST clearly
241 /// document how/if Port is interpreted.
242 ///
243 /// For the purpose of status, an attachment is considered successful as
244 /// long as the parent resource accepts it partially. For example, Gateway
245 /// listeners can restrict which Routes can attach to them by Route kind,
246 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
247 /// from the referencing Route, the Route MUST be considered successfully
248 /// attached. If no Gateway listeners accept attachment from this Route,
249 /// the Route MUST be considered detached from the Gateway.
250 ///
251 /// Support: Extended
252 #[serde(default, skip_serializing_if = "Option::is_none")]
253 pub port: Option<i32>,
254 /// SectionName is the name of a section within the target resource. In the
255 /// following resources, SectionName is interpreted as the following:
256 ///
257 /// * Gateway: Listener name. When both Port (experimental) and SectionName
258 /// are specified, the name and port of the selected listener must match
259 /// both specified values.
260 /// * Service: Port name. When both Port (experimental) and SectionName
261 /// are specified, the name and port of the selected listener must match
262 /// both specified values.
263 ///
264 /// Implementations MAY choose to support attaching Routes to other resources.
265 /// If that is the case, they MUST clearly document how SectionName is
266 /// interpreted.
267 ///
268 /// When unspecified (empty string), this will reference the entire resource.
269 /// For the purpose of status, an attachment is considered successful if at
270 /// least one section in the parent resource accepts it. For example, Gateway
271 /// listeners can restrict which Routes can attach to them by Route kind,
272 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
273 /// the referencing Route, the Route MUST be considered successfully
274 /// attached. If no Gateway listeners accept attachment from this Route, the
275 /// Route MUST be considered detached from the Gateway.
276 ///
277 /// Support: Core
278 #[serde(
279 default,
280 skip_serializing_if = "Option::is_none",
281 rename = "sectionName"
282 )]
283 pub section_name: Option<String>,
284}
285
286/// HTTPRouteRule defines semantics for matching an HTTP request based on
287/// conditions (matches), processing it (filters), and forwarding the request to
288/// an API object (backendRefs).
289#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
290pub struct HTTPRouteRules {
291 /// BackendRefs defines the backend(s) where matching requests should be
292 /// sent.
293 ///
294 /// Failure behavior here depends on how many BackendRefs are specified and
295 /// how many are invalid.
296 ///
297 /// If *all* entries in BackendRefs are invalid, and there are also no filters
298 /// specified in this route rule, *all* traffic which matches this rule MUST
299 /// receive a 500 status code.
300 ///
301 /// See the HTTPBackendRef definition for the rules about what makes a single
302 /// HTTPBackendRef invalid.
303 ///
304 /// When a HTTPBackendRef is invalid, 500 status codes MUST be returned for
305 /// requests that would have otherwise been routed to an invalid backend. If
306 /// multiple backends are specified, and some are invalid, the proportion of
307 /// requests that would otherwise have been routed to an invalid backend
308 /// MUST receive a 500 status code.
309 ///
310 /// For example, if two backends are specified with equal weights, and one is
311 /// invalid, 50 percent of traffic must receive a 500. Implementations may
312 /// choose how that 50 percent is determined.
313 ///
314 /// When a HTTPBackendRef refers to a Service that has no ready endpoints,
315 /// implementations SHOULD return a 503 for requests to that backend instead.
316 /// If an implementation chooses to do this, all of the above rules for 500 responses
317 /// MUST also apply for responses that return a 503.
318 ///
319 /// Support: Core for Kubernetes Service
320 ///
321 /// Support: Extended for Kubernetes ServiceImport
322 ///
323 /// Support: Implementation-specific for any other resource
324 ///
325 /// Support for weight: Core
326 #[serde(
327 default,
328 skip_serializing_if = "Option::is_none",
329 rename = "backendRefs"
330 )]
331 pub backend_refs: Option<Vec<HTTPRouteRulesBackendRefs>>,
332 /// Filters define the filters that are applied to requests that match
333 /// this rule.
334 ///
335 /// Wherever possible, implementations SHOULD implement filters in the order
336 /// they are specified.
337 ///
338 /// Implementations MAY choose to implement this ordering strictly, rejecting
339 /// any combination or order of filters that can not be supported. If implementations
340 /// choose a strict interpretation of filter ordering, they MUST clearly document
341 /// that behavior.
342 ///
343 /// To reject an invalid combination or order of filters, implementations SHOULD
344 /// consider the Route Rules with this configuration invalid. If all Route Rules
345 /// in a Route are invalid, the entire Route would be considered invalid. If only
346 /// a portion of Route Rules are invalid, implementations MUST set the
347 /// "PartiallyInvalid" condition for the Route.
348 ///
349 /// Conformance-levels at this level are defined based on the type of filter:
350 ///
351 /// - ALL core filters MUST be supported by all implementations.
352 /// - Implementers are encouraged to support extended filters.
353 /// - Implementation-specific custom filters have no API guarantees across
354 /// implementations.
355 ///
356 /// Specifying the same filter multiple times is not supported unless explicitly
357 /// indicated in the filter.
358 ///
359 /// All filters are expected to be compatible with each other except for the
360 /// URLRewrite and RequestRedirect filters, which may not be combined. If an
361 /// implementation can not support other combinations of filters, they must clearly
362 /// document that limitation. In cases where incompatible or unsupported
363 /// filters are specified and cause the `Accepted` condition to be set to status
364 /// `False`, implementations may use the `IncompatibleFilters` reason to specify
365 /// this configuration error.
366 ///
367 /// Support: Core
368 #[serde(default, skip_serializing_if = "Option::is_none")]
369 pub filters: Option<Vec<HTTPRouteRulesFilters>>,
370 /// Matches define conditions used for matching the rule against incoming
371 /// HTTP requests. Each match is independent, i.e. this rule will be matched
372 /// if **any** one of the matches is satisfied.
373 ///
374 /// For example, take the following matches configuration:
375 ///
376 /// ```text
377 /// matches:
378 /// - path:
379 /// value: "/foo"
380 /// headers:
381 /// - name: "version"
382 /// value: "v2"
383 /// - path:
384 /// value: "/v2/foo"
385 /// ```
386 ///
387 /// For a request to match against this rule, a request must satisfy
388 /// EITHER of the two conditions:
389 ///
390 /// - path prefixed with `/foo` AND contains the header `version: v2`
391 /// - path prefix of `/v2/foo`
392 ///
393 /// See the documentation for HTTPRouteMatch on how to specify multiple
394 /// match conditions that should be ANDed together.
395 ///
396 /// If no matches are specified, the default is a prefix
397 /// path match on "/", which has the effect of matching every
398 /// HTTP request.
399 ///
400 /// Proxy or Load Balancer routing configuration generated from HTTPRoutes
401 /// MUST prioritize matches based on the following criteria, continuing on
402 /// ties. Across all rules specified on applicable Routes, precedence must be
403 /// given to the match having:
404 ///
405 /// * "Exact" path match.
406 /// * "Prefix" path match with largest number of characters.
407 /// * Method match.
408 /// * Largest number of header matches.
409 /// * Largest number of query param matches.
410 ///
411 /// Note: The precedence of RegularExpression path matches are implementation-specific.
412 ///
413 /// If ties still exist across multiple Routes, matching precedence MUST be
414 /// determined in order of the following criteria, continuing on ties:
415 ///
416 /// * The oldest Route based on creation timestamp.
417 /// * The Route appearing first in alphabetical order by
418 /// "{namespace}/{name}".
419 ///
420 /// If ties still exist within an HTTPRoute, matching precedence MUST be granted
421 /// to the FIRST matching rule (in list order) with a match meeting the above
422 /// criteria.
423 ///
424 /// When no rules matching a request have been successfully attached to the
425 /// parent a request is coming from, a HTTP 404 status code MUST be returned.
426 #[serde(default, skip_serializing_if = "Option::is_none")]
427 pub matches: Option<Vec<HTTPRouteRulesMatches>>,
428 /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
429 ///
430 /// Support: Extended
431 ///
432 #[serde(default, skip_serializing_if = "Option::is_none")]
433 pub name: Option<String>,
434 /// Retry defines the configuration for when to retry an HTTP request.
435 ///
436 /// Support: Extended
437 ///
438 ///
439 #[serde(default, skip_serializing_if = "Option::is_none")]
440 pub retry: Option<HTTPRouteRulesRetry>,
441 /// SessionPersistence defines and configures session persistence
442 /// for the route rule.
443 ///
444 /// Support: Extended
445 ///
446 ///
447 #[serde(
448 default,
449 skip_serializing_if = "Option::is_none",
450 rename = "sessionPersistence"
451 )]
452 pub session_persistence: Option<HTTPRouteRulesSessionPersistence>,
453 /// Timeouts defines the timeouts that can be configured for an HTTP request.
454 ///
455 /// Support: Extended
456 #[serde(default, skip_serializing_if = "Option::is_none")]
457 pub timeouts: Option<HTTPRouteRulesTimeouts>,
458}
459
460/// HTTPBackendRef defines how a HTTPRoute forwards a HTTP request.
461///
462/// Note that when a namespace different than the local namespace is specified, a
463/// ReferenceGrant object is required in the referent namespace to allow that
464/// namespace's owner to accept the reference. See the ReferenceGrant
465/// documentation for details.
466///
467/// <gateway:experimental:description>
468///
469/// When the BackendRef points to a Kubernetes Service, implementations SHOULD
470/// honor the appProtocol field if it is set for the target Service Port.
471///
472/// Implementations supporting appProtocol SHOULD recognize the Kubernetes
473/// Standard Application Protocols defined in KEP-3726.
474///
475/// If a Service appProtocol isn't specified, an implementation MAY infer the
476/// backend protocol through its own means. Implementations MAY infer the
477/// protocol from the Route type referring to the backend Service.
478///
479/// If a Route is not able to send traffic to the backend using the specified
480/// protocol then the backend is considered invalid. Implementations MUST set the
481/// "ResolvedRefs" condition to "False" with the "UnsupportedProtocol" reason.
482///
483/// </gateway:experimental:description>
484#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
485pub struct HTTPRouteRulesBackendRefs {
486 /// Filters defined at this level should be executed if and only if the
487 /// request is being forwarded to the backend defined here.
488 ///
489 /// Support: Implementation-specific (For broader support of filters, use the
490 /// Filters field in HTTPRouteRule.)
491 #[serde(default, skip_serializing_if = "Option::is_none")]
492 pub filters: Option<Vec<HTTPRouteRulesBackendRefsFilters>>,
493 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
494 /// When unspecified or empty string, core API group is inferred.
495 #[serde(default, skip_serializing_if = "Option::is_none")]
496 pub group: Option<String>,
497 /// Kind is the Kubernetes resource kind of the referent. For example
498 /// "Service".
499 ///
500 /// Defaults to "Service" when not specified.
501 ///
502 /// ExternalName services can refer to CNAME DNS records that may live
503 /// outside of the cluster and as such are difficult to reason about in
504 /// terms of conformance. They also may not be safe to forward to (see
505 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
506 /// support ExternalName Services.
507 ///
508 /// Support: Core (Services with a type other than ExternalName)
509 ///
510 /// Support: Implementation-specific (Services with type ExternalName)
511 #[serde(default, skip_serializing_if = "Option::is_none")]
512 pub kind: Option<String>,
513 /// Name is the name of the referent.
514 pub name: String,
515 /// Namespace is the namespace of the backend. When unspecified, the local
516 /// namespace is inferred.
517 ///
518 /// Note that when a namespace different than the local namespace is specified,
519 /// a ReferenceGrant object is required in the referent namespace to allow that
520 /// namespace's owner to accept the reference. See the ReferenceGrant
521 /// documentation for details.
522 ///
523 /// Support: Core
524 #[serde(default, skip_serializing_if = "Option::is_none")]
525 pub namespace: Option<String>,
526 /// Port specifies the destination port number to use for this resource.
527 /// Port is required when the referent is a Kubernetes Service. In this
528 /// case, the port number is the service port number, not the target port.
529 /// For other resources, destination port might be derived from the referent
530 /// resource or this field.
531 #[serde(default, skip_serializing_if = "Option::is_none")]
532 pub port: Option<i32>,
533 /// Weight specifies the proportion of requests forwarded to the referenced
534 /// backend. This is computed as weight/(sum of all weights in this
535 /// BackendRefs list). For non-zero values, there may be some epsilon from
536 /// the exact proportion defined here depending on the precision an
537 /// implementation supports. Weight is not a percentage and the sum of
538 /// weights does not need to equal 100.
539 ///
540 /// If only one backend is specified and it has a weight greater than 0, 100%
541 /// of the traffic is forwarded to that backend. If weight is set to 0, no
542 /// traffic should be forwarded for this entry. If unspecified, weight
543 /// defaults to 1.
544 ///
545 /// Support for this field varies based on the context where used.
546 #[serde(default, skip_serializing_if = "Option::is_none")]
547 pub weight: Option<i32>,
548}
549
550/// HTTPRouteFilter defines processing steps that must be completed during the
551/// request or response lifecycle. HTTPRouteFilters are meant as an extension
552/// point to express processing that may be done in Gateway implementations. Some
553/// examples include request or response modification, implementing
554/// authentication strategies, rate-limiting, and traffic shaping. API
555/// guarantee/conformance is defined based on the type of the filter.
556#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
557pub struct HTTPRouteRulesBackendRefsFilters {
558 /// ExtensionRef is an optional, implementation-specific extension to the
559 /// "filter" behavior. For example, resource "myroutefilter" in group
560 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
561 /// extended filters.
562 ///
563 /// This filter can be used multiple times within the same rule.
564 ///
565 /// Support: Implementation-specific
566 #[serde(
567 default,
568 skip_serializing_if = "Option::is_none",
569 rename = "extensionRef"
570 )]
571 pub extension_ref: Option<HTTPRouteRulesBackendRefsFiltersExtensionRef>,
572 /// RequestHeaderModifier defines a schema for a filter that modifies request
573 /// headers.
574 ///
575 /// Support: Core
576 #[serde(
577 default,
578 skip_serializing_if = "Option::is_none",
579 rename = "requestHeaderModifier"
580 )]
581 pub request_header_modifier: Option<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifier>,
582 /// RequestMirror defines a schema for a filter that mirrors requests.
583 /// Requests are sent to the specified destination, but responses from
584 /// that destination are ignored.
585 ///
586 /// This filter can be used multiple times within the same rule. Note that
587 /// not all implementations will be able to support mirroring to multiple
588 /// backends.
589 ///
590 /// Support: Extended
591 ///
592 ///
593 #[serde(
594 default,
595 skip_serializing_if = "Option::is_none",
596 rename = "requestMirror"
597 )]
598 pub request_mirror: Option<HTTPRouteRulesBackendRefsFiltersRequestMirror>,
599 /// RequestRedirect defines a schema for a filter that responds to the
600 /// request with an HTTP redirection.
601 ///
602 /// Support: Core
603 #[serde(
604 default,
605 skip_serializing_if = "Option::is_none",
606 rename = "requestRedirect"
607 )]
608 pub request_redirect: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirect>,
609 /// ResponseHeaderModifier defines a schema for a filter that modifies response
610 /// headers.
611 ///
612 /// Support: Extended
613 #[serde(
614 default,
615 skip_serializing_if = "Option::is_none",
616 rename = "responseHeaderModifier"
617 )]
618 pub response_header_modifier: Option<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifier>,
619 /// Type identifies the type of filter to apply. As with other API fields,
620 /// types are classified into three conformance levels:
621 ///
622 /// - Core: Filter types and their corresponding configuration defined by
623 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
624 /// implementations must support core filters.
625 ///
626 /// - Extended: Filter types and their corresponding configuration defined by
627 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
628 /// are encouraged to support extended filters.
629 ///
630 /// - Implementation-specific: Filters that are defined and supported by
631 /// specific vendors.
632 /// In the future, filters showing convergence in behavior across multiple
633 /// implementations will be considered for inclusion in extended or core
634 /// conformance levels. Filter-specific configuration for such filters
635 /// is specified using the ExtensionRef field. `Type` should be set to
636 /// "ExtensionRef" for custom filters.
637 ///
638 /// Implementers are encouraged to define custom implementation types to
639 /// extend the core API with implementation-specific behavior.
640 ///
641 /// If a reference to a custom filter type cannot be resolved, the filter
642 /// MUST NOT be skipped. Instead, requests that would have been processed by
643 /// that filter MUST receive a HTTP error response.
644 ///
645 /// Note that values may be added to this enum, implementations
646 /// must ensure that unknown values will not cause a crash.
647 ///
648 /// Unknown values here must result in the implementation setting the
649 /// Accepted Condition for the Route to `status: False`, with a
650 /// Reason of `UnsupportedValue`.
651 #[serde(rename = "type")]
652 pub r#type: HTTPRouteRulesBackendRefsFiltersType,
653 /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
654 ///
655 /// Support: Extended
656 #[serde(
657 default,
658 skip_serializing_if = "Option::is_none",
659 rename = "urlRewrite"
660 )]
661 pub url_rewrite: Option<HTTPRouteRulesBackendRefsFiltersUrlRewrite>,
662}
663
664/// ExtensionRef is an optional, implementation-specific extension to the
665/// "filter" behavior. For example, resource "myroutefilter" in group
666/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
667/// extended filters.
668///
669/// This filter can be used multiple times within the same rule.
670///
671/// Support: Implementation-specific
672#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
673pub struct HTTPRouteRulesBackendRefsFiltersExtensionRef {
674 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
675 /// When unspecified or empty string, core API group is inferred.
676 pub group: String,
677 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
678 pub kind: String,
679 /// Name is the name of the referent.
680 pub name: String,
681}
682
683/// RequestHeaderModifier defines a schema for a filter that modifies request
684/// headers.
685///
686/// Support: Core
687#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
688pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifier {
689 /// Add adds the given header(s) (name, value) to the request
690 /// before the action. It appends to any existing values associated
691 /// with the header name.
692 ///
693 /// Input:
694 /// GET /foo HTTP/1.1
695 /// my-header: foo
696 ///
697 /// Config:
698 /// add:
699 /// - name: "my-header"
700 /// value: "bar,baz"
701 ///
702 /// Output:
703 /// GET /foo HTTP/1.1
704 /// my-header: foo,bar,baz
705 #[serde(default, skip_serializing_if = "Option::is_none")]
706 pub add: Option<Vec<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierAdd>>,
707 /// Remove the given header(s) from the HTTP request before the action. The
708 /// value of Remove is a list of HTTP header names. Note that the header
709 /// names are case-insensitive (see
710 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
711 ///
712 /// Input:
713 /// GET /foo HTTP/1.1
714 /// my-header1: foo
715 /// my-header2: bar
716 /// my-header3: baz
717 ///
718 /// Config:
719 /// remove: ["my-header1", "my-header3"]
720 ///
721 /// Output:
722 /// GET /foo HTTP/1.1
723 /// my-header2: bar
724 #[serde(default, skip_serializing_if = "Option::is_none")]
725 pub remove: Option<Vec<String>>,
726 /// Set overwrites the request with the given header (name, value)
727 /// before the action.
728 ///
729 /// Input:
730 /// GET /foo HTTP/1.1
731 /// my-header: foo
732 ///
733 /// Config:
734 /// set:
735 /// - name: "my-header"
736 /// value: "bar"
737 ///
738 /// Output:
739 /// GET /foo HTTP/1.1
740 /// my-header: bar
741 #[serde(default, skip_serializing_if = "Option::is_none")]
742 pub set: Option<Vec<HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierSet>>,
743}
744
745/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
746#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
747pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierAdd {
748 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
749 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
750 ///
751 /// If multiple entries specify equivalent header names, the first entry with
752 /// an equivalent name MUST be considered for a match. Subsequent entries
753 /// with an equivalent header name MUST be ignored. Due to the
754 /// case-insensitivity of header names, "foo" and "Foo" are considered
755 /// equivalent.
756 pub name: String,
757 /// Value is the value of HTTP Header to be matched.
758 pub value: String,
759}
760
761/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
762#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
763pub struct HTTPRouteRulesBackendRefsFiltersRequestHeaderModifierSet {
764 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
765 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
766 ///
767 /// If multiple entries specify equivalent header names, the first entry with
768 /// an equivalent name MUST be considered for a match. Subsequent entries
769 /// with an equivalent header name MUST be ignored. Due to the
770 /// case-insensitivity of header names, "foo" and "Foo" are considered
771 /// equivalent.
772 pub name: String,
773 /// Value is the value of HTTP Header to be matched.
774 pub value: String,
775}
776
777/// RequestMirror defines a schema for a filter that mirrors requests.
778/// Requests are sent to the specified destination, but responses from
779/// that destination are ignored.
780///
781/// This filter can be used multiple times within the same rule. Note that
782/// not all implementations will be able to support mirroring to multiple
783/// backends.
784///
785/// Support: Extended
786///
787///
788#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
789pub struct HTTPRouteRulesBackendRefsFiltersRequestMirror {
790 /// BackendRef references a resource where mirrored requests are sent.
791 ///
792 /// Mirrored requests must be sent only to a single destination endpoint
793 /// within this BackendRef, irrespective of how many endpoints are present
794 /// within this BackendRef.
795 ///
796 /// If the referent cannot be found, this BackendRef is invalid and must be
797 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
798 /// condition on the Route status is set to `status: False` and not configure
799 /// this backend in the underlying implementation.
800 ///
801 /// If there is a cross-namespace reference to an *existing* object
802 /// that is not allowed by a ReferenceGrant, the controller must ensure the
803 /// "ResolvedRefs" condition on the Route is set to `status: False`,
804 /// with the "RefNotPermitted" reason and not configure this backend in the
805 /// underlying implementation.
806 ///
807 /// In either error case, the Message of the `ResolvedRefs` Condition
808 /// should be used to provide more detail about the problem.
809 ///
810 /// Support: Extended for Kubernetes Service
811 ///
812 /// Support: Implementation-specific for any other resource
813 #[serde(rename = "backendRef")]
814 pub backend_ref: HTTPRouteRulesBackendRefsFiltersRequestMirrorBackendRef,
815 /// Fraction represents the fraction of requests that should be
816 /// mirrored to BackendRef.
817 ///
818 /// Only one of Fraction or Percent may be specified. If neither field
819 /// is specified, 100% of requests will be mirrored.
820 ///
821 ///
822 #[serde(default, skip_serializing_if = "Option::is_none")]
823 pub fraction: Option<HTTPRouteRulesBackendRefsFiltersRequestMirrorFraction>,
824 /// Percent represents the percentage of requests that should be
825 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
826 /// requests) and its maximum value is 100 (indicating 100% of requests).
827 ///
828 /// Only one of Fraction or Percent may be specified. If neither field
829 /// is specified, 100% of requests will be mirrored.
830 ///
831 ///
832 #[serde(default, skip_serializing_if = "Option::is_none")]
833 pub percent: Option<i32>,
834}
835
836/// BackendRef references a resource where mirrored requests are sent.
837///
838/// Mirrored requests must be sent only to a single destination endpoint
839/// within this BackendRef, irrespective of how many endpoints are present
840/// within this BackendRef.
841///
842/// If the referent cannot be found, this BackendRef is invalid and must be
843/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
844/// condition on the Route status is set to `status: False` and not configure
845/// this backend in the underlying implementation.
846///
847/// If there is a cross-namespace reference to an *existing* object
848/// that is not allowed by a ReferenceGrant, the controller must ensure the
849/// "ResolvedRefs" condition on the Route is set to `status: False`,
850/// with the "RefNotPermitted" reason and not configure this backend in the
851/// underlying implementation.
852///
853/// In either error case, the Message of the `ResolvedRefs` Condition
854/// should be used to provide more detail about the problem.
855///
856/// Support: Extended for Kubernetes Service
857///
858/// Support: Implementation-specific for any other resource
859#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
860pub struct HTTPRouteRulesBackendRefsFiltersRequestMirrorBackendRef {
861 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
862 /// When unspecified or empty string, core API group is inferred.
863 #[serde(default, skip_serializing_if = "Option::is_none")]
864 pub group: Option<String>,
865 /// Kind is the Kubernetes resource kind of the referent. For example
866 /// "Service".
867 ///
868 /// Defaults to "Service" when not specified.
869 ///
870 /// ExternalName services can refer to CNAME DNS records that may live
871 /// outside of the cluster and as such are difficult to reason about in
872 /// terms of conformance. They also may not be safe to forward to (see
873 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
874 /// support ExternalName Services.
875 ///
876 /// Support: Core (Services with a type other than ExternalName)
877 ///
878 /// Support: Implementation-specific (Services with type ExternalName)
879 #[serde(default, skip_serializing_if = "Option::is_none")]
880 pub kind: Option<String>,
881 /// Name is the name of the referent.
882 pub name: String,
883 /// Namespace is the namespace of the backend. When unspecified, the local
884 /// namespace is inferred.
885 ///
886 /// Note that when a namespace different than the local namespace is specified,
887 /// a ReferenceGrant object is required in the referent namespace to allow that
888 /// namespace's owner to accept the reference. See the ReferenceGrant
889 /// documentation for details.
890 ///
891 /// Support: Core
892 #[serde(default, skip_serializing_if = "Option::is_none")]
893 pub namespace: Option<String>,
894 /// Port specifies the destination port number to use for this resource.
895 /// Port is required when the referent is a Kubernetes Service. In this
896 /// case, the port number is the service port number, not the target port.
897 /// For other resources, destination port might be derived from the referent
898 /// resource or this field.
899 #[serde(default, skip_serializing_if = "Option::is_none")]
900 pub port: Option<i32>,
901}
902
903/// Fraction represents the fraction of requests that should be
904/// mirrored to BackendRef.
905///
906/// Only one of Fraction or Percent may be specified. If neither field
907/// is specified, 100% of requests will be mirrored.
908///
909///
910#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
911pub struct HTTPRouteRulesBackendRefsFiltersRequestMirrorFraction {
912 #[serde(default, skip_serializing_if = "Option::is_none")]
913 pub denominator: Option<i32>,
914 pub numerator: i32,
915}
916
917/// RequestRedirect defines a schema for a filter that responds to the
918/// request with an HTTP redirection.
919///
920/// Support: Core
921#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
922pub struct HTTPRouteRulesBackendRefsFiltersRequestRedirect {
923 /// Hostname is the hostname to be used in the value of the `Location`
924 /// header in the response.
925 /// When empty, the hostname in the `Host` header of the request is used.
926 ///
927 /// Support: Core
928 #[serde(default, skip_serializing_if = "Option::is_none")]
929 pub hostname: Option<String>,
930 /// Path defines parameters used to modify the path of the incoming request.
931 /// The modified path is then used to construct the `Location` header. When
932 /// empty, the request path is used as-is.
933 ///
934 /// Support: Extended
935 #[serde(default, skip_serializing_if = "Option::is_none")]
936 pub path: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirectPath>,
937 /// Port is the port to be used in the value of the `Location`
938 /// header in the response.
939 ///
940 /// If no port is specified, the redirect port MUST be derived using the
941 /// following rules:
942 ///
943 /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
944 /// port associated with the redirect scheme. Specifically "http" to port 80
945 /// and "https" to port 443. If the redirect scheme does not have a
946 /// well-known port, the listener port of the Gateway SHOULD be used.
947 /// * If redirect scheme is empty, the redirect port MUST be the Gateway
948 /// Listener port.
949 ///
950 /// Implementations SHOULD NOT add the port number in the 'Location'
951 /// header in the following cases:
952 ///
953 /// * A Location header that will use HTTP (whether that is determined via
954 /// the Listener protocol or the Scheme field) _and_ use port 80.
955 /// * A Location header that will use HTTPS (whether that is determined via
956 /// the Listener protocol or the Scheme field) _and_ use port 443.
957 ///
958 /// Support: Extended
959 #[serde(default, skip_serializing_if = "Option::is_none")]
960 pub port: Option<i32>,
961 /// Scheme is the scheme to be used in the value of the `Location` header in
962 /// the response. When empty, the scheme of the request is used.
963 ///
964 /// Scheme redirects can affect the port of the redirect, for more information,
965 /// refer to the documentation for the port field of this filter.
966 ///
967 /// Note that values may be added to this enum, implementations
968 /// must ensure that unknown values will not cause a crash.
969 ///
970 /// Unknown values here must result in the implementation setting the
971 /// Accepted Condition for the Route to `status: False`, with a
972 /// Reason of `UnsupportedValue`.
973 ///
974 /// Support: Extended
975 #[serde(default, skip_serializing_if = "Option::is_none")]
976 pub scheme: Option<HTTPRouteRulesBackendRefsFiltersRequestRedirectScheme>,
977 /// StatusCode is the HTTP status code to be used in response.
978 ///
979 /// Note that values may be added to this enum, implementations
980 /// must ensure that unknown values will not cause a crash.
981 ///
982 /// Unknown values here must result in the implementation setting the
983 /// Accepted Condition for the Route to `status: False`, with a
984 /// Reason of `UnsupportedValue`.
985 ///
986 /// Support: Core
987 #[serde(
988 default,
989 skip_serializing_if = "Option::is_none",
990 rename = "statusCode"
991 )]
992 pub status_code: Option<i64>,
993}
994
995/// Path defines parameters used to modify the path of the incoming request.
996/// The modified path is then used to construct the `Location` header. When
997/// empty, the request path is used as-is.
998///
999/// Support: Extended
1000#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1001pub struct HTTPRouteRulesBackendRefsFiltersRequestRedirectPath {
1002 /// ReplaceFullPath specifies the value with which to replace the full path
1003 /// of a request during a rewrite or redirect.
1004 #[serde(
1005 default,
1006 skip_serializing_if = "Option::is_none",
1007 rename = "replaceFullPath"
1008 )]
1009 pub replace_full_path: Option<String>,
1010 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1011 /// match of a request during a rewrite or redirect. For example, a request
1012 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1013 /// of "/xyz" would be modified to "/xyz/bar".
1014 ///
1015 /// Note that this matches the behavior of the PathPrefix match type. This
1016 /// matches full path elements. A path element refers to the list of labels
1017 /// in the path split by the `/` separator. When specified, a trailing `/` is
1018 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1019 /// match the prefix `/abc`, but the path `/abcd` would not.
1020 ///
1021 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1022 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1023 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1024 ///
1025 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1026 #[serde(
1027 default,
1028 skip_serializing_if = "Option::is_none",
1029 rename = "replacePrefixMatch"
1030 )]
1031 pub replace_prefix_match: Option<String>,
1032 /// Type defines the type of path modifier. Additional types may be
1033 /// added in a future release of the API.
1034 ///
1035 /// Note that values may be added to this enum, implementations
1036 /// must ensure that unknown values will not cause a crash.
1037 ///
1038 /// Unknown values here must result in the implementation setting the
1039 /// Accepted Condition for the Route to `status: False`, with a
1040 /// Reason of `UnsupportedValue`.
1041 #[serde(rename = "type")]
1042 pub r#type: HTTPRouteRulesBackendRefsFiltersRequestRedirectPathType,
1043}
1044
1045/// Path defines parameters used to modify the path of the incoming request.
1046/// The modified path is then used to construct the `Location` header. When
1047/// empty, the request path is used as-is.
1048///
1049/// Support: Extended
1050#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1051pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectPathType {
1052 ReplaceFullPath,
1053 ReplacePrefixMatch,
1054}
1055
1056/// RequestRedirect defines a schema for a filter that responds to the
1057/// request with an HTTP redirection.
1058///
1059/// Support: Core
1060#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1061pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectScheme {
1062 #[serde(rename = "http")]
1063 Http,
1064 #[serde(rename = "https")]
1065 Https,
1066}
1067
1068/// RequestRedirect defines a schema for a filter that responds to the
1069/// request with an HTTP redirection.
1070///
1071/// Support: Core
1072#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1073pub enum HTTPRouteRulesBackendRefsFiltersRequestRedirectStatusCode {
1074 #[serde(rename = "301")]
1075 r#_301,
1076 #[serde(rename = "302")]
1077 r#_302,
1078}
1079
1080/// ResponseHeaderModifier defines a schema for a filter that modifies response
1081/// headers.
1082///
1083/// Support: Extended
1084#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1085pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifier {
1086 /// Add adds the given header(s) (name, value) to the request
1087 /// before the action. It appends to any existing values associated
1088 /// with the header name.
1089 ///
1090 /// Input:
1091 /// GET /foo HTTP/1.1
1092 /// my-header: foo
1093 ///
1094 /// Config:
1095 /// add:
1096 /// - name: "my-header"
1097 /// value: "bar,baz"
1098 ///
1099 /// Output:
1100 /// GET /foo HTTP/1.1
1101 /// my-header: foo,bar,baz
1102 #[serde(default, skip_serializing_if = "Option::is_none")]
1103 pub add: Option<Vec<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierAdd>>,
1104 /// Remove the given header(s) from the HTTP request before the action. The
1105 /// value of Remove is a list of HTTP header names. Note that the header
1106 /// names are case-insensitive (see
1107 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1108 ///
1109 /// Input:
1110 /// GET /foo HTTP/1.1
1111 /// my-header1: foo
1112 /// my-header2: bar
1113 /// my-header3: baz
1114 ///
1115 /// Config:
1116 /// remove: ["my-header1", "my-header3"]
1117 ///
1118 /// Output:
1119 /// GET /foo HTTP/1.1
1120 /// my-header2: bar
1121 #[serde(default, skip_serializing_if = "Option::is_none")]
1122 pub remove: Option<Vec<String>>,
1123 /// Set overwrites the request with the given header (name, value)
1124 /// before the action.
1125 ///
1126 /// Input:
1127 /// GET /foo HTTP/1.1
1128 /// my-header: foo
1129 ///
1130 /// Config:
1131 /// set:
1132 /// - name: "my-header"
1133 /// value: "bar"
1134 ///
1135 /// Output:
1136 /// GET /foo HTTP/1.1
1137 /// my-header: bar
1138 #[serde(default, skip_serializing_if = "Option::is_none")]
1139 pub set: Option<Vec<HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierSet>>,
1140}
1141
1142/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1143#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1144pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierAdd {
1145 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1146 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1147 ///
1148 /// If multiple entries specify equivalent header names, the first entry with
1149 /// an equivalent name MUST be considered for a match. Subsequent entries
1150 /// with an equivalent header name MUST be ignored. Due to the
1151 /// case-insensitivity of header names, "foo" and "Foo" are considered
1152 /// equivalent.
1153 pub name: String,
1154 /// Value is the value of HTTP Header to be matched.
1155 pub value: String,
1156}
1157
1158/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1159#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1160pub struct HTTPRouteRulesBackendRefsFiltersResponseHeaderModifierSet {
1161 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1162 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1163 ///
1164 /// If multiple entries specify equivalent header names, the first entry with
1165 /// an equivalent name MUST be considered for a match. Subsequent entries
1166 /// with an equivalent header name MUST be ignored. Due to the
1167 /// case-insensitivity of header names, "foo" and "Foo" are considered
1168 /// equivalent.
1169 pub name: String,
1170 /// Value is the value of HTTP Header to be matched.
1171 pub value: String,
1172}
1173
1174/// HTTPRouteFilter defines processing steps that must be completed during the
1175/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1176/// point to express processing that may be done in Gateway implementations. Some
1177/// examples include request or response modification, implementing
1178/// authentication strategies, rate-limiting, and traffic shaping. API
1179/// guarantee/conformance is defined based on the type of the filter.
1180#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1181pub enum HTTPRouteRulesBackendRefsFiltersType {
1182 RequestHeaderModifier,
1183 ResponseHeaderModifier,
1184 RequestMirror,
1185 RequestRedirect,
1186 #[serde(rename = "URLRewrite")]
1187 UrlRewrite,
1188 ExtensionRef,
1189}
1190
1191/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1192///
1193/// Support: Extended
1194#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1195pub struct HTTPRouteRulesBackendRefsFiltersUrlRewrite {
1196 /// Hostname is the value to be used to replace the Host header value during
1197 /// forwarding.
1198 ///
1199 /// Support: Extended
1200 #[serde(default, skip_serializing_if = "Option::is_none")]
1201 pub hostname: Option<String>,
1202 /// Path defines a path rewrite.
1203 ///
1204 /// Support: Extended
1205 #[serde(default, skip_serializing_if = "Option::is_none")]
1206 pub path: Option<HTTPRouteRulesBackendRefsFiltersUrlRewritePath>,
1207}
1208
1209/// Path defines a path rewrite.
1210///
1211/// Support: Extended
1212#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1213pub struct HTTPRouteRulesBackendRefsFiltersUrlRewritePath {
1214 /// ReplaceFullPath specifies the value with which to replace the full path
1215 /// of a request during a rewrite or redirect.
1216 #[serde(
1217 default,
1218 skip_serializing_if = "Option::is_none",
1219 rename = "replaceFullPath"
1220 )]
1221 pub replace_full_path: Option<String>,
1222 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1223 /// match of a request during a rewrite or redirect. For example, a request
1224 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1225 /// of "/xyz" would be modified to "/xyz/bar".
1226 ///
1227 /// Note that this matches the behavior of the PathPrefix match type. This
1228 /// matches full path elements. A path element refers to the list of labels
1229 /// in the path split by the `/` separator. When specified, a trailing `/` is
1230 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1231 /// match the prefix `/abc`, but the path `/abcd` would not.
1232 ///
1233 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1234 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1235 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1236 ///
1237 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1238 #[serde(
1239 default,
1240 skip_serializing_if = "Option::is_none",
1241 rename = "replacePrefixMatch"
1242 )]
1243 pub replace_prefix_match: Option<String>,
1244 /// Type defines the type of path modifier. Additional types may be
1245 /// added in a future release of the API.
1246 ///
1247 /// Note that values may be added to this enum, implementations
1248 /// must ensure that unknown values will not cause a crash.
1249 ///
1250 /// Unknown values here must result in the implementation setting the
1251 /// Accepted Condition for the Route to `status: False`, with a
1252 /// Reason of `UnsupportedValue`.
1253 #[serde(rename = "type")]
1254 pub r#type: HTTPRouteRulesBackendRefsFiltersUrlRewritePathType,
1255}
1256
1257/// Path defines a path rewrite.
1258///
1259/// Support: Extended
1260#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1261pub enum HTTPRouteRulesBackendRefsFiltersUrlRewritePathType {
1262 ReplaceFullPath,
1263 ReplacePrefixMatch,
1264}
1265
1266/// HTTPRouteFilter defines processing steps that must be completed during the
1267/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1268/// point to express processing that may be done in Gateway implementations. Some
1269/// examples include request or response modification, implementing
1270/// authentication strategies, rate-limiting, and traffic shaping. API
1271/// guarantee/conformance is defined based on the type of the filter.
1272#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1273pub struct HTTPRouteRulesFilters {
1274 /// ExtensionRef is an optional, implementation-specific extension to the
1275 /// "filter" behavior. For example, resource "myroutefilter" in group
1276 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1277 /// extended filters.
1278 ///
1279 /// This filter can be used multiple times within the same rule.
1280 ///
1281 /// Support: Implementation-specific
1282 #[serde(
1283 default,
1284 skip_serializing_if = "Option::is_none",
1285 rename = "extensionRef"
1286 )]
1287 pub extension_ref: Option<HTTPRouteRulesFiltersExtensionRef>,
1288 /// RequestHeaderModifier defines a schema for a filter that modifies request
1289 /// headers.
1290 ///
1291 /// Support: Core
1292 #[serde(
1293 default,
1294 skip_serializing_if = "Option::is_none",
1295 rename = "requestHeaderModifier"
1296 )]
1297 pub request_header_modifier: Option<HTTPRouteRulesFiltersRequestHeaderModifier>,
1298 /// RequestMirror defines a schema for a filter that mirrors requests.
1299 /// Requests are sent to the specified destination, but responses from
1300 /// that destination are ignored.
1301 ///
1302 /// This filter can be used multiple times within the same rule. Note that
1303 /// not all implementations will be able to support mirroring to multiple
1304 /// backends.
1305 ///
1306 /// Support: Extended
1307 ///
1308 ///
1309 #[serde(
1310 default,
1311 skip_serializing_if = "Option::is_none",
1312 rename = "requestMirror"
1313 )]
1314 pub request_mirror: Option<HTTPRouteRulesFiltersRequestMirror>,
1315 /// RequestRedirect defines a schema for a filter that responds to the
1316 /// request with an HTTP redirection.
1317 ///
1318 /// Support: Core
1319 #[serde(
1320 default,
1321 skip_serializing_if = "Option::is_none",
1322 rename = "requestRedirect"
1323 )]
1324 pub request_redirect: Option<HTTPRouteRulesFiltersRequestRedirect>,
1325 /// ResponseHeaderModifier defines a schema for a filter that modifies response
1326 /// headers.
1327 ///
1328 /// Support: Extended
1329 #[serde(
1330 default,
1331 skip_serializing_if = "Option::is_none",
1332 rename = "responseHeaderModifier"
1333 )]
1334 pub response_header_modifier: Option<HTTPRouteRulesFiltersResponseHeaderModifier>,
1335 /// Type identifies the type of filter to apply. As with other API fields,
1336 /// types are classified into three conformance levels:
1337 ///
1338 /// - Core: Filter types and their corresponding configuration defined by
1339 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
1340 /// implementations must support core filters.
1341 ///
1342 /// - Extended: Filter types and their corresponding configuration defined by
1343 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
1344 /// are encouraged to support extended filters.
1345 ///
1346 /// - Implementation-specific: Filters that are defined and supported by
1347 /// specific vendors.
1348 /// In the future, filters showing convergence in behavior across multiple
1349 /// implementations will be considered for inclusion in extended or core
1350 /// conformance levels. Filter-specific configuration for such filters
1351 /// is specified using the ExtensionRef field. `Type` should be set to
1352 /// "ExtensionRef" for custom filters.
1353 ///
1354 /// Implementers are encouraged to define custom implementation types to
1355 /// extend the core API with implementation-specific behavior.
1356 ///
1357 /// If a reference to a custom filter type cannot be resolved, the filter
1358 /// MUST NOT be skipped. Instead, requests that would have been processed by
1359 /// that filter MUST receive a HTTP error response.
1360 ///
1361 /// Note that values may be added to this enum, implementations
1362 /// must ensure that unknown values will not cause a crash.
1363 ///
1364 /// Unknown values here must result in the implementation setting the
1365 /// Accepted Condition for the Route to `status: False`, with a
1366 /// Reason of `UnsupportedValue`.
1367 #[serde(rename = "type")]
1368 pub r#type: HTTPRouteRulesFiltersType,
1369 /// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1370 ///
1371 /// Support: Extended
1372 #[serde(
1373 default,
1374 skip_serializing_if = "Option::is_none",
1375 rename = "urlRewrite"
1376 )]
1377 pub url_rewrite: Option<HTTPRouteRulesFiltersUrlRewrite>,
1378}
1379
1380/// ExtensionRef is an optional, implementation-specific extension to the
1381/// "filter" behavior. For example, resource "myroutefilter" in group
1382/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
1383/// extended filters.
1384///
1385/// This filter can be used multiple times within the same rule.
1386///
1387/// Support: Implementation-specific
1388#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1389pub struct HTTPRouteRulesFiltersExtensionRef {
1390 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1391 /// When unspecified or empty string, core API group is inferred.
1392 pub group: String,
1393 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
1394 pub kind: String,
1395 /// Name is the name of the referent.
1396 pub name: String,
1397}
1398
1399/// RequestHeaderModifier defines a schema for a filter that modifies request
1400/// headers.
1401///
1402/// Support: Core
1403#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1404pub struct HTTPRouteRulesFiltersRequestHeaderModifier {
1405 /// Add adds the given header(s) (name, value) to the request
1406 /// before the action. It appends to any existing values associated
1407 /// with the header name.
1408 ///
1409 /// Input:
1410 /// GET /foo HTTP/1.1
1411 /// my-header: foo
1412 ///
1413 /// Config:
1414 /// add:
1415 /// - name: "my-header"
1416 /// value: "bar,baz"
1417 ///
1418 /// Output:
1419 /// GET /foo HTTP/1.1
1420 /// my-header: foo,bar,baz
1421 #[serde(default, skip_serializing_if = "Option::is_none")]
1422 pub add: Option<Vec<HTTPRouteRulesFiltersRequestHeaderModifierAdd>>,
1423 /// Remove the given header(s) from the HTTP request before the action. The
1424 /// value of Remove is a list of HTTP header names. Note that the header
1425 /// names are case-insensitive (see
1426 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1427 ///
1428 /// Input:
1429 /// GET /foo HTTP/1.1
1430 /// my-header1: foo
1431 /// my-header2: bar
1432 /// my-header3: baz
1433 ///
1434 /// Config:
1435 /// remove: ["my-header1", "my-header3"]
1436 ///
1437 /// Output:
1438 /// GET /foo HTTP/1.1
1439 /// my-header2: bar
1440 #[serde(default, skip_serializing_if = "Option::is_none")]
1441 pub remove: Option<Vec<String>>,
1442 /// Set overwrites the request with the given header (name, value)
1443 /// before the action.
1444 ///
1445 /// Input:
1446 /// GET /foo HTTP/1.1
1447 /// my-header: foo
1448 ///
1449 /// Config:
1450 /// set:
1451 /// - name: "my-header"
1452 /// value: "bar"
1453 ///
1454 /// Output:
1455 /// GET /foo HTTP/1.1
1456 /// my-header: bar
1457 #[serde(default, skip_serializing_if = "Option::is_none")]
1458 pub set: Option<Vec<HTTPRouteRulesFiltersRequestHeaderModifierSet>>,
1459}
1460
1461/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1462#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1463pub struct HTTPRouteRulesFiltersRequestHeaderModifierAdd {
1464 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1465 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1466 ///
1467 /// If multiple entries specify equivalent header names, the first entry with
1468 /// an equivalent name MUST be considered for a match. Subsequent entries
1469 /// with an equivalent header name MUST be ignored. Due to the
1470 /// case-insensitivity of header names, "foo" and "Foo" are considered
1471 /// equivalent.
1472 pub name: String,
1473 /// Value is the value of HTTP Header to be matched.
1474 pub value: String,
1475}
1476
1477/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1478#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1479pub struct HTTPRouteRulesFiltersRequestHeaderModifierSet {
1480 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1481 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1482 ///
1483 /// If multiple entries specify equivalent header names, the first entry with
1484 /// an equivalent name MUST be considered for a match. Subsequent entries
1485 /// with an equivalent header name MUST be ignored. Due to the
1486 /// case-insensitivity of header names, "foo" and "Foo" are considered
1487 /// equivalent.
1488 pub name: String,
1489 /// Value is the value of HTTP Header to be matched.
1490 pub value: String,
1491}
1492
1493/// RequestMirror defines a schema for a filter that mirrors requests.
1494/// Requests are sent to the specified destination, but responses from
1495/// that destination are ignored.
1496///
1497/// This filter can be used multiple times within the same rule. Note that
1498/// not all implementations will be able to support mirroring to multiple
1499/// backends.
1500///
1501/// Support: Extended
1502///
1503///
1504#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1505pub struct HTTPRouteRulesFiltersRequestMirror {
1506 /// BackendRef references a resource where mirrored requests are sent.
1507 ///
1508 /// Mirrored requests must be sent only to a single destination endpoint
1509 /// within this BackendRef, irrespective of how many endpoints are present
1510 /// within this BackendRef.
1511 ///
1512 /// If the referent cannot be found, this BackendRef is invalid and must be
1513 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1514 /// condition on the Route status is set to `status: False` and not configure
1515 /// this backend in the underlying implementation.
1516 ///
1517 /// If there is a cross-namespace reference to an *existing* object
1518 /// that is not allowed by a ReferenceGrant, the controller must ensure the
1519 /// "ResolvedRefs" condition on the Route is set to `status: False`,
1520 /// with the "RefNotPermitted" reason and not configure this backend in the
1521 /// underlying implementation.
1522 ///
1523 /// In either error case, the Message of the `ResolvedRefs` Condition
1524 /// should be used to provide more detail about the problem.
1525 ///
1526 /// Support: Extended for Kubernetes Service
1527 ///
1528 /// Support: Implementation-specific for any other resource
1529 #[serde(rename = "backendRef")]
1530 pub backend_ref: HTTPRouteRulesFiltersRequestMirrorBackendRef,
1531 /// Fraction represents the fraction of requests that should be
1532 /// mirrored to BackendRef.
1533 ///
1534 /// Only one of Fraction or Percent may be specified. If neither field
1535 /// is specified, 100% of requests will be mirrored.
1536 ///
1537 ///
1538 #[serde(default, skip_serializing_if = "Option::is_none")]
1539 pub fraction: Option<HTTPRouteRulesFiltersRequestMirrorFraction>,
1540 /// Percent represents the percentage of requests that should be
1541 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
1542 /// requests) and its maximum value is 100 (indicating 100% of requests).
1543 ///
1544 /// Only one of Fraction or Percent may be specified. If neither field
1545 /// is specified, 100% of requests will be mirrored.
1546 ///
1547 ///
1548 #[serde(default, skip_serializing_if = "Option::is_none")]
1549 pub percent: Option<i32>,
1550}
1551
1552/// BackendRef references a resource where mirrored requests are sent.
1553///
1554/// Mirrored requests must be sent only to a single destination endpoint
1555/// within this BackendRef, irrespective of how many endpoints are present
1556/// within this BackendRef.
1557///
1558/// If the referent cannot be found, this BackendRef is invalid and must be
1559/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1560/// condition on the Route status is set to `status: False` and not configure
1561/// this backend in the underlying implementation.
1562///
1563/// If there is a cross-namespace reference to an *existing* object
1564/// that is not allowed by a ReferenceGrant, the controller must ensure the
1565/// "ResolvedRefs" condition on the Route is set to `status: False`,
1566/// with the "RefNotPermitted" reason and not configure this backend in the
1567/// underlying implementation.
1568///
1569/// In either error case, the Message of the `ResolvedRefs` Condition
1570/// should be used to provide more detail about the problem.
1571///
1572/// Support: Extended for Kubernetes Service
1573///
1574/// Support: Implementation-specific for any other resource
1575#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1576pub struct HTTPRouteRulesFiltersRequestMirrorBackendRef {
1577 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1578 /// When unspecified or empty string, core API group is inferred.
1579 #[serde(default, skip_serializing_if = "Option::is_none")]
1580 pub group: Option<String>,
1581 /// Kind is the Kubernetes resource kind of the referent. For example
1582 /// "Service".
1583 ///
1584 /// Defaults to "Service" when not specified.
1585 ///
1586 /// ExternalName services can refer to CNAME DNS records that may live
1587 /// outside of the cluster and as such are difficult to reason about in
1588 /// terms of conformance. They also may not be safe to forward to (see
1589 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
1590 /// support ExternalName Services.
1591 ///
1592 /// Support: Core (Services with a type other than ExternalName)
1593 ///
1594 /// Support: Implementation-specific (Services with type ExternalName)
1595 #[serde(default, skip_serializing_if = "Option::is_none")]
1596 pub kind: Option<String>,
1597 /// Name is the name of the referent.
1598 pub name: String,
1599 /// Namespace is the namespace of the backend. When unspecified, the local
1600 /// namespace is inferred.
1601 ///
1602 /// Note that when a namespace different than the local namespace is specified,
1603 /// a ReferenceGrant object is required in the referent namespace to allow that
1604 /// namespace's owner to accept the reference. See the ReferenceGrant
1605 /// documentation for details.
1606 ///
1607 /// Support: Core
1608 #[serde(default, skip_serializing_if = "Option::is_none")]
1609 pub namespace: Option<String>,
1610 /// Port specifies the destination port number to use for this resource.
1611 /// Port is required when the referent is a Kubernetes Service. In this
1612 /// case, the port number is the service port number, not the target port.
1613 /// For other resources, destination port might be derived from the referent
1614 /// resource or this field.
1615 #[serde(default, skip_serializing_if = "Option::is_none")]
1616 pub port: Option<i32>,
1617}
1618
1619/// Fraction represents the fraction of requests that should be
1620/// mirrored to BackendRef.
1621///
1622/// Only one of Fraction or Percent may be specified. If neither field
1623/// is specified, 100% of requests will be mirrored.
1624///
1625///
1626#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1627pub struct HTTPRouteRulesFiltersRequestMirrorFraction {
1628 #[serde(default, skip_serializing_if = "Option::is_none")]
1629 pub denominator: Option<i32>,
1630 pub numerator: i32,
1631}
1632
1633/// RequestRedirect defines a schema for a filter that responds to the
1634/// request with an HTTP redirection.
1635///
1636/// Support: Core
1637#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1638pub struct HTTPRouteRulesFiltersRequestRedirect {
1639 /// Hostname is the hostname to be used in the value of the `Location`
1640 /// header in the response.
1641 /// When empty, the hostname in the `Host` header of the request is used.
1642 ///
1643 /// Support: Core
1644 #[serde(default, skip_serializing_if = "Option::is_none")]
1645 pub hostname: Option<String>,
1646 /// Path defines parameters used to modify the path of the incoming request.
1647 /// The modified path is then used to construct the `Location` header. When
1648 /// empty, the request path is used as-is.
1649 ///
1650 /// Support: Extended
1651 #[serde(default, skip_serializing_if = "Option::is_none")]
1652 pub path: Option<HTTPRouteRulesFiltersRequestRedirectPath>,
1653 /// Port is the port to be used in the value of the `Location`
1654 /// header in the response.
1655 ///
1656 /// If no port is specified, the redirect port MUST be derived using the
1657 /// following rules:
1658 ///
1659 /// * If redirect scheme is not-empty, the redirect port MUST be the well-known
1660 /// port associated with the redirect scheme. Specifically "http" to port 80
1661 /// and "https" to port 443. If the redirect scheme does not have a
1662 /// well-known port, the listener port of the Gateway SHOULD be used.
1663 /// * If redirect scheme is empty, the redirect port MUST be the Gateway
1664 /// Listener port.
1665 ///
1666 /// Implementations SHOULD NOT add the port number in the 'Location'
1667 /// header in the following cases:
1668 ///
1669 /// * A Location header that will use HTTP (whether that is determined via
1670 /// the Listener protocol or the Scheme field) _and_ use port 80.
1671 /// * A Location header that will use HTTPS (whether that is determined via
1672 /// the Listener protocol or the Scheme field) _and_ use port 443.
1673 ///
1674 /// Support: Extended
1675 #[serde(default, skip_serializing_if = "Option::is_none")]
1676 pub port: Option<i32>,
1677 /// Scheme is the scheme to be used in the value of the `Location` header in
1678 /// the response. When empty, the scheme of the request is used.
1679 ///
1680 /// Scheme redirects can affect the port of the redirect, for more information,
1681 /// refer to the documentation for the port field of this filter.
1682 ///
1683 /// Note that values may be added to this enum, implementations
1684 /// must ensure that unknown values will not cause a crash.
1685 ///
1686 /// Unknown values here must result in the implementation setting the
1687 /// Accepted Condition for the Route to `status: False`, with a
1688 /// Reason of `UnsupportedValue`.
1689 ///
1690 /// Support: Extended
1691 #[serde(default, skip_serializing_if = "Option::is_none")]
1692 pub scheme: Option<HTTPRouteRulesFiltersRequestRedirectScheme>,
1693 /// StatusCode is the HTTP status code to be used in response.
1694 ///
1695 /// Note that values may be added to this enum, implementations
1696 /// must ensure that unknown values will not cause a crash.
1697 ///
1698 /// Unknown values here must result in the implementation setting the
1699 /// Accepted Condition for the Route to `status: False`, with a
1700 /// Reason of `UnsupportedValue`.
1701 ///
1702 /// Support: Core
1703 #[serde(
1704 default,
1705 skip_serializing_if = "Option::is_none",
1706 rename = "statusCode"
1707 )]
1708 pub status_code: Option<i64>,
1709}
1710
1711/// Path defines parameters used to modify the path of the incoming request.
1712/// The modified path is then used to construct the `Location` header. When
1713/// empty, the request path is used as-is.
1714///
1715/// Support: Extended
1716#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1717pub struct HTTPRouteRulesFiltersRequestRedirectPath {
1718 /// ReplaceFullPath specifies the value with which to replace the full path
1719 /// of a request during a rewrite or redirect.
1720 #[serde(
1721 default,
1722 skip_serializing_if = "Option::is_none",
1723 rename = "replaceFullPath"
1724 )]
1725 pub replace_full_path: Option<String>,
1726 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1727 /// match of a request during a rewrite or redirect. For example, a request
1728 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1729 /// of "/xyz" would be modified to "/xyz/bar".
1730 ///
1731 /// Note that this matches the behavior of the PathPrefix match type. This
1732 /// matches full path elements. A path element refers to the list of labels
1733 /// in the path split by the `/` separator. When specified, a trailing `/` is
1734 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1735 /// match the prefix `/abc`, but the path `/abcd` would not.
1736 ///
1737 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1738 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1739 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1740 ///
1741 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1742 #[serde(
1743 default,
1744 skip_serializing_if = "Option::is_none",
1745 rename = "replacePrefixMatch"
1746 )]
1747 pub replace_prefix_match: Option<String>,
1748 /// Type defines the type of path modifier. Additional types may be
1749 /// added in a future release of the API.
1750 ///
1751 /// Note that values may be added to this enum, implementations
1752 /// must ensure that unknown values will not cause a crash.
1753 ///
1754 /// Unknown values here must result in the implementation setting the
1755 /// Accepted Condition for the Route to `status: False`, with a
1756 /// Reason of `UnsupportedValue`.
1757 #[serde(rename = "type")]
1758 pub r#type: HTTPRouteRulesFiltersRequestRedirectPathType,
1759}
1760
1761/// Path defines parameters used to modify the path of the incoming request.
1762/// The modified path is then used to construct the `Location` header. When
1763/// empty, the request path is used as-is.
1764///
1765/// Support: Extended
1766#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1767pub enum HTTPRouteRulesFiltersRequestRedirectPathType {
1768 ReplaceFullPath,
1769 ReplacePrefixMatch,
1770}
1771
1772/// RequestRedirect defines a schema for a filter that responds to the
1773/// request with an HTTP redirection.
1774///
1775/// Support: Core
1776#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1777pub enum HTTPRouteRulesFiltersRequestRedirectScheme {
1778 #[serde(rename = "http")]
1779 Http,
1780 #[serde(rename = "https")]
1781 Https,
1782}
1783
1784/// RequestRedirect defines a schema for a filter that responds to the
1785/// request with an HTTP redirection.
1786///
1787/// Support: Core
1788#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1789pub enum HTTPRouteRulesFiltersRequestRedirectStatusCode {
1790 #[serde(rename = "301")]
1791 r#_301,
1792 #[serde(rename = "302")]
1793 r#_302,
1794}
1795
1796/// ResponseHeaderModifier defines a schema for a filter that modifies response
1797/// headers.
1798///
1799/// Support: Extended
1800#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1801pub struct HTTPRouteRulesFiltersResponseHeaderModifier {
1802 /// Add adds the given header(s) (name, value) to the request
1803 /// before the action. It appends to any existing values associated
1804 /// with the header name.
1805 ///
1806 /// Input:
1807 /// GET /foo HTTP/1.1
1808 /// my-header: foo
1809 ///
1810 /// Config:
1811 /// add:
1812 /// - name: "my-header"
1813 /// value: "bar,baz"
1814 ///
1815 /// Output:
1816 /// GET /foo HTTP/1.1
1817 /// my-header: foo,bar,baz
1818 #[serde(default, skip_serializing_if = "Option::is_none")]
1819 pub add: Option<Vec<HTTPRouteRulesFiltersResponseHeaderModifierAdd>>,
1820 /// Remove the given header(s) from the HTTP request before the action. The
1821 /// value of Remove is a list of HTTP header names. Note that the header
1822 /// names are case-insensitive (see
1823 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1824 ///
1825 /// Input:
1826 /// GET /foo HTTP/1.1
1827 /// my-header1: foo
1828 /// my-header2: bar
1829 /// my-header3: baz
1830 ///
1831 /// Config:
1832 /// remove: ["my-header1", "my-header3"]
1833 ///
1834 /// Output:
1835 /// GET /foo HTTP/1.1
1836 /// my-header2: bar
1837 #[serde(default, skip_serializing_if = "Option::is_none")]
1838 pub remove: Option<Vec<String>>,
1839 /// Set overwrites the request with the given header (name, value)
1840 /// before the action.
1841 ///
1842 /// Input:
1843 /// GET /foo HTTP/1.1
1844 /// my-header: foo
1845 ///
1846 /// Config:
1847 /// set:
1848 /// - name: "my-header"
1849 /// value: "bar"
1850 ///
1851 /// Output:
1852 /// GET /foo HTTP/1.1
1853 /// my-header: bar
1854 #[serde(default, skip_serializing_if = "Option::is_none")]
1855 pub set: Option<Vec<HTTPRouteRulesFiltersResponseHeaderModifierSet>>,
1856}
1857
1858/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1859#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1860pub struct HTTPRouteRulesFiltersResponseHeaderModifierAdd {
1861 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1862 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1863 ///
1864 /// If multiple entries specify equivalent header names, the first entry with
1865 /// an equivalent name MUST be considered for a match. Subsequent entries
1866 /// with an equivalent header name MUST be ignored. Due to the
1867 /// case-insensitivity of header names, "foo" and "Foo" are considered
1868 /// equivalent.
1869 pub name: String,
1870 /// Value is the value of HTTP Header to be matched.
1871 pub value: String,
1872}
1873
1874/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1875#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1876pub struct HTTPRouteRulesFiltersResponseHeaderModifierSet {
1877 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1878 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1879 ///
1880 /// If multiple entries specify equivalent header names, the first entry with
1881 /// an equivalent name MUST be considered for a match. Subsequent entries
1882 /// with an equivalent header name MUST be ignored. Due to the
1883 /// case-insensitivity of header names, "foo" and "Foo" are considered
1884 /// equivalent.
1885 pub name: String,
1886 /// Value is the value of HTTP Header to be matched.
1887 pub value: String,
1888}
1889
1890/// HTTPRouteFilter defines processing steps that must be completed during the
1891/// request or response lifecycle. HTTPRouteFilters are meant as an extension
1892/// point to express processing that may be done in Gateway implementations. Some
1893/// examples include request or response modification, implementing
1894/// authentication strategies, rate-limiting, and traffic shaping. API
1895/// guarantee/conformance is defined based on the type of the filter.
1896#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1897pub enum HTTPRouteRulesFiltersType {
1898 RequestHeaderModifier,
1899 ResponseHeaderModifier,
1900 RequestMirror,
1901 RequestRedirect,
1902 #[serde(rename = "URLRewrite")]
1903 UrlRewrite,
1904 ExtensionRef,
1905}
1906
1907/// URLRewrite defines a schema for a filter that modifies a request during forwarding.
1908///
1909/// Support: Extended
1910#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1911pub struct HTTPRouteRulesFiltersUrlRewrite {
1912 /// Hostname is the value to be used to replace the Host header value during
1913 /// forwarding.
1914 ///
1915 /// Support: Extended
1916 #[serde(default, skip_serializing_if = "Option::is_none")]
1917 pub hostname: Option<String>,
1918 /// Path defines a path rewrite.
1919 ///
1920 /// Support: Extended
1921 #[serde(default, skip_serializing_if = "Option::is_none")]
1922 pub path: Option<HTTPRouteRulesFiltersUrlRewritePath>,
1923}
1924
1925/// Path defines a path rewrite.
1926///
1927/// Support: Extended
1928#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1929pub struct HTTPRouteRulesFiltersUrlRewritePath {
1930 /// ReplaceFullPath specifies the value with which to replace the full path
1931 /// of a request during a rewrite or redirect.
1932 #[serde(
1933 default,
1934 skip_serializing_if = "Option::is_none",
1935 rename = "replaceFullPath"
1936 )]
1937 pub replace_full_path: Option<String>,
1938 /// ReplacePrefixMatch specifies the value with which to replace the prefix
1939 /// match of a request during a rewrite or redirect. For example, a request
1940 /// to "/foo/bar" with a prefix match of "/foo" and a ReplacePrefixMatch
1941 /// of "/xyz" would be modified to "/xyz/bar".
1942 ///
1943 /// Note that this matches the behavior of the PathPrefix match type. This
1944 /// matches full path elements. A path element refers to the list of labels
1945 /// in the path split by the `/` separator. When specified, a trailing `/` is
1946 /// ignored. For example, the paths `/abc`, `/abc/`, and `/abc/def` would all
1947 /// match the prefix `/abc`, but the path `/abcd` would not.
1948 ///
1949 /// ReplacePrefixMatch is only compatible with a `PathPrefix` HTTPRouteMatch.
1950 /// Using any other HTTPRouteMatch type on the same HTTPRouteRule will result in
1951 /// the implementation setting the Accepted Condition for the Route to `status: False`.
1952 ///
1953 /// Request Path | Prefix Match | Replace Prefix | Modified Path
1954 #[serde(
1955 default,
1956 skip_serializing_if = "Option::is_none",
1957 rename = "replacePrefixMatch"
1958 )]
1959 pub replace_prefix_match: Option<String>,
1960 /// Type defines the type of path modifier. Additional types may be
1961 /// added in a future release of the API.
1962 ///
1963 /// Note that values may be added to this enum, implementations
1964 /// must ensure that unknown values will not cause a crash.
1965 ///
1966 /// Unknown values here must result in the implementation setting the
1967 /// Accepted Condition for the Route to `status: False`, with a
1968 /// Reason of `UnsupportedValue`.
1969 #[serde(rename = "type")]
1970 pub r#type: HTTPRouteRulesFiltersUrlRewritePathType,
1971}
1972
1973/// Path defines a path rewrite.
1974///
1975/// Support: Extended
1976#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1977pub enum HTTPRouteRulesFiltersUrlRewritePathType {
1978 ReplaceFullPath,
1979 ReplacePrefixMatch,
1980}
1981
1982/// HTTPRouteMatch defines the predicate used to match requests to a given
1983/// action. Multiple match types are ANDed together, i.e. the match will
1984/// evaluate to true only if all conditions are satisfied.
1985///
1986/// For example, the match below will match a HTTP request only if its path
1987/// starts with `/foo` AND it contains the `version: v1` header:
1988///
1989/// ```text
1990/// match:
1991///
1992/// path:
1993/// value: "/foo"
1994/// headers:
1995/// - name: "version"
1996/// value "v1"
1997///
1998/// ```
1999#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2000pub struct HTTPRouteRulesMatches {
2001 /// Headers specifies HTTP request header matchers. Multiple match values are
2002 /// ANDed together, meaning, a request must match all the specified headers
2003 /// to select the route.
2004 #[serde(default, skip_serializing_if = "Option::is_none")]
2005 pub headers: Option<Vec<HTTPRouteRulesMatchesHeaders>>,
2006 /// Method specifies HTTP method matcher.
2007 /// When specified, this route will be matched only if the request has the
2008 /// specified method.
2009 ///
2010 /// Support: Extended
2011 #[serde(default, skip_serializing_if = "Option::is_none")]
2012 pub method: Option<HTTPRouteRulesMatchesMethod>,
2013 /// Path specifies a HTTP request path matcher. If this field is not
2014 /// specified, a default prefix match on the "/" path is provided.
2015 #[serde(default, skip_serializing_if = "Option::is_none")]
2016 pub path: Option<HTTPRouteRulesMatchesPath>,
2017 /// QueryParams specifies HTTP query parameter matchers. Multiple match
2018 /// values are ANDed together, meaning, a request must match all the
2019 /// specified query parameters to select the route.
2020 ///
2021 /// Support: Extended
2022 #[serde(
2023 default,
2024 skip_serializing_if = "Option::is_none",
2025 rename = "queryParams"
2026 )]
2027 pub query_params: Option<Vec<HTTPRouteRulesMatchesQueryParams>>,
2028}
2029
2030/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2031/// headers.
2032#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2033pub struct HTTPRouteRulesMatchesHeaders {
2034 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
2035 /// case insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
2036 ///
2037 /// If multiple entries specify equivalent header names, only the first
2038 /// entry with an equivalent name MUST be considered for a match. Subsequent
2039 /// entries with an equivalent header name MUST be ignored. Due to the
2040 /// case-insensitivity of header names, "foo" and "Foo" are considered
2041 /// equivalent.
2042 ///
2043 /// When a header is repeated in an HTTP request, it is
2044 /// implementation-specific behavior as to how this is represented.
2045 /// Generally, proxies should follow the guidance from the RFC:
2046 /// https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
2047 /// processing a repeated header, with special handling for "Set-Cookie".
2048 pub name: String,
2049 /// Type specifies how to match against the value of the header.
2050 ///
2051 /// Support: Core (Exact)
2052 ///
2053 /// Support: Implementation-specific (RegularExpression)
2054 ///
2055 /// Since RegularExpression HeaderMatchType has implementation-specific
2056 /// conformance, implementations can support POSIX, PCRE or any other dialects
2057 /// of regular expressions. Please read the implementation's documentation to
2058 /// determine the supported dialect.
2059 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2060 pub r#type: Option<HTTPRouteRulesMatchesHeadersType>,
2061 /// Value is the value of HTTP Header to be matched.
2062 pub value: String,
2063}
2064
2065/// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
2066/// headers.
2067#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2068pub enum HTTPRouteRulesMatchesHeadersType {
2069 Exact,
2070 RegularExpression,
2071}
2072
2073/// HTTPRouteMatch defines the predicate used to match requests to a given
2074/// action. Multiple match types are ANDed together, i.e. the match will
2075/// evaluate to true only if all conditions are satisfied.
2076///
2077/// For example, the match below will match a HTTP request only if its path
2078/// starts with `/foo` AND it contains the `version: v1` header:
2079///
2080/// ```text
2081/// match:
2082///
2083/// path:
2084/// value: "/foo"
2085/// headers:
2086/// - name: "version"
2087/// value "v1"
2088///
2089/// ```
2090#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2091pub enum HTTPRouteRulesMatchesMethod {
2092 #[serde(rename = "GET")]
2093 Get,
2094 #[serde(rename = "HEAD")]
2095 Head,
2096 #[serde(rename = "POST")]
2097 Post,
2098 #[serde(rename = "PUT")]
2099 Put,
2100 #[serde(rename = "DELETE")]
2101 Delete,
2102 #[serde(rename = "CONNECT")]
2103 Connect,
2104 #[serde(rename = "OPTIONS")]
2105 Options,
2106 #[serde(rename = "TRACE")]
2107 Trace,
2108 #[serde(rename = "PATCH")]
2109 Patch,
2110}
2111
2112/// Path specifies a HTTP request path matcher. If this field is not
2113/// specified, a default prefix match on the "/" path is provided.
2114#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2115pub struct HTTPRouteRulesMatchesPath {
2116 /// Type specifies how to match against the path Value.
2117 ///
2118 /// Support: Core (Exact, PathPrefix)
2119 ///
2120 /// Support: Implementation-specific (RegularExpression)
2121 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2122 pub r#type: Option<HTTPRouteRulesMatchesPathType>,
2123 /// Value of the HTTP path to match against.
2124 #[serde(default, skip_serializing_if = "Option::is_none")]
2125 pub value: Option<String>,
2126}
2127
2128/// Path specifies a HTTP request path matcher. If this field is not
2129/// specified, a default prefix match on the "/" path is provided.
2130#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2131pub enum HTTPRouteRulesMatchesPathType {
2132 Exact,
2133 PathPrefix,
2134 RegularExpression,
2135}
2136
2137/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2138/// query parameters.
2139#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2140pub struct HTTPRouteRulesMatchesQueryParams {
2141 /// Name is the name of the HTTP query param to be matched. This must be an
2142 /// exact string match. (See
2143 /// https://tools.ietf.org/html/rfc7230#section-2.7.3).
2144 ///
2145 /// If multiple entries specify equivalent query param names, only the first
2146 /// entry with an equivalent name MUST be considered for a match. Subsequent
2147 /// entries with an equivalent query param name MUST be ignored.
2148 ///
2149 /// If a query param is repeated in an HTTP request, the behavior is
2150 /// purposely left undefined, since different data planes have different
2151 /// capabilities. However, it is *recommended* that implementations should
2152 /// match against the first value of the param if the data plane supports it,
2153 /// as this behavior is expected in other load balancing contexts outside of
2154 /// the Gateway API.
2155 ///
2156 /// Users SHOULD NOT route traffic based on repeated query params to guard
2157 /// themselves against potential differences in the implementations.
2158 pub name: String,
2159 /// Type specifies how to match against the value of the query parameter.
2160 ///
2161 /// Support: Extended (Exact)
2162 ///
2163 /// Support: Implementation-specific (RegularExpression)
2164 ///
2165 /// Since RegularExpression QueryParamMatchType has Implementation-specific
2166 /// conformance, implementations can support POSIX, PCRE or any other
2167 /// dialects of regular expressions. Please read the implementation's
2168 /// documentation to determine the supported dialect.
2169 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2170 pub r#type: Option<HTTPRouteRulesMatchesQueryParamsType>,
2171 /// Value is the value of HTTP query param to be matched.
2172 pub value: String,
2173}
2174
2175/// HTTPQueryParamMatch describes how to select a HTTP route by matching HTTP
2176/// query parameters.
2177#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2178pub enum HTTPRouteRulesMatchesQueryParamsType {
2179 Exact,
2180 RegularExpression,
2181}
2182
2183/// Retry defines the configuration for when to retry an HTTP request.
2184///
2185/// Support: Extended
2186///
2187///
2188#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2189pub struct HTTPRouteRulesRetry {
2190 /// Attempts specifies the maxmimum number of times an individual request
2191 /// from the gateway to a backend should be retried.
2192 ///
2193 /// If the maximum number of retries has been attempted without a successful
2194 /// response from the backend, the Gateway MUST return an error.
2195 ///
2196 /// When this field is unspecified, the number of times to attempt to retry
2197 /// a backend request is implementation-specific.
2198 ///
2199 /// Support: Extended
2200 #[serde(default, skip_serializing_if = "Option::is_none")]
2201 pub attempts: Option<i64>,
2202 /// Backoff specifies the minimum duration a Gateway should wait between
2203 /// retry attempts and is represented in Gateway API Duration formatting.
2204 ///
2205 /// For example, setting the `rules[].retry.backoff` field to the value
2206 /// `100ms` will cause a backend request to first be retried approximately
2207 /// 100 milliseconds after timing out or receiving a response code configured
2208 /// to be retryable.
2209 ///
2210 /// An implementation MAY use an exponential or alternative backoff strategy
2211 /// for subsequent retry attempts, MAY cap the maximum backoff duration to
2212 /// some amount greater than the specified minimum, and MAY add arbitrary
2213 /// jitter to stagger requests, as long as unsuccessful backend requests are
2214 /// not retried before the configured minimum duration.
2215 ///
2216 /// If a Request timeout (`rules[].timeouts.request`) is configured on the
2217 /// route, the entire duration of the initial request and any retry attempts
2218 /// MUST not exceed the Request timeout duration. If any retry attempts are
2219 /// still in progress when the Request timeout duration has been reached,
2220 /// these SHOULD be canceled if possible and the Gateway MUST immediately
2221 /// return a timeout error.
2222 ///
2223 /// If a BackendRequest timeout (`rules[].timeouts.backendRequest`) is
2224 /// configured on the route, any retry attempts which reach the configured
2225 /// BackendRequest timeout duration without a response SHOULD be canceled if
2226 /// possible and the Gateway should wait for at least the specified backoff
2227 /// duration before attempting to retry the backend request again.
2228 ///
2229 /// If a BackendRequest timeout is _not_ configured on the route, retry
2230 /// attempts MAY time out after an implementation default duration, or MAY
2231 /// remain pending until a configured Request timeout or implementation
2232 /// default duration for total request time is reached.
2233 ///
2234 /// When this field is unspecified, the time to wait between retry attempts
2235 /// is implementation-specific.
2236 ///
2237 /// Support: Extended
2238 #[serde(default, skip_serializing_if = "Option::is_none")]
2239 pub backoff: Option<String>,
2240 /// Codes defines the HTTP response status codes for which a backend request
2241 /// should be retried.
2242 ///
2243 /// Support: Extended
2244 #[serde(default, skip_serializing_if = "Option::is_none")]
2245 pub codes: Option<Vec<i64>>,
2246}
2247
2248/// SessionPersistence defines and configures session persistence
2249/// for the route rule.
2250///
2251/// Support: Extended
2252///
2253///
2254#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2255pub struct HTTPRouteRulesSessionPersistence {
2256 /// AbsoluteTimeout defines the absolute timeout of the persistent
2257 /// session. Once the AbsoluteTimeout duration has elapsed, the
2258 /// session becomes invalid.
2259 ///
2260 /// Support: Extended
2261 #[serde(
2262 default,
2263 skip_serializing_if = "Option::is_none",
2264 rename = "absoluteTimeout"
2265 )]
2266 pub absolute_timeout: Option<String>,
2267 /// CookieConfig provides configuration settings that are specific
2268 /// to cookie-based session persistence.
2269 ///
2270 /// Support: Core
2271 #[serde(
2272 default,
2273 skip_serializing_if = "Option::is_none",
2274 rename = "cookieConfig"
2275 )]
2276 pub cookie_config: Option<HTTPRouteRulesSessionPersistenceCookieConfig>,
2277 /// IdleTimeout defines the idle timeout of the persistent session.
2278 /// Once the session has been idle for more than the specified
2279 /// IdleTimeout duration, the session becomes invalid.
2280 ///
2281 /// Support: Extended
2282 #[serde(
2283 default,
2284 skip_serializing_if = "Option::is_none",
2285 rename = "idleTimeout"
2286 )]
2287 pub idle_timeout: Option<String>,
2288 /// SessionName defines the name of the persistent session token
2289 /// which may be reflected in the cookie or the header. Users
2290 /// should avoid reusing session names to prevent unintended
2291 /// consequences, such as rejection or unpredictable behavior.
2292 ///
2293 /// Support: Implementation-specific
2294 #[serde(
2295 default,
2296 skip_serializing_if = "Option::is_none",
2297 rename = "sessionName"
2298 )]
2299 pub session_name: Option<String>,
2300 /// Type defines the type of session persistence such as through
2301 /// the use a header or cookie. Defaults to cookie based session
2302 /// persistence.
2303 ///
2304 /// Support: Core for "Cookie" type
2305 ///
2306 /// Support: Extended for "Header" type
2307 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
2308 pub r#type: Option<HTTPRouteRulesSessionPersistenceType>,
2309}
2310
2311/// CookieConfig provides configuration settings that are specific
2312/// to cookie-based session persistence.
2313///
2314/// Support: Core
2315#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2316pub struct HTTPRouteRulesSessionPersistenceCookieConfig {
2317 /// LifetimeType specifies whether the cookie has a permanent or
2318 /// session-based lifetime. A permanent cookie persists until its
2319 /// specified expiry time, defined by the Expires or Max-Age cookie
2320 /// attributes, while a session cookie is deleted when the current
2321 /// session ends.
2322 ///
2323 /// When set to "Permanent", AbsoluteTimeout indicates the
2324 /// cookie's lifetime via the Expires or Max-Age cookie attributes
2325 /// and is required.
2326 ///
2327 /// When set to "Session", AbsoluteTimeout indicates the
2328 /// absolute lifetime of the cookie tracked by the gateway and
2329 /// is optional.
2330 ///
2331 /// Support: Core for "Session" type
2332 ///
2333 /// Support: Extended for "Permanent" type
2334 #[serde(
2335 default,
2336 skip_serializing_if = "Option::is_none",
2337 rename = "lifetimeType"
2338 )]
2339 pub lifetime_type: Option<HTTPRouteRulesSessionPersistenceCookieConfigLifetimeType>,
2340}
2341
2342/// CookieConfig provides configuration settings that are specific
2343/// to cookie-based session persistence.
2344///
2345/// Support: Core
2346#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2347pub enum HTTPRouteRulesSessionPersistenceCookieConfigLifetimeType {
2348 Permanent,
2349 Session,
2350}
2351
2352/// SessionPersistence defines and configures session persistence
2353/// for the route rule.
2354///
2355/// Support: Extended
2356///
2357///
2358#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
2359pub enum HTTPRouteRulesSessionPersistenceType {
2360 Cookie,
2361 Header,
2362}
2363
2364/// Timeouts defines the timeouts that can be configured for an HTTP request.
2365///
2366/// Support: Extended
2367#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2368pub struct HTTPRouteRulesTimeouts {
2369 /// BackendRequest specifies a timeout for an individual request from the gateway
2370 /// to a backend. This covers the time from when the request first starts being
2371 /// sent from the gateway to when the full response has been received from the backend.
2372 ///
2373 /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2374 /// completely. Implementations that cannot completely disable the timeout MUST
2375 /// instead interpret the zero duration as the longest possible value to which
2376 /// the timeout can be set.
2377 ///
2378 /// An entire client HTTP transaction with a gateway, covered by the Request timeout,
2379 /// may result in more than one call from the gateway to the destination backend,
2380 /// for example, if automatic retries are supported.
2381 ///
2382 /// The value of BackendRequest must be a Gateway API Duration string as defined by
2383 /// GEP-2257. When this field is unspecified, its behavior is implementation-specific;
2384 /// when specified, the value of BackendRequest must be no more than the value of the
2385 /// Request timeout (since the Request timeout encompasses the BackendRequest timeout).
2386 ///
2387 /// Support: Extended
2388 #[serde(
2389 default,
2390 skip_serializing_if = "Option::is_none",
2391 rename = "backendRequest"
2392 )]
2393 pub backend_request: Option<String>,
2394 /// Request specifies the maximum duration for a gateway to respond to an HTTP request.
2395 /// If the gateway has not been able to respond before this deadline is met, the gateway
2396 /// MUST return a timeout error.
2397 ///
2398 /// For example, setting the `rules.timeouts.request` field to the value `10s` in an
2399 /// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
2400 /// to complete.
2401 ///
2402 /// Setting a timeout to the zero duration (e.g. "0s") SHOULD disable the timeout
2403 /// completely. Implementations that cannot completely disable the timeout MUST
2404 /// instead interpret the zero duration as the longest possible value to which
2405 /// the timeout can be set.
2406 ///
2407 /// This timeout is intended to cover as close to the whole request-response transaction
2408 /// as possible although an implementation MAY choose to start the timeout after the entire
2409 /// request stream has been received instead of immediately after the transaction is
2410 /// initiated by the client.
2411 ///
2412 /// The value of Request is a Gateway API Duration string as defined by GEP-2257. When this
2413 /// field is unspecified, request timeout behavior is implementation-specific.
2414 ///
2415 /// Support: Extended
2416 #[serde(default, skip_serializing_if = "Option::is_none")]
2417 pub request: Option<String>,
2418}
2419
2420/// Status defines the current state of HTTPRoute.
2421#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2422pub struct HTTPRouteStatus {
2423 /// Parents is a list of parent resources (usually Gateways) that are
2424 /// associated with the route, and the status of the route with respect to
2425 /// each parent. When this route attaches to a parent, the controller that
2426 /// manages the parent must add an entry to this list when the controller
2427 /// first sees the route and should update the entry as appropriate when the
2428 /// route or gateway is modified.
2429 ///
2430 /// Note that parent references that cannot be resolved by an implementation
2431 /// of this API will not be added to this list. Implementations of this API
2432 /// can only populate Route status for the Gateways/parent resources they are
2433 /// responsible for.
2434 ///
2435 /// A maximum of 32 Gateways will be represented in this list. An empty list
2436 /// means the route has not been attached to any Gateway.
2437 pub parents: Vec<HTTPRouteStatusParents>,
2438}
2439
2440/// RouteParentStatus describes the status of a route with respect to an
2441/// associated Parent.
2442#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2443pub struct HTTPRouteStatusParents {
2444 /// Conditions describes the status of the route with respect to the Gateway.
2445 /// Note that the route's availability is also subject to the Gateway's own
2446 /// status conditions and listener status.
2447 ///
2448 /// If the Route's ParentRef specifies an existing Gateway that supports
2449 /// Routes of this kind AND that Gateway's controller has sufficient access,
2450 /// then that Gateway's controller MUST set the "Accepted" condition on the
2451 /// Route, to indicate whether the route has been accepted or rejected by the
2452 /// Gateway, and why.
2453 ///
2454 /// A Route MUST be considered "Accepted" if at least one of the Route's
2455 /// rules is implemented by the Gateway.
2456 ///
2457 /// There are a number of cases where the "Accepted" condition may not be set
2458 /// due to lack of controller visibility, that includes when:
2459 ///
2460 /// * The Route refers to a non-existent parent.
2461 /// * The Route is of a type that the controller does not support.
2462 /// * The Route is in a namespace the controller does not have access to.
2463 #[serde(default, skip_serializing_if = "Option::is_none")]
2464 pub conditions: Option<Vec<Condition>>,
2465 /// ControllerName is a domain/path string that indicates the name of the
2466 /// controller that wrote this status. This corresponds with the
2467 /// controllerName field on GatewayClass.
2468 ///
2469 /// Example: "example.net/gateway-controller".
2470 ///
2471 /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
2472 /// valid Kubernetes names
2473 /// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
2474 ///
2475 /// Controllers MUST populate this field when writing status. Controllers should ensure that
2476 /// entries to status populated with their ControllerName are cleaned up when they are no
2477 /// longer necessary.
2478 #[serde(rename = "controllerName")]
2479 pub controller_name: String,
2480 /// ParentRef corresponds with a ParentRef in the spec that this
2481 /// RouteParentStatus struct describes the status of.
2482 #[serde(rename = "parentRef")]
2483 pub parent_ref: HTTPRouteStatusParentsParentRef,
2484}
2485
2486/// ParentRef corresponds with a ParentRef in the spec that this
2487/// RouteParentStatus struct describes the status of.
2488#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
2489pub struct HTTPRouteStatusParentsParentRef {
2490 /// Group is the group of the referent.
2491 /// When unspecified, "gateway.networking.k8s.io" is inferred.
2492 /// To set the core API group (such as for a "Service" kind referent),
2493 /// Group must be explicitly set to "" (empty string).
2494 ///
2495 /// Support: Core
2496 #[serde(default, skip_serializing_if = "Option::is_none")]
2497 pub group: Option<String>,
2498 /// Kind is kind of the referent.
2499 ///
2500 /// There are two kinds of parent resources with "Core" support:
2501 ///
2502 /// * Gateway (Gateway conformance profile)
2503 /// * Service (Mesh conformance profile, ClusterIP Services only)
2504 ///
2505 /// Support for other resources is Implementation-Specific.
2506 #[serde(default, skip_serializing_if = "Option::is_none")]
2507 pub kind: Option<String>,
2508 /// Name is the name of the referent.
2509 ///
2510 /// Support: Core
2511 pub name: String,
2512 /// Namespace is the namespace of the referent. When unspecified, this refers
2513 /// to the local namespace of the Route.
2514 ///
2515 /// Note that there are specific rules for ParentRefs which cross namespace
2516 /// boundaries. Cross-namespace references are only valid if they are explicitly
2517 /// allowed by something in the namespace they are referring to. For example:
2518 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
2519 /// generic way to enable any other kind of cross-namespace reference.
2520 ///
2521 ///
2522 /// ParentRefs from a Route to a Service in the same namespace are "producer"
2523 /// routes, which apply default routing rules to inbound connections from
2524 /// any namespace to the Service.
2525 ///
2526 /// ParentRefs from a Route to a Service in a different namespace are
2527 /// "consumer" routes, and these routing rules are only applied to outbound
2528 /// connections originating from the same namespace as the Route, for which
2529 /// the intended destination of the connections are a Service targeted as a
2530 /// ParentRef of the Route.
2531 ///
2532 ///
2533 /// Support: Core
2534 #[serde(default, skip_serializing_if = "Option::is_none")]
2535 pub namespace: Option<String>,
2536 /// Port is the network port this Route targets. It can be interpreted
2537 /// differently based on the type of parent resource.
2538 ///
2539 /// When the parent resource is a Gateway, this targets all listeners
2540 /// listening on the specified port that also support this kind of Route(and
2541 /// select this Route). It's not recommended to set `Port` unless the
2542 /// networking behaviors specified in a Route must apply to a specific port
2543 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
2544 /// and SectionName are specified, the name and port of the selected listener
2545 /// must match both specified values.
2546 ///
2547 ///
2548 /// When the parent resource is a Service, this targets a specific port in the
2549 /// Service spec. When both Port (experimental) and SectionName are specified,
2550 /// the name and port of the selected port must match both specified values.
2551 ///
2552 ///
2553 /// Implementations MAY choose to support other parent resources.
2554 /// Implementations supporting other types of parent resources MUST clearly
2555 /// document how/if Port is interpreted.
2556 ///
2557 /// For the purpose of status, an attachment is considered successful as
2558 /// long as the parent resource accepts it partially. For example, Gateway
2559 /// listeners can restrict which Routes can attach to them by Route kind,
2560 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
2561 /// from the referencing Route, the Route MUST be considered successfully
2562 /// attached. If no Gateway listeners accept attachment from this Route,
2563 /// the Route MUST be considered detached from the Gateway.
2564 ///
2565 /// Support: Extended
2566 #[serde(default, skip_serializing_if = "Option::is_none")]
2567 pub port: Option<i32>,
2568 /// SectionName is the name of a section within the target resource. In the
2569 /// following resources, SectionName is interpreted as the following:
2570 ///
2571 /// * Gateway: Listener name. When both Port (experimental) and SectionName
2572 /// are specified, the name and port of the selected listener must match
2573 /// both specified values.
2574 /// * Service: Port name. When both Port (experimental) and SectionName
2575 /// are specified, the name and port of the selected listener must match
2576 /// both specified values.
2577 ///
2578 /// Implementations MAY choose to support attaching Routes to other resources.
2579 /// If that is the case, they MUST clearly document how SectionName is
2580 /// interpreted.
2581 ///
2582 /// When unspecified (empty string), this will reference the entire resource.
2583 /// For the purpose of status, an attachment is considered successful if at
2584 /// least one section in the parent resource accepts it. For example, Gateway
2585 /// listeners can restrict which Routes can attach to them by Route kind,
2586 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
2587 /// the referencing Route, the Route MUST be considered successfully
2588 /// attached. If no Gateway listeners accept attachment from this Route, the
2589 /// Route MUST be considered detached from the Gateway.
2590 ///
2591 /// Support: Core
2592 #[serde(
2593 default,
2594 skip_serializing_if = "Option::is_none",
2595 rename = "sectionName"
2596 )]
2597 pub section_name: Option<String>,
2598}