Merge 'v1.7.3' into master
This commit is contained in:
commit
6dcb51a4bd
187 changed files with 26637 additions and 2091 deletions
|
@ -63,56 +63,6 @@ func TestDockerBuildConfiguration(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "when frontend basic auth",
|
||||
containers: []docker.ContainerJSON{
|
||||
containerJSON(
|
||||
name("test"),
|
||||
labels(map[string]string{
|
||||
label.TraefikFrontendAuthBasicUsers: "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/,test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
|
||||
label.TraefikFrontendAuthBasicUsersFile: ".htpasswd",
|
||||
label.TraefikFrontendAuthBasicRemoveHeader: "true",
|
||||
label.TraefikFrontendAuthBasicRealm: "myRealm",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"80/tcp": {},
|
||||
}),
|
||||
withNetwork("bridge", ipv4("127.0.0.1")),
|
||||
),
|
||||
},
|
||||
expectedFrontends: map[string]*types.Frontend{
|
||||
"frontend-Host-test-docker-localhost-0": {
|
||||
Backend: "backend-test",
|
||||
PassHostHeader: true,
|
||||
EntryPoints: []string{},
|
||||
Auth: &types.Auth{
|
||||
Basic: &types.Basic{
|
||||
RemoveHeader: true,
|
||||
Realm: "myRealm",
|
||||
Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
|
||||
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"},
|
||||
UsersFile: ".htpasswd",
|
||||
},
|
||||
},
|
||||
Routes: map[string]types.Route{
|
||||
"route-frontend-Host-test-docker-localhost-0": {
|
||||
Rule: "Host:test.docker.localhost",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedBackends: map[string]*types.Backend{
|
||||
"backend-test": {
|
||||
Servers: map[string]types.Server{
|
||||
"server-test-842895ca2aca17f6ee36ddb2f621194d": {
|
||||
URL: "http://127.0.0.1:80",
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "when pass tls client certificate",
|
||||
containers: []docker.ContainerJSON{
|
||||
|
@ -175,6 +125,55 @@ func TestDockerBuildConfiguration(t *testing.T) {
|
|||
CircuitBreaker: nil,
|
||||
},
|
||||
},
|
||||
}, {
|
||||
desc: "when frontend basic auth",
|
||||
containers: []docker.ContainerJSON{
|
||||
containerJSON(
|
||||
name("test"),
|
||||
labels(map[string]string{
|
||||
label.TraefikFrontendAuthBasicUsers: "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/,test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0",
|
||||
label.TraefikFrontendAuthBasicUsersFile: ".htpasswd",
|
||||
label.TraefikFrontendAuthBasicRemoveHeader: "true",
|
||||
label.TraefikFrontendAuthBasicRealm: "myRealm",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"80/tcp": {},
|
||||
}),
|
||||
withNetwork("bridge", ipv4("127.0.0.1")),
|
||||
),
|
||||
},
|
||||
expectedFrontends: map[string]*types.Frontend{
|
||||
"frontend-Host-test-docker-localhost-0": {
|
||||
Backend: "backend-test",
|
||||
PassHostHeader: true,
|
||||
EntryPoints: []string{},
|
||||
Auth: &types.Auth{
|
||||
Basic: &types.Basic{
|
||||
RemoveHeader: true,
|
||||
Realm: "myRealm",
|
||||
Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/",
|
||||
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"},
|
||||
UsersFile: ".htpasswd",
|
||||
},
|
||||
},
|
||||
Routes: map[string]types.Route{
|
||||
"route-frontend-Host-test-docker-localhost-0": {
|
||||
Rule: "Host:test.docker.localhost",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedBackends: map[string]*types.Backend{
|
||||
"backend-test": {
|
||||
Servers: map[string]types.Server{
|
||||
"server-test-842895ca2aca17f6ee36ddb2f621194d": {
|
||||
URL: "http://127.0.0.1:80",
|
||||
Weight: label.DefaultWeight,
|
||||
},
|
||||
},
|
||||
CircuitBreaker: nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "when frontend basic auth backward compatibility",
|
||||
|
@ -281,6 +280,7 @@ func TestDockerBuildConfiguration(t *testing.T) {
|
|||
label.TraefikFrontendAuthForwardTLSCert: "server.crt",
|
||||
label.TraefikFrontendAuthForwardTLSKey: "server.key",
|
||||
label.TraefikFrontendAuthForwardTLSInsecureSkipVerify: "true",
|
||||
label.TraefikFrontendAuthForwardAuthResponseHeaders: "X-Auth-User,X-Auth-Token",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"80/tcp": {},
|
||||
|
@ -295,8 +295,7 @@ func TestDockerBuildConfiguration(t *testing.T) {
|
|||
EntryPoints: []string{},
|
||||
Auth: &types.Auth{
|
||||
Forward: &types.Forward{
|
||||
Address: "auth.server",
|
||||
TrustForwardHeader: true,
|
||||
Address: "auth.server",
|
||||
TLS: &types.ClientTLS{
|
||||
CA: "ca.crt",
|
||||
CAOptional: true,
|
||||
|
@ -304,6 +303,8 @@ func TestDockerBuildConfiguration(t *testing.T) {
|
|||
Cert: "server.crt",
|
||||
Key: "server.key",
|
||||
},
|
||||
TrustForwardHeader: true,
|
||||
AuthResponseHeaders: []string{"X-Auth-User", "X-Auth-Token"},
|
||||
},
|
||||
},
|
||||
Routes: map[string]types.Route{
|
||||
|
@ -1398,6 +1399,31 @@ func TestDockerGetIPPort(t *testing.T) {
|
|||
ip, port string
|
||||
expectsError bool
|
||||
}{
|
||||
{
|
||||
desc: "label traefik.port not set, no binding, falling back on the container's IP/Port",
|
||||
container: containerJSON(
|
||||
ports(nat.PortMap{
|
||||
"8080/tcp": {},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
ip: "10.11.12.13",
|
||||
port: "8080",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port not set, single binding with port only, falling back on the container's IP/Port",
|
||||
container: containerJSON(
|
||||
withNetwork("testnet", ipv4("10.11.12.13")),
|
||||
ports(nat.PortMap{
|
||||
"80/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
),
|
||||
ip: "10.11.12.13",
|
||||
port: "80",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port not set, binding with ip:port should create a route to the bound ip:port",
|
||||
container: containerJSON(
|
||||
|
@ -1413,6 +1439,52 @@ func TestDockerGetIPPort(t *testing.T) {
|
|||
ip: "1.2.3.4",
|
||||
port: "8081",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, no binding, falling back on the container's IP/traefik.port",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "80",
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
ip: "10.11.12.13",
|
||||
port: "80",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, single binding with ip:port for the label, creates the route",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "443",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"443/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "5.6.7.8",
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
ip: "5.6.7.8",
|
||||
port: "8082",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, no binding on the corresponding port, falling back on the container's IP/label.port",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "80",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"443/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "5.6.7.8",
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
ip: "10.11.12.13",
|
||||
port: "80",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, multiple bindings on different ports, uses the label to select the correct (first) binding",
|
||||
container: containerJSON(
|
||||
|
@ -1461,69 +1533,6 @@ func TestDockerGetIPPort(t *testing.T) {
|
|||
ip: "5.6.7.8",
|
||||
port: "8082",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, single binding with ip:port for the label, creates the route",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "443",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"443/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "5.6.7.8",
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
ip: "5.6.7.8",
|
||||
port: "8082",
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port not set, single binding with port only, server ignored",
|
||||
container: containerJSON(
|
||||
ports(nat.PortMap{
|
||||
"80/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
expectsError: true,
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port not set, no binding, server ignored",
|
||||
container: containerJSON(
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
expectsError: true,
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, no binding on the corresponding port, server ignored",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "80",
|
||||
}),
|
||||
ports(nat.PortMap{
|
||||
"443/tcp": []nat.PortBinding{
|
||||
{
|
||||
HostIP: "5.6.7.8",
|
||||
HostPort: "8082",
|
||||
},
|
||||
},
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
expectsError: true,
|
||||
},
|
||||
{
|
||||
desc: "label traefik.port set, no binding, server ignored",
|
||||
container: containerJSON(
|
||||
labels(map[string]string{
|
||||
label.TraefikPort: "80",
|
||||
}),
|
||||
withNetwork("testnet", ipv4("10.11.12.13"))),
|
||||
expectsError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range testCases {
|
||||
|
@ -1536,7 +1545,7 @@ func TestDockerGetIPPort(t *testing.T) {
|
|||
dData.SegmentLabels = segmentProperties[""]
|
||||
|
||||
provider := &Provider{
|
||||
Network: "webnet",
|
||||
Network: "testnet",
|
||||
UseBindPortIP: true,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue