gateway_api/apis/standard/grpcroutes.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 GRPCRoute.
15#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
16#[kube(
17 group = "gateway.networking.k8s.io",
18 version = "v1",
19 kind = "GRPCRoute",
20 plural = "grpcroutes"
21)]
22#[kube(namespaced)]
23#[kube(status = "GRPCRouteStatus")]
24#[kube(derive = "Default")]
25#[kube(derive = "PartialEq")]
26pub struct GRPCRouteSpec {
27 /// Hostnames defines a set of hostnames to match against the GRPC
28 /// Host header to select a GRPCRoute to process the request. This matches
29 /// the RFC 1123 definition of a hostname with 2 notable exceptions:
30 ///
31 /// 1. IPs are not allowed.
32 /// 2. A hostname may be prefixed with a wildcard label (`*.`). The wildcard
33 /// label MUST appear by itself as the first label.
34 ///
35 /// If a hostname is specified by both the Listener and GRPCRoute, there
36 /// MUST be at least one intersecting hostname for the GRPCRoute to be
37 /// attached to the Listener. For example:
38 ///
39 /// * A Listener with `test.example.com` as the hostname matches GRPCRoutes
40 /// that have either not specified any hostnames, or have specified at
41 /// least one of `test.example.com` or `*.example.com`.
42 /// * A Listener with `*.example.com` as the hostname matches GRPCRoutes
43 /// that have either not specified any hostnames or have specified at least
44 /// one hostname that matches the Listener hostname. For example,
45 /// `test.example.com` and `*.example.com` would both match. On the other
46 /// hand, `example.com` and `test.example.net` would not match.
47 ///
48 /// Hostnames that are prefixed with a wildcard label (`*.`) are interpreted
49 /// as a suffix match. That means that a match for `*.example.com` would match
50 /// both `test.example.com`, and `foo.test.example.com`, but not `example.com`.
51 ///
52 /// If both the Listener and GRPCRoute have specified hostnames, any
53 /// GRPCRoute hostnames that do not match the Listener hostname MUST be
54 /// ignored. For example, if a Listener specified `*.example.com`, and the
55 /// GRPCRoute specified `test.example.com` and `test.example.net`,
56 /// `test.example.net` MUST NOT be considered for a match.
57 ///
58 /// If both the Listener and GRPCRoute have specified hostnames, and none
59 /// match with the criteria above, then the GRPCRoute MUST NOT be accepted by
60 /// the implementation. The implementation MUST raise an 'Accepted' Condition
61 /// with a status of `False` in the corresponding RouteParentStatus.
62 ///
63 /// If a Route (A) of type HTTPRoute or GRPCRoute is attached to a
64 /// Listener and that listener already has another Route (B) of the other
65 /// type attached and the intersection of the hostnames of A and B is
66 /// non-empty, then the implementation MUST accept exactly one of these two
67 /// routes, determined by the following criteria, in order:
68 ///
69 /// * The oldest Route based on creation timestamp.
70 /// * The Route appearing first in alphabetical order by
71 /// "{namespace}/{name}".
72 ///
73 /// The rejected Route MUST raise an 'Accepted' condition with a status of
74 /// 'False' in the corresponding RouteParentStatus.
75 ///
76 /// Support: Core
77 #[serde(default, skip_serializing_if = "Option::is_none")]
78 pub hostnames: Option<Vec<String>>,
79 /// ParentRefs references the resources (usually Gateways) that a Route wants
80 /// to be attached to. Note that the referenced parent resource needs to
81 /// allow this for the attachment to be complete. For Gateways, that means
82 /// the Gateway needs to allow attachment from Routes of this kind and
83 /// namespace. For Services, that means the Service must either be in the same
84 /// namespace for a "producer" route, or the mesh implementation must support
85 /// and allow "consumer" routes for the referenced Service. ReferenceGrant is
86 /// not applicable for governing ParentRefs to Services - it is not possible to
87 /// create a "producer" route for a Service in a different namespace from the
88 /// Route.
89 ///
90 /// There are two kinds of parent resources with "Core" support:
91 ///
92 /// * Gateway (Gateway conformance profile)
93 /// * Service (Mesh conformance profile, ClusterIP Services only)
94 ///
95 /// This API may be extended in the future to support additional kinds of parent
96 /// resources.
97 ///
98 /// ParentRefs must be _distinct_. This means either that:
99 ///
100 /// * They select different objects. If this is the case, then parentRef
101 /// entries are distinct. In terms of fields, this means that the
102 /// multi-part key defined by `group`, `kind`, `namespace`, and `name` must
103 /// be unique across all parentRef entries in the Route.
104 /// * They do not select different objects, but for each optional field used,
105 /// each ParentRef that selects the same object must set the same set of
106 /// optional fields to different values. If one ParentRef sets a
107 /// combination of optional fields, all must set the same combination.
108 ///
109 /// Some examples:
110 ///
111 /// * If one ParentRef sets `sectionName`, all ParentRefs referencing the
112 /// same object must also set `sectionName`.
113 /// * If one ParentRef sets `port`, all ParentRefs referencing the same
114 /// object must also set `port`.
115 /// * If one ParentRef sets `sectionName` and `port`, all ParentRefs
116 /// referencing the same object must also set `sectionName` and `port`.
117 ///
118 /// It is possible to separately reference multiple distinct objects that may
119 /// be collapsed by an implementation. For example, some implementations may
120 /// choose to merge compatible Gateway Listeners together. If that is the
121 /// case, the list of routes attached to those resources should also be
122 /// merged.
123 ///
124 /// Note that for ParentRefs that cross namespace boundaries, there are specific
125 /// rules. Cross-namespace references are only valid if they are explicitly
126 /// allowed by something in the namespace they are referring to. For example,
127 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
128 /// generic way to enable other kinds of cross-namespace reference.
129 #[serde(
130 default,
131 skip_serializing_if = "Option::is_none",
132 rename = "parentRefs"
133 )]
134 pub parent_refs: Option<Vec<GRPCRouteParentRefs>>,
135 /// Rules are a list of GRPC matchers, filters and actions.
136 #[serde(default, skip_serializing_if = "Option::is_none")]
137 pub rules: Option<Vec<GRPCRouteRules>>,
138}
139
140/// ParentReference identifies an API object (usually a Gateway) that can be considered
141/// a parent of this resource (usually a route). There are two kinds of parent resources
142/// with "Core" support:
143///
144/// * Gateway (Gateway conformance profile)
145/// * Service (Mesh conformance profile, ClusterIP Services only)
146///
147/// This API may be extended in the future to support additional kinds of parent
148/// resources.
149///
150/// The API object must be valid in the cluster; the Group and Kind must
151/// be registered in the cluster for this reference to be valid.
152#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
153pub struct GRPCRouteParentRefs {
154 /// Group is the group of the referent.
155 /// When unspecified, "gateway.networking.k8s.io" is inferred.
156 /// To set the core API group (such as for a "Service" kind referent),
157 /// Group must be explicitly set to "" (empty string).
158 ///
159 /// Support: Core
160 #[serde(default, skip_serializing_if = "Option::is_none")]
161 pub group: Option<String>,
162 /// Kind is kind of the referent.
163 ///
164 /// There are two kinds of parent resources with "Core" support:
165 ///
166 /// * Gateway (Gateway conformance profile)
167 /// * Service (Mesh conformance profile, ClusterIP Services only)
168 ///
169 /// Support for other resources is Implementation-Specific.
170 #[serde(default, skip_serializing_if = "Option::is_none")]
171 pub kind: Option<String>,
172 /// Name is the name of the referent.
173 ///
174 /// Support: Core
175 pub name: String,
176 /// Namespace is the namespace of the referent. When unspecified, this refers
177 /// to the local namespace of the Route.
178 ///
179 /// Note that there are specific rules for ParentRefs which cross namespace
180 /// boundaries. Cross-namespace references are only valid if they are explicitly
181 /// allowed by something in the namespace they are referring to. For example:
182 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
183 /// generic way to enable any other kind of cross-namespace reference.
184 ///
185 /// Support: Core
186 #[serde(default, skip_serializing_if = "Option::is_none")]
187 pub namespace: Option<String>,
188 /// Port is the network port this Route targets. It can be interpreted
189 /// differently based on the type of parent resource.
190 ///
191 /// When the parent resource is a Gateway, this targets all listeners
192 /// listening on the specified port that also support this kind of Route(and
193 /// select this Route). It's not recommended to set `Port` unless the
194 /// networking behaviors specified in a Route must apply to a specific port
195 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
196 /// and SectionName are specified, the name and port of the selected listener
197 /// must match both specified values.
198 ///
199 /// Implementations MAY choose to support other parent resources.
200 /// Implementations supporting other types of parent resources MUST clearly
201 /// document how/if Port is interpreted.
202 ///
203 /// For the purpose of status, an attachment is considered successful as
204 /// long as the parent resource accepts it partially. For example, Gateway
205 /// listeners can restrict which Routes can attach to them by Route kind,
206 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
207 /// from the referencing Route, the Route MUST be considered successfully
208 /// attached. If no Gateway listeners accept attachment from this Route,
209 /// the Route MUST be considered detached from the Gateway.
210 ///
211 /// Support: Extended
212 #[serde(default, skip_serializing_if = "Option::is_none")]
213 pub port: Option<i32>,
214 /// SectionName is the name of a section within the target resource. In the
215 /// following resources, SectionName is interpreted as the following:
216 ///
217 /// * Gateway: Listener name. When both Port (experimental) and SectionName
218 /// are specified, the name and port of the selected listener must match
219 /// both specified values.
220 /// * Service: Port name. When both Port (experimental) and SectionName
221 /// are specified, the name and port of the selected listener must match
222 /// both specified values.
223 ///
224 /// Implementations MAY choose to support attaching Routes to other resources.
225 /// If that is the case, they MUST clearly document how SectionName is
226 /// interpreted.
227 ///
228 /// When unspecified (empty string), this will reference the entire resource.
229 /// For the purpose of status, an attachment is considered successful if at
230 /// least one section in the parent resource accepts it. For example, Gateway
231 /// listeners can restrict which Routes can attach to them by Route kind,
232 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
233 /// the referencing Route, the Route MUST be considered successfully
234 /// attached. If no Gateway listeners accept attachment from this Route, the
235 /// Route MUST be considered detached from the Gateway.
236 ///
237 /// Support: Core
238 #[serde(
239 default,
240 skip_serializing_if = "Option::is_none",
241 rename = "sectionName"
242 )]
243 pub section_name: Option<String>,
244}
245
246/// GRPCRouteRule defines the semantics for matching a gRPC request based on
247/// conditions (matches), processing it (filters), and forwarding the request to
248/// an API object (backendRefs).
249#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
250pub struct GRPCRouteRules {
251 /// BackendRefs defines the backend(s) where matching requests should be
252 /// sent.
253 ///
254 /// Failure behavior here depends on how many BackendRefs are specified and
255 /// how many are invalid.
256 ///
257 /// If *all* entries in BackendRefs are invalid, and there are also no filters
258 /// specified in this route rule, *all* traffic which matches this rule MUST
259 /// receive an `UNAVAILABLE` status.
260 ///
261 /// See the GRPCBackendRef definition for the rules about what makes a single
262 /// GRPCBackendRef invalid.
263 ///
264 /// When a GRPCBackendRef is invalid, `UNAVAILABLE` statuses MUST be returned for
265 /// requests that would have otherwise been routed to an invalid backend. If
266 /// multiple backends are specified, and some are invalid, the proportion of
267 /// requests that would otherwise have been routed to an invalid backend
268 /// MUST receive an `UNAVAILABLE` status.
269 ///
270 /// For example, if two backends are specified with equal weights, and one is
271 /// invalid, 50 percent of traffic MUST receive an `UNAVAILABLE` status.
272 /// Implementations may choose how that 50 percent is determined.
273 ///
274 /// Support: Core for Kubernetes Service
275 ///
276 /// Support: Implementation-specific for any other resource
277 ///
278 /// Support for weight: Core
279 #[serde(
280 default,
281 skip_serializing_if = "Option::is_none",
282 rename = "backendRefs"
283 )]
284 pub backend_refs: Option<Vec<GRPCRouteRulesBackendRefs>>,
285 /// Filters define the filters that are applied to requests that match
286 /// this rule.
287 ///
288 /// The effects of ordering of multiple behaviors are currently unspecified.
289 /// This can change in the future based on feedback during the alpha stage.
290 ///
291 /// Conformance-levels at this level are defined based on the type of filter:
292 ///
293 /// - ALL core filters MUST be supported by all implementations that support
294 /// GRPCRoute.
295 /// - Implementers are encouraged to support extended filters.
296 /// - Implementation-specific custom filters have no API guarantees across
297 /// implementations.
298 ///
299 /// Specifying the same filter multiple times is not supported unless explicitly
300 /// indicated in the filter.
301 ///
302 /// If an implementation cannot support a combination of filters, it must clearly
303 /// document that limitation. In cases where incompatible or unsupported
304 /// filters are specified and cause the `Accepted` condition to be set to status
305 /// `False`, implementations may use the `IncompatibleFilters` reason to specify
306 /// this configuration error.
307 ///
308 /// Support: Core
309 #[serde(default, skip_serializing_if = "Option::is_none")]
310 pub filters: Option<Vec<GRPCRouteRulesFilters>>,
311 /// Matches define conditions used for matching the rule against incoming
312 /// gRPC requests. Each match is independent, i.e. this rule will be matched
313 /// if **any** one of the matches is satisfied.
314 ///
315 /// For example, take the following matches configuration:
316 ///
317 /// ```text
318 /// matches:
319 /// - method:
320 /// service: foo.bar
321 /// headers:
322 /// values:
323 /// version: 2
324 /// - method:
325 /// service: foo.bar.v2
326 /// ```
327 ///
328 /// For a request to match against this rule, it MUST satisfy
329 /// EITHER of the two conditions:
330 ///
331 /// - service of foo.bar AND contains the header `version: 2`
332 /// - service of foo.bar.v2
333 ///
334 /// See the documentation for GRPCRouteMatch on how to specify multiple
335 /// match conditions to be ANDed together.
336 ///
337 /// If no matches are specified, the implementation MUST match every gRPC request.
338 ///
339 /// Proxy or Load Balancer routing configuration generated from GRPCRoutes
340 /// MUST prioritize rules based on the following criteria, continuing on
341 /// ties. Merging MUST not be done between GRPCRoutes and HTTPRoutes.
342 /// Precedence MUST be given to the rule with the largest number of:
343 ///
344 /// * Characters in a matching non-wildcard hostname.
345 /// * Characters in a matching hostname.
346 /// * Characters in a matching service.
347 /// * Characters in a matching method.
348 /// * Header matches.
349 ///
350 /// If ties still exist across multiple Routes, matching precedence MUST be
351 /// determined in order of the following criteria, continuing on ties:
352 ///
353 /// * The oldest Route based on creation timestamp.
354 /// * The Route appearing first in alphabetical order by
355 /// "{namespace}/{name}".
356 ///
357 /// If ties still exist within the Route that has been given precedence,
358 /// matching precedence MUST be granted to the first matching rule meeting
359 /// the above criteria.
360 #[serde(default, skip_serializing_if = "Option::is_none")]
361 pub matches: Option<Vec<GRPCRouteRulesMatches>>,
362 /// Name is the name of the route rule. This name MUST be unique within a Route if it is set.
363 ///
364 /// Support: Extended
365 #[serde(default, skip_serializing_if = "Option::is_none")]
366 pub name: Option<String>,
367}
368
369/// GRPCBackendRef defines how a GRPCRoute forwards a gRPC request.
370///
371/// Note that when a namespace different than the local namespace is specified, a
372/// ReferenceGrant object is required in the referent namespace to allow that
373/// namespace's owner to accept the reference. See the ReferenceGrant
374/// documentation for details.
375#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
376pub struct GRPCRouteRulesBackendRefs {
377 /// Filters defined at this level MUST be executed if and only if the
378 /// request is being forwarded to the backend defined here.
379 ///
380 /// Support: Implementation-specific (For broader support of filters, use the
381 /// Filters field in GRPCRouteRule.)
382 #[serde(default, skip_serializing_if = "Option::is_none")]
383 pub filters: Option<Vec<GRPCRouteRulesBackendRefsFilters>>,
384 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
385 /// When unspecified or empty string, core API group is inferred.
386 #[serde(default, skip_serializing_if = "Option::is_none")]
387 pub group: Option<String>,
388 /// Kind is the Kubernetes resource kind of the referent. For example
389 /// "Service".
390 ///
391 /// Defaults to "Service" when not specified.
392 ///
393 /// ExternalName services can refer to CNAME DNS records that may live
394 /// outside of the cluster and as such are difficult to reason about in
395 /// terms of conformance. They also may not be safe to forward to (see
396 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
397 /// support ExternalName Services.
398 ///
399 /// Support: Core (Services with a type other than ExternalName)
400 ///
401 /// Support: Implementation-specific (Services with type ExternalName)
402 #[serde(default, skip_serializing_if = "Option::is_none")]
403 pub kind: Option<String>,
404 /// Name is the name of the referent.
405 pub name: String,
406 /// Namespace is the namespace of the backend. When unspecified, the local
407 /// namespace is inferred.
408 ///
409 /// Note that when a namespace different than the local namespace is specified,
410 /// a ReferenceGrant object is required in the referent namespace to allow that
411 /// namespace's owner to accept the reference. See the ReferenceGrant
412 /// documentation for details.
413 ///
414 /// Support: Core
415 #[serde(default, skip_serializing_if = "Option::is_none")]
416 pub namespace: Option<String>,
417 /// Port specifies the destination port number to use for this resource.
418 /// Port is required when the referent is a Kubernetes Service. In this
419 /// case, the port number is the service port number, not the target port.
420 /// For other resources, destination port might be derived from the referent
421 /// resource or this field.
422 #[serde(default, skip_serializing_if = "Option::is_none")]
423 pub port: Option<i32>,
424 /// Weight specifies the proportion of requests forwarded to the referenced
425 /// backend. This is computed as weight/(sum of all weights in this
426 /// BackendRefs list). For non-zero values, there may be some epsilon from
427 /// the exact proportion defined here depending on the precision an
428 /// implementation supports. Weight is not a percentage and the sum of
429 /// weights does not need to equal 100.
430 ///
431 /// If only one backend is specified and it has a weight greater than 0, 100%
432 /// of the traffic is forwarded to that backend. If weight is set to 0, no
433 /// traffic should be forwarded for this entry. If unspecified, weight
434 /// defaults to 1.
435 ///
436 /// Support for this field varies based on the context where used.
437 #[serde(default, skip_serializing_if = "Option::is_none")]
438 pub weight: Option<i32>,
439}
440
441/// GRPCRouteFilter defines processing steps that must be completed during the
442/// request or response lifecycle. GRPCRouteFilters are meant as an extension
443/// point to express processing that may be done in Gateway implementations. Some
444/// examples include request or response modification, implementing
445/// authentication strategies, rate-limiting, and traffic shaping. API
446/// guarantee/conformance is defined based on the type of the filter.
447#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
448pub struct GRPCRouteRulesBackendRefsFilters {
449 /// ExtensionRef is an optional, implementation-specific extension to the
450 /// "filter" behavior. For example, resource "myroutefilter" in group
451 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
452 /// extended filters.
453 ///
454 /// Support: Implementation-specific
455 ///
456 /// This filter can be used multiple times within the same rule.
457 #[serde(
458 default,
459 skip_serializing_if = "Option::is_none",
460 rename = "extensionRef"
461 )]
462 pub extension_ref: Option<GRPCRouteRulesBackendRefsFiltersExtensionRef>,
463 /// RequestHeaderModifier defines a schema for a filter that modifies request
464 /// headers.
465 ///
466 /// Support: Core
467 #[serde(
468 default,
469 skip_serializing_if = "Option::is_none",
470 rename = "requestHeaderModifier"
471 )]
472 pub request_header_modifier: Option<GRPCRouteRulesBackendRefsFiltersRequestHeaderModifier>,
473 /// RequestMirror defines a schema for a filter that mirrors requests.
474 /// Requests are sent to the specified destination, but responses from
475 /// that destination are ignored.
476 ///
477 /// This filter can be used multiple times within the same rule. Note that
478 /// not all implementations will be able to support mirroring to multiple
479 /// backends.
480 ///
481 /// Support: Extended
482 #[serde(
483 default,
484 skip_serializing_if = "Option::is_none",
485 rename = "requestMirror"
486 )]
487 pub request_mirror: Option<GRPCRouteRulesBackendRefsFiltersRequestMirror>,
488 /// ResponseHeaderModifier defines a schema for a filter that modifies response
489 /// headers.
490 ///
491 /// Support: Extended
492 #[serde(
493 default,
494 skip_serializing_if = "Option::is_none",
495 rename = "responseHeaderModifier"
496 )]
497 pub response_header_modifier: Option<GRPCRouteRulesBackendRefsFiltersResponseHeaderModifier>,
498 /// Type identifies the type of filter to apply. As with other API fields,
499 /// types are classified into three conformance levels:
500 ///
501 /// - Core: Filter types and their corresponding configuration defined by
502 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
503 /// implementations supporting GRPCRoute MUST support core filters.
504 ///
505 /// - Extended: Filter types and their corresponding configuration defined by
506 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
507 /// are encouraged to support extended filters.
508 ///
509 /// - Implementation-specific: Filters that are defined and supported by specific vendors.
510 /// In the future, filters showing convergence in behavior across multiple
511 /// implementations will be considered for inclusion in extended or core
512 /// conformance levels. Filter-specific configuration for such filters
513 /// is specified using the ExtensionRef field. `Type` MUST be set to
514 /// "ExtensionRef" for custom filters.
515 ///
516 /// Implementers are encouraged to define custom implementation types to
517 /// extend the core API with implementation-specific behavior.
518 ///
519 /// If a reference to a custom filter type cannot be resolved, the filter
520 /// MUST NOT be skipped. Instead, requests that would have been processed by
521 /// that filter MUST receive a HTTP error response.
522 #[serde(rename = "type")]
523 pub r#type: GRPCRouteRulesBackendRefsFiltersType,
524}
525
526/// ExtensionRef is an optional, implementation-specific extension to the
527/// "filter" behavior. For example, resource "myroutefilter" in group
528/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
529/// extended filters.
530///
531/// Support: Implementation-specific
532///
533/// This filter can be used multiple times within the same rule.
534#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
535pub struct GRPCRouteRulesBackendRefsFiltersExtensionRef {
536 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
537 /// When unspecified or empty string, core API group is inferred.
538 pub group: String,
539 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
540 pub kind: String,
541 /// Name is the name of the referent.
542 pub name: String,
543}
544
545/// RequestHeaderModifier defines a schema for a filter that modifies request
546/// headers.
547///
548/// Support: Core
549#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
550pub struct GRPCRouteRulesBackendRefsFiltersRequestHeaderModifier {
551 /// Add adds the given header(s) (name, value) to the request
552 /// before the action. It appends to any existing values associated
553 /// with the header name.
554 ///
555 /// Input:
556 /// GET /foo HTTP/1.1
557 /// my-header: foo
558 ///
559 /// Config:
560 /// add:
561 /// - name: "my-header"
562 /// value: "bar,baz"
563 ///
564 /// Output:
565 /// GET /foo HTTP/1.1
566 /// my-header: foo,bar,baz
567 #[serde(default, skip_serializing_if = "Option::is_none")]
568 pub add: Option<Vec<GRPCRouteRulesBackendRefsFiltersRequestHeaderModifierAdd>>,
569 /// Remove the given header(s) from the HTTP request before the action. The
570 /// value of Remove is a list of HTTP header names. Note that the header
571 /// names are case-insensitive (see
572 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
573 ///
574 /// Input:
575 /// GET /foo HTTP/1.1
576 /// my-header1: foo
577 /// my-header2: bar
578 /// my-header3: baz
579 ///
580 /// Config:
581 /// remove: ["my-header1", "my-header3"]
582 ///
583 /// Output:
584 /// GET /foo HTTP/1.1
585 /// my-header2: bar
586 #[serde(default, skip_serializing_if = "Option::is_none")]
587 pub remove: Option<Vec<String>>,
588 /// Set overwrites the request with the given header (name, value)
589 /// before the action.
590 ///
591 /// Input:
592 /// GET /foo HTTP/1.1
593 /// my-header: foo
594 ///
595 /// Config:
596 /// set:
597 /// - name: "my-header"
598 /// value: "bar"
599 ///
600 /// Output:
601 /// GET /foo HTTP/1.1
602 /// my-header: bar
603 #[serde(default, skip_serializing_if = "Option::is_none")]
604 pub set: Option<Vec<GRPCRouteRulesBackendRefsFiltersRequestHeaderModifierSet>>,
605}
606
607/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
608#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
609pub struct GRPCRouteRulesBackendRefsFiltersRequestHeaderModifierAdd {
610 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
611 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
612 ///
613 /// If multiple entries specify equivalent header names, the first entry with
614 /// an equivalent name MUST be considered for a match. Subsequent entries
615 /// with an equivalent header name MUST be ignored. Due to the
616 /// case-insensitivity of header names, "foo" and "Foo" are considered
617 /// equivalent.
618 pub name: String,
619 /// Value is the value of HTTP Header to be matched.
620 pub value: String,
621}
622
623/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
624#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
625pub struct GRPCRouteRulesBackendRefsFiltersRequestHeaderModifierSet {
626 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
627 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
628 ///
629 /// If multiple entries specify equivalent header names, the first entry with
630 /// an equivalent name MUST be considered for a match. Subsequent entries
631 /// with an equivalent header name MUST be ignored. Due to the
632 /// case-insensitivity of header names, "foo" and "Foo" are considered
633 /// equivalent.
634 pub name: String,
635 /// Value is the value of HTTP Header to be matched.
636 pub value: String,
637}
638
639/// RequestMirror defines a schema for a filter that mirrors requests.
640/// Requests are sent to the specified destination, but responses from
641/// that destination are ignored.
642///
643/// This filter can be used multiple times within the same rule. Note that
644/// not all implementations will be able to support mirroring to multiple
645/// backends.
646///
647/// Support: Extended
648#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
649pub struct GRPCRouteRulesBackendRefsFiltersRequestMirror {
650 /// BackendRef references a resource where mirrored requests are sent.
651 ///
652 /// Mirrored requests must be sent only to a single destination endpoint
653 /// within this BackendRef, irrespective of how many endpoints are present
654 /// within this BackendRef.
655 ///
656 /// If the referent cannot be found, this BackendRef is invalid and must be
657 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
658 /// condition on the Route status is set to `status: False` and not configure
659 /// this backend in the underlying implementation.
660 ///
661 /// If there is a cross-namespace reference to an *existing* object
662 /// that is not allowed by a ReferenceGrant, the controller must ensure the
663 /// "ResolvedRefs" condition on the Route is set to `status: False`,
664 /// with the "RefNotPermitted" reason and not configure this backend in the
665 /// underlying implementation.
666 ///
667 /// In either error case, the Message of the `ResolvedRefs` Condition
668 /// should be used to provide more detail about the problem.
669 ///
670 /// Support: Extended for Kubernetes Service
671 ///
672 /// Support: Implementation-specific for any other resource
673 #[serde(rename = "backendRef")]
674 pub backend_ref: GRPCRouteRulesBackendRefsFiltersRequestMirrorBackendRef,
675 /// Fraction represents the fraction of requests that should be
676 /// mirrored to BackendRef.
677 ///
678 /// Only one of Fraction or Percent may be specified. If neither field
679 /// is specified, 100% of requests will be mirrored.
680 #[serde(default, skip_serializing_if = "Option::is_none")]
681 pub fraction: Option<GRPCRouteRulesBackendRefsFiltersRequestMirrorFraction>,
682 /// Percent represents the percentage of requests that should be
683 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
684 /// requests) and its maximum value is 100 (indicating 100% of requests).
685 ///
686 /// Only one of Fraction or Percent may be specified. If neither field
687 /// is specified, 100% of requests will be mirrored.
688 #[serde(default, skip_serializing_if = "Option::is_none")]
689 pub percent: Option<i32>,
690}
691
692/// BackendRef references a resource where mirrored requests are sent.
693///
694/// Mirrored requests must be sent only to a single destination endpoint
695/// within this BackendRef, irrespective of how many endpoints are present
696/// within this BackendRef.
697///
698/// If the referent cannot be found, this BackendRef is invalid and must be
699/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
700/// condition on the Route status is set to `status: False` and not configure
701/// this backend in the underlying implementation.
702///
703/// If there is a cross-namespace reference to an *existing* object
704/// that is not allowed by a ReferenceGrant, the controller must ensure the
705/// "ResolvedRefs" condition on the Route is set to `status: False`,
706/// with the "RefNotPermitted" reason and not configure this backend in the
707/// underlying implementation.
708///
709/// In either error case, the Message of the `ResolvedRefs` Condition
710/// should be used to provide more detail about the problem.
711///
712/// Support: Extended for Kubernetes Service
713///
714/// Support: Implementation-specific for any other resource
715#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
716pub struct GRPCRouteRulesBackendRefsFiltersRequestMirrorBackendRef {
717 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
718 /// When unspecified or empty string, core API group is inferred.
719 #[serde(default, skip_serializing_if = "Option::is_none")]
720 pub group: Option<String>,
721 /// Kind is the Kubernetes resource kind of the referent. For example
722 /// "Service".
723 ///
724 /// Defaults to "Service" when not specified.
725 ///
726 /// ExternalName services can refer to CNAME DNS records that may live
727 /// outside of the cluster and as such are difficult to reason about in
728 /// terms of conformance. They also may not be safe to forward to (see
729 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
730 /// support ExternalName Services.
731 ///
732 /// Support: Core (Services with a type other than ExternalName)
733 ///
734 /// Support: Implementation-specific (Services with type ExternalName)
735 #[serde(default, skip_serializing_if = "Option::is_none")]
736 pub kind: Option<String>,
737 /// Name is the name of the referent.
738 pub name: String,
739 /// Namespace is the namespace of the backend. When unspecified, the local
740 /// namespace is inferred.
741 ///
742 /// Note that when a namespace different than the local namespace is specified,
743 /// a ReferenceGrant object is required in the referent namespace to allow that
744 /// namespace's owner to accept the reference. See the ReferenceGrant
745 /// documentation for details.
746 ///
747 /// Support: Core
748 #[serde(default, skip_serializing_if = "Option::is_none")]
749 pub namespace: Option<String>,
750 /// Port specifies the destination port number to use for this resource.
751 /// Port is required when the referent is a Kubernetes Service. In this
752 /// case, the port number is the service port number, not the target port.
753 /// For other resources, destination port might be derived from the referent
754 /// resource or this field.
755 #[serde(default, skip_serializing_if = "Option::is_none")]
756 pub port: Option<i32>,
757}
758
759/// Fraction represents the fraction of requests that should be
760/// mirrored to BackendRef.
761///
762/// Only one of Fraction or Percent may be specified. If neither field
763/// is specified, 100% of requests will be mirrored.
764#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
765pub struct GRPCRouteRulesBackendRefsFiltersRequestMirrorFraction {
766 #[serde(default, skip_serializing_if = "Option::is_none")]
767 pub denominator: Option<i32>,
768 pub numerator: i32,
769}
770
771/// ResponseHeaderModifier defines a schema for a filter that modifies response
772/// headers.
773///
774/// Support: Extended
775#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
776pub struct GRPCRouteRulesBackendRefsFiltersResponseHeaderModifier {
777 /// Add adds the given header(s) (name, value) to the request
778 /// before the action. It appends to any existing values associated
779 /// with the header name.
780 ///
781 /// Input:
782 /// GET /foo HTTP/1.1
783 /// my-header: foo
784 ///
785 /// Config:
786 /// add:
787 /// - name: "my-header"
788 /// value: "bar,baz"
789 ///
790 /// Output:
791 /// GET /foo HTTP/1.1
792 /// my-header: foo,bar,baz
793 #[serde(default, skip_serializing_if = "Option::is_none")]
794 pub add: Option<Vec<GRPCRouteRulesBackendRefsFiltersResponseHeaderModifierAdd>>,
795 /// Remove the given header(s) from the HTTP request before the action. The
796 /// value of Remove is a list of HTTP header names. Note that the header
797 /// names are case-insensitive (see
798 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
799 ///
800 /// Input:
801 /// GET /foo HTTP/1.1
802 /// my-header1: foo
803 /// my-header2: bar
804 /// my-header3: baz
805 ///
806 /// Config:
807 /// remove: ["my-header1", "my-header3"]
808 ///
809 /// Output:
810 /// GET /foo HTTP/1.1
811 /// my-header2: bar
812 #[serde(default, skip_serializing_if = "Option::is_none")]
813 pub remove: Option<Vec<String>>,
814 /// Set overwrites the request with the given header (name, value)
815 /// before the action.
816 ///
817 /// Input:
818 /// GET /foo HTTP/1.1
819 /// my-header: foo
820 ///
821 /// Config:
822 /// set:
823 /// - name: "my-header"
824 /// value: "bar"
825 ///
826 /// Output:
827 /// GET /foo HTTP/1.1
828 /// my-header: bar
829 #[serde(default, skip_serializing_if = "Option::is_none")]
830 pub set: Option<Vec<GRPCRouteRulesBackendRefsFiltersResponseHeaderModifierSet>>,
831}
832
833/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
834#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
835pub struct GRPCRouteRulesBackendRefsFiltersResponseHeaderModifierAdd {
836 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
837 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
838 ///
839 /// If multiple entries specify equivalent header names, the first entry with
840 /// an equivalent name MUST be considered for a match. Subsequent entries
841 /// with an equivalent header name MUST be ignored. Due to the
842 /// case-insensitivity of header names, "foo" and "Foo" are considered
843 /// equivalent.
844 pub name: String,
845 /// Value is the value of HTTP Header to be matched.
846 pub value: String,
847}
848
849/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
850#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
851pub struct GRPCRouteRulesBackendRefsFiltersResponseHeaderModifierSet {
852 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
853 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
854 ///
855 /// If multiple entries specify equivalent header names, the first entry with
856 /// an equivalent name MUST be considered for a match. Subsequent entries
857 /// with an equivalent header name MUST be ignored. Due to the
858 /// case-insensitivity of header names, "foo" and "Foo" are considered
859 /// equivalent.
860 pub name: String,
861 /// Value is the value of HTTP Header to be matched.
862 pub value: String,
863}
864
865/// GRPCRouteFilter defines processing steps that must be completed during the
866/// request or response lifecycle. GRPCRouteFilters are meant as an extension
867/// point to express processing that may be done in Gateway implementations. Some
868/// examples include request or response modification, implementing
869/// authentication strategies, rate-limiting, and traffic shaping. API
870/// guarantee/conformance is defined based on the type of the filter.
871#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
872pub enum GRPCRouteRulesBackendRefsFiltersType {
873 ResponseHeaderModifier,
874 RequestHeaderModifier,
875 RequestMirror,
876 ExtensionRef,
877}
878
879/// GRPCRouteFilter defines processing steps that must be completed during the
880/// request or response lifecycle. GRPCRouteFilters are meant as an extension
881/// point to express processing that may be done in Gateway implementations. Some
882/// examples include request or response modification, implementing
883/// authentication strategies, rate-limiting, and traffic shaping. API
884/// guarantee/conformance is defined based on the type of the filter.
885#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
886pub struct GRPCRouteRulesFilters {
887 /// ExtensionRef is an optional, implementation-specific extension to the
888 /// "filter" behavior. For example, resource "myroutefilter" in group
889 /// "networking.example.net"). ExtensionRef MUST NOT be used for core and
890 /// extended filters.
891 ///
892 /// Support: Implementation-specific
893 ///
894 /// This filter can be used multiple times within the same rule.
895 #[serde(
896 default,
897 skip_serializing_if = "Option::is_none",
898 rename = "extensionRef"
899 )]
900 pub extension_ref: Option<GRPCRouteRulesFiltersExtensionRef>,
901 /// RequestHeaderModifier defines a schema for a filter that modifies request
902 /// headers.
903 ///
904 /// Support: Core
905 #[serde(
906 default,
907 skip_serializing_if = "Option::is_none",
908 rename = "requestHeaderModifier"
909 )]
910 pub request_header_modifier: Option<GRPCRouteRulesFiltersRequestHeaderModifier>,
911 /// RequestMirror defines a schema for a filter that mirrors requests.
912 /// Requests are sent to the specified destination, but responses from
913 /// that destination are ignored.
914 ///
915 /// This filter can be used multiple times within the same rule. Note that
916 /// not all implementations will be able to support mirroring to multiple
917 /// backends.
918 ///
919 /// Support: Extended
920 #[serde(
921 default,
922 skip_serializing_if = "Option::is_none",
923 rename = "requestMirror"
924 )]
925 pub request_mirror: Option<GRPCRouteRulesFiltersRequestMirror>,
926 /// ResponseHeaderModifier defines a schema for a filter that modifies response
927 /// headers.
928 ///
929 /// Support: Extended
930 #[serde(
931 default,
932 skip_serializing_if = "Option::is_none",
933 rename = "responseHeaderModifier"
934 )]
935 pub response_header_modifier: Option<GRPCRouteRulesFiltersResponseHeaderModifier>,
936 /// Type identifies the type of filter to apply. As with other API fields,
937 /// types are classified into three conformance levels:
938 ///
939 /// - Core: Filter types and their corresponding configuration defined by
940 /// "Support: Core" in this package, e.g. "RequestHeaderModifier". All
941 /// implementations supporting GRPCRoute MUST support core filters.
942 ///
943 /// - Extended: Filter types and their corresponding configuration defined by
944 /// "Support: Extended" in this package, e.g. "RequestMirror". Implementers
945 /// are encouraged to support extended filters.
946 ///
947 /// - Implementation-specific: Filters that are defined and supported by specific vendors.
948 /// In the future, filters showing convergence in behavior across multiple
949 /// implementations will be considered for inclusion in extended or core
950 /// conformance levels. Filter-specific configuration for such filters
951 /// is specified using the ExtensionRef field. `Type` MUST be set to
952 /// "ExtensionRef" for custom filters.
953 ///
954 /// Implementers are encouraged to define custom implementation types to
955 /// extend the core API with implementation-specific behavior.
956 ///
957 /// If a reference to a custom filter type cannot be resolved, the filter
958 /// MUST NOT be skipped. Instead, requests that would have been processed by
959 /// that filter MUST receive a HTTP error response.
960 #[serde(rename = "type")]
961 pub r#type: GRPCRouteRulesFiltersType,
962}
963
964/// ExtensionRef is an optional, implementation-specific extension to the
965/// "filter" behavior. For example, resource "myroutefilter" in group
966/// "networking.example.net"). ExtensionRef MUST NOT be used for core and
967/// extended filters.
968///
969/// Support: Implementation-specific
970///
971/// This filter can be used multiple times within the same rule.
972#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
973pub struct GRPCRouteRulesFiltersExtensionRef {
974 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
975 /// When unspecified or empty string, core API group is inferred.
976 pub group: String,
977 /// Kind is kind of the referent. For example "HTTPRoute" or "Service".
978 pub kind: String,
979 /// Name is the name of the referent.
980 pub name: String,
981}
982
983/// RequestHeaderModifier defines a schema for a filter that modifies request
984/// headers.
985///
986/// Support: Core
987#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
988pub struct GRPCRouteRulesFiltersRequestHeaderModifier {
989 /// Add adds the given header(s) (name, value) to the request
990 /// before the action. It appends to any existing values associated
991 /// with the header name.
992 ///
993 /// Input:
994 /// GET /foo HTTP/1.1
995 /// my-header: foo
996 ///
997 /// Config:
998 /// add:
999 /// - name: "my-header"
1000 /// value: "bar,baz"
1001 ///
1002 /// Output:
1003 /// GET /foo HTTP/1.1
1004 /// my-header: foo,bar,baz
1005 #[serde(default, skip_serializing_if = "Option::is_none")]
1006 pub add: Option<Vec<GRPCRouteRulesFiltersRequestHeaderModifierAdd>>,
1007 /// Remove the given header(s) from the HTTP request before the action. The
1008 /// value of Remove is a list of HTTP header names. Note that the header
1009 /// names are case-insensitive (see
1010 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1011 ///
1012 /// Input:
1013 /// GET /foo HTTP/1.1
1014 /// my-header1: foo
1015 /// my-header2: bar
1016 /// my-header3: baz
1017 ///
1018 /// Config:
1019 /// remove: ["my-header1", "my-header3"]
1020 ///
1021 /// Output:
1022 /// GET /foo HTTP/1.1
1023 /// my-header2: bar
1024 #[serde(default, skip_serializing_if = "Option::is_none")]
1025 pub remove: Option<Vec<String>>,
1026 /// Set overwrites the request with the given header (name, value)
1027 /// before the action.
1028 ///
1029 /// Input:
1030 /// GET /foo HTTP/1.1
1031 /// my-header: foo
1032 ///
1033 /// Config:
1034 /// set:
1035 /// - name: "my-header"
1036 /// value: "bar"
1037 ///
1038 /// Output:
1039 /// GET /foo HTTP/1.1
1040 /// my-header: bar
1041 #[serde(default, skip_serializing_if = "Option::is_none")]
1042 pub set: Option<Vec<GRPCRouteRulesFiltersRequestHeaderModifierSet>>,
1043}
1044
1045/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1046#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1047pub struct GRPCRouteRulesFiltersRequestHeaderModifierAdd {
1048 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1049 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1050 ///
1051 /// If multiple entries specify equivalent header names, the first entry with
1052 /// an equivalent name MUST be considered for a match. Subsequent entries
1053 /// with an equivalent header name MUST be ignored. Due to the
1054 /// case-insensitivity of header names, "foo" and "Foo" are considered
1055 /// equivalent.
1056 pub name: String,
1057 /// Value is the value of HTTP Header to be matched.
1058 pub value: String,
1059}
1060
1061/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1062#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1063pub struct GRPCRouteRulesFiltersRequestHeaderModifierSet {
1064 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1065 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1066 ///
1067 /// If multiple entries specify equivalent header names, the first entry with
1068 /// an equivalent name MUST be considered for a match. Subsequent entries
1069 /// with an equivalent header name MUST be ignored. Due to the
1070 /// case-insensitivity of header names, "foo" and "Foo" are considered
1071 /// equivalent.
1072 pub name: String,
1073 /// Value is the value of HTTP Header to be matched.
1074 pub value: String,
1075}
1076
1077/// RequestMirror defines a schema for a filter that mirrors requests.
1078/// Requests are sent to the specified destination, but responses from
1079/// that destination are ignored.
1080///
1081/// This filter can be used multiple times within the same rule. Note that
1082/// not all implementations will be able to support mirroring to multiple
1083/// backends.
1084///
1085/// Support: Extended
1086#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1087pub struct GRPCRouteRulesFiltersRequestMirror {
1088 /// BackendRef references a resource where mirrored requests are sent.
1089 ///
1090 /// Mirrored requests must be sent only to a single destination endpoint
1091 /// within this BackendRef, irrespective of how many endpoints are present
1092 /// within this BackendRef.
1093 ///
1094 /// If the referent cannot be found, this BackendRef is invalid and must be
1095 /// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1096 /// condition on the Route status is set to `status: False` and not configure
1097 /// this backend in the underlying implementation.
1098 ///
1099 /// If there is a cross-namespace reference to an *existing* object
1100 /// that is not allowed by a ReferenceGrant, the controller must ensure the
1101 /// "ResolvedRefs" condition on the Route is set to `status: False`,
1102 /// with the "RefNotPermitted" reason and not configure this backend in the
1103 /// underlying implementation.
1104 ///
1105 /// In either error case, the Message of the `ResolvedRefs` Condition
1106 /// should be used to provide more detail about the problem.
1107 ///
1108 /// Support: Extended for Kubernetes Service
1109 ///
1110 /// Support: Implementation-specific for any other resource
1111 #[serde(rename = "backendRef")]
1112 pub backend_ref: GRPCRouteRulesFiltersRequestMirrorBackendRef,
1113 /// Fraction represents the fraction of requests that should be
1114 /// mirrored to BackendRef.
1115 ///
1116 /// Only one of Fraction or Percent may be specified. If neither field
1117 /// is specified, 100% of requests will be mirrored.
1118 #[serde(default, skip_serializing_if = "Option::is_none")]
1119 pub fraction: Option<GRPCRouteRulesFiltersRequestMirrorFraction>,
1120 /// Percent represents the percentage of requests that should be
1121 /// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
1122 /// requests) and its maximum value is 100 (indicating 100% of requests).
1123 ///
1124 /// Only one of Fraction or Percent may be specified. If neither field
1125 /// is specified, 100% of requests will be mirrored.
1126 #[serde(default, skip_serializing_if = "Option::is_none")]
1127 pub percent: Option<i32>,
1128}
1129
1130/// BackendRef references a resource where mirrored requests are sent.
1131///
1132/// Mirrored requests must be sent only to a single destination endpoint
1133/// within this BackendRef, irrespective of how many endpoints are present
1134/// within this BackendRef.
1135///
1136/// If the referent cannot be found, this BackendRef is invalid and must be
1137/// dropped from the Gateway. The controller must ensure the "ResolvedRefs"
1138/// condition on the Route status is set to `status: False` and not configure
1139/// this backend in the underlying implementation.
1140///
1141/// If there is a cross-namespace reference to an *existing* object
1142/// that is not allowed by a ReferenceGrant, the controller must ensure the
1143/// "ResolvedRefs" condition on the Route is set to `status: False`,
1144/// with the "RefNotPermitted" reason and not configure this backend in the
1145/// underlying implementation.
1146///
1147/// In either error case, the Message of the `ResolvedRefs` Condition
1148/// should be used to provide more detail about the problem.
1149///
1150/// Support: Extended for Kubernetes Service
1151///
1152/// Support: Implementation-specific for any other resource
1153#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1154pub struct GRPCRouteRulesFiltersRequestMirrorBackendRef {
1155 /// Group is the group of the referent. For example, "gateway.networking.k8s.io".
1156 /// When unspecified or empty string, core API group is inferred.
1157 #[serde(default, skip_serializing_if = "Option::is_none")]
1158 pub group: Option<String>,
1159 /// Kind is the Kubernetes resource kind of the referent. For example
1160 /// "Service".
1161 ///
1162 /// Defaults to "Service" when not specified.
1163 ///
1164 /// ExternalName services can refer to CNAME DNS records that may live
1165 /// outside of the cluster and as such are difficult to reason about in
1166 /// terms of conformance. They also may not be safe to forward to (see
1167 /// CVE-2021-25740 for more information). Implementations SHOULD NOT
1168 /// support ExternalName Services.
1169 ///
1170 /// Support: Core (Services with a type other than ExternalName)
1171 ///
1172 /// Support: Implementation-specific (Services with type ExternalName)
1173 #[serde(default, skip_serializing_if = "Option::is_none")]
1174 pub kind: Option<String>,
1175 /// Name is the name of the referent.
1176 pub name: String,
1177 /// Namespace is the namespace of the backend. When unspecified, the local
1178 /// namespace is inferred.
1179 ///
1180 /// Note that when a namespace different than the local namespace is specified,
1181 /// a ReferenceGrant object is required in the referent namespace to allow that
1182 /// namespace's owner to accept the reference. See the ReferenceGrant
1183 /// documentation for details.
1184 ///
1185 /// Support: Core
1186 #[serde(default, skip_serializing_if = "Option::is_none")]
1187 pub namespace: Option<String>,
1188 /// Port specifies the destination port number to use for this resource.
1189 /// Port is required when the referent is a Kubernetes Service. In this
1190 /// case, the port number is the service port number, not the target port.
1191 /// For other resources, destination port might be derived from the referent
1192 /// resource or this field.
1193 #[serde(default, skip_serializing_if = "Option::is_none")]
1194 pub port: Option<i32>,
1195}
1196
1197/// Fraction represents the fraction of requests that should be
1198/// mirrored to BackendRef.
1199///
1200/// Only one of Fraction or Percent may be specified. If neither field
1201/// is specified, 100% of requests will be mirrored.
1202#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1203pub struct GRPCRouteRulesFiltersRequestMirrorFraction {
1204 #[serde(default, skip_serializing_if = "Option::is_none")]
1205 pub denominator: Option<i32>,
1206 pub numerator: i32,
1207}
1208
1209/// ResponseHeaderModifier defines a schema for a filter that modifies response
1210/// headers.
1211///
1212/// Support: Extended
1213#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1214pub struct GRPCRouteRulesFiltersResponseHeaderModifier {
1215 /// Add adds the given header(s) (name, value) to the request
1216 /// before the action. It appends to any existing values associated
1217 /// with the header name.
1218 ///
1219 /// Input:
1220 /// GET /foo HTTP/1.1
1221 /// my-header: foo
1222 ///
1223 /// Config:
1224 /// add:
1225 /// - name: "my-header"
1226 /// value: "bar,baz"
1227 ///
1228 /// Output:
1229 /// GET /foo HTTP/1.1
1230 /// my-header: foo,bar,baz
1231 #[serde(default, skip_serializing_if = "Option::is_none")]
1232 pub add: Option<Vec<GRPCRouteRulesFiltersResponseHeaderModifierAdd>>,
1233 /// Remove the given header(s) from the HTTP request before the action. The
1234 /// value of Remove is a list of HTTP header names. Note that the header
1235 /// names are case-insensitive (see
1236 /// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
1237 ///
1238 /// Input:
1239 /// GET /foo HTTP/1.1
1240 /// my-header1: foo
1241 /// my-header2: bar
1242 /// my-header3: baz
1243 ///
1244 /// Config:
1245 /// remove: ["my-header1", "my-header3"]
1246 ///
1247 /// Output:
1248 /// GET /foo HTTP/1.1
1249 /// my-header2: bar
1250 #[serde(default, skip_serializing_if = "Option::is_none")]
1251 pub remove: Option<Vec<String>>,
1252 /// Set overwrites the request with the given header (name, value)
1253 /// before the action.
1254 ///
1255 /// Input:
1256 /// GET /foo HTTP/1.1
1257 /// my-header: foo
1258 ///
1259 /// Config:
1260 /// set:
1261 /// - name: "my-header"
1262 /// value: "bar"
1263 ///
1264 /// Output:
1265 /// GET /foo HTTP/1.1
1266 /// my-header: bar
1267 #[serde(default, skip_serializing_if = "Option::is_none")]
1268 pub set: Option<Vec<GRPCRouteRulesFiltersResponseHeaderModifierSet>>,
1269}
1270
1271/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1272#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1273pub struct GRPCRouteRulesFiltersResponseHeaderModifierAdd {
1274 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1275 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1276 ///
1277 /// If multiple entries specify equivalent header names, the first entry with
1278 /// an equivalent name MUST be considered for a match. Subsequent entries
1279 /// with an equivalent header name MUST be ignored. Due to the
1280 /// case-insensitivity of header names, "foo" and "Foo" are considered
1281 /// equivalent.
1282 pub name: String,
1283 /// Value is the value of HTTP Header to be matched.
1284 pub value: String,
1285}
1286
1287/// HTTPHeader represents an HTTP Header name and value as defined by RFC 7230.
1288#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1289pub struct GRPCRouteRulesFiltersResponseHeaderModifierSet {
1290 /// Name is the name of the HTTP Header to be matched. Name matching MUST be
1291 /// case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
1292 ///
1293 /// If multiple entries specify equivalent header names, the first entry with
1294 /// an equivalent name MUST be considered for a match. Subsequent entries
1295 /// with an equivalent header name MUST be ignored. Due to the
1296 /// case-insensitivity of header names, "foo" and "Foo" are considered
1297 /// equivalent.
1298 pub name: String,
1299 /// Value is the value of HTTP Header to be matched.
1300 pub value: String,
1301}
1302
1303/// GRPCRouteFilter defines processing steps that must be completed during the
1304/// request or response lifecycle. GRPCRouteFilters are meant as an extension
1305/// point to express processing that may be done in Gateway implementations. Some
1306/// examples include request or response modification, implementing
1307/// authentication strategies, rate-limiting, and traffic shaping. API
1308/// guarantee/conformance is defined based on the type of the filter.
1309#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1310pub enum GRPCRouteRulesFiltersType {
1311 ResponseHeaderModifier,
1312 RequestHeaderModifier,
1313 RequestMirror,
1314 ExtensionRef,
1315}
1316
1317/// GRPCRouteMatch defines the predicate used to match requests to a given
1318/// action. Multiple match types are ANDed together, i.e. the match will
1319/// evaluate to true only if all conditions are satisfied.
1320///
1321/// For example, the match below will match a gRPC request only if its service
1322/// is `foo` AND it contains the `version: v1` header:
1323///
1324/// ```text
1325/// matches:
1326/// - method:
1327/// type: Exact
1328/// service: "foo"
1329/// headers:
1330/// - name: "version"
1331/// value "v1"
1332///
1333/// ```
1334#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1335pub struct GRPCRouteRulesMatches {
1336 /// Headers specifies gRPC request header matchers. Multiple match values are
1337 /// ANDed together, meaning, a request MUST match all the specified headers
1338 /// to select the route.
1339 #[serde(default, skip_serializing_if = "Option::is_none")]
1340 pub headers: Option<Vec<GRPCRouteRulesMatchesHeaders>>,
1341 /// Method specifies a gRPC request service/method matcher. If this field is
1342 /// not specified, all services and methods will match.
1343 #[serde(default, skip_serializing_if = "Option::is_none")]
1344 pub method: Option<GRPCRouteRulesMatchesMethod>,
1345}
1346
1347/// GRPCHeaderMatch describes how to select a gRPC route by matching gRPC request
1348/// headers.
1349#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1350pub struct GRPCRouteRulesMatchesHeaders {
1351 /// Name is the name of the gRPC Header to be matched.
1352 ///
1353 /// If multiple entries specify equivalent header names, only the first
1354 /// entry with an equivalent name MUST be considered for a match. Subsequent
1355 /// entries with an equivalent header name MUST be ignored. Due to the
1356 /// case-insensitivity of header names, "foo" and "Foo" are considered
1357 /// equivalent.
1358 pub name: String,
1359 /// Type specifies how to match against the value of the header.
1360 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
1361 pub r#type: Option<GRPCRouteRulesMatchesHeadersType>,
1362 /// Value is the value of the gRPC Header to be matched.
1363 pub value: String,
1364}
1365
1366/// GRPCHeaderMatch describes how to select a gRPC route by matching gRPC request
1367/// headers.
1368#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1369pub enum GRPCRouteRulesMatchesHeadersType {
1370 Exact,
1371 RegularExpression,
1372}
1373
1374/// Method specifies a gRPC request service/method matcher. If this field is
1375/// not specified, all services and methods will match.
1376#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1377pub struct GRPCRouteRulesMatchesMethod {
1378 /// Value of the method to match against. If left empty or omitted, will
1379 /// match all services.
1380 ///
1381 /// At least one of Service and Method MUST be a non-empty string.
1382 #[serde(default, skip_serializing_if = "Option::is_none")]
1383 pub method: Option<String>,
1384 /// Value of the service to match against. If left empty or omitted, will
1385 /// match any service.
1386 ///
1387 /// At least one of Service and Method MUST be a non-empty string.
1388 #[serde(default, skip_serializing_if = "Option::is_none")]
1389 pub service: Option<String>,
1390 /// Type specifies how to match against the service and/or method.
1391 /// Support: Core (Exact with service and method specified)
1392 ///
1393 /// Support: Implementation-specific (Exact with method specified but no service specified)
1394 ///
1395 /// Support: Implementation-specific (RegularExpression)
1396 #[serde(default, skip_serializing_if = "Option::is_none", rename = "type")]
1397 pub r#type: Option<GRPCRouteRulesMatchesMethodType>,
1398}
1399
1400/// Method specifies a gRPC request service/method matcher. If this field is
1401/// not specified, all services and methods will match.
1402#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, PartialEq)]
1403pub enum GRPCRouteRulesMatchesMethodType {
1404 Exact,
1405 RegularExpression,
1406}
1407
1408/// Status defines the current state of GRPCRoute.
1409#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1410pub struct GRPCRouteStatus {
1411 /// Parents is a list of parent resources (usually Gateways) that are
1412 /// associated with the route, and the status of the route with respect to
1413 /// each parent. When this route attaches to a parent, the controller that
1414 /// manages the parent must add an entry to this list when the controller
1415 /// first sees the route and should update the entry as appropriate when the
1416 /// route or gateway is modified.
1417 ///
1418 /// Note that parent references that cannot be resolved by an implementation
1419 /// of this API will not be added to this list. Implementations of this API
1420 /// can only populate Route status for the Gateways/parent resources they are
1421 /// responsible for.
1422 ///
1423 /// A maximum of 32 Gateways will be represented in this list. An empty list
1424 /// means the route has not been attached to any Gateway.
1425 pub parents: Vec<GRPCRouteStatusParents>,
1426}
1427
1428/// RouteParentStatus describes the status of a route with respect to an
1429/// associated Parent.
1430#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1431pub struct GRPCRouteStatusParents {
1432 /// Conditions describes the status of the route with respect to the Gateway.
1433 /// Note that the route's availability is also subject to the Gateway's own
1434 /// status conditions and listener status.
1435 ///
1436 /// If the Route's ParentRef specifies an existing Gateway that supports
1437 /// Routes of this kind AND that Gateway's controller has sufficient access,
1438 /// then that Gateway's controller MUST set the "Accepted" condition on the
1439 /// Route, to indicate whether the route has been accepted or rejected by the
1440 /// Gateway, and why.
1441 ///
1442 /// A Route MUST be considered "Accepted" if at least one of the Route's
1443 /// rules is implemented by the Gateway.
1444 ///
1445 /// There are a number of cases where the "Accepted" condition may not be set
1446 /// due to lack of controller visibility, that includes when:
1447 ///
1448 /// * The Route refers to a nonexistent parent.
1449 /// * The Route is of a type that the controller does not support.
1450 /// * The Route is in a namespace the controller does not have access to.
1451 pub conditions: Vec<Condition>,
1452 /// ControllerName is a domain/path string that indicates the name of the
1453 /// controller that wrote this status. This corresponds with the
1454 /// controllerName field on GatewayClass.
1455 ///
1456 /// Example: "example.net/gateway-controller".
1457 ///
1458 /// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are
1459 /// valid Kubernetes names
1460 /// (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
1461 ///
1462 /// Controllers MUST populate this field when writing status. Controllers should ensure that
1463 /// entries to status populated with their ControllerName are cleaned up when they are no
1464 /// longer necessary.
1465 #[serde(rename = "controllerName")]
1466 pub controller_name: String,
1467 /// ParentRef corresponds with a ParentRef in the spec that this
1468 /// RouteParentStatus struct describes the status of.
1469 #[serde(rename = "parentRef")]
1470 pub parent_ref: GRPCRouteStatusParentsParentRef,
1471}
1472
1473/// ParentRef corresponds with a ParentRef in the spec that this
1474/// RouteParentStatus struct describes the status of.
1475#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, Default, PartialEq)]
1476pub struct GRPCRouteStatusParentsParentRef {
1477 /// Group is the group of the referent.
1478 /// When unspecified, "gateway.networking.k8s.io" is inferred.
1479 /// To set the core API group (such as for a "Service" kind referent),
1480 /// Group must be explicitly set to "" (empty string).
1481 ///
1482 /// Support: Core
1483 #[serde(default, skip_serializing_if = "Option::is_none")]
1484 pub group: Option<String>,
1485 /// Kind is kind of the referent.
1486 ///
1487 /// There are two kinds of parent resources with "Core" support:
1488 ///
1489 /// * Gateway (Gateway conformance profile)
1490 /// * Service (Mesh conformance profile, ClusterIP Services only)
1491 ///
1492 /// Support for other resources is Implementation-Specific.
1493 #[serde(default, skip_serializing_if = "Option::is_none")]
1494 pub kind: Option<String>,
1495 /// Name is the name of the referent.
1496 ///
1497 /// Support: Core
1498 pub name: String,
1499 /// Namespace is the namespace of the referent. When unspecified, this refers
1500 /// to the local namespace of the Route.
1501 ///
1502 /// Note that there are specific rules for ParentRefs which cross namespace
1503 /// boundaries. Cross-namespace references are only valid if they are explicitly
1504 /// allowed by something in the namespace they are referring to. For example:
1505 /// Gateway has the AllowedRoutes field, and ReferenceGrant provides a
1506 /// generic way to enable any other kind of cross-namespace reference.
1507 ///
1508 /// Support: Core
1509 #[serde(default, skip_serializing_if = "Option::is_none")]
1510 pub namespace: Option<String>,
1511 /// Port is the network port this Route targets. It can be interpreted
1512 /// differently based on the type of parent resource.
1513 ///
1514 /// When the parent resource is a Gateway, this targets all listeners
1515 /// listening on the specified port that also support this kind of Route(and
1516 /// select this Route). It's not recommended to set `Port` unless the
1517 /// networking behaviors specified in a Route must apply to a specific port
1518 /// as opposed to a listener(s) whose port(s) may be changed. When both Port
1519 /// and SectionName are specified, the name and port of the selected listener
1520 /// must match both specified values.
1521 ///
1522 /// Implementations MAY choose to support other parent resources.
1523 /// Implementations supporting other types of parent resources MUST clearly
1524 /// document how/if Port is interpreted.
1525 ///
1526 /// For the purpose of status, an attachment is considered successful as
1527 /// long as the parent resource accepts it partially. For example, Gateway
1528 /// listeners can restrict which Routes can attach to them by Route kind,
1529 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment
1530 /// from the referencing Route, the Route MUST be considered successfully
1531 /// attached. If no Gateway listeners accept attachment from this Route,
1532 /// the Route MUST be considered detached from the Gateway.
1533 ///
1534 /// Support: Extended
1535 #[serde(default, skip_serializing_if = "Option::is_none")]
1536 pub port: Option<i32>,
1537 /// SectionName is the name of a section within the target resource. In the
1538 /// following resources, SectionName is interpreted as the following:
1539 ///
1540 /// * Gateway: Listener name. When both Port (experimental) and SectionName
1541 /// are specified, the name and port of the selected listener must match
1542 /// both specified values.
1543 /// * Service: Port name. When both Port (experimental) and SectionName
1544 /// are specified, the name and port of the selected listener must match
1545 /// both specified values.
1546 ///
1547 /// Implementations MAY choose to support attaching Routes to other resources.
1548 /// If that is the case, they MUST clearly document how SectionName is
1549 /// interpreted.
1550 ///
1551 /// When unspecified (empty string), this will reference the entire resource.
1552 /// For the purpose of status, an attachment is considered successful if at
1553 /// least one section in the parent resource accepts it. For example, Gateway
1554 /// listeners can restrict which Routes can attach to them by Route kind,
1555 /// namespace, or hostname. If 1 of 2 Gateway listeners accept attachment from
1556 /// the referencing Route, the Route MUST be considered successfully
1557 /// attached. If no Gateway listeners accept attachment from this Route, the
1558 /// Route MUST be considered detached from the Gateway.
1559 ///
1560 /// Support: Core
1561 #[serde(
1562 default,
1563 skip_serializing_if = "Option::is_none",
1564 rename = "sectionName"
1565 )]
1566 pub section_name: Option<String>,
1567}