1
0
Fork 0

Upgrade the CRD version from apiextensions.k8s.io/v1beta1 to apiextensions.k8s.io/v1

Co-authored-by: kevinpollet <pollet.kevin@gmail.com>
This commit is contained in:
Jean-Baptiste Doumenjou 2021-03-03 15:32:04 +01:00 committed by GitHub
parent e658712d53
commit 992d4c1b94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 3064 additions and 221 deletions

View file

@ -10,17 +10,18 @@ import (
// IngressRouteSpec is a specification for a IngressRouteSpec resource.
type IngressRouteSpec struct {
Routes []Route `json:"routes"`
EntryPoints []string `json:"entryPoints"`
EntryPoints []string `json:"entryPoints,omitempty"`
TLS *TLS `json:"tls,omitempty"`
}
// Route contains the set of routes.
type Route struct {
Match string `json:"match"`
Match string `json:"match"`
// +kubebuilder:validation:Enum=Rule
Kind string `json:"kind"`
Priority int `json:"priority"`
Priority int `json:"priority,omitempty"`
Services []Service `json:"services,omitempty"`
Middlewares []MiddlewareRef `json:"middlewares"`
Middlewares []MiddlewareRef `json:"middlewares,omitempty"`
}
// TLS contains the TLS certificates configuration of the routes.
@ -34,7 +35,7 @@ type Route struct {
type TLS struct {
// SecretName is the name of the referenced Kubernetes Secret to specify the
// certificate details.
SecretName string `json:"secretName"`
SecretName string `json:"secretName,omitempty"`
// Options is a reference to a TLSOption, that specifies the parameters of the TLS connection.
Options *TLSOptionRef `json:"options,omitempty"`
// Store is a reference to a TLSStore, that specifies the parameters of the TLS store.
@ -46,13 +47,13 @@ type TLS struct {
// TLSOptionRef is a ref to the TLSOption resources.
type TLSOptionRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// TLSStoreRef is a ref to the TLSStore resource.
type TLSStoreRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// LoadBalancerSpec can reference either a Kubernetes Service object (a load-balancer of servers),
@ -61,14 +62,16 @@ type LoadBalancerSpec struct {
// Name is a reference to a Kubernetes Service object (for a load-balancer of servers),
// or to a TraefikService object (service load-balancer, mirroring, etc).
// The differentiation between the two is specified in the Kind field.
Name string `json:"name"`
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
// +kubebuilder:validation:Enum=Service;TraefikService
Kind string `json:"kind,omitempty"`
Namespace string `json:"namespace,omitempty"`
Sticky *dynamic.Sticky `json:"sticky,omitempty"`
// Port and all the fields below are related to a servers load-balancer,
// and therefore should only be specified when Name references a Kubernetes Service.
Port intstr.IntOrString `json:"port"`
Port intstr.IntOrString `json:"port,omitempty"`
Scheme string `json:"scheme,omitempty"`
Strategy string `json:"strategy,omitempty"`
PassHostHeader *bool `json:"passHostHeader,omitempty"`
@ -82,17 +85,18 @@ type LoadBalancerSpec struct {
// Service defines an upstream to proxy traffic.
type Service struct {
LoadBalancerSpec
LoadBalancerSpec `json:",inline"`
}
// MiddlewareRef is a ref to the Middleware resources.
type MiddlewareRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// IngressRoute is an Ingress CRD specification.
type IngressRoute struct {

View file

@ -10,7 +10,7 @@ import (
// IngressRouteTCPSpec is a specification for a IngressRouteTCPSpec resource.
type IngressRouteTCPSpec struct {
Routes []RouteTCP `json:"routes"`
EntryPoints []string `json:"entryPoints"`
EntryPoints []string `json:"entryPoints,omitempty"`
TLS *TLSTCP `json:"tls,omitempty"`
}
@ -31,32 +31,32 @@ type RouteTCP struct {
type TLSTCP struct {
// SecretName is the name of the referenced Kubernetes Secret to specify the
// certificate details.
SecretName string `json:"secretName"`
Passthrough bool `json:"passthrough"`
SecretName string `json:"secretName,omitempty"`
Passthrough bool `json:"passthrough,omitempty"`
// Options is a reference to a TLSOption, that specifies the parameters of the TLS connection.
Options *TLSOptionTCPRef `json:"options"`
Options *TLSOptionTCPRef `json:"options,omitempty"`
// Store is a reference to a TLSStore, that specifies the parameters of the TLS store.
Store *TLSStoreTCPRef `json:"store"`
CertResolver string `json:"certResolver"`
Store *TLSStoreTCPRef `json:"store,omitempty"`
CertResolver string `json:"certResolver,omitempty"`
Domains []types.Domain `json:"domains,omitempty"`
}
// TLSOptionTCPRef is a ref to the TLSOption resources.
type TLSOptionTCPRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// TLSStoreTCPRef is a ref to the TLSStore resources.
type TLSStoreTCPRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// ServiceTCP defines an upstream to proxy traffic.
type ServiceTCP struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
Port intstr.IntOrString `json:"port"`
Weight *int `json:"weight,omitempty"`
TerminationDelay *int `json:"terminationDelay,omitempty"`
@ -65,6 +65,7 @@ type ServiceTCP struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// IngressRouteTCP is an Ingress CRD specification.
type IngressRouteTCP struct {

View file

@ -8,7 +8,7 @@ import (
// IngressRouteUDPSpec is a specification for a IngressRouteUDPSpec resource.
type IngressRouteUDPSpec struct {
Routes []RouteUDP `json:"routes"`
EntryPoints []string `json:"entryPoints"`
EntryPoints []string `json:"entryPoints,omitempty"`
}
// RouteUDP contains the set of routes.
@ -19,19 +19,20 @@ type RouteUDP struct {
// TLSOptionUDPRef is a ref to the TLSOption resources.
type TLSOptionUDPRef struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
}
// ServiceUDP defines an upstream to proxy traffic.
type ServiceUDP struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Namespace string `json:"namespace,omitempty"`
Port intstr.IntOrString `json:"port"`
Weight *int `json:"weight,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// IngressRouteUDP is an Ingress CRD specification.
type IngressRouteUDP struct {

View file

@ -2,11 +2,14 @@ package v1alpha1
import (
"github.com/traefik/traefik/v2/pkg/config/dynamic"
apiextensionv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// Middleware is a specification for a Middleware resource.
type Middleware struct {
@ -20,29 +23,29 @@ type Middleware struct {
// MiddlewareSpec holds the Middleware configuration.
type MiddlewareSpec struct {
AddPrefix *dynamic.AddPrefix `json:"addPrefix,omitempty"`
StripPrefix *dynamic.StripPrefix `json:"stripPrefix,omitempty"`
StripPrefixRegex *dynamic.StripPrefixRegex `json:"stripPrefixRegex,omitempty"`
ReplacePath *dynamic.ReplacePath `json:"replacePath,omitempty"`
ReplacePathRegex *dynamic.ReplacePathRegex `json:"replacePathRegex,omitempty"`
Chain *Chain `json:"chain,omitempty"`
IPWhiteList *dynamic.IPWhiteList `json:"ipWhiteList,omitempty"`
Headers *dynamic.Headers `json:"headers,omitempty"`
Errors *ErrorPage `json:"errors,omitempty"`
RateLimit *dynamic.RateLimit `json:"rateLimit,omitempty"`
RedirectRegex *dynamic.RedirectRegex `json:"redirectRegex,omitempty"`
RedirectScheme *dynamic.RedirectScheme `json:"redirectScheme,omitempty"`
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
DigestAuth *DigestAuth `json:"digestAuth,omitempty"`
ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty"`
InFlightReq *dynamic.InFlightReq `json:"inFlightReq,omitempty"`
Buffering *dynamic.Buffering `json:"buffering,omitempty"`
CircuitBreaker *dynamic.CircuitBreaker `json:"circuitBreaker,omitempty"`
Compress *dynamic.Compress `json:"compress,omitempty"`
PassTLSClientCert *dynamic.PassTLSClientCert `json:"passTLSClientCert,omitempty"`
Retry *dynamic.Retry `json:"retry,omitempty"`
ContentType *dynamic.ContentType `json:"contentType,omitempty"`
Plugin map[string]dynamic.PluginConf `json:"plugin,omitempty"`
AddPrefix *dynamic.AddPrefix `json:"addPrefix,omitempty"`
StripPrefix *dynamic.StripPrefix `json:"stripPrefix,omitempty"`
StripPrefixRegex *dynamic.StripPrefixRegex `json:"stripPrefixRegex,omitempty"`
ReplacePath *dynamic.ReplacePath `json:"replacePath,omitempty"`
ReplacePathRegex *dynamic.ReplacePathRegex `json:"replacePathRegex,omitempty"`
Chain *Chain `json:"chain,omitempty"`
IPWhiteList *dynamic.IPWhiteList `json:"ipWhiteList,omitempty"`
Headers *dynamic.Headers `json:"headers,omitempty"`
Errors *ErrorPage `json:"errors,omitempty"`
RateLimit *RateLimit `json:"rateLimit,omitempty"`
RedirectRegex *dynamic.RedirectRegex `json:"redirectRegex,omitempty"`
RedirectScheme *dynamic.RedirectScheme `json:"redirectScheme,omitempty"`
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
DigestAuth *DigestAuth `json:"digestAuth,omitempty"`
ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty"`
InFlightReq *dynamic.InFlightReq `json:"inFlightReq,omitempty"`
Buffering *dynamic.Buffering `json:"buffering,omitempty"`
CircuitBreaker *dynamic.CircuitBreaker `json:"circuitBreaker,omitempty"`
Compress *dynamic.Compress `json:"compress,omitempty"`
PassTLSClientCert *dynamic.PassTLSClientCert `json:"passTLSClientCert,omitempty"`
Retry *Retry `json:"retry,omitempty"`
ContentType *dynamic.ContentType `json:"contentType,omitempty"`
Plugin map[string]apiextensionv1.JSON `json:"plugin,omitempty"`
}
// +k8s:deepcopy-gen=true
@ -110,3 +113,21 @@ type MiddlewareList struct {
Items []Middleware `json:"items"`
}
// +k8s:deepcopy-gen=true
// RateLimit holds the rate limiting configuration for a given router.
type RateLimit struct {
Average int64 `json:"average,omitempty"`
Period *intstr.IntOrString `json:"period,omitempty"`
Burst *int64 `json:"burst,omitempty"`
SourceCriterion *dynamic.SourceCriterion `json:"sourceCriterion,omitempty"`
}
// +k8s:deepcopy-gen=true
// Retry holds the retry configuration.
type Retry struct {
Attempts int `json:"attempts,omitempty"`
InitialInterval intstr.IntOrString `json:"initialInterval,omitempty"`
}

View file

@ -7,6 +7,7 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// ServersTransport is a specification for a ServersTransport resource.
type ServersTransport struct {
@ -20,21 +21,31 @@ type ServersTransport struct {
// ServersTransportSpec options to configure communication between Traefik and the servers.
type ServersTransportSpec struct {
ServerName string `description:"ServerName used to contact the server" json:"serverName,omitempty" toml:"serverName,omitempty" yaml:"serverName,omitempty" export:"true"`
InsecureSkipVerify bool `description:"Disable SSL certificate verification." json:"insecureSkipVerify,omitempty" toml:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty" export:"true"`
RootCAsSecrets []string `description:"Add cert file for self-signed certificate." json:"rootCAsSecrets,omitempty" toml:"rootCAsSecrets,omitempty" yaml:"rootCAsSecrets,omitempty"`
CertificatesSecrets []string `description:"Certificates for mTLS." json:"certificatesSecrets,omitempty" toml:"certificatesSecrets,omitempty" yaml:"certificatesSecrets,omitempty"`
MaxIdleConnsPerHost int `description:"If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used" json:"maxIdleConnsPerHost,omitempty" toml:"maxIdleConnsPerHost,omitempty" yaml:"maxIdleConnsPerHost,omitempty" export:"true"`
ForwardingTimeouts *ForwardingTimeouts `description:"Timeouts for requests forwarded to the backend servers." json:"forwardingTimeouts,omitempty" toml:"forwardingTimeouts,omitempty" yaml:"forwardingTimeouts,omitempty" export:"true"`
// ServerName used to contact the server.
ServerName string `json:"serverName,omitempty"`
// Disable SSL certificate verification.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
// Add cert file for self-signed certificate.
RootCAsSecrets []string `json:"rootCAsSecrets,omitempty"`
// Certificates for mTLS.
CertificatesSecrets []string `json:"certificatesSecrets,omitempty"`
// If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used.
MaxIdleConnsPerHost int `json:"maxIdleConnsPerHost,omitempty"`
// Timeouts for requests forwarded to the backend servers.
ForwardingTimeouts *ForwardingTimeouts `json:"forwardingTimeouts,omitempty"`
}
// +k8s:deepcopy-gen=true
// ForwardingTimeouts contains timeout configurations for forwarding requests to the backend servers.
type ForwardingTimeouts struct {
DialTimeout *intstr.IntOrString `description:"The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists." json:"dialTimeout,omitempty" toml:"dialTimeout,omitempty" yaml:"dialTimeout,omitempty" export:"true"`
ResponseHeaderTimeout *intstr.IntOrString `description:"The amount of time to wait for a server's response headers after fully writing the request (including its body, if any). If zero, no timeout exists." json:"responseHeaderTimeout,omitempty" toml:"responseHeaderTimeout,omitempty" yaml:"responseHeaderTimeout,omitempty" export:"true"`
IdleConnTimeout *intstr.IntOrString `description:"The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself" json:"idleConnTimeout,omitempty" toml:"idleConnTimeout,omitempty" yaml:"idleConnTimeout,omitempty" export:"true"`
// The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists.
DialTimeout *intstr.IntOrString `json:"dialTimeout,omitempty"`
// The amount of time to wait for a server's response headers after fully writing the request (including its body, if any).
// If zero, no timeout exists.
ResponseHeaderTimeout *intstr.IntOrString `json:"responseHeaderTimeout,omitempty"`
// The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself.
IdleConnTimeout *intstr.IntOrString `json:"idleConnTimeout,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View file

@ -7,6 +7,7 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// TraefikService is the specification for a service (that an IngressRoute refers
// to) that is usually not a terminal service (i.e. not a pod of servers), as
@ -43,8 +44,9 @@ type ServiceSpec struct {
// Mirroring defines a mirroring service, which is composed of a main
// load-balancer, and a list of mirrors.
type Mirroring struct {
LoadBalancerSpec
MaxBodySize *int64
LoadBalancerSpec `json:",inline"`
MaxBodySize *int64 `json:"maxBodySize,omitempty"`
Mirrors []MirrorService `json:"mirrors,omitempty"`
}
@ -52,7 +54,8 @@ type Mirroring struct {
// MirrorService defines one of the mirrors of a Mirroring service.
type MirrorService struct {
LoadBalancerSpec
LoadBalancerSpec `json:",inline"`
Percent int `json:"percent,omitempty"`
}

View file

@ -6,6 +6,7 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// TLSOption is a specification for a TLSOption resource.
type TLSOption struct {
@ -32,12 +33,11 @@ type TLSOptionSpec struct {
// ClientAuth defines the parameters of the client authentication part of the TLS connection, if any.
type ClientAuth struct {
// SecretName is the name of the referenced Kubernetes Secret to specify the
// certificate details.
SecretNames []string `json:"secretNames"`
// SecretName is the name of the referenced Kubernetes Secret to specify the certificate details.
SecretNames []string `json:"secretNames,omitempty"`
// +kubebuilder:validation:Enum=NoClientCert;RequestClientCert;VerifyClientCertIfGiven;RequireAndVerifyClientCert
// ClientAuthType defines the client authentication type to apply.
// The available values are: "NoClientCert", "RequestClientCert", "VerifyClientCertIfGiven" and "RequireAndVerifyClientCert".
ClientAuthType string `json:"clientAuthType"`
ClientAuthType string `json:"clientAuthType,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View file

@ -6,6 +6,7 @@ import (
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:storageversion
// TLSStore is a specification for a TLSStore resource.
type TLSStore struct {
@ -26,9 +27,8 @@ type TLSStoreSpec struct {
// DefaultCertificate holds a secret name for the TLSOption resource.
type DefaultCertificate struct {
// SecretName is the name of the referenced Kubernetes Secret to specify the
// certificate details.
SecretName string `json:"secretName,omitempty"`
// SecretName is the name of the referenced Kubernetes Secret to specify the certificate details.
SecretName string `json:"secretName"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View file

@ -31,6 +31,7 @@ package v1alpha1
import (
dynamic "github.com/traefik/traefik/v2/pkg/config/dynamic"
types "github.com/traefik/traefik/v2/pkg/types"
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
intstr "k8s.io/apimachinery/pkg/util/intstr"
)
@ -662,7 +663,7 @@ func (in *MiddlewareSpec) DeepCopyInto(out *MiddlewareSpec) {
}
if in.RateLimit != nil {
in, out := &in.RateLimit, &out.RateLimit
*out = new(dynamic.RateLimit)
*out = new(RateLimit)
(*in).DeepCopyInto(*out)
}
if in.RedirectRegex != nil {
@ -717,7 +718,7 @@ func (in *MiddlewareSpec) DeepCopyInto(out *MiddlewareSpec) {
}
if in.Retry != nil {
in, out := &in.Retry, &out.Retry
*out = new(dynamic.Retry)
*out = new(Retry)
**out = **in
}
if in.ContentType != nil {
@ -727,7 +728,7 @@ func (in *MiddlewareSpec) DeepCopyInto(out *MiddlewareSpec) {
}
if in.Plugin != nil {
in, out := &in.Plugin, &out.Plugin
*out = make(map[string]dynamic.PluginConf, len(*in))
*out = make(map[string]v1.JSON, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
@ -791,6 +792,54 @@ func (in *Mirroring) DeepCopy() *Mirroring {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RateLimit) DeepCopyInto(out *RateLimit) {
*out = *in
if in.Period != nil {
in, out := &in.Period, &out.Period
*out = new(intstr.IntOrString)
**out = **in
}
if in.Burst != nil {
in, out := &in.Burst, &out.Burst
*out = new(int64)
**out = **in
}
if in.SourceCriterion != nil {
in, out := &in.SourceCriterion, &out.SourceCriterion
*out = new(dynamic.SourceCriterion)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RateLimit.
func (in *RateLimit) DeepCopy() *RateLimit {
if in == nil {
return nil
}
out := new(RateLimit)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Retry) DeepCopyInto(out *Retry) {
*out = *in
out.InitialInterval = in.InitialInterval
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Retry.
func (in *Retry) DeepCopy() *Retry {
if in == nil {
return nil
}
out := new(Retry)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Route) DeepCopyInto(out *Route) {
*out = *in