2019-03-14 14:56:06 +00:00
|
|
|
package v1alpha1
|
|
|
|
|
|
|
|
import (
|
2019-09-13 14:46:04 +00:00
|
|
|
"github.com/containous/traefik/v2/pkg/config/dynamic"
|
2019-09-09 11:52:04 +00:00
|
|
|
"github.com/containous/traefik/v2/pkg/types"
|
2019-03-14 14:56:06 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
// IngressRouteSpec is a specification for a IngressRouteSpec resource.
|
|
|
|
type IngressRouteSpec struct {
|
|
|
|
Routes []Route `json:"routes"`
|
|
|
|
EntryPoints []string `json:"entryPoints"`
|
|
|
|
TLS *TLS `json:"tls,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Route contains the set of routes.
|
|
|
|
type Route struct {
|
|
|
|
Match string `json:"match"`
|
|
|
|
Kind string `json:"kind"`
|
|
|
|
Priority int `json:"priority"`
|
|
|
|
Services []Service `json:"services,omitempty"`
|
|
|
|
Middlewares []MiddlewareRef `json:"middlewares"`
|
|
|
|
}
|
|
|
|
|
2019-03-26 10:12:04 +00:00
|
|
|
// TLS contains the TLS certificates configuration of the routes. To enable
|
2019-06-11 13:12:04 +00:00
|
|
|
// Let's Encrypt, use an empty TLS struct, e.g. in YAML:
|
|
|
|
//
|
|
|
|
// tls: {} # inline format
|
|
|
|
//
|
|
|
|
// tls:
|
|
|
|
// secretName: # block format
|
2019-03-14 14:56:06 +00:00
|
|
|
type TLS struct {
|
2019-03-26 10:12:04 +00:00
|
|
|
// SecretName is the name of the referenced Kubernetes Secret to specify the
|
|
|
|
// certificate details.
|
2019-03-14 14:56:06 +00:00
|
|
|
SecretName string `json:"secretName"`
|
2019-06-21 15:18:05 +00:00
|
|
|
// Options is a reference to a TLSOption, that specifies the parameters of the TLS connection.
|
2019-09-09 11:52:04 +00:00
|
|
|
Options *TLSOptionRef `json:"options,omitempty"`
|
|
|
|
CertResolver string `json:"certResolver,omitempty"`
|
|
|
|
Domains []types.Domain `json:"domains,omitempty"`
|
2019-06-21 15:18:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// TLSOptionRef is a ref to the TLSOption resources.
|
|
|
|
type TLSOptionRef struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Namespace string `json:"namespace"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Service defines an upstream to proxy traffic.
|
|
|
|
type Service struct {
|
2019-09-13 14:46:04 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
Port int32 `json:"port"`
|
|
|
|
Scheme string `json:"scheme,omitempty"`
|
|
|
|
HealthCheck *HealthCheck `json:"healthCheck,omitempty"`
|
|
|
|
Strategy string `json:"strategy,omitempty"`
|
|
|
|
PassHostHeader *bool `json:"passHostHeader,omitempty"`
|
|
|
|
ResponseForwarding *dynamic.ResponseForwarding `json:"responseForwarding,omitempty"`
|
|
|
|
Weight *int `json:"weight,omitempty"`
|
2019-03-14 14:56:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// MiddlewareRef is a ref to the Middleware resources.
|
|
|
|
type MiddlewareRef struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Namespace string `json:"namespace"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// HealthCheck is the HealthCheck definition.
|
|
|
|
type HealthCheck struct {
|
|
|
|
Path string `json:"path"`
|
|
|
|
Host string `json:"host,omitempty"`
|
|
|
|
Scheme string `json:"scheme"`
|
|
|
|
IntervalSeconds int64 `json:"intervalSeconds"`
|
|
|
|
TimeoutSeconds int64 `json:"timeoutSeconds"`
|
|
|
|
Headers map[string]string `json:"headers"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// +genclient
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
|
|
|
|
|
|
// IngressRoute is an Ingress CRD specification.
|
|
|
|
type IngressRoute struct {
|
|
|
|
metav1.TypeMeta `json:",inline"`
|
|
|
|
metav1.ObjectMeta `json:"metadata"`
|
|
|
|
|
|
|
|
Spec IngressRouteSpec `json:"spec"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
|
|
|
|
|
|
// IngressRouteList is a list of IngressRoutes.
|
|
|
|
type IngressRouteList struct {
|
|
|
|
metav1.TypeMeta `json:",inline"`
|
|
|
|
metav1.ListMeta `json:"metadata"`
|
|
|
|
Items []IngressRoute `json:"items"`
|
|
|
|
}
|