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