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