1
0
Fork 0

Add TCP Middlewares support

This commit is contained in:
Romain 2021-06-11 15:30:05 +02:00 committed by GitHub
parent 679def0151
commit fc9f41b955
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
134 changed files with 5865 additions and 1852 deletions

View file

@ -18,6 +18,8 @@ type IngressRouteTCPSpec struct {
type RouteTCP struct {
Match string `json:"match"`
Services []ServiceTCP `json:"services,omitempty"`
// Middlewares contains references to MiddlewareTCP resources.
Middlewares []ObjectReference `json:"middlewares,omitempty"`
}
// TLSTCP contains the TLS certificates configuration of the routes.
@ -34,23 +36,11 @@ type TLSTCP struct {
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,omitempty"`
Options *ObjectReference `json:"options,omitempty"`
// Store is a reference to a TLSStore, that specifies the parameters of the TLS store.
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,omitempty"`
}
// TLSStoreTCPRef is a ref to the TLSStore resources.
type TLSStoreTCPRef struct {
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
Store *ObjectReference `json:"store,omitempty"`
CertResolver string `json:"certResolver,omitempty"`
Domains []types.Domain `json:"domains,omitempty"`
}
// ServiceTCP defines an upstream to proxy traffic.

View file

@ -0,0 +1,34 @@
package v1alpha1
import (
"github.com/traefik/traefik/v2/pkg/config/dynamic"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// MiddlewareTCP is a specification for a MiddlewareTCP resource.
type MiddlewareTCP struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec MiddlewareTCPSpec `json:"spec"`
}
// +k8s:deepcopy-gen=true
// MiddlewareTCPSpec holds the MiddlewareTCP configuration.
type MiddlewareTCPSpec struct {
IPWhiteList *dynamic.TCPIPWhiteList `json:"ipWhiteList,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// MiddlewareTCPList is a list of MiddlewareTCP resources.
type MiddlewareTCPList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []MiddlewareTCP `json:"items"`
}

View file

@ -0,0 +1,7 @@
package v1alpha1
// ObjectReference is a generic reference to a Traefik resource.
type ObjectReference struct {
Name string `json:"name"`
Namespace string `json:"namespace,omitempty"`
}

View file

@ -41,6 +41,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&IngressRouteUDPList{},
&Middleware{},
&MiddlewareList{},
&MiddlewareTCP{},
&MiddlewareTCPList{},
&TLSOption{},
&TLSOptionList{},
&TLSStore{},

View file

@ -746,6 +746,87 @@ func (in *MiddlewareSpec) DeepCopy() *MiddlewareSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MiddlewareTCP) DeepCopyInto(out *MiddlewareTCP) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MiddlewareTCP.
func (in *MiddlewareTCP) DeepCopy() *MiddlewareTCP {
if in == nil {
return nil
}
out := new(MiddlewareTCP)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MiddlewareTCP) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MiddlewareTCPList) DeepCopyInto(out *MiddlewareTCPList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]MiddlewareTCP, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MiddlewareTCPList.
func (in *MiddlewareTCPList) DeepCopy() *MiddlewareTCPList {
if in == nil {
return nil
}
out := new(MiddlewareTCPList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *MiddlewareTCPList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MiddlewareTCPSpec) DeepCopyInto(out *MiddlewareTCPSpec) {
*out = *in
if in.IPWhiteList != nil {
in, out := &in.IPWhiteList, &out.IPWhiteList
*out = new(dynamic.TCPIPWhiteList)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MiddlewareTCPSpec.
func (in *MiddlewareTCPSpec) DeepCopy() *MiddlewareTCPSpec {
if in == nil {
return nil
}
out := new(MiddlewareTCPSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MirrorService) DeepCopyInto(out *MirrorService) {
*out = *in
@ -792,6 +873,22 @@ 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 *ObjectReference) DeepCopyInto(out *ObjectReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
func (in *ObjectReference) DeepCopy() *ObjectReference {
if in == nil {
return nil
}
out := new(ObjectReference)
in.DeepCopyInto(out)
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
@ -878,6 +975,11 @@ func (in *RouteTCP) DeepCopyInto(out *RouteTCP) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Middlewares != nil {
in, out := &in.Middlewares, &out.Middlewares
*out = make([]ObjectReference, len(*in))
copy(*out, *in)
}
return
}
@ -1238,22 +1340,6 @@ func (in *TLSOptionSpec) DeepCopy() *TLSOptionSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLSOptionTCPRef) DeepCopyInto(out *TLSOptionTCPRef) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSOptionTCPRef.
func (in *TLSOptionTCPRef) DeepCopy() *TLSOptionTCPRef {
if in == nil {
return nil
}
out := new(TLSOptionTCPRef)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLSOptionUDPRef) DeepCopyInto(out *TLSOptionUDPRef) {
*out = *in
@ -1363,33 +1449,17 @@ func (in *TLSStoreSpec) DeepCopy() *TLSStoreSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLSStoreTCPRef) DeepCopyInto(out *TLSStoreTCPRef) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSStoreTCPRef.
func (in *TLSStoreTCPRef) DeepCopy() *TLSStoreTCPRef {
if in == nil {
return nil
}
out := new(TLSStoreTCPRef)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLSTCP) DeepCopyInto(out *TLSTCP) {
*out = *in
if in.Options != nil {
in, out := &in.Options, &out.Options
*out = new(TLSOptionTCPRef)
*out = new(ObjectReference)
**out = **in
}
if in.Store != nil {
in, out := &in.Store, &out.Store
*out = new(TLSStoreTCPRef)
*out = new(ObjectReference)
**out = **in
}
if in.Domains != nil {