1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium ingressroutes.traefik.io -A -b --derive=Default --derive=PartialEq --smart-derive-elision
// kopium version: 0.21.2
#[allow(unused_imports)]
mod prelude {
pub use kube::CustomResource;
pub use typed_builder::TypedBuilder;
pub use schemars::JsonSchema;
pub use serde::{Serialize, Deserialize};
pub use std::collections::BTreeMap;
pub use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
}
use self::prelude::*;
/// IngressRouteSpec defines the desired state of IngressRoute.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
#[kube(group = "traefik.io", version = "v1alpha1", kind = "IngressRoute", plural = "ingressroutes")]
#[kube(namespaced)]
#[kube(derive="Default")]
#[kube(derive="PartialEq")]
pub struct IngressRouteSpec {
/// EntryPoints defines the list of entry point names to bind to.
/// Entry points have to be configured in the static configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/entrypoints/
/// Default: all.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "entryPoints")]
#[builder(default, setter(strip_option))]
pub entry_points: Option<Vec<String>>,
/// Routes defines the list of routes.
#[builder(default)]
pub routes: Vec<IngressRouteRoutes>,
/// TLS defines the TLS configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#tls
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub tls: Option<IngressRouteTls>,
}
/// Route holds the HTTP route configuration.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutes {
/// Kind defines the kind of the route.
/// Rule is the only supported kind.
/// If not defined, defaults to Rule.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub kind: Option<IngressRouteRoutesKind>,
/// Match defines the router's rule.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#rule
#[serde(rename = "match")]
pub r#match: String,
/// Middlewares defines the list of references to Middleware resources.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/providers/kubernetes-crd/#kind-middleware
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub middlewares: Option<Vec<IngressRouteRoutesMiddlewares>>,
/// Observability defines the observability configuration for a router.
/// More info: https://doc.traefik.io/traefik/v3.2/routing/routers/#observability
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub observability: Option<IngressRouteRoutesObservability>,
/// Priority defines the router's priority.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#priority
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub priority: Option<i64>,
/// Services defines the list of Service.
/// It can contain any combination of TraefikService and/or reference to a Kubernetes Service.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub services: Option<Vec<IngressRouteRoutesServices>>,
/// Syntax defines the router's rule syntax.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#rulesyntax
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub syntax: Option<String>,
}
/// Route holds the HTTP route configuration.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub enum IngressRouteRoutesKind {
Rule,
}
/// MiddlewareRef is a reference to a Middleware resource.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesMiddlewares {
/// Name defines the name of the referenced Middleware resource.
pub name: String,
/// Namespace defines the namespace of the referenced Middleware resource.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub namespace: Option<String>,
}
/// Observability defines the observability configuration for a router.
/// More info: https://doc.traefik.io/traefik/v3.2/routing/routers/#observability
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesObservability {
#[serde(default, skip_serializing_if = "Option::is_none", rename = "accessLogs")]
#[builder(default, setter(strip_option))]
pub access_logs: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub metrics: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub tracing: Option<bool>,
}
/// Service defines an upstream HTTP service to proxy traffic to.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesServices {
/// Healthcheck defines health checks for ExternalName services.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "healthCheck")]
#[builder(default, setter(strip_option))]
pub health_check: Option<IngressRouteRoutesServicesHealthCheck>,
/// Kind defines the kind of the Service.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub kind: Option<IngressRouteRoutesServicesKind>,
/// Name defines the name of the referenced Kubernetes Service or TraefikService.
/// The differentiation between the two is specified in the Kind field.
pub name: String,
/// Namespace defines the namespace of the referenced Kubernetes Service or TraefikService.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub namespace: Option<String>,
/// NativeLB controls, when creating the load-balancer,
/// whether the LB's children are directly the pods IPs or if the only child is the Kubernetes Service clusterIP.
/// The Kubernetes Service itself does load-balance to the pods.
/// By default, NativeLB is false.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "nativeLB")]
#[builder(default, setter(strip_option))]
pub native_lb: Option<bool>,
/// NodePortLB controls, when creating the load-balancer,
/// whether the LB's children are directly the nodes internal IPs using the nodePort when the service type is NodePort.
/// It allows services to be reachable when Traefik runs externally from the Kubernetes cluster but within the same network of the nodes.
/// By default, NodePortLB is false.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "nodePortLB")]
#[builder(default, setter(strip_option))]
pub node_port_lb: Option<bool>,
/// PassHostHeader defines whether the client Host header is forwarded to the upstream Kubernetes Service.
/// By default, passHostHeader is true.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "passHostHeader")]
#[builder(default, setter(strip_option))]
pub pass_host_header: Option<bool>,
/// Port defines the port of a Kubernetes Service.
/// This can be a reference to a named port.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub port: Option<IntOrString>,
/// ResponseForwarding defines how Traefik forwards the response from the upstream Kubernetes Service to the client.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "responseForwarding")]
#[builder(default, setter(strip_option))]
pub response_forwarding: Option<IngressRouteRoutesServicesResponseForwarding>,
/// Scheme defines the scheme to use for the request to the upstream Kubernetes Service.
/// It defaults to https when Kubernetes Service port is 443, http otherwise.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub scheme: Option<String>,
/// ServersTransport defines the name of ServersTransport resource to use.
/// It allows to configure the transport between Traefik and your servers.
/// Can only be used on a Kubernetes Service.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "serversTransport")]
#[builder(default, setter(strip_option))]
pub servers_transport: Option<String>,
/// Sticky defines the sticky sessions configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#sticky-sessions
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub sticky: Option<IngressRouteRoutesServicesSticky>,
/// Strategy defines the load balancing strategy between the servers.
/// RoundRobin is the only supported value at the moment.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub strategy: Option<String>,
/// Weight defines the weight and should only be specified when Name references a TraefikService object
/// (and to be precise, one that embeds a Weighted Round Robin).
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub weight: Option<i64>,
}
/// Healthcheck defines health checks for ExternalName services.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesServicesHealthCheck {
/// FollowRedirects defines whether redirects should be followed during the health check calls.
/// Default: true
#[serde(default, skip_serializing_if = "Option::is_none", rename = "followRedirects")]
#[builder(default, setter(strip_option))]
pub follow_redirects: Option<bool>,
/// Headers defines custom headers to be sent to the health check endpoint.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub headers: Option<BTreeMap<String, String>>,
/// Hostname defines the value of hostname in the Host header of the health check request.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub hostname: Option<String>,
/// Interval defines the frequency of the health check calls.
/// Default: 30s
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub interval: Option<IntOrString>,
/// Method defines the healthcheck method.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub method: Option<String>,
/// Mode defines the health check mode.
/// If defined to grpc, will use the gRPC health check protocol to probe the server.
/// Default: http
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub mode: Option<String>,
/// Path defines the server URL path for the health check endpoint.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub path: Option<String>,
/// Port defines the server URL port for the health check endpoint.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub port: Option<i64>,
/// Scheme replaces the server URL scheme for the health check endpoint.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub scheme: Option<String>,
/// Status defines the expected HTTP status code of the response to the health check request.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub status: Option<i64>,
/// Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy.
/// Default: 5s
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub timeout: Option<IntOrString>,
}
/// Service defines an upstream HTTP service to proxy traffic to.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub enum IngressRouteRoutesServicesKind {
Service,
TraefikService,
}
/// ResponseForwarding defines how Traefik forwards the response from the upstream Kubernetes Service to the client.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesServicesResponseForwarding {
/// FlushInterval defines the interval, in milliseconds, in between flushes to the client while copying the response body.
/// A negative value means to flush immediately after each write to the client.
/// This configuration is ignored when ReverseProxy recognizes a response as a streaming response;
/// for such responses, writes are flushed to the client immediately.
/// Default: 100ms
#[serde(default, skip_serializing_if = "Option::is_none", rename = "flushInterval")]
#[builder(default, setter(strip_option))]
pub flush_interval: Option<String>,
}
/// Sticky defines the sticky sessions configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/services/#sticky-sessions
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesServicesSticky {
/// Cookie defines the sticky cookie configuration.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub cookie: Option<IngressRouteRoutesServicesStickyCookie>,
}
/// Cookie defines the sticky cookie configuration.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteRoutesServicesStickyCookie {
/// HTTPOnly defines whether the cookie can be accessed by client-side APIs, such as JavaScript.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "httpOnly")]
#[builder(default, setter(strip_option))]
pub http_only: Option<bool>,
/// MaxAge defines the number of seconds until the cookie expires.
/// When set to a negative number, the cookie expires immediately.
/// When set to zero, the cookie never expires.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "maxAge")]
#[builder(default, setter(strip_option))]
pub max_age: Option<i64>,
/// Name defines the Cookie name.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub name: Option<String>,
/// Path defines the path that must exist in the requested URL for the browser to send the Cookie header.
/// When not provided the cookie will be sent on every request to the domain.
/// More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#pathpath-value
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub path: Option<String>,
/// SameSite defines the same site policy.
/// More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
#[serde(default, skip_serializing_if = "Option::is_none", rename = "sameSite")]
#[builder(default, setter(strip_option))]
pub same_site: Option<String>,
/// Secure defines whether the cookie can only be transmitted over an encrypted connection (i.e. HTTPS).
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub secure: Option<bool>,
}
/// TLS defines the TLS configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#tls
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteTls {
/// CertResolver defines the name of the certificate resolver to use.
/// Cert resolvers have to be configured in the static configuration.
/// More info: https://doc.traefik.io/traefik/v3.3/https/acme/#certificate-resolvers
#[serde(default, skip_serializing_if = "Option::is_none", rename = "certResolver")]
#[builder(default, setter(strip_option))]
pub cert_resolver: Option<String>,
/// Domains defines the list of domains that will be used to issue certificates.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/routers/#domains
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub domains: Option<Vec<IngressRouteTlsDomains>>,
/// Options defines the reference to a TLSOption, that specifies the parameters of the TLS connection.
/// If not defined, the `default` TLSOption is used.
/// More info: https://doc.traefik.io/traefik/v3.3/https/tls/#tls-options
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub options: Option<IngressRouteTlsOptions>,
/// SecretName is the name of the referenced Kubernetes Secret to specify the certificate details.
#[serde(default, skip_serializing_if = "Option::is_none", rename = "secretName")]
#[builder(default, setter(strip_option))]
pub secret_name: Option<String>,
/// Store defines the reference to the TLSStore, that will be used to store certificates.
/// Please note that only `default` TLSStore can be used.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub store: Option<IngressRouteTlsStore>,
}
/// Domain holds a domain name with SANs.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteTlsDomains {
/// Main defines the main domain name.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub main: Option<String>,
/// SANs defines the subject alternative domain names.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub sans: Option<Vec<String>>,
}
/// Options defines the reference to a TLSOption, that specifies the parameters of the TLS connection.
/// If not defined, the `default` TLSOption is used.
/// More info: https://doc.traefik.io/traefik/v3.3/https/tls/#tls-options
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteTlsOptions {
/// Name defines the name of the referenced TLSOption.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/providers/kubernetes-crd/#kind-tlsoption
pub name: String,
/// Namespace defines the namespace of the referenced TLSOption.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/providers/kubernetes-crd/#kind-tlsoption
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub namespace: Option<String>,
}
/// Store defines the reference to the TLSStore, that will be used to store certificates.
/// Please note that only `default` TLSStore can be used.
#[derive(Serialize, Deserialize, Clone, Debug, TypedBuilder, Default, PartialEq, JsonSchema)]
pub struct IngressRouteTlsStore {
/// Name defines the name of the referenced TLSStore.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/providers/kubernetes-crd/#kind-tlsstore
pub name: String,
/// Namespace defines the namespace of the referenced TLSStore.
/// More info: https://doc.traefik.io/traefik/v3.3/routing/providers/kubernetes-crd/#kind-tlsstore
#[serde(default, skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub namespace: Option<String>,
}