1
0
Fork 0

Move dynamic config into a dedicated package.

This commit is contained in:
Ludovic Fernandez 2019-07-10 09:26:04 +02:00 committed by Traefiker Bot
parent 09cc1161c9
commit c8bf8e896a
102 changed files with 3170 additions and 3166 deletions

View file

@ -0,0 +1,36 @@
package dynamic
import (
"github.com/containous/traefik/pkg/tls"
)
// +k8s:deepcopy-gen=true
// Message holds configuration information exchanged between parts of traefik.
type Message struct {
ProviderName string
Configuration *Configuration
}
// +k8s:deepcopy-gen=true
// Configurations is for currentConfigurations Map.
type Configurations map[string]*Configuration
// +k8s:deepcopy-gen=true
// Configuration is the root of the dynamic configuration
type Configuration struct {
HTTP *HTTPConfiguration `json:"http,omitempty" toml:"http,omitempty" yaml:"http,omitempty"`
TCP *TCPConfiguration `json:"tcp,omitempty" toml:"tcp,omitempty" yaml:"tcp,omitempty"`
TLS *TLSConfiguration `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"`
}
// +k8s:deepcopy-gen=true
// TLSConfiguration contains all the configuration parameters of a TLS connection.
type TLSConfiguration struct {
Certificates []*tls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"`
Options map[string]tls.Options `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"`
Stores map[string]tls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"`
}

View file

@ -1,4 +1,4 @@
package config
package dynamic
import (
"reflect"

View file

@ -1,41 +1,6 @@
package config
package dynamic
import (
"reflect"
traefiktls "github.com/containous/traefik/pkg/tls"
)
// +k8s:deepcopy-gen=true
// Message holds configuration information exchanged between parts of traefik.
type Message struct {
ProviderName string
Configuration *Configuration
}
// +k8s:deepcopy-gen=true
// Configurations is for currentConfigurations Map.
type Configurations map[string]*Configuration
// +k8s:deepcopy-gen=true
// Configuration is the root of the dynamic configuration
type Configuration struct {
HTTP *HTTPConfiguration `json:"http,omitempty" toml:"http,omitempty" yaml:"http,omitempty"`
TCP *TCPConfiguration `json:"tcp,omitempty" toml:"tcp,omitempty" yaml:"tcp,omitempty"`
TLS *TLSConfiguration `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"`
}
// +k8s:deepcopy-gen=true
// TLSConfiguration contains all the configuration parameters of a TLS connection.
type TLSConfiguration struct {
Certificates []*traefiktls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"`
Options map[string]traefiktls.Options `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"`
Stores map[string]traefiktls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"`
}
import "reflect"
// +k8s:deepcopy-gen=true
@ -48,14 +13,6 @@ type HTTPConfiguration struct {
// +k8s:deepcopy-gen=true
// TCPConfiguration contains all the TCP configuration parameters.
type TCPConfiguration struct {
Routers map[string]*TCPRouter `json:"routers,omitempty" toml:"routers,omitempty" yaml:"routers,omitempty"`
Services map[string]*TCPService `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"`
}
// +k8s:deepcopy-gen=true
// Service holds a service configuration (can only be of one type at the same time).
type Service struct {
LoadBalancer *LoadBalancerService `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"`
@ -63,13 +20,6 @@ type Service struct {
// +k8s:deepcopy-gen=true
// TCPService holds a tcp service configuration (can only be of one type at the same time).
type TCPService struct {
LoadBalancer *TCPLoadBalancerService `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"`
}
// +k8s:deepcopy-gen=true
// Router holds the router configuration.
type Router struct {
EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"`
@ -89,24 +39,6 @@ type RouterTLSConfig struct {
// +k8s:deepcopy-gen=true
// TCPRouter holds the router configuration.
type TCPRouter struct {
EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"`
Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty"`
Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"`
TLS *RouterTCPTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"`
}
// +k8s:deepcopy-gen=true
// RouterTCPTLSConfig holds the TLS configuration for a router
type RouterTCPTLSConfig struct {
Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"`
Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"`
}
// +k8s:deepcopy-gen=true
// LoadBalancerService holds the LoadBalancerService configuration.
type LoadBalancerService struct {
Stickiness *Stickiness `json:"stickiness,omitempty" toml:"stickiness,omitempty" yaml:"stickiness,omitempty" label:"allowEmpty"`
@ -116,30 +48,6 @@ type LoadBalancerService struct {
ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty" toml:"responseForwarding,omitempty" yaml:"responseForwarding,omitempty"`
}
// +k8s:deepcopy-gen=true
// TCPLoadBalancerService holds the LoadBalancerService configuration.
type TCPLoadBalancerService struct {
Servers []TCPServer `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server" label-slice-as-struct:"server"`
}
// Mergeable tells if the given service is mergeable.
func (l *TCPLoadBalancerService) Mergeable(loadBalancer *TCPLoadBalancerService) bool {
savedServers := l.Servers
defer func() {
l.Servers = savedServers
}()
l.Servers = nil
savedServersLB := loadBalancer.Servers
defer func() {
loadBalancer.Servers = savedServersLB
}()
loadBalancer.Servers = nil
return reflect.DeepEqual(l, loadBalancer)
}
// Mergeable tells if the given service is mergeable.
func (l *LoadBalancerService) Mergeable(loadBalancer *LoadBalancerService) bool {
savedServers := l.Servers
@ -187,14 +95,6 @@ type Server struct {
Port string `toml:"-" json:"-" yaml:"-"`
}
// +k8s:deepcopy-gen=true
// TCPServer holds a TCP Server configuration
type TCPServer struct {
Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"`
Port string `toml:"-" json:"-" yaml:"-"`
}
// SetDefaults Default values for a Server.
func (s *Server) SetDefaults() {
s.Scheme = "http"

View file

@ -1,4 +1,4 @@
package config
package dynamic
import (
"crypto/tls"

View file

@ -1,4 +1,4 @@
package config
package dynamic
import (
"context"

View file

@ -0,0 +1,68 @@
package dynamic
import "reflect"
// +k8s:deepcopy-gen=true
// TCPConfiguration contains all the TCP configuration parameters.
type TCPConfiguration struct {
Routers map[string]*TCPRouter `json:"routers,omitempty" toml:"routers,omitempty" yaml:"routers,omitempty"`
Services map[string]*TCPService `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"`
}
// +k8s:deepcopy-gen=true
// TCPService holds a tcp service configuration (can only be of one type at the same time).
type TCPService struct {
LoadBalancer *TCPLoadBalancerService `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"`
}
// +k8s:deepcopy-gen=true
// TCPRouter holds the router configuration.
type TCPRouter struct {
EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"`
Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty"`
Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"`
TLS *RouterTCPTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"`
}
// +k8s:deepcopy-gen=true
// RouterTCPTLSConfig holds the TLS configuration for a router
type RouterTCPTLSConfig struct {
Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"`
Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"`
}
// +k8s:deepcopy-gen=true
// TCPLoadBalancerService holds the LoadBalancerService configuration.
type TCPLoadBalancerService struct {
Servers []TCPServer `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server" label-slice-as-struct:"server"`
}
// Mergeable tells if the given service is mergeable.
func (l *TCPLoadBalancerService) Mergeable(loadBalancer *TCPLoadBalancerService) bool {
savedServers := l.Servers
defer func() {
l.Servers = savedServers
}()
l.Servers = nil
savedServersLB := loadBalancer.Servers
defer func() {
loadBalancer.Servers = savedServersLB
}()
loadBalancer.Servers = nil
return reflect.DeepEqual(l, loadBalancer)
}
// +k8s:deepcopy-gen=true
// TCPServer holds a TCP Server configuration
type TCPServer struct {
Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"`
Port string `toml:"-" json:"-" yaml:"-"`
}

View file

@ -26,7 +26,7 @@ THE SOFTWARE.
// Code generated by deepcopy-gen. DO NOT EDIT.
package config
package dynamic
import (
tls "github.com/containous/traefik/pkg/tls"

View file

@ -2,15 +2,15 @@
package label
import (
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/config/dynamic"
"github.com/containous/traefik/pkg/config/parser"
)
// DecodeConfiguration converts the labels to a configuration.
func DecodeConfiguration(labels map[string]string) (*config.Configuration, error) {
conf := &config.Configuration{
HTTP: &config.HTTPConfiguration{},
TCP: &config.TCPConfiguration{},
func DecodeConfiguration(labels map[string]string) (*dynamic.Configuration, error) {
conf := &dynamic.Configuration{
HTTP: &dynamic.HTTPConfiguration{},
TCP: &dynamic.TCPConfiguration{},
}
err := parser.Decode(labels, conf, parser.DefaultRootName, "traefik.http", "traefik.tcp")
@ -22,7 +22,7 @@ func DecodeConfiguration(labels map[string]string) (*config.Configuration, error
}
// EncodeConfiguration converts a configuration to labels.
func EncodeConfiguration(conf *config.Configuration) (map[string]string, error) {
func EncodeConfiguration(conf *dynamic.Configuration) (map[string]string, error) {
return parser.Encode(conf, parser.DefaultRootName)
}

View file

@ -5,7 +5,7 @@ import (
"testing"
"time"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/config/dynamic"
"github.com/containous/traefik/pkg/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -175,9 +175,9 @@ func TestDecodeConfiguration(t *testing.T) {
configuration, err := DecodeConfiguration(labels)
require.NoError(t, err)
expected := &config.Configuration{
TCP: &config.TCPConfiguration{
Routers: map[string]*config.TCPRouter{
expected := &dynamic.Configuration{
TCP: &dynamic.TCPConfiguration{
Routers: map[string]*dynamic.TCPRouter{
"Router0": {
EntryPoints: []string{
"foobar",
@ -185,7 +185,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
Service: "foobar",
Rule: "foobar",
TLS: &config.RouterTCPTLSConfig{
TLS: &dynamic.RouterTCPTLSConfig{
Passthrough: false,
Options: "foo",
},
@ -197,16 +197,16 @@ func TestDecodeConfiguration(t *testing.T) {
},
Service: "foobar",
Rule: "foobar",
TLS: &config.RouterTCPTLSConfig{
TLS: &dynamic.RouterTCPTLSConfig{
Passthrough: false,
Options: "foo",
},
},
},
Services: map[string]*config.TCPService{
Services: map[string]*dynamic.TCPService{
"Service0": {
LoadBalancer: &config.TCPLoadBalancerService{
Servers: []config.TCPServer{
LoadBalancer: &dynamic.TCPLoadBalancerService{
Servers: []dynamic.TCPServer{
{
Port: "42",
},
@ -214,8 +214,8 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Service1": {
LoadBalancer: &config.TCPLoadBalancerService{
Servers: []config.TCPServer{
LoadBalancer: &dynamic.TCPLoadBalancerService{
Servers: []dynamic.TCPServer{
{
Port: "42",
},
@ -224,8 +224,8 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
},
HTTP: &config.HTTPConfiguration{
Routers: map[string]*config.Router{
HTTP: &dynamic.HTTPConfiguration{
Routers: map[string]*dynamic.Router{
"Router0": {
EntryPoints: []string{
"foobar",
@ -238,7 +238,7 @@ func TestDecodeConfiguration(t *testing.T) {
Service: "foobar",
Rule: "foobar",
Priority: 42,
TLS: &config.RouterTLSConfig{},
TLS: &dynamic.RouterTLSConfig{},
},
"Router1": {
EntryPoints: []string{
@ -254,14 +254,14 @@ func TestDecodeConfiguration(t *testing.T) {
Priority: 42,
},
},
Middlewares: map[string]*config.Middleware{
Middlewares: map[string]*dynamic.Middleware{
"Middleware0": {
AddPrefix: &config.AddPrefix{
AddPrefix: &dynamic.AddPrefix{
Prefix: "foobar",
},
},
"Middleware1": {
BasicAuth: &config.BasicAuth{
BasicAuth: &dynamic.BasicAuth{
Users: []string{
"foobar",
"fiibar",
@ -273,18 +273,18 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware10": {
MaxConn: &config.MaxConn{
MaxConn: &dynamic.MaxConn{
Amount: 42,
ExtractorFunc: "foobar",
},
},
"Middleware11": {
PassTLSClientCert: &config.PassTLSClientCert{
PassTLSClientCert: &dynamic.PassTLSClientCert{
PEM: true,
Info: &config.TLSClientCertificateInfo{
Info: &dynamic.TLSClientCertificateInfo{
NotAfter: true,
NotBefore: true,
Subject: &config.TLSCLientCertificateDNInfo{
Subject: &dynamic.TLSCLientCertificateDNInfo{
Country: true,
Province: true,
Locality: true,
@ -293,7 +293,7 @@ func TestDecodeConfiguration(t *testing.T) {
SerialNumber: true,
DomainComponent: true,
},
Issuer: &config.TLSCLientCertificateDNInfo{
Issuer: &dynamic.TLSCLientCertificateDNInfo{
Country: true,
Province: true,
Locality: true,
@ -307,8 +307,8 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware12": {
RateLimit: &config.RateLimit{
RateSet: map[string]*config.Rate{
RateLimit: &dynamic.RateLimit{
RateSet: map[string]*dynamic.Rate{
"Rate0": {
Period: types.Duration(42 * time.Second),
Average: 42,
@ -324,37 +324,37 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware13": {
RedirectRegex: &config.RedirectRegex{
RedirectRegex: &dynamic.RedirectRegex{
Regex: "foobar",
Replacement: "foobar",
Permanent: true,
},
},
"Middleware13b": {
RedirectScheme: &config.RedirectScheme{
RedirectScheme: &dynamic.RedirectScheme{
Scheme: "https",
Port: "80",
Permanent: true,
},
},
"Middleware14": {
ReplacePath: &config.ReplacePath{
ReplacePath: &dynamic.ReplacePath{
Path: "foobar",
},
},
"Middleware15": {
ReplacePathRegex: &config.ReplacePathRegex{
ReplacePathRegex: &dynamic.ReplacePathRegex{
Regex: "foobar",
Replacement: "foobar",
},
},
"Middleware16": {
Retry: &config.Retry{
Retry: &dynamic.Retry{
Attempts: 42,
},
},
"Middleware17": {
StripPrefix: &config.StripPrefix{
StripPrefix: &dynamic.StripPrefix{
Prefixes: []string{
"foobar",
"fiibar",
@ -362,7 +362,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware18": {
StripPrefixRegex: &config.StripPrefixRegex{
StripPrefixRegex: &dynamic.StripPrefixRegex{
Regex: []string{
"foobar",
"fiibar",
@ -370,10 +370,10 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware19": {
Compress: &config.Compress{},
Compress: &dynamic.Compress{},
},
"Middleware2": {
Buffering: &config.Buffering{
Buffering: &dynamic.Buffering{
MaxRequestBodyBytes: 42,
MemRequestBodyBytes: 42,
MaxResponseBodyBytes: 42,
@ -382,7 +382,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware3": {
Chain: &config.Chain{
Chain: &dynamic.Chain{
Middlewares: []string{
"foobar",
"fiibar",
@ -390,12 +390,12 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware4": {
CircuitBreaker: &config.CircuitBreaker{
CircuitBreaker: &dynamic.CircuitBreaker{
Expression: "foobar",
},
},
"Middleware5": {
DigestAuth: &config.DigestAuth{
DigestAuth: &dynamic.DigestAuth{
Users: []string{
"foobar",
"fiibar",
@ -407,7 +407,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware6": {
Errors: &config.ErrorPage{
Errors: &dynamic.ErrorPage{
Status: []string{
"foobar",
"fiibar",
@ -417,9 +417,9 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware7": {
ForwardAuth: &config.ForwardAuth{
ForwardAuth: &dynamic.ForwardAuth{
Address: "foobar",
TLS: &config.ClientTLS{
TLS: &dynamic.ClientTLS{
CA: "foobar",
CAOptional: true,
Cert: "foobar",
@ -434,7 +434,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware8": {
Headers: &config.Headers{
Headers: &dynamic.Headers{
CustomRequestHeaders: map[string]string{
"name0": "foobar",
"name1": "foobar",
@ -491,12 +491,12 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
"Middleware9": {
IPWhiteList: &config.IPWhiteList{
IPWhiteList: &dynamic.IPWhiteList{
SourceRange: []string{
"foobar",
"fiibar",
},
IPStrategy: &config.IPStrategy{
IPStrategy: &dynamic.IPStrategy{
Depth: 42,
ExcludedIPs: []string{
"foobar",
@ -506,21 +506,21 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
},
Services: map[string]*config.Service{
Services: map[string]*dynamic.Service{
"Service0": {
LoadBalancer: &config.LoadBalancerService{
Stickiness: &config.Stickiness{
LoadBalancer: &dynamic.LoadBalancerService{
Stickiness: &dynamic.Stickiness{
CookieName: "foobar",
SecureCookie: true,
HTTPOnlyCookie: false,
},
Servers: []config.Server{
Servers: []dynamic.Server{
{
Scheme: "foobar",
Port: "8080",
},
},
HealthCheck: &config.HealthCheck{
HealthCheck: &dynamic.HealthCheck{
Scheme: "foobar",
Path: "foobar",
Port: 42,
@ -533,20 +533,20 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
PassHostHeader: true,
ResponseForwarding: &config.ResponseForwarding{
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: "foobar",
},
},
},
"Service1": {
LoadBalancer: &config.LoadBalancerService{
Servers: []config.Server{
LoadBalancer: &dynamic.LoadBalancerService{
Servers: []dynamic.Server{
{
Scheme: "foobar",
Port: "8080",
},
},
HealthCheck: &config.HealthCheck{
HealthCheck: &dynamic.HealthCheck{
Scheme: "foobar",
Path: "foobar",
Port: 42,
@ -559,7 +559,7 @@ func TestDecodeConfiguration(t *testing.T) {
},
},
PassHostHeader: true,
ResponseForwarding: &config.ResponseForwarding{
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: "foobar",
},
},
@ -572,9 +572,9 @@ func TestDecodeConfiguration(t *testing.T) {
}
func TestEncodeConfiguration(t *testing.T) {
configuration := &config.Configuration{
TCP: &config.TCPConfiguration{
Routers: map[string]*config.TCPRouter{
configuration := &dynamic.Configuration{
TCP: &dynamic.TCPConfiguration{
Routers: map[string]*dynamic.TCPRouter{
"Router0": {
EntryPoints: []string{
"foobar",
@ -582,7 +582,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
Service: "foobar",
Rule: "foobar",
TLS: &config.RouterTCPTLSConfig{
TLS: &dynamic.RouterTCPTLSConfig{
Passthrough: false,
Options: "foo",
},
@ -594,16 +594,16 @@ func TestEncodeConfiguration(t *testing.T) {
},
Service: "foobar",
Rule: "foobar",
TLS: &config.RouterTCPTLSConfig{
TLS: &dynamic.RouterTCPTLSConfig{
Passthrough: false,
Options: "foo",
},
},
},
Services: map[string]*config.TCPService{
Services: map[string]*dynamic.TCPService{
"Service0": {
LoadBalancer: &config.TCPLoadBalancerService{
Servers: []config.TCPServer{
LoadBalancer: &dynamic.TCPLoadBalancerService{
Servers: []dynamic.TCPServer{
{
Port: "42",
},
@ -611,8 +611,8 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Service1": {
LoadBalancer: &config.TCPLoadBalancerService{
Servers: []config.TCPServer{
LoadBalancer: &dynamic.TCPLoadBalancerService{
Servers: []dynamic.TCPServer{
{
Port: "42",
},
@ -621,8 +621,8 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
},
HTTP: &config.HTTPConfiguration{
Routers: map[string]*config.Router{
HTTP: &dynamic.HTTPConfiguration{
Routers: map[string]*dynamic.Router{
"Router0": {
EntryPoints: []string{
"foobar",
@ -635,7 +635,7 @@ func TestEncodeConfiguration(t *testing.T) {
Service: "foobar",
Rule: "foobar",
Priority: 42,
TLS: &config.RouterTLSConfig{},
TLS: &dynamic.RouterTLSConfig{},
},
"Router1": {
EntryPoints: []string{
@ -651,14 +651,14 @@ func TestEncodeConfiguration(t *testing.T) {
Priority: 42,
},
},
Middlewares: map[string]*config.Middleware{
Middlewares: map[string]*dynamic.Middleware{
"Middleware0": {
AddPrefix: &config.AddPrefix{
AddPrefix: &dynamic.AddPrefix{
Prefix: "foobar",
},
},
"Middleware1": {
BasicAuth: &config.BasicAuth{
BasicAuth: &dynamic.BasicAuth{
Users: []string{
"foobar",
"fiibar",
@ -670,18 +670,18 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware10": {
MaxConn: &config.MaxConn{
MaxConn: &dynamic.MaxConn{
Amount: 42,
ExtractorFunc: "foobar",
},
},
"Middleware11": {
PassTLSClientCert: &config.PassTLSClientCert{
PassTLSClientCert: &dynamic.PassTLSClientCert{
PEM: true,
Info: &config.TLSClientCertificateInfo{
Info: &dynamic.TLSClientCertificateInfo{
NotAfter: true,
NotBefore: true,
Subject: &config.TLSCLientCertificateDNInfo{
Subject: &dynamic.TLSCLientCertificateDNInfo{
Country: true,
Province: true,
Locality: true,
@ -690,7 +690,7 @@ func TestEncodeConfiguration(t *testing.T) {
SerialNumber: true,
DomainComponent: true,
},
Issuer: &config.TLSCLientCertificateDNInfo{
Issuer: &dynamic.TLSCLientCertificateDNInfo{
Country: true,
Province: true,
Locality: true,
@ -703,8 +703,8 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware12": {
RateLimit: &config.RateLimit{
RateSet: map[string]*config.Rate{
RateLimit: &dynamic.RateLimit{
RateSet: map[string]*dynamic.Rate{
"Rate0": {
Period: types.Duration(42 * time.Nanosecond),
Average: 42,
@ -720,37 +720,37 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware13": {
RedirectRegex: &config.RedirectRegex{
RedirectRegex: &dynamic.RedirectRegex{
Regex: "foobar",
Replacement: "foobar",
Permanent: true,
},
},
"Middleware13b": {
RedirectScheme: &config.RedirectScheme{
RedirectScheme: &dynamic.RedirectScheme{
Scheme: "https",
Port: "80",
Permanent: true,
},
},
"Middleware14": {
ReplacePath: &config.ReplacePath{
ReplacePath: &dynamic.ReplacePath{
Path: "foobar",
},
},
"Middleware15": {
ReplacePathRegex: &config.ReplacePathRegex{
ReplacePathRegex: &dynamic.ReplacePathRegex{
Regex: "foobar",
Replacement: "foobar",
},
},
"Middleware16": {
Retry: &config.Retry{
Retry: &dynamic.Retry{
Attempts: 42,
},
},
"Middleware17": {
StripPrefix: &config.StripPrefix{
StripPrefix: &dynamic.StripPrefix{
Prefixes: []string{
"foobar",
"fiibar",
@ -758,7 +758,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware18": {
StripPrefixRegex: &config.StripPrefixRegex{
StripPrefixRegex: &dynamic.StripPrefixRegex{
Regex: []string{
"foobar",
"fiibar",
@ -766,10 +766,10 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware19": {
Compress: &config.Compress{},
Compress: &dynamic.Compress{},
},
"Middleware2": {
Buffering: &config.Buffering{
Buffering: &dynamic.Buffering{
MaxRequestBodyBytes: 42,
MemRequestBodyBytes: 42,
MaxResponseBodyBytes: 42,
@ -778,7 +778,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware3": {
Chain: &config.Chain{
Chain: &dynamic.Chain{
Middlewares: []string{
"foobar",
"fiibar",
@ -786,12 +786,12 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware4": {
CircuitBreaker: &config.CircuitBreaker{
CircuitBreaker: &dynamic.CircuitBreaker{
Expression: "foobar",
},
},
"Middleware5": {
DigestAuth: &config.DigestAuth{
DigestAuth: &dynamic.DigestAuth{
Users: []string{
"foobar",
"fiibar",
@ -803,7 +803,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware6": {
Errors: &config.ErrorPage{
Errors: &dynamic.ErrorPage{
Status: []string{
"foobar",
"fiibar",
@ -813,9 +813,9 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware7": {
ForwardAuth: &config.ForwardAuth{
ForwardAuth: &dynamic.ForwardAuth{
Address: "foobar",
TLS: &config.ClientTLS{
TLS: &dynamic.ClientTLS{
CA: "foobar",
CAOptional: true,
Cert: "foobar",
@ -830,7 +830,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware8": {
Headers: &config.Headers{
Headers: &dynamic.Headers{
CustomRequestHeaders: map[string]string{
"name0": "foobar",
"name1": "foobar",
@ -887,12 +887,12 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
"Middleware9": {
IPWhiteList: &config.IPWhiteList{
IPWhiteList: &dynamic.IPWhiteList{
SourceRange: []string{
"foobar",
"fiibar",
},
IPStrategy: &config.IPStrategy{
IPStrategy: &dynamic.IPStrategy{
Depth: 42,
ExcludedIPs: []string{
"foobar",
@ -902,20 +902,20 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
},
Services: map[string]*config.Service{
Services: map[string]*dynamic.Service{
"Service0": {
LoadBalancer: &config.LoadBalancerService{
Stickiness: &config.Stickiness{
LoadBalancer: &dynamic.LoadBalancerService{
Stickiness: &dynamic.Stickiness{
CookieName: "foobar",
HTTPOnlyCookie: true,
},
Servers: []config.Server{
Servers: []dynamic.Server{
{
Scheme: "foobar",
Port: "8080",
},
},
HealthCheck: &config.HealthCheck{
HealthCheck: &dynamic.HealthCheck{
Scheme: "foobar",
Path: "foobar",
Port: 42,
@ -928,20 +928,20 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
PassHostHeader: true,
ResponseForwarding: &config.ResponseForwarding{
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: "foobar",
},
},
},
"Service1": {
LoadBalancer: &config.LoadBalancerService{
Servers: []config.Server{
LoadBalancer: &dynamic.LoadBalancerService{
Servers: []dynamic.Server{
{
Scheme: "foobar",
Port: "8080",
},
},
HealthCheck: &config.HealthCheck{
HealthCheck: &dynamic.HealthCheck{
Scheme: "foobar",
Path: "foobar",
Port: 42,
@ -954,7 +954,7 @@ func TestEncodeConfiguration(t *testing.T) {
},
},
PassHostHeader: true,
ResponseForwarding: &config.ResponseForwarding{
ResponseForwarding: &dynamic.ResponseForwarding{
FlushInterval: "foobar",
},
},