2019-03-14 14:56:06 +00:00
|
|
|
package v1alpha1
|
|
|
|
|
|
|
|
import (
|
2023-02-03 14:24:05 +00:00
|
|
|
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
|
|
|
"github.com/traefik/traefik/v3/pkg/types"
|
2019-03-14 14:56:06 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
2021-01-15 14:54:04 +00:00
|
|
|
"k8s.io/apimachinery/pkg/util/intstr"
|
2019-03-14 14:56:06 +00:00
|
|
|
)
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// IngressRouteSpec defines the desired state of IngressRoute.
|
2019-03-14 14:56:06 +00:00
|
|
|
type IngressRouteSpec struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Routes defines the list of routes.
|
|
|
|
Routes []Route `json:"routes"`
|
|
|
|
// EntryPoints defines the list of entry point names to bind to.
|
|
|
|
// Entry points have to be configured in the static configuration.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/entrypoints/
|
2022-06-24 10:40:08 +00:00
|
|
|
// Default: all.
|
2021-03-03 14:32:04 +00:00
|
|
|
EntryPoints []string `json:"entryPoints,omitempty"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// TLS defines the TLS configuration.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#tls
|
2022-06-24 10:40:08 +00:00
|
|
|
TLS *TLS `json:"tls,omitempty"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// Route holds the HTTP route configuration.
|
2019-03-14 14:56:06 +00:00
|
|
|
type Route struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Match defines the router's rule.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#rule
|
2021-03-03 14:32:04 +00:00
|
|
|
Match string `json:"match"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Kind defines the kind of the route.
|
|
|
|
// Rule is the only supported kind.
|
2021-03-03 14:32:04 +00:00
|
|
|
// +kubebuilder:validation:Enum=Rule
|
2022-06-24 10:40:08 +00:00
|
|
|
Kind string `json:"kind"`
|
|
|
|
// Priority defines the router's priority.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#priority
|
2022-06-24 10:40:08 +00:00
|
|
|
Priority int `json:"priority,omitempty"`
|
2024-01-23 10:34:05 +00:00
|
|
|
// Syntax defines the router's rule syntax.
|
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#rulesyntax
|
|
|
|
Syntax string `json:"syntax,omitempty"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Services defines the list of Service.
|
|
|
|
// It can contain any combination of TraefikService and/or reference to a Kubernetes Service.
|
|
|
|
Services []Service `json:"services,omitempty"`
|
|
|
|
// Middlewares defines the list of references to Middleware resources.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-middleware
|
2021-03-03 14:32:04 +00:00
|
|
|
Middlewares []MiddlewareRef `json:"middlewares,omitempty"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// TLS holds the TLS configuration.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#tls
|
2019-03-14 14:56:06 +00:00
|
|
|
type TLS struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// SecretName is the name of the referenced Kubernetes Secret to specify the certificate details.
|
2021-03-03 14:32:04 +00:00
|
|
|
SecretName string `json:"secretName,omitempty"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Options defines the reference to a TLSOption, that specifies the parameters of the TLS connection.
|
|
|
|
// If not defined, the `default` TLSOption is used.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/https/tls/#tls-options
|
2020-02-24 16:14:06 +00:00
|
|
|
Options *TLSOptionRef `json:"options,omitempty"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Store defines the reference to the TLSStore, that will be used to store certificates.
|
|
|
|
// Please note that only `default` TLSStore can be used.
|
|
|
|
Store *TLSStoreRef `json:"store,omitempty"`
|
|
|
|
// CertResolver defines the name of the certificate resolver to use.
|
|
|
|
// Cert resolvers have to be configured in the static configuration.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/https/acme/#certificate-resolvers
|
2022-06-24 10:40:08 +00:00
|
|
|
CertResolver string `json:"certResolver,omitempty"`
|
|
|
|
// Domains defines the list of domains that will be used to issue certificates.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/routers/#domains
|
2022-06-24 10:40:08 +00:00
|
|
|
Domains []types.Domain `json:"domains,omitempty"`
|
2019-06-21 15:18:05 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// TLSOptionRef is a reference to a TLSOption resource.
|
2019-06-21 15:18:05 +00:00
|
|
|
type TLSOptionRef struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Name defines the name of the referenced TLSOption.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-tlsoption
|
2022-06-24 10:40:08 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
// Namespace defines the namespace of the referenced TLSOption.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-tlsoption
|
2021-03-03 14:32:04 +00:00
|
|
|
Namespace string `json:"namespace,omitempty"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// TLSStoreRef is a reference to a TLSStore resource.
|
2020-02-24 16:14:06 +00:00
|
|
|
type TLSStoreRef struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Name defines the name of the referenced TLSStore.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-tlsstore
|
2022-06-24 10:40:08 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
// Namespace defines the namespace of the referenced TLSStore.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/providers/kubernetes-crd/#kind-tlsstore
|
2021-03-03 14:32:04 +00:00
|
|
|
Namespace string `json:"namespace,omitempty"`
|
2020-02-24 16:14:06 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// LoadBalancerSpec defines the desired state of LoadBalancer.
|
|
|
|
// It can reference either a Kubernetes Service object (a load-balancer of servers),
|
|
|
|
// or a TraefikService object (a load-balancer of Traefik services).
|
2019-11-14 18:28:04 +00:00
|
|
|
type LoadBalancerSpec struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Name defines the name of the referenced Kubernetes Service or TraefikService.
|
2019-11-14 18:28:04 +00:00
|
|
|
// The differentiation between the two is specified in the Kind field.
|
2021-03-03 14:32:04 +00:00
|
|
|
Name string `json:"name"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Kind defines the kind of the Service.
|
2021-03-03 14:32:04 +00:00
|
|
|
// +kubebuilder:validation:Enum=Service;TraefikService
|
2022-06-24 10:40:08 +00:00
|
|
|
Kind string `json:"kind,omitempty"`
|
|
|
|
// Namespace defines the namespace of the referenced Kubernetes Service or TraefikService.
|
|
|
|
Namespace string `json:"namespace,omitempty"`
|
|
|
|
// Sticky defines the sticky sessions configuration.
|
2022-12-05 15:58:04 +00:00
|
|
|
// More info: https://doc.traefik.io/traefik/v3.0/routing/services/#sticky-sessions
|
2022-06-24 10:40:08 +00:00
|
|
|
Sticky *dynamic.Sticky `json:"sticky,omitempty"`
|
|
|
|
// Port defines the port of a Kubernetes Service.
|
|
|
|
// This can be a reference to a named port.
|
|
|
|
Port intstr.IntOrString `json:"port,omitempty"`
|
|
|
|
// 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.
|
|
|
|
Scheme string `json:"scheme,omitempty"`
|
|
|
|
// Strategy defines the load balancing strategy between the servers.
|
|
|
|
// RoundRobin is the only supported value at the moment.
|
|
|
|
Strategy string `json:"strategy,omitempty"`
|
|
|
|
// PassHostHeader defines whether the client Host header is forwarded to the upstream Kubernetes Service.
|
|
|
|
// By default, passHostHeader is true.
|
|
|
|
PassHostHeader *bool `json:"passHostHeader,omitempty"`
|
|
|
|
// ResponseForwarding defines how Traefik forwards the response from the upstream Kubernetes Service to the client.
|
2022-11-16 10:38:07 +00:00
|
|
|
ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// 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.
|
|
|
|
ServersTransport string `json:"serversTransport,omitempty"`
|
|
|
|
// Weight defines the weight and should only be specified when Name references a TraefikService object
|
2019-11-14 18:28:04 +00:00
|
|
|
// (and to be precise, one that embeds a Weighted Round Robin).
|
|
|
|
Weight *int `json:"weight,omitempty"`
|
2023-03-20 15:46:05 +00:00
|
|
|
// 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.
|
2024-04-29 10:20:04 +00:00
|
|
|
NativeLB *bool `json:"nativeLB,omitempty"`
|
2024-02-27 09:54:04 +00:00
|
|
|
// 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.
|
|
|
|
NodePortLB bool `json:"nodePortLB,omitempty"`
|
2024-06-04 07:32:04 +00:00
|
|
|
// Healthcheck defines health checks for ExternalName services.
|
|
|
|
HealthCheck *ServerHealthCheck `json:"healthCheck,omitempty"`
|
2019-11-14 18:28:04 +00:00
|
|
|
}
|
|
|
|
|
2022-11-16 10:38:07 +00:00
|
|
|
type ResponseForwarding struct {
|
|
|
|
// 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
|
|
|
|
FlushInterval string `json:"flushInterval,omitempty"`
|
|
|
|
}
|
|
|
|
|
2024-06-04 07:32:04 +00:00
|
|
|
type ServerHealthCheck struct {
|
|
|
|
// Scheme replaces the server URL scheme for the health check endpoint.
|
|
|
|
Scheme string `json:"scheme,omitempty"`
|
|
|
|
// Mode defines the health check mode.
|
|
|
|
// If defined to grpc, will use the gRPC health check protocol to probe the server.
|
|
|
|
// Default: http
|
|
|
|
Mode string `json:"mode,omitempty"`
|
|
|
|
// Path defines the server URL path for the health check endpoint.
|
|
|
|
Path string `json:"path,omitempty"`
|
|
|
|
// Method defines the healthcheck method.
|
|
|
|
Method string `json:"method,omitempty"`
|
|
|
|
// Status defines the expected HTTP status code of the response to the health check request.
|
|
|
|
Status int `json:"status,omitempty"`
|
|
|
|
// Port defines the server URL port for the health check endpoint.
|
|
|
|
Port int `json:"port,omitempty"`
|
|
|
|
// Interval defines the frequency of the health check calls.
|
|
|
|
// Default: 30s
|
|
|
|
Interval *intstr.IntOrString `json:"interval,omitempty"`
|
|
|
|
// Timeout defines the maximum duration Traefik will wait for a health check request before considering the server unhealthy.
|
|
|
|
// Default: 5s
|
|
|
|
Timeout *intstr.IntOrString `json:"timeout,omitempty"`
|
|
|
|
// Hostname defines the value of hostname in the Host header of the health check request.
|
|
|
|
Hostname string `json:"hostname,omitempty"`
|
|
|
|
// FollowRedirects defines whether redirects should be followed during the health check calls.
|
|
|
|
// Default: true
|
|
|
|
FollowRedirects *bool `json:"followRedirects,omitempty"`
|
|
|
|
// Headers defines custom headers to be sent to the health check endpoint.
|
|
|
|
Headers map[string]string `json:"headers,omitempty"`
|
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// Service defines an upstream HTTP service to proxy traffic to.
|
2019-11-14 18:28:04 +00:00
|
|
|
type Service struct {
|
2021-03-03 14:32:04 +00:00
|
|
|
LoadBalancerSpec `json:",inline"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// MiddlewareRef is a reference to a Middleware resource.
|
2019-03-14 14:56:06 +00:00
|
|
|
type MiddlewareRef struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
// Name defines the name of the referenced Middleware resource.
|
|
|
|
Name string `json:"name"`
|
|
|
|
// Namespace defines the namespace of the referenced Middleware resource.
|
2021-03-03 14:32:04 +00:00
|
|
|
Namespace string `json:"namespace,omitempty"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// +genclient
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
2021-03-03 14:32:04 +00:00
|
|
|
// +kubebuilder:storageversion
|
2019-03-14 14:56:06 +00:00
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// IngressRoute is the CRD implementation of a Traefik HTTP Router.
|
2019-03-14 14:56:06 +00:00
|
|
|
type IngressRoute struct {
|
2022-06-24 10:40:08 +00:00
|
|
|
metav1.TypeMeta `json:",inline"`
|
|
|
|
// Standard object's metadata.
|
|
|
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
2019-03-14 14:56:06 +00:00
|
|
|
metav1.ObjectMeta `json:"metadata"`
|
|
|
|
|
|
|
|
Spec IngressRouteSpec `json:"spec"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
|
|
|
2022-06-24 10:40:08 +00:00
|
|
|
// IngressRouteList is a collection of IngressRoute.
|
2019-03-14 14:56:06 +00:00
|
|
|
type IngressRouteList struct {
|
|
|
|
metav1.TypeMeta `json:",inline"`
|
2022-06-24 10:40:08 +00:00
|
|
|
// Standard object's metadata.
|
|
|
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
2019-03-14 14:56:06 +00:00
|
|
|
metav1.ListMeta `json:"metadata"`
|
2022-06-24 10:40:08 +00:00
|
|
|
|
|
|
|
// Items is the list of IngressRoute.
|
|
|
|
Items []IngressRoute `json:"items"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|