Remove Deprecated Step 1
This commit is contained in:
parent
1d53077fc7
commit
8627256e74
68 changed files with 168 additions and 1695 deletions
|
@ -10,7 +10,6 @@ const (
|
|||
pathBackendHealthCheckHostname = "/healthcheck/hostname"
|
||||
pathBackendHealthCheckHeaders = "/healthcheck/headers/"
|
||||
pathBackendLoadBalancerMethod = "/loadbalancer/method"
|
||||
pathBackendLoadBalancerSticky = "/loadbalancer/sticky"
|
||||
pathBackendLoadBalancerStickiness = "/loadbalancer/stickiness"
|
||||
pathBackendLoadBalancerStickinessCookieName = "/loadbalancer/stickiness/cookiename"
|
||||
pathBackendMaxConnAmount = "/maxconn/amount"
|
||||
|
@ -28,7 +27,6 @@ const (
|
|||
pathFrontends = "/frontends/"
|
||||
pathFrontendBackend = "/backend"
|
||||
pathFrontendPriority = "/priority"
|
||||
pathFrontendPassHostHeaderDeprecated = "/passHostHeader" // Deprecated
|
||||
pathFrontendPassHostHeader = "/passhostheader"
|
||||
pathFrontendPassTLSCert = "/passtlscert"
|
||||
pathFrontendWhiteListSourceRange = "/whitelist/sourcerange"
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"github.com/BurntSushi/ty/fun"
|
||||
"github.com/abronan/valkeyrie/store"
|
||||
"github.com/containous/flaeg"
|
||||
"github.com/containous/flaeg/parse"
|
||||
"github.com/containous/traefik/log"
|
||||
"github.com/containous/traefik/provider/label"
|
||||
"github.com/containous/traefik/tls"
|
||||
|
@ -43,7 +43,7 @@ func (p *Provider) buildConfiguration() *types.Configuration {
|
|||
// Frontend functions
|
||||
"getBackendName": p.getFuncString(pathFrontendBackend, ""),
|
||||
"getPriority": p.getFuncInt(pathFrontendPriority, label.DefaultFrontendPriority),
|
||||
"getPassHostHeader": p.getPassHostHeader(),
|
||||
"getPassHostHeader": p.getFuncBool(pathFrontendPassHostHeader, label.DefaultPassHostHeader),
|
||||
"getPassTLSCert": p.getFuncBool(pathFrontendPassTLSCert, label.DefaultPassTLSCert),
|
||||
"getEntryPoints": p.getFuncList(pathFrontendEntryPoints),
|
||||
"getBasicAuth": p.getFuncList(pathFrontendBasicAuth), // Deprecated
|
||||
|
@ -56,15 +56,12 @@ func (p *Provider) buildConfiguration() *types.Configuration {
|
|||
"getWhiteList": p.getWhiteList,
|
||||
|
||||
// Backend functions
|
||||
"getServers": p.getServers,
|
||||
"getCircuitBreaker": p.getCircuitBreaker,
|
||||
"getLoadBalancer": p.getLoadBalancer,
|
||||
"getMaxConn": p.getMaxConn,
|
||||
"getHealthCheck": p.getHealthCheck,
|
||||
"getBuffering": p.getBuffering,
|
||||
"getSticky": p.getSticky, // Deprecated [breaking]
|
||||
"hasStickinessLabel": p.hasStickinessLabel, // Deprecated [breaking]
|
||||
"getStickinessCookieName": p.getStickinessCookieName, // Deprecated [breaking]
|
||||
"getServers": p.getServers,
|
||||
"getCircuitBreaker": p.getCircuitBreaker,
|
||||
"getLoadBalancer": p.getLoadBalancer,
|
||||
"getMaxConn": p.getMaxConn,
|
||||
"getHealthCheck": p.getHealthCheck,
|
||||
"getBuffering": p.getBuffering,
|
||||
}
|
||||
|
||||
configuration, err := p.GetConfiguration("templates/kv.tmpl", KvFuncMap, templateObjects)
|
||||
|
@ -81,51 +78,6 @@ func (p *Provider) buildConfiguration() *types.Configuration {
|
|||
return configuration
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
func (p *Provider) getPassHostHeader() func(rootPath string) bool {
|
||||
return func(rootPath string) bool {
|
||||
rawValue := p.get("", rootPath, pathFrontendPassHostHeader)
|
||||
|
||||
if len(rawValue) > 0 {
|
||||
value, err := strconv.ParseBool(rawValue)
|
||||
if err != nil {
|
||||
log.Errorf("Invalid value for %s %s: %s", rootPath, pathFrontendPassHostHeader, rawValue)
|
||||
return label.DefaultPassHostHeader
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
return p.getBool(label.DefaultPassHostHeader, rootPath, pathFrontendPassHostHeaderDeprecated)
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
func (p *Provider) getSticky(rootPath string) bool {
|
||||
stickyValue := p.get("", rootPath, pathBackendLoadBalancerSticky)
|
||||
if len(stickyValue) > 0 {
|
||||
log.Warnf("Deprecated configuration found: %s. Please use %s.", pathBackendLoadBalancerSticky, pathBackendLoadBalancerStickiness)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
|
||||
sticky, err := strconv.ParseBool(stickyValue)
|
||||
if err != nil {
|
||||
log.Warnf("Invalid %s value: %s.", pathBackendLoadBalancerSticky, stickyValue)
|
||||
}
|
||||
|
||||
return sticky
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
func (p *Provider) hasStickinessLabel(rootPath string) bool {
|
||||
return p.getBool(false, rootPath, pathBackendLoadBalancerStickiness)
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
func (p *Provider) getStickinessCookieName(rootPath string) string {
|
||||
return p.get("", rootPath, pathBackendLoadBalancerStickinessCookieName)
|
||||
}
|
||||
|
||||
func (p *Provider) getWhiteList(rootPath string) *types.WhiteList {
|
||||
ranges := p.getList(rootPath, pathFrontendWhiteListSourceRange)
|
||||
|
||||
|
@ -198,7 +150,7 @@ func (p *Provider) getRateLimit(rootPath string) *types.RateLimit {
|
|||
|
||||
rawPeriod := p.get("", pathLimits+pathFrontendRateLimitPeriod)
|
||||
|
||||
var period flaeg.Duration
|
||||
var period parse.Duration
|
||||
err := period.Set(rawPeriod)
|
||||
if err != nil {
|
||||
log.Errorf("Invalid %q value: %q", pathLimits+pathFrontendRateLimitPeriod, rawPeriod)
|
||||
|
@ -256,7 +208,6 @@ func (p *Provider) getHeaders(rootPath string) *types.Headers {
|
|||
func (p *Provider) getLoadBalancer(rootPath string) *types.LoadBalancer {
|
||||
lb := &types.LoadBalancer{
|
||||
Method: p.get(label.DefaultBackendLoadBalancerMethod, rootPath, pathBackendLoadBalancerMethod),
|
||||
Sticky: p.getSticky(rootPath),
|
||||
}
|
||||
|
||||
if p.getBool(false, rootPath, pathBackendLoadBalancerStickiness) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/abronan/valkeyrie/store"
|
||||
"github.com/containous/flaeg"
|
||||
"github.com/containous/flaeg/parse"
|
||||
"github.com/containous/traefik/provider/label"
|
||||
"github.com/containous/traefik/tls"
|
||||
"github.com/containous/traefik/types"
|
||||
|
@ -253,7 +253,6 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
backend("backend1",
|
||||
withPair(pathBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
|
||||
withPair(pathBackendLoadBalancerMethod, "drr"),
|
||||
withPair(pathBackendLoadBalancerSticky, "true"),
|
||||
withPair(pathBackendLoadBalancerStickiness, "true"),
|
||||
withPair(pathBackendLoadBalancerStickinessCookieName, "tomate"),
|
||||
withPair(pathBackendHealthCheckScheme, "http"),
|
||||
|
@ -362,7 +361,6 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
},
|
||||
LoadBalancer: &types.LoadBalancer{
|
||||
Method: "drr",
|
||||
Sticky: true,
|
||||
Stickiness: &types.Stickiness{
|
||||
CookieName: "tomate",
|
||||
},
|
||||
|
@ -432,12 +430,12 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
"foo": {
|
||||
Average: 6,
|
||||
Burst: 12,
|
||||
Period: flaeg.Duration(18 * time.Second),
|
||||
Period: parse.Duration(18 * time.Second),
|
||||
},
|
||||
"bar": {
|
||||
Average: 3,
|
||||
Burst: 6,
|
||||
Period: flaeg.Duration(9 * time.Second),
|
||||
Period: parse.Duration(9 * time.Second),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1244,7 +1242,7 @@ func TestProviderHasStickinessLabel(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
actual := p.hasStickinessLabel(test.rootPath)
|
||||
actual := p.getLoadBalancer(test.rootPath).Stickiness != nil
|
||||
|
||||
if actual != test.expected {
|
||||
t.Fatalf("expected %v, got %v", test.expected, actual)
|
||||
|
@ -1474,12 +1472,12 @@ func TestProviderGetRateLimit(t *testing.T) {
|
|||
"foo": {
|
||||
Average: 6,
|
||||
Burst: 12,
|
||||
Period: flaeg.Duration(18 * time.Second),
|
||||
Period: parse.Duration(18 * time.Second),
|
||||
},
|
||||
"bar": {
|
||||
Average: 3,
|
||||
Burst: 6,
|
||||
Period: flaeg.Duration(9 * time.Second),
|
||||
Period: parse.Duration(9 * time.Second),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1794,12 +1792,10 @@ func TestProviderGetLoadBalancer(t *testing.T) {
|
|||
kvPairs: filler("traefik",
|
||||
backend("foo",
|
||||
withPair(pathBackendLoadBalancerMethod, "drr"),
|
||||
withPair(pathBackendLoadBalancerSticky, "true"),
|
||||
withPair(pathBackendLoadBalancerStickiness, "true"),
|
||||
withPair(pathBackendLoadBalancerStickinessCookieName, "aubergine"))),
|
||||
expected: &types.LoadBalancer{
|
||||
Method: "drr",
|
||||
Sticky: true,
|
||||
Stickiness: &types.Stickiness{
|
||||
CookieName: "aubergine",
|
||||
},
|
||||
|
@ -1823,17 +1819,6 @@ func TestProviderGetLoadBalancer(t *testing.T) {
|
|||
Method: "drr",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "when sticky is set",
|
||||
rootPath: "traefik/backends/foo",
|
||||
kvPairs: filler("traefik",
|
||||
backend("foo",
|
||||
withPair(pathBackendLoadBalancerSticky, "true"))),
|
||||
expected: &types.LoadBalancer{
|
||||
Method: "wrr",
|
||||
Sticky: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "when stickiness is set",
|
||||
rootPath: "traefik/backends/foo",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue