Override health check scheme
This commit is contained in:
parent
b7d20496f3
commit
df11e67bb4
33 changed files with 194 additions and 104 deletions
|
@ -3,6 +3,7 @@ package kv
|
|||
const (
|
||||
pathBackends = "/backends/"
|
||||
pathBackendCircuitBreakerExpression = "/circuitbreaker/expression"
|
||||
pathBackendHealthCheckScheme = "/healthcheck/scheme"
|
||||
pathBackendHealthCheckPath = "/healthcheck/path"
|
||||
pathBackendHealthCheckPort = "/healthcheck/port"
|
||||
pathBackendHealthCheckInterval = "/healthcheck/interval"
|
||||
|
|
|
@ -301,17 +301,19 @@ func (p *Provider) getHealthCheck(rootPath string) *types.HealthCheck {
|
|||
return nil
|
||||
}
|
||||
|
||||
scheme := p.get("", rootPath, pathBackendHealthCheckScheme)
|
||||
port := p.getInt(label.DefaultBackendHealthCheckPort, rootPath, pathBackendHealthCheckPort)
|
||||
interval := p.get("30s", rootPath, pathBackendHealthCheckInterval)
|
||||
hostname := p.get("", rootPath, pathBackendHealthCheckHostname)
|
||||
headers := p.getMap(rootPath, pathBackendHealthCheckHeaders)
|
||||
|
||||
return &types.HealthCheck{
|
||||
Hostname: hostname,
|
||||
Headers: headers,
|
||||
Scheme: scheme,
|
||||
Path: path,
|
||||
Port: port,
|
||||
Interval: interval,
|
||||
Hostname: hostname,
|
||||
Headers: headers,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,9 +71,13 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
withPair(pathBackendLoadBalancerSticky, "true"),
|
||||
withPair(pathBackendLoadBalancerStickiness, "true"),
|
||||
withPair(pathBackendLoadBalancerStickinessCookieName, "tomate"),
|
||||
withPair(pathBackendHealthCheckScheme, "http"),
|
||||
withPair(pathBackendHealthCheckPath, "/health"),
|
||||
withPair(pathBackendHealthCheckPort, "80"),
|
||||
withPair(pathBackendHealthCheckInterval, "30s"),
|
||||
withPair(pathBackendHealthCheckHostname, "foo.com"),
|
||||
withPair(pathBackendHealthCheckHeaders+"Foo", "bar"),
|
||||
withPair(pathBackendHealthCheckHeaders+"Bar", "foo"),
|
||||
withPair(pathBackendMaxConnAmount, "5"),
|
||||
withPair(pathBackendMaxConnExtractorFunc, "client.ip"),
|
||||
withPair(pathBackendBufferingMaxResponseBodyBytes, "10485760"),
|
||||
|
@ -167,9 +171,15 @@ func TestProviderBuildConfiguration(t *testing.T) {
|
|||
ExtractorFunc: "client.ip",
|
||||
},
|
||||
HealthCheck: &types.HealthCheck{
|
||||
Scheme: "http",
|
||||
Path: "/health",
|
||||
Port: 80,
|
||||
Interval: "30s",
|
||||
Hostname: "foo.com",
|
||||
Headers: map[string]string{
|
||||
"Foo": "bar",
|
||||
"Bar": "foo",
|
||||
},
|
||||
},
|
||||
Buffering: &types.Buffering{
|
||||
MaxResponseBodyBytes: 10485760,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue