k8s_traefik_api/
ingressroutetcps.rs

1// WARNING: generated by kopium - manual changes will be overwritten
2// kopium command: kopium ingressroutetcps.traefik.io -A -b --derive=Default --derive=PartialEq --smart-derive-elision
3// kopium version: 0.21.2
4
5#[allow(unused_imports)]
6mod prelude {
7    pub use kube::CustomResource;
8    pub use typed_builder::TypedBuilder;
9    pub use schemars::JsonSchema;
10    pub use serde::{Serialize, Deserialize};
11    pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
12}
13use self::prelude::*;
14
15/// IngressRouteTCPSpec defines the desired state of IngressRouteTCP.
16#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
17#[kube(group = "traefik.io", version = "v1alpha1", kind = "IngressRouteTCP", plural = "ingressroutetcps")]
18#[kube(namespaced)]
19#[kube(derive="Default")]
20#[kube(derive="PartialEq")]
21pub struct IngressRouteTCPSpec {
22    /// EntryPoints defines the list of entry point names to bind to.
23    /// Entry points have to be configured in the static configuration.
24    /// More info: https://doc.traefik.io/traefik/v3.3/routing/entrypoints/
25    /// Default: all.
26    #[serde(default, skip_serializing_if = "Option::is_none", rename = "entryPoints")]
27    #[builder(default, setter(strip_option))]
28    pub entry_points: Option<Vec<String>>,
29    /// Routes defines the list of routes.
30    #[builder(default)]
31    pub routes: Vec<IngressRouteTCPRoutes>,
32    /// TLS defines the TLS configuration on a layer 4 / TCP Route.
33    /// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#tls_1
34    #[serde(default, skip_serializing_if = "Option::is_none")]
35    #[builder(default, setter(strip_option))]
36    pub tls: Option<IngressRouteTCPTls>,
37}
38
39/// RouteTCP holds the TCP route configuration.
40#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
41pub struct IngressRouteTCPRoutes {
42    /// Match defines the router's rule.
43    /// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#rule_1
44    #[serde(rename = "match")]
45    pub r#match: String,
46    /// Middlewares defines the list of references to MiddlewareTCP resources.
47    #[serde(default, skip_serializing_if = "Option::is_none")]
48    #[builder(default, setter(strip_option))]
49    pub middlewares: Option<Vec<IngressRouteTCPRoutesMiddlewares>>,
50    /// Priority defines the router's priority.
51    /// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#priority_1
52    #[serde(default, skip_serializing_if = "Option::is_none")]
53    #[builder(default, setter(strip_option))]
54    pub priority: Option<i64>,
55    /// Services defines the list of TCP services.
56    #[serde(default, skip_serializing_if = "Option::is_none")]
57    #[builder(default, setter(strip_option))]
58    pub services: Option<Vec<IngressRouteTCPRoutesServices>>,
59    /// Syntax defines the router's rule syntax.
60    /// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#rulesyntax_1
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    #[builder(default, setter(strip_option))]
63    pub syntax: Option<String>,
64}
65
66/// ObjectReference is a generic reference to a Traefik resource.
67#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
68pub struct IngressRouteTCPRoutesMiddlewares {
69    /// Name defines the name of the referenced Traefik resource.
70    pub name: String,
71    /// Namespace defines the namespace of the referenced Traefik resource.
72    #[serde(default, skip_serializing_if = "Option::is_none")]
73    #[builder(default, setter(strip_option))]
74    pub namespace: Option<String>,
75}
76
77/// ServiceTCP defines an upstream TCP service to proxy traffic to.
78#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
79pub struct IngressRouteTCPRoutesServices {
80    /// Name defines the name of the referenced Kubernetes Service.
81    pub name: String,
82    /// Namespace defines the namespace of the referenced Kubernetes Service.
83    #[serde(default, skip_serializing_if = "Option::is_none")]
84    #[builder(default, setter(strip_option))]
85    pub namespace: Option<String>,
86    /// NativeLB controls, when creating the load-balancer,
87    /// whether the LB's children are directly the pods IPs or if the only child is the Kubernetes Service clusterIP.
88    /// The Kubernetes Service itself does load-balance to the pods.
89    /// By default, NativeLB is false.
90    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nativeLB")]
91    #[builder(default, setter(strip_option))]
92    pub native_lb: Option<bool>,
93    /// NodePortLB controls, when creating the load-balancer,
94    /// whether the LB's children are directly the nodes internal IPs using the nodePort when the service type is NodePort.
95    /// It allows services to be reachable when Traefik runs externally from the Kubernetes cluster but within the same network of the nodes.
96    /// By default, NodePortLB is false.
97    #[serde(default, skip_serializing_if = "Option::is_none", rename = "nodePortLB")]
98    #[builder(default, setter(strip_option))]
99    pub node_port_lb: Option<bool>,
100    /// Port defines the port of a Kubernetes Service.
101    /// This can be a reference to a named port.
102    pub port: IntOrString,
103    /// ProxyProtocol defines the PROXY protocol configuration.
104    /// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#proxy-protocol
105    #[serde(default, skip_serializing_if = "Option::is_none", rename = "proxyProtocol")]
106    #[builder(default, setter(strip_option))]
107    pub proxy_protocol: Option<IngressRouteTCPRoutesServicesProxyProtocol>,
108    /// ServersTransport defines the name of ServersTransportTCP resource to use.
109    /// It allows to configure the transport between Traefik and your servers.
110    /// Can only be used on a Kubernetes Service.
111    #[serde(default, skip_serializing_if = "Option::is_none", rename = "serversTransport")]
112    #[builder(default, setter(strip_option))]
113    pub servers_transport: Option<String>,
114    /// TerminationDelay defines the deadline that the proxy sets, after one of its connected peers indicates
115    /// it has closed the writing capability of its connection, to close the reading capability as well,
116    /// hence fully terminating the connection.
117    /// It is a duration in milliseconds, defaulting to 100.
118    /// A negative value means an infinite deadline (i.e. the reading capability is never closed).
119    /// Deprecated: TerminationDelay will not be supported in future APIVersions, please use ServersTransport to configure the TerminationDelay instead.
120    #[serde(default, skip_serializing_if = "Option::is_none", rename = "terminationDelay")]
121    #[builder(default, setter(strip_option))]
122    pub termination_delay: Option<i64>,
123    /// TLS determines whether to use TLS when dialing with the backend.
124    #[serde(default, skip_serializing_if = "Option::is_none")]
125    #[builder(default, setter(strip_option))]
126    pub tls: Option<bool>,
127    /// Weight defines the weight used when balancing requests between multiple Kubernetes Service.
128    #[serde(default, skip_serializing_if = "Option::is_none")]
129    #[builder(default, setter(strip_option))]
130    pub weight: Option<i64>,
131}
132
133/// ProxyProtocol defines the PROXY protocol configuration.
134/// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#proxy-protocol
135#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
136pub struct IngressRouteTCPRoutesServicesProxyProtocol {
137    /// Version defines the PROXY Protocol version to use.
138    #[serde(default, skip_serializing_if = "Option::is_none")]
139    #[builder(default, setter(strip_option))]
140    pub version: Option<i64>,
141}
142
143/// TLS defines the TLS configuration on a layer 4 / TCP Route.
144/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#tls_1
145#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
146pub struct IngressRouteTCPTls {
147    /// CertResolver defines the name of the certificate resolver to use.
148    /// Cert resolvers have to be configured in the static configuration.
149    /// More info: https://doc.traefik.io/traefik/v3.3/https/acme/#certificate-resolvers
150    #[serde(default, skip_serializing_if = "Option::is_none", rename = "certResolver")]
151    #[builder(default, setter(strip_option))]
152    pub cert_resolver: Option<String>,
153    /// Domains defines the list of domains that will be used to issue certificates.
154    /// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#domains
155    #[serde(default, skip_serializing_if = "Option::is_none")]
156    #[builder(default, setter(strip_option))]
157    pub domains: Option<Vec<IngressRouteTCPTlsDomains>>,
158    /// Options defines the reference to a TLSOption, that specifies the parameters of the TLS connection.
159    /// If not defined, the `default` TLSOption is used.
160    /// More info: https://doc.traefik.io/traefik/v3.3/https/tls/#tls-options
161    #[serde(default, skip_serializing_if = "Option::is_none")]
162    #[builder(default, setter(strip_option))]
163    pub options: Option<IngressRouteTCPTlsOptions>,
164    /// Passthrough defines whether a TLS router will terminate the TLS connection.
165    #[serde(default, skip_serializing_if = "Option::is_none")]
166    #[builder(default, setter(strip_option))]
167    pub passthrough: Option<bool>,
168    /// SecretName is the name of the referenced Kubernetes Secret to specify the certificate details.
169    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretName")]
170    #[builder(default, setter(strip_option))]
171    pub secret_name: Option<String>,
172    /// Store defines the reference to the TLSStore, that will be used to store certificates.
173    /// Please note that only `default` TLSStore can be used.
174    #[serde(default, skip_serializing_if = "Option::is_none")]
175    #[builder(default, setter(strip_option))]
176    pub store: Option<IngressRouteTCPTlsStore>,
177}
178
179/// Domain holds a domain name with SANs.
180#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
181pub struct IngressRouteTCPTlsDomains {
182    /// Main defines the main domain name.
183    #[serde(default, skip_serializing_if = "Option::is_none")]
184    #[builder(default, setter(strip_option))]
185    pub main: Option<String>,
186    /// SANs defines the subject alternative domain names.
187    #[serde(default, skip_serializing_if = "Option::is_none")]
188    #[builder(default, setter(strip_option))]
189    pub sans: Option<Vec<String>>,
190}
191
192/// Options defines the reference to a TLSOption, that specifies the parameters of the TLS connection.
193/// If not defined, the `default` TLSOption is used.
194/// More info: https://doc.traefik.io/traefik/v3.3/https/tls/#tls-options
195#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
196pub struct IngressRouteTCPTlsOptions {
197    /// Name defines the name of the referenced Traefik resource.
198    pub name: String,
199    /// Namespace defines the namespace of the referenced Traefik resource.
200    #[serde(default, skip_serializing_if = "Option::is_none")]
201    #[builder(default, setter(strip_option))]
202    pub namespace: Option<String>,
203}
204
205/// Store defines the reference to the TLSStore, that will be used to store certificates.
206/// Please note that only `default` TLSStore can be used.
207#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
208pub struct IngressRouteTCPTlsStore {
209    /// Name defines the name of the referenced Traefik resource.
210    pub name: String,
211    /// Namespace defines the namespace of the referenced Traefik resource.
212    #[serde(default, skip_serializing_if = "Option::is_none")]
213    #[builder(default, setter(strip_option))]
214    pub namespace: Option<String>,
215}
216