1
0
Fork 0

Add TCP Servers Transports support

Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
Simon Delicata 2022-12-09 09:58:05 +01:00 committed by GitHub
parent c2dac39da1
commit 3eeea2bb2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 5956 additions and 1669 deletions

View file

@ -41,7 +41,7 @@ import (
"github.com/traefik/traefik/v2/pkg/types"
)
var updateExpected = flag.Bool("update_expected", false, "Update expected files in fixtures")
var updateExpected = flag.Bool("update_expected", true, "Update expected files in fixtures")
var fullDynConf *dynamic.Configuration
@ -370,7 +370,6 @@ func init() {
Services: map[string]*dynamic.TCPService{
"foo": {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
TerminationDelay: intPtr(42),
ProxyProtocol: &dynamic.ProxyProtocol{
Version: 42,
},
@ -379,6 +378,7 @@ func init() {
Address: "127.0.0.1:8080",
},
},
ServersTransport: "foo",
},
},
"bar": {
@ -392,6 +392,24 @@ func init() {
},
},
},
ServersTransports: map[string]*dynamic.TCPServersTransport{
"foo": {
TLS: &dynamic.TLSClientConfig{
ServerName: "foo",
InsecureSkipVerify: true,
RootCAs: []traefiktls.FileOrContent{"rootca.pem"},
Certificates: []traefiktls.Certificate{
{
CertFile: "cert.pem",
KeyFile: "key.pem",
},
},
},
DialTimeout: 42,
DialKeepAlive: 42,
TerminationDelay: 42,
},
},
}
config.UDP = &dynamic.UDPConfiguration{
Routers: map[string]*dynamic.UDPRouter{
@ -500,17 +518,6 @@ func TestDo_staticConfiguration(t *testing.T) {
SendAnonymousUsage: true,
}
config.ServersTransport = &static.ServersTransport{
InsecureSkipVerify: true,
RootCAs: []traefiktls.FileOrContent{"root.ca"},
MaxIdleConnsPerHost: 42,
ForwardingTimeouts: &static.ForwardingTimeouts{
DialTimeout: 42,
ResponseHeaderTimeout: 42,
IdleConnTimeout: 42,
},
}
config.EntryPoints = static.EntryPoints{
"foobar": {
Address: "foo Address",
@ -569,6 +576,15 @@ func TestDo_staticConfiguration(t *testing.T) {
},
}
config.TCPServersTransport = &static.TCPServersTransport{
DialTimeout: ptypes.Duration(111 * time.Second),
DialKeepAlive: ptypes.Duration(111 * time.Second),
TLS: &static.TLSClientConfig{
InsecureSkipVerify: true,
RootCAs: []traefiktls.FileOrContent{"RootCAs 1", "RootCAs 2", "RootCAs 3"},
},
}
config.Providers.File = &file.Provider{
Directory: "file Directory",
Watch: true,

View file

@ -389,7 +389,6 @@
},
"foo": {
"loadBalancer": {
"terminationDelay": 42,
"proxyProtocol": {
"version": 42
},
@ -397,6 +396,27 @@
{
"address": "xxxx"
}
],
"serversTransport": "foo"
}
}
},
"serversTransports": {
"foo": {
"dialKeepAlive": "42ns",
"dialTimeout": "42ns",
"terminationDelay": "42ns",
"tls": {
"serverName": "xxxx",
"insecureSkipVerify": true,
"rootCAs": [
"xxxx"
],
"certificates": [
{
"certFile": "xxxx",
"keyFile": "xxxx"
}
]
}
}
@ -466,4 +486,4 @@
}
}
}
}
}

View file

@ -17,6 +17,18 @@
"idleConnTimeout": "1m51s"
}
},
"tcpServersTransport": {
"dialKeepAlive": "1m51s",
"dialTimeout": "1m51s",
"tls": {
"insecureSkipVerify": true,
"rootCAs": [
"xxxx",
"xxxx",
"xxxx"
]
}
},
"entryPoints": {
"foobar": {
"address": "xxxx",

View file

@ -392,7 +392,6 @@
},
"foo": {
"loadBalancer": {
"terminationDelay": 42,
"proxyProtocol": {
"version": 42
},
@ -400,6 +399,27 @@
{
"address": "127.0.0.1:8080"
}
],
"serversTransport": "foo"
}
}
},
"serversTransports": {
"foo": {
"dialKeepAlive": "42ns",
"dialTimeout": "42ns",
"terminationDelay": "42ns",
"tls": {
"serverName": "foo",
"insecureSkipVerify": true,
"rootCAs": [
"rootca.pem"
],
"certificates": [
{
"certFile": "cert.pem",
"keyFile": "xxxx"
}
]
}
}
@ -474,4 +494,4 @@
}
}
}
}
}