Merge tag 'v1.7.4' into master
This commit is contained in:
commit
d3ae88f108
154 changed files with 4356 additions and 1285 deletions
|
|
@ -34,6 +34,7 @@ func (p *Provider) buildConfiguration(catalog []catalogUpdate) *types.Configurat
|
|||
"getMaxConn": label.GetMaxConn,
|
||||
"getHealthCheck": label.GetHealthCheck,
|
||||
"getBuffering": label.GetBuffering,
|
||||
"getResponseForwarding": label.GetResponseForwarding,
|
||||
"getServer": p.getServer,
|
||||
|
||||
// Frontend functions
|
||||
|
|
@ -111,7 +112,7 @@ func (p *Provider) getFrontendRule(service serviceUpdate) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
return buffer.String()
|
||||
return strings.TrimSuffix(buffer.String(), ".")
|
||||
}
|
||||
|
||||
func (p *Provider) getServer(node *api.ServiceEntry) types.Server {
|
||||
|
|
|
|||
|
|
@ -408,6 +408,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
label.TraefikBackend + "=foobar",
|
||||
|
||||
label.TraefikBackendCircuitBreakerExpression + "=NetworkErrorRatio() > 0.5",
|
||||
label.TraefikBackendResponseForwardingFlushInterval + "=10ms",
|
||||
label.TraefikBackendHealthCheckPath + "=/health",
|
||||
label.TraefikBackendHealthCheckScheme + "=http",
|
||||
label.TraefikBackendHealthCheckPort + "=880",
|
||||
|
|
@ -680,6 +681,9 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
CircuitBreaker: &types.CircuitBreaker{
|
||||
Expression: "NetworkErrorRatio() > 0.5",
|
||||
},
|
||||
ResponseForwarding: &types.ResponseForwarding{
|
||||
FlushInterval: "10ms",
|
||||
},
|
||||
LoadBalancer: &types.LoadBalancer{
|
||||
Method: "drr",
|
||||
Stickiness: &types.Stickiness{
|
||||
|
|
@ -1036,6 +1040,7 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
testCases := []struct {
|
||||
desc string
|
||||
service serviceUpdate
|
||||
domain string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
|
|
@ -1044,8 +1049,18 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
ServiceName: "foo",
|
||||
Attributes: []string{},
|
||||
},
|
||||
domain: "localhost",
|
||||
expected: "Host:foo.localhost",
|
||||
},
|
||||
{
|
||||
desc: "When no domain should return default host foo",
|
||||
service: serviceUpdate{
|
||||
ServiceName: "foo",
|
||||
Attributes: []string{},
|
||||
},
|
||||
domain: "",
|
||||
expected: "Host:foo",
|
||||
},
|
||||
{
|
||||
desc: "Should return host *.example.com",
|
||||
service: serviceUpdate{
|
||||
|
|
@ -1054,6 +1069,7 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
"traefik.frontend.rule=Host:*.example.com",
|
||||
},
|
||||
},
|
||||
domain: "localhost",
|
||||
expected: "Host:*.example.com",
|
||||
},
|
||||
{
|
||||
|
|
@ -1064,6 +1080,7 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
"traefik.frontend.rule=Host:{{.ServiceName}}.example.com",
|
||||
},
|
||||
},
|
||||
domain: "localhost",
|
||||
expected: "Host:foo.example.com",
|
||||
},
|
||||
{
|
||||
|
|
@ -1075,6 +1092,7 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
"contextPath=/bar",
|
||||
},
|
||||
},
|
||||
domain: "localhost",
|
||||
expected: "PathPrefix:/bar",
|
||||
},
|
||||
}
|
||||
|
|
@ -1085,7 +1103,7 @@ func TestProviderGetFrontendRule(t *testing.T) {
|
|||
t.Parallel()
|
||||
|
||||
p := &Provider{
|
||||
Domain: "localhost",
|
||||
Domain: test.domain,
|
||||
Prefix: "traefik",
|
||||
FrontEndRule: "Host:{{.ServiceName}}.{{.Domain}}",
|
||||
frontEndRuleTemplate: template.New("consul catalog frontend rule"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue