k8s_gateway_api/exp/
tcproute.rs

1use crate::*;
2
3/// TCPRoute provides a way to route TCP requests. When combined with a Gateway
4/// listener, it can be used to forward connections on the port specified by the
5/// listener to a set of backends specified by the TCPRoute.
6#[derive(
7    Clone, Debug, kube::CustomResource, serde::Deserialize, serde::Serialize, schemars::JsonSchema,
8)]
9#[kube(
10    group = "gateway.networking.k8s.io",
11    version = "v1alpha2",
12    kind = "TCPRoute",
13    root = "TcpRoute",
14    status = "TcpRouteStatus",
15    namespaced
16)]
17pub struct TcpRouteSpec {
18    /// Common route information.
19    #[serde(flatten)]
20    pub inner: CommonRouteSpec,
21
22    /// Rules are a list of TCP matchers and actions.
23    pub rules: Vec<TcpRouteRule>,
24}
25
26/// TCPRouteStatus defines the observed state of TCPRoute
27#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema)]
28pub struct TcpRouteStatus {
29    /// Common route status.
30    #[serde(flatten)]
31    pub inner: RouteStatus,
32}
33
34/// TCPRouteRule is the configuration for a given rule.
35#[derive(
36    Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, schemars::JsonSchema,
37)]
38#[serde(rename_all = "camelCase")]
39pub struct TcpRouteRule {
40    /// BackendRefs defines the backend(s) where matching requests should be
41    /// sent. If unspecified or invalid (refers to a non-existent resource or a
42    /// Service with no endpoints), the underlying implementation MUST actively
43    /// reject connection attempts to this backend. Connection rejections must
44    /// respect weight; if an invalid backend is requested to have 80% of
45    /// connections, then 80% of connections must be rejected instead.
46    ///
47    /// Support: Core for Kubernetes Service
48    /// Support: Custom for any other resource
49    ///
50    /// Support for weight: Extended
51    pub backend_refs: Vec<BackendRef>,
52}