Merge branch v2.11 into v3.7

Assisted-by: Claude Fable 5.1
This commit is contained in:
Julien Salleyron committed 2026-10-21 16:37:28 +02:00
commit 7fdde68e1a
49 files changed
+603 -820

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ on:
- '*'
env:
GOLANGCI_LINT_VERSION: v2.13.2
GOLANGCI_LINT_VERSION: v2.14.0
MISSPELL_VERSION: v0.7.0
permissions:
+1 -1
View File
@@ -1 +1 @@
1.26
1.27
+13 -15
View File
@@ -18,21 +18,19 @@ type TraefikCmdConfiguration struct {
// NewTraefikConfiguration creates a TraefikCmdConfiguration with default values.
func NewTraefikConfiguration() *TraefikCmdConfiguration {
return &TraefikCmdConfiguration{
Configuration: static.Configuration{
Global: &static.Global{
CheckNewVersion: true,
},
EntryPoints: make(static.EntryPoints),
Providers: &static.Providers{
ProvidersThrottleDuration: ptypes.Duration(2 * time.Second),
},
ServersTransport: &static.ServersTransport{
MaxIdleConnsPerHost: 200,
},
TCPServersTransport: &static.TCPServersTransport{
DialTimeout: ptypes.Duration(30 * time.Second),
DialKeepAlive: ptypes.Duration(15 * time.Second),
},
Global: &static.Global{
CheckNewVersion: true,
},
EntryPoints: make(static.EntryPoints),
Providers: &static.Providers{
ProvidersThrottleDuration: ptypes.Duration(2 * time.Second),
},
ServersTransport: &static.ServersTransport{
MaxIdleConnsPerHost: 200,
},
TCPServersTransport: &static.TCPServersTransport{
DialTimeout: ptypes.Duration(30 * time.Second),
DialKeepAlive: ptypes.Duration(15 * time.Second),
},
ConfigFile: "",
}
+31
View File
@@ -9,6 +9,37 @@ This guide provides detailed migration steps for upgrading between different Tra
---
## v3.7.17
Starting with `v3.7.17`, Traefik is built with Go 1.27.
### GODEBUG TLS Settings
Go 1.27 removed the `tlsrsakex`, `tls10server` and `tls3des` `GODEBUG` settings.
Setting them in the `GODEBUG` environment variable has no effect anymore.
For the incoming connections, the RSA key exchange and 3DES cipher suites, as well as TLS 1.0 and 1.1,
can still be enabled with the `cipherSuites` and `minVersion` fields of the [TLS options](../reference/routing-configuration/http/tls/tls-options.md),
referenced in the TLS configuration of a [router](../reference/routing-configuration/http/routing/router.md) or of an [entrypoint](../reference/install-configuration/entrypoints.md#opt-http-tls-options).
For the connections to the backends, they can still be enabled with the `cipherSuites` and `minVersion` fields of the [ServersTransport](../reference/routing-configuration/http/load-balancing/serverstransport.md#opt-cipherSuites).
Please check out the [go documentation](https://go.dev/doc/go1.27#cryptotlspkgcryptotls) for more details.
### Maximum Number of Request Header Values
Go 1.27 limits the number of header values a request can carry to 500.
A request exceeding this limit is rejected with a `431 Request Header Fields Too Large` response,
for HTTP/1 and HTTP/2.
This limit can be changed with the new [`maxHeaderValueCount`](../reference/install-configuration/entrypoints.md#opt-http-maxHeaderValueCount) entry point option.
As the rejection happens before the routing, the rejected requests are not reported in the access logs.
Please check out the [go documentation](https://go.dev/doc/go1.27#nethttppkgnethttp) for more details.
---
## v3.7.16
### Kubernetes CRD and Ingress-NGINX Providers: Secret references in middlewares
@@ -101,6 +101,7 @@ THIS FILE MUST NOT BE EDITED BY HAND
| <a id="opt-entrypoints-name-http-encodedcharacters-allowencodedslash" href="#opt-entrypoints-name-http-encodedcharacters-allowencodedslash" title="#opt-entrypoints-name-http-encodedcharacters-allowencodedslash">entrypoints._name_.http.encodedcharacters.allowencodedslash</a> | Defines whether requests with encoded slash characters in the path are allowed. | true |
| <a id="opt-entrypoints-name-http-encodequerysemicolons" href="#opt-entrypoints-name-http-encodequerysemicolons" title="#opt-entrypoints-name-http-encodequerysemicolons">entrypoints._name_.http.encodequerysemicolons</a> | Defines whether request query semicolons should be URLEncoded. | false |
| <a id="opt-entrypoints-name-http-maxheaderbytes" href="#opt-entrypoints-name-http-maxheaderbytes" title="#opt-entrypoints-name-http-maxheaderbytes">entrypoints._name_.http.maxheaderbytes</a> | Maximum size of request headers in bytes. | 1048576 |
| <a id="opt-entrypoints-name-http-maxheadervaluecount" href="#opt-entrypoints-name-http-maxheadervaluecount" title="#opt-entrypoints-name-http-maxheadervaluecount">entrypoints._name_.http.maxheadervaluecount</a> | Maximum number of request header values. | 500 |
| <a id="opt-entrypoints-name-http-middlewares" href="#opt-entrypoints-name-http-middlewares" title="#opt-entrypoints-name-http-middlewares">entrypoints._name_.http.middlewares</a> | Default middlewares for the routers linked to the entry point. | |
| <a id="opt-entrypoints-name-http-redirections-entrypoint-permanent" href="#opt-entrypoints-name-http-redirections-entrypoint-permanent" title="#opt-entrypoints-name-http-redirections-entrypoint-permanent">entrypoints._name_.http.redirections.entrypoint.permanent</a> | Applies a permanent redirection. | true |
| <a id="opt-entrypoints-name-http-redirections-entrypoint-priority" href="#opt-entrypoints-name-http-redirections-entrypoint-priority" title="#opt-entrypoints-name-http-redirections-entrypoint-priority">entrypoints._name_.http.redirections.entrypoint.priority</a> | Priority of the generated router. | 9223372036854775806 |
@@ -108,6 +108,7 @@ additionalArguments:
| <a id="opt-http-aliasHeadersStrategy" href="#opt-http-aliasHeadersStrategy" title="#opt-http-aliasHeadersStrategy">`http.aliasHeadersStrategy`</a> | Defines the strategy to handle the requests carrying a header whose name aliases another header name (keep, delete, and reject).<br /> More information [here](#aliasheadersstrategy). | keep | No |
| <a id="opt-http-sanitizePath" href="#opt-http-sanitizePath" title="#opt-http-sanitizePath">`http.sanitizePath`</a> | Defines whether to enable the request path sanitization.<br /> More information [here](#sanitizepath). | true | No |
| <a id="opt-http-maxHeaderBytes" href="#opt-http-maxHeaderBytes" title="#opt-http-maxHeaderBytes">`http.maxHeaderBytes`</a> | Set the maximum size of request headers in bytes. | 1048576 | No |
| <a id="opt-http-maxHeaderValueCount" href="#opt-http-maxHeaderValueCount" title="#opt-http-maxHeaderValueCount">`http.maxHeaderValueCount`</a> | Set the maximum number of request header values Traefik reads for each request. A request exceeding this limit is rejected with a `431 Request Header Fields Too Large` status. <br /> Comma-separated values in a single header line count as one value, while values sent on multiple header lines count once per line. <br /> This option applies to HTTP/1 and HTTP/2 only; it has no effect on HTTP/3 requests. | 500 | No |
| <a id="opt-http-middlewares" href="#opt-http-middlewares" title="#opt-http-middlewares">`http.middlewares`</a> | Set the list of middlewares that are prepended by default to the list of middlewares of each router associated to the named entry point. <br />More information [here](#httpmiddlewares). | - | No |
| <a id="opt-http-tls" href="#opt-http-tls" title="#opt-http-tls">`http.tls`</a> | Enable TLS on every router attached to the `entryPoint`. <br /> If no certificate are set, a default self-signed certificate is generated by Traefik. <br /> We recommend to not use self signed certificates in production. | - | No |
| <a id="opt-http-tls-options" href="#opt-http-tls-options" title="#opt-http-tls-options">`http.tls.options`</a> | Apply TLS options on every router attached to the `entryPoint`. <br /> These options apply only while the router does not define its own `tls` section. <br /> Defining a router `tls` section (even empty, or with any field such as `certResolver`) replaces the entrypoint TLS configuration for that router (no merge). <br /> More information in the [dedicated section](../../reference/routing-configuration/http/tls/tls-options.md) and [HTTP TLS overview](../../reference/routing-configuration/http/tls/overview.md). | - | No |
@@ -58,6 +58,7 @@
encodeQuerySemicolons = true
sanitizePath = true
maxHeaderBytes = 42
maxHeaderValueCount = 42
aliasHeadersStrategy = "foobar"
underscoreHeadersStrategy = "foobar"
[entryPoints.EntryPoint0.http.redirections]
@@ -96,6 +96,7 @@ entryPoints:
encodeQuerySemicolons: true
sanitizePath: true
maxHeaderBytes: 42
maxHeaderValueCount: 42
aliasHeadersStrategy: foobar
underscoreHeadersStrategy: foobar
http2:
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/traefik/traefik/v3
go 1.26.0
go 1.27.0
require (
github.com/BurntSushi/toml v1.6.0
@@ -0,0 +1,25 @@
[global]
checkNewVersion = false
sendAnonymousUsage = false
[entryPoints]
[entryPoints.web]
address = ":8000"
[entryPoints.web.http]
maxHeaderValueCount = 10
[providers.file]
filename = "{{ .SelfFilename }}"
## dynamic configuration ##
[http.routers]
[http.routers.test-router]
entryPoints = ["web"]
service = "test-service"
rule = "Host(`127.0.0.1`)"
[http.services]
[http.services.test-service]
[[http.services.test-service.loadBalancer.servers]]
url = "{{ .TestServer }}"
+2 -4
View File
@@ -1468,10 +1468,8 @@ func (s *HTTPSSuite) modifyCertificateConfFileContent(certFileName, confFileName
TLS: &dynamic.TLSConfiguration{
Certificates: []*traefiktls.CertAndStores{
{
Certificate: traefiktls.Certificate{
CertFile: types.FileOrContent("fixtures/https/" + certFileName + ".cert"),
KeyFile: types.FileOrContent("fixtures/https/" + certFileName + ".key"),
},
CertFile: types.FileOrContent("fixtures/https/" + certFileName + ".cert"),
KeyFile: types.FileOrContent("fixtures/https/" + certFileName + ".key"),
},
},
},
+45
View File
@@ -14,6 +14,7 @@ import (
"net/http/httptest"
"os"
"regexp"
"strconv"
"strings"
"sync/atomic"
"syscall"
@@ -2438,6 +2439,50 @@ func (s *SimpleSuite) TestAllowACMEByPassRedirect() {
assert.Equal(s.T(), http.StatusMovedPermanently, resp.StatusCode)
}
func (s *SimpleSuite) TestMaxHeaderValueCount() {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
defer ts.Close()
file := s.adaptFile("fixtures/simple_max_header_value_count.toml", struct {
TestServer string
}{ts.URL})
s.traefikCmd(withConfigFile(file))
testCases := []struct {
name string
headerCount int
expectedStatus int
}{
{
name: "5 headers",
headerCount: 5,
expectedStatus: http.StatusOK,
},
{
name: "20 headers",
headerCount: 20,
expectedStatus: http.StatusRequestHeaderFieldsTooLarge,
},
}
for _, test := range testCases {
s.Run(test.name, func() {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000", nil)
require.NoError(s.T(), err)
for i := range test.headerCount {
req.Header.Add("X-Header", strconv.Itoa(i))
}
err = try.Request(req, 2*time.Second, try.StatusCodeIs(test.expectedStatus))
require.NoError(s.T(), err)
})
}
}
func (s *SimpleSuite) TestUnderscoreHeadersStrategy() {
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if _, ok := r.Header["X_auth_user"]; ok {
+10 -20
View File
@@ -537,10 +537,8 @@ func TestHandler_Certificates(t *testing.T) {
if test.setup.loadCerts {
dynamicConfigs := []*tlspkg.CertAndStores{{
Certificate: tlspkg.Certificate{
CertFile: localhostCert,
KeyFile: localhostKey,
},
CertFile: localhostCert,
KeyFile: localhostKey,
}}
tlsManager.UpdateConfigs(t.Context(), nil, nil, dynamicConfigs)
@@ -549,28 +547,20 @@ func TestHandler_Certificates(t *testing.T) {
if test.setup.loadMultipleCerts {
dynamicConfigs := []*tlspkg.CertAndStores{
{
Certificate: tlspkg.Certificate{
CertFile: localhostCert,
KeyFile: localhostKey,
},
CertFile: localhostCert,
KeyFile: localhostKey,
},
{
Certificate: tlspkg.Certificate{
CertFile: warnCert,
KeyFile: warnKey,
},
CertFile: warnCert,
KeyFile: warnKey,
},
{
Certificate: tlspkg.Certificate{
CertFile: expiredCert,
KeyFile: expiredKey,
},
CertFile: expiredCert,
KeyFile: expiredKey,
},
{
Certificate: tlspkg.Certificate{
CertFile: acmeCert,
KeyFile: acmeKey,
},
CertFile: acmeCert,
KeyFile: acmeKey,
},
}
+2
View File
@@ -102,6 +102,7 @@ type HTTPConfig struct {
EncodeQuerySemicolons bool `description:"Defines whether request query semicolons should be URLEncoded." json:"encodeQuerySemicolons,omitempty" toml:"encodeQuerySemicolons,omitempty" yaml:"encodeQuerySemicolons,omitempty" export:"true"`
SanitizePath *bool `description:"Defines whether to enable request path sanitization (removal of /./, /../ and multiple slash sequences)." json:"sanitizePath,omitempty" toml:"sanitizePath,omitempty" yaml:"sanitizePath,omitempty" export:"true"`
MaxHeaderBytes int `description:"Maximum size of request headers in bytes." json:"maxHeaderBytes,omitempty" toml:"maxHeaderBytes,omitempty" yaml:"maxHeaderBytes,omitempty" export:"true"`
MaxHeaderValueCount int `description:"Maximum number of request header values." json:"maxHeaderValueCount,omitempty" toml:"maxHeaderValueCount,omitempty" yaml:"maxHeaderValueCount,omitempty" export:"true"`
AliasHeadersStrategy string `description:"Defines the strategy to handle the requests carrying a header whose name aliases another header name (keep, delete, and reject)." json:"aliasHeadersStrategy,omitempty" toml:"aliasHeadersStrategy,omitempty" yaml:"aliasHeadersStrategy,omitempty" export:"true"`
// UnderscoreHeadersStrategy is the strategy to handle request headers with underscores in their names.
@@ -114,6 +115,7 @@ type HTTPConfig struct {
func (h *HTTPConfig) SetDefaults() {
h.SanitizePath = new(true)
h.MaxHeaderBytes = http.DefaultMaxHeaderBytes
h.MaxHeaderValueCount = http.DefaultMaxHeaderValueCount
}
// EncodedCharacters configures which encoded characters are allowed in the request path.
+15 -10
View File
@@ -222,8 +222,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
ProxyProtocol: nil,
ForwardedHeaders: &ForwardedHeaders{},
HTTP: HTTPConfig{
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
MaxHeaderValueCount: 500,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
@@ -270,8 +271,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
ProxyProtocol: nil,
ForwardedHeaders: &ForwardedHeaders{},
HTTP: HTTPConfig{
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
MaxHeaderValueCount: 500,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
@@ -329,8 +331,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
ProxyProtocol: nil,
ForwardedHeaders: &ForwardedHeaders{},
HTTP: HTTPConfig{
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
MaxHeaderValueCount: 500,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
@@ -392,8 +395,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
ProxyProtocol: nil,
ForwardedHeaders: &ForwardedHeaders{},
HTTP: HTTPConfig{
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
MaxHeaderValueCount: 500,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
@@ -503,8 +507,9 @@ func TestConfiguration_SetEffectiveConfiguration(t *testing.T) {
},
ForwardedHeaders: &ForwardedHeaders{},
HTTP: HTTPConfig{
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
SanitizePath: new(true),
MaxHeaderBytes: 1048576,
MaxHeaderValueCount: 500,
},
HTTP2: &HTTP2Config{
MaxConcurrentStreams: 250,
+2 -6
View File
@@ -598,12 +598,12 @@ func TestForwardAuthFailResponseHeaders(t *testing.T) {
func TestForwardAuthClientClosedRequest(t *testing.T) {
requestStarted := make(chan struct{})
requestCancelled := make(chan struct{})
responseComplete := make(chan struct{})
authTs := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
close(requestStarted)
<-requestCancelled
// Wait for the client to give up on the request, so the auth server never answers before the cancellation is observed.
<-r.Context().Done()
}))
t.Cleanup(authTs.Close)
@@ -629,11 +629,7 @@ func TestForwardAuthClientClosedRequest(t *testing.T) {
<-requestStarted
// Cancel request and wait for cancellation to propagate
cancel()
<-ctx.Done()
close(requestCancelled)
<-responseComplete
+3 -5
View File
@@ -153,11 +153,9 @@ func createMessage(certs map[string]*Certificate) dynamic.Message {
for _, cert := range certs {
certConf := &traefiktls.CertAndStores{
Certificate: traefiktls.Certificate{
CertFile: types.FileOrContent(cert.Certificate),
KeyFile: types.FileOrContent(cert.Key),
},
Stores: []string{tlsalpn01.ACMETLS1Protocol},
CertFile: types.FileOrContent(cert.Certificate),
KeyFile: types.FileOrContent(cert.Key),
Stores: []string{tlsalpn01.ACMETLS1Protocol},
}
conf.Configuration.TLS.Certificates = append(conf.Configuration.TLS.Certificates, certConf)
}
+3 -5
View File
@@ -890,11 +890,9 @@ func (p *Provider) buildMessage() dynamic.Message {
for _, cert := range p.certificates {
certConf := &traefiktls.CertAndStores{
Certificate: traefiktls.Certificate{
CertFile: types.FileOrContent(cert.Certificate.Certificate),
KeyFile: types.FileOrContent(cert.Key),
},
Stores: []string{cert.Store},
CertFile: types.FileOrContent(cert.Certificate.Certificate),
KeyFile: types.FileOrContent(cert.Key),
Stores: []string{cert.Store},
}
conf.Configuration.TLS.Certificates = append(conf.Configuration.TLS.Certificates, certConf)
}
+5 -15
View File
@@ -49,9 +49,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
domains: []string{"*.traefik.wtf"},
acmeCertificates: []*CertAndStore{
{
Certificate: Certificate{
Domain: types.Domain{Main: "*.traefik.wtf"},
},
Domain: types.Domain{Main: "*.traefik.wtf"},
},
},
expectedDomains: nil,
@@ -72,9 +70,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
domains: []string{"traefik.wtf", "foo.traefik.wtf"},
acmeCertificates: []*CertAndStore{
{
Certificate: Certificate{
Domain: types.Domain{Main: "traefik.wtf"},
},
Domain: types.Domain{Main: "traefik.wtf"},
},
},
expectedDomains: []string{"foo.traefik.wtf"},
@@ -90,9 +86,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
domains: []string{"traefik.wtf"},
acmeCertificates: []*CertAndStore{
{
Certificate: Certificate{
Domain: types.Domain{Main: "traefik.wtf"},
},
Domain: types.Domain{Main: "traefik.wtf"},
},
},
expectedDomains: nil,
@@ -108,9 +102,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
domains: []string{"who.traefik.wtf", "foo.traefik.wtf"},
acmeCertificates: []*CertAndStore{
{
Certificate: Certificate{
Domain: types.Domain{Main: "*.traefik.wtf"},
},
Domain: types.Domain{Main: "*.traefik.wtf"},
},
},
expectedDomains: nil,
@@ -120,9 +112,7 @@ func TestGetUncheckedCertificates(t *testing.T) {
domains: []string{"traefik.wtf", "foo.traefik.wtf"},
acmeCertificates: []*CertAndStore{
{
Certificate: Certificate{
Domain: types.Domain{Main: "*.traefik.wtf"},
},
Domain: types.Domain{Main: "*.traefik.wtf"},
},
},
expectedDomains: []string{"traefik.wtf"},
+7 -11
View File
@@ -406,10 +406,8 @@ func TestDynConfBuilder_DefaultRule(t *testing.T) {
t.Parallel()
p := Provider{
Shared: Shared{
ExposedByDefault: true,
DefaultRule: test.defaultRule,
},
ExposedByDefault: true,
DefaultRule: test.defaultRule,
}
require.NoError(t, p.Init())
@@ -3910,14 +3908,12 @@ func TestDynConfBuilder_build(t *testing.T) {
t.Parallel()
p := Provider{
Shared: Shared{
AllowEmptyServices: test.allowEmptyServices,
ExposedByDefault: true,
UseBindPortIP: test.useBindPortIP,
DefaultRule: "Host(`{{ normalize .Name }}.traefik.wtf`)",
},
AllowEmptyServices: test.allowEmptyServices,
ExposedByDefault: true,
UseBindPortIP: test.useBindPortIP,
DefaultRule: "Host(`{{ normalize .Name }}.traefik.wtf`)",
Constraints: test.constraints,
}
p.Constraints = test.constraints
require.NoError(t, p.Init())
+30 -34
View File
@@ -152,23 +152,21 @@ func TestSwarmProvider_listServices(t *testing.T) {
dockerVersion: "1.30",
networks: []networktypes.Summary{
{
Network: networktypes.Network{
Name: "network_name",
ID: "yk6l57rfwizjzxxzftn4amaot",
Created: time.Now(),
Scope: "swarm",
Driver: "overlay",
EnableIPv6: false,
Internal: true,
Ingress: false,
ConfigOnly: false,
Options: map[string]string{
"com.docker.networktypes.driver.overlay.vxlanid_list": "4098",
"com.docker.networktypes.enable_ipv6": "false",
},
Labels: map[string]string{
"com.docker.stack.namespace": "test",
},
Name: "network_name",
ID: "yk6l57rfwizjzxxzftn4amaot",
Created: time.Now(),
Scope: "swarm",
Driver: "overlay",
EnableIPv6: false,
Internal: true,
Ingress: false,
ConfigOnly: false,
Options: map[string]string{
"com.docker.networktypes.driver.overlay.vxlanid_list": "4098",
"com.docker.networktypes.enable_ipv6": "false",
},
Labels: map[string]string{
"com.docker.stack.namespace": "test",
},
},
},
@@ -209,23 +207,21 @@ func TestSwarmProvider_listServices(t *testing.T) {
dockerVersion: "1.30",
networks: []networktypes.Summary{
{
Network: networktypes.Network{
Name: "network_name",
ID: "yk6l57rfwizjzxxzftn4amaot",
Created: time.Now(),
Scope: "swarm",
Driver: "overlay",
EnableIPv6: false,
Internal: true,
Ingress: false,
ConfigOnly: false,
Options: map[string]string{
"com.docker.networktypes.driver.overlay.vxlanid_list": "4098",
"com.docker.networktypes.enable_ipv6": "false",
},
Labels: map[string]string{
"com.docker.stack.namespace": "test",
},
Name: "network_name",
ID: "yk6l57rfwizjzxxzftn4amaot",
Created: time.Now(),
Scope: "swarm",
Driver: "overlay",
EnableIPv6: false,
Internal: true,
Ingress: false,
ConfigOnly: false,
Options: map[string]string{
"com.docker.networktypes.driver.overlay.vxlanid_list": "4098",
"com.docker.networktypes.enable_ipv6": "false",
},
Labels: map[string]string{
"com.docker.stack.namespace": "test",
},
},
},
+6 -11
View File
@@ -8,24 +8,19 @@ import (
"github.com/stretchr/testify/require"
traefikcrdfake "github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd/generated/clientset/versioned/fake"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubefake "k8s.io/client-go/kubernetes/fake"
)
func TestClientIgnoresHelmOwnedSecrets(t *testing.T) {
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "secret",
},
Namespace: "default",
Name: "secret",
}
helmSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
}
+2 -4
View File
@@ -1580,10 +1580,8 @@ func getTLS(k8sClient Client, secretName, namespace string) (*tls.CertAndStores,
}
return &tls.CertAndStores{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
},
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
}, nil
}
+7 -13
View File
@@ -788,10 +788,8 @@ func TestLoadIngressRouteTCPs(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
},
},
@@ -5831,10 +5829,8 @@ func TestLoadIngressRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
},
},
@@ -8023,11 +8019,9 @@ func TestLoadIngressRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
Stores: []string{"default"},
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
Stores: []string{"default"},
},
},
Stores: map[string]tls.Store{
+4 -12
View File
@@ -524,9 +524,7 @@ func (c *clientWrapper) UpdateHTTPRouteStatus(ctx context.Context, route ktypes.
currentRoute = currentRoute.DeepCopy()
currentRoute.Status = gatev1.HTTPRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if _, err = c.csGateway.GatewayV1().HTTPRoutes(route.Namespace).UpdateStatus(ctx, currentRoute, metav1.UpdateOptions{}); err != nil {
@@ -566,9 +564,7 @@ func (c *clientWrapper) UpdateGRPCRouteStatus(ctx context.Context, route ktypes.
currentRoute = currentRoute.DeepCopy()
currentRoute.Status = gatev1.GRPCRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if _, err = c.csGateway.GatewayV1().GRPCRoutes(route.Namespace).UpdateStatus(ctx, currentRoute, metav1.UpdateOptions{}); err != nil {
@@ -608,9 +604,7 @@ func (c *clientWrapper) UpdateTCPRouteStatus(ctx context.Context, route ktypes.N
currentRoute = currentRoute.DeepCopy()
currentRoute.Status = gatev1alpha2.TCPRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if _, err = c.csGateway.GatewayV1alpha2().TCPRoutes(route.Namespace).UpdateStatus(ctx, currentRoute, metav1.UpdateOptions{}); err != nil {
@@ -650,9 +644,7 @@ func (c *clientWrapper) UpdateTLSRouteStatus(ctx context.Context, route ktypes.N
currentRoute = currentRoute.DeepCopy()
currentRoute.Status = gatev1.TLSRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if _, err = c.csGateway.GatewayV1().TLSRoutes(route.Namespace).UpdateStatus(ctx, currentRoute, metav1.UpdateOptions{}); err != nil {
+1 -3
View File
@@ -116,9 +116,7 @@ func (p *Provider) loadGRPCRoute(ctx context.Context, gateways []gatewayWithList
}
status := gatev1.GRPCRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if err := p.client.UpdateGRPCRouteStatus(ctx, ktypes.NamespacedName{Namespace: route.Namespace, Name: route.Name}, gateways, status); err != nil {
logger.Warn().
+1 -3
View File
@@ -120,9 +120,7 @@ func (p *Provider) loadHTTPRoute(ctx context.Context, gateways []gatewayWithList
}
status := gatev1.HTTPRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if err := p.client.UpdateHTTPRouteStatus(ctx, ktypes.NamespacedName{Namespace: route.Namespace, Name: route.Name}, gateways, status); err != nil {
logger.Warn().
@@ -965,10 +965,8 @@ func (p *Provider) getTLSCert(secretName gatev1.ObjectName, namespace string) (*
}
certAndStore := &tls.CertAndStores{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
},
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
}
if _, err := certAndStore.GetCertificate(); err != nil {
return nil, fmt.Errorf("validating certificate: %w", err)
@@ -620,10 +620,8 @@ func TestLoadHTTPRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -878,10 +876,8 @@ func TestLoadHTTPRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -950,16 +946,12 @@ func TestLoadHTTPRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -1458,10 +1450,8 @@ func TestLoadHTTPRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -1569,10 +1559,8 @@ func TestLoadHTTPRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -5611,10 +5599,8 @@ func TestLoadTLSRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -5915,10 +5901,8 @@ func TestLoadTLSRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -7252,10 +7236,8 @@ func TestLoadMixedRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -7462,10 +7444,8 @@ func TestLoadMixedRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -7644,10 +7624,8 @@ func TestLoadMixedRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -7826,10 +7804,8 @@ func TestLoadMixedRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -7966,10 +7942,8 @@ func TestLoadMixedRoutes(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -8392,10 +8366,8 @@ func TestLoadRoutesWithReferenceGrants(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
CertFile: types.FileOrContent(listenerCert),
KeyFile: types.FileOrContent(listenerKey),
},
},
},
@@ -9236,10 +9208,8 @@ func Test_managesGateway(t *testing.T) {
{
desc: "no scoping manages everything",
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "foo",
},
Namespace: "default",
Name: "foo",
},
want: true,
},
@@ -9247,10 +9217,8 @@ func Test_managesGateway(t *testing.T) {
desc: "matching ref",
gateways: []NamespacedName{{Namespace: "default", Name: "foo"}},
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "foo",
},
Namespace: "default",
Name: "foo",
},
want: true,
},
@@ -9258,10 +9226,8 @@ func Test_managesGateway(t *testing.T) {
desc: "different name",
gateways: []NamespacedName{{Namespace: "default", Name: "foo"}},
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "bar",
},
Namespace: "default",
Name: "bar",
},
want: false,
},
@@ -9269,10 +9235,8 @@ func Test_managesGateway(t *testing.T) {
desc: "different namespace",
gateways: []NamespacedName{{Namespace: "default", Name: "foo"}},
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "other",
Name: "foo",
},
Namespace: "other",
Name: "foo",
},
want: false,
},
@@ -9283,10 +9247,8 @@ func Test_managesGateway(t *testing.T) {
{Namespace: "other", Name: "bar"},
},
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "foo",
},
Namespace: "default",
Name: "foo",
},
want: true,
},
@@ -9297,10 +9259,8 @@ func Test_managesGateway(t *testing.T) {
{Namespace: "other", Name: "bar"},
},
gw: &gatev1.Gateway{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "baz",
},
Namespace: "default",
Name: "baz",
},
want: false,
},
+1 -3
View File
@@ -108,9 +108,7 @@ func (p *Provider) loadTCPRoutes(ctx context.Context, gateways []gatewayWithList
}
routeStatus := gatev1alpha2.TCPRouteStatus{
RouteStatus: gatev1alpha2.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if err := p.client.UpdateTCPRouteStatus(ctx, ktypes.NamespacedName{Namespace: route.Namespace, Name: route.Name}, gateways, routeStatus); err != nil {
logger.Warn().
+1 -3
View File
@@ -129,9 +129,7 @@ func (p *Provider) loadTLSRoutes(ctx context.Context, gateways []gatewayWithList
}
routeStatus := gatev1.TLSRouteStatus{
RouteStatus: gatev1.RouteStatus{
Parents: parentStatuses,
},
Parents: parentStatuses,
}
if err := p.client.UpdateTLSRouteStatus(ctx, ktypes.NamespacedName{Namespace: route.Namespace, Name: route.Name}, gateways, routeStatus); err != nil {
logger.Warn().
@@ -7,7 +7,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/traefik/traefik/v3/pkg/config/dynamic"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubefake "k8s.io/client-go/kubernetes/fake"
)
@@ -57,8 +56,8 @@ func TestProvider_resolveBasicAuth_authMap(t *testing.T) {
t.Parallel()
kubeClient := kubefake.NewClientset(&corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: "basic-auth", Namespace: "default"},
Data: map[string][]byte{"user2": []byte("hash2"), "user1": []byte("hash1")},
Name: "basic-auth", Namespace: "default",
Data: map[string][]byte{"user2": []byte("hash2"), "user1": []byte("hash1")},
})
client := newClient(kubeClient)
@@ -94,18 +94,14 @@ func TestIsLoadBalancerIngressEquals(t *testing.T) {
func TestClientIgnoresHelmOwnedSecrets(t *testing.T) {
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "secret",
},
Namespace: "default",
Name: "secret",
}
helmSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
}
@@ -146,13 +142,11 @@ func TestClientIgnoresHelmOwnedSecrets(t *testing.T) {
func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
emptyEndpointSlice := &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Name: "empty-endpointslice",
Namespace: "test",
ResourceVersion: "1244",
Annotations: map[string]string{
"test-annotation": "_",
},
Name: "empty-endpointslice",
Namespace: "test",
ResourceVersion: "1244",
Annotations: map[string]string{
"test-annotation": "_",
},
}
@@ -161,12 +155,10 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
samplePortProtocol := corev1.ProtocolTCP
sampleAddressReady := true
filledEndpointSlice := &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Name: "filled-endpointslice",
Namespace: "test",
ResourceVersion: "1234",
},
AddressType: discoveryv1.AddressTypeIPv4,
Name: "filled-endpointslice",
Namespace: "test",
ResourceVersion: "1234",
AddressType: discoveryv1.AddressTypeIPv4,
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.13.37.1"},
Conditions: discoveryv1.EndpointConditions{
@@ -1313,10 +1313,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -2883,10 +2881,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -3452,10 +3448,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -3737,10 +3731,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -9920,10 +9912,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -12948,10 +12938,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -13722,10 +13710,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -13972,10 +13958,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -14295,10 +14279,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -17299,10 +17281,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -17465,10 +17445,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -21409,10 +21387,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -22455,10 +22431,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -22989,16 +22963,12 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -23120,10 +23090,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -23266,10 +23234,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
Options: map[string]tls.Options{
@@ -23630,10 +23596,8 @@ func TestLoadIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
CertFile: "-----BEGIN CERTIFICATE-----",
KeyFile: "-----BEGIN CERTIFICATE-----",
},
},
},
@@ -42,10 +42,8 @@ func (p *Provider) translate(ctx context.Context, mc *model) *dynamic.Configurat
for _, k := range slices.Sorted(maps.Keys(mc.Certs)) {
cp := mc.Certs[k]
conf.TLS.Certificates = append(conf.TLS.Certificates, &tls.CertAndStores{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(cp.Cert),
KeyFile: types.FileOrContent(cp.Key),
},
CertFile: types.FileOrContent(cp.Cert),
KeyFile: types.FileOrContent(cp.Key),
})
}
+15 -23
View File
@@ -134,18 +134,14 @@ func TestIsLoadBalancerIngressEquals(t *testing.T) {
func TestClientIgnoresHelmOwnedSecrets(t *testing.T) {
secret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "secret",
},
Namespace: "default",
Name: "secret",
}
helmSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
Namespace: "default",
Name: "helm-secret",
Labels: map[string]string{
"owner": "helm",
},
}
@@ -190,13 +186,11 @@ func TestClientIgnoresHelmOwnedSecrets(t *testing.T) {
func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
emptyEndpointSlice := &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Name: "empty-endpointslice",
Namespace: "test",
ResourceVersion: "1244",
Annotations: map[string]string{
"test-annotation": "_",
},
Name: "empty-endpointslice",
Namespace: "test",
ResourceVersion: "1244",
Annotations: map[string]string{
"test-annotation": "_",
},
}
@@ -205,12 +199,10 @@ func TestClientIgnoresEmptyEndpointSliceUpdates(t *testing.T) {
samplePortProtocol := corev1.ProtocolTCP
sampleAddressReady := true
filledEndpointSlice := &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
Name: "filled-endpointslice",
Namespace: "test",
ResourceVersion: "1234",
},
AddressType: discoveryv1.AddressTypeIPv4,
Name: "filled-endpointslice",
Namespace: "test",
ResourceVersion: "1234",
AddressType: discoveryv1.AddressTypeIPv4,
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.13.37.1"},
Conditions: discoveryv1.EndpointConditions{
@@ -839,10 +839,8 @@ func getCertificates(ctx context.Context, ingress *netv1.Ingress, k8sClient Clie
}
tlsConfigs[configKey] = &tls.CertAndStores{
Certificate: tls.Certificate{
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
},
CertFile: types.FileOrContent(cert),
KeyFile: types.FileOrContent(key),
}
}
}
@@ -1389,10 +1389,8 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
CertFile: types.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"),
KeyFile: types.FileOrContent("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----"),
},
},
},
@@ -3221,10 +3219,8 @@ func TestGetCertificates(t *testing.T) {
client: clientMock{
secrets: []*corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret",
Namespace: "testing",
},
Name: "test-secret",
Namespace: "testing",
Data: map[string][]byte{
"tls.key": []byte("tls-key"),
},
@@ -3239,10 +3235,8 @@ func TestGetCertificates(t *testing.T) {
client: clientMock{
secrets: []*corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret",
Namespace: "testing",
},
Name: "test-secret",
Namespace: "testing",
Data: map[string][]byte{
"tls.crt": []byte("tls-crt"),
},
@@ -3257,11 +3251,9 @@ func TestGetCertificates(t *testing.T) {
client: clientMock{
secrets: []*corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret",
Namespace: "testing",
},
Data: map[string][]byte{},
Name: "test-secret",
Namespace: "testing",
Data: map[string][]byte{},
},
},
},
@@ -3284,20 +3276,16 @@ func TestGetCertificates(t *testing.T) {
client: clientMock{
secrets: []*corev1.Secret{
{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret2",
Namespace: "testing",
},
Name: "test-secret2",
Namespace: "testing",
Data: map[string][]byte{
"tls.crt": []byte("tls-crt"),
"tls.key": []byte("tls-key"),
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "test-secret",
Namespace: "testing",
},
Name: "test-secret",
Namespace: "testing",
Data: map[string][]byte{
"tls.crt": []byte("tls-crt"),
"tls.key": []byte("tls-key"),
@@ -25,34 +25,26 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
},
@@ -62,11 +54,9 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "unknown",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{},
@@ -77,11 +67,9 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "other",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "other",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{},
@@ -92,11 +80,9 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "other"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "other"},
},
},
expected: []*discoveryv1.EndpointSlice{},
@@ -107,34 +93,26 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
},
@@ -144,38 +122,30 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-b",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-b",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
},
@@ -185,38 +155,30 @@ func Test_EndpointSlicesByServiceName(t *testing.T) {
svcName: "app",
endpointSlices: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-z",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-z",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
expected: []*discoveryv1.EndpointSlice{
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-z",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-z",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
Name: "slice-a",
Namespace: "default",
CreationTimestamp: metav1.NewTime(time.Date(2025, 1, 2, 0, 0, 0, 0, time.UTC)),
Labels: map[string]string{discoveryv1.LabelServiceName: "app"},
},
},
},
+52 -125
View File
@@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/assert"
discoveryv1 "k8s.io/api/discovery/v1"
netv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func Test_detectChanges(t *testing.T) {
@@ -38,141 +37,105 @@ func Test_detectChanges(t *testing.T) {
{
name: "With same version",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
},
{
name: "With different version",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
},
},
{
name: "Ingress With same version",
oldObj: &netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
newObj: &netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
},
{
name: "Ingress With different version",
oldObj: &netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
},
newObj: &netv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
},
want: true,
},
{
name: "With same annotations",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
Annotations: map[string]string{
"test-annotation": "_",
},
ResourceVersion: "1",
Annotations: map[string]string{
"test-annotation": "_",
},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{
"test-annotation": "_",
},
ResourceVersion: "2",
Annotations: map[string]string{
"test-annotation": "_",
},
},
},
{
name: "With different annotations",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
Annotations: map[string]string{
"test-annotation": "V",
},
ResourceVersion: "1",
Annotations: map[string]string{
"test-annotation": "V",
},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{
"test-annotation": "X",
},
ResourceVersion: "2",
Annotations: map[string]string{
"test-annotation": "X",
},
},
},
{
name: "With same endpoints and ports",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
Endpoints: []discoveryv1.Endpoint{},
Ports: []discoveryv1.EndpointPort{},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{},
Ports: []discoveryv1.EndpointPort{},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
Endpoints: []discoveryv1.Endpoint{},
Ports: []discoveryv1.EndpointPort{},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{},
Ports: []discoveryv1.EndpointPort{},
},
},
{
name: "With different len of endpoints",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
Endpoints: []discoveryv1.Endpoint{},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
Endpoints: []discoveryv1.Endpoint{{}},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{}},
},
want: true,
},
{
name: "With different endpoints",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.11"},
}},
@@ -182,18 +145,14 @@ func Test_detectChanges(t *testing.T) {
{
name: "With different endpoint ready condition",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Ready: new(true)},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Ready: new(false)},
@@ -204,18 +163,14 @@ func Test_detectChanges(t *testing.T) {
{
name: "With different endpoint serving condition",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Serving: new(true)},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Serving: new(false)},
@@ -226,18 +181,14 @@ func Test_detectChanges(t *testing.T) {
{
name: "With different endpoint terminating condition",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Terminating: new(false)},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Terminating: new(true)},
@@ -248,17 +199,13 @@ func Test_detectChanges(t *testing.T) {
{
name: "With endpoint serving condition nil then explicitly true",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Serving: new(true)},
@@ -268,17 +215,13 @@ func Test_detectChanges(t *testing.T) {
{
name: "With endpoint serving condition nil then explicitly false",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Serving: new(false)},
@@ -289,17 +232,13 @@ func Test_detectChanges(t *testing.T) {
{
name: "With endpoint terminating condition nil then explicitly false",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Terminating: new(false)},
@@ -309,17 +248,13 @@ func Test_detectChanges(t *testing.T) {
{
name: "With endpoint terminating condition nil then explicitly true",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Endpoints: []discoveryv1.Endpoint{{
Addresses: []string{"10.10.10.10"},
Conditions: discoveryv1.EndpointConditions{Terminating: new(true)},
@@ -330,33 +265,25 @@ func Test_detectChanges(t *testing.T) {
{
name: "With different len of ports",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
Ports: []discoveryv1.EndpointPort{},
ResourceVersion: "1",
Ports: []discoveryv1.EndpointPort{},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
Ports: []discoveryv1.EndpointPort{{}},
ResourceVersion: "2",
Ports: []discoveryv1.EndpointPort{{}},
},
want: true,
},
{
name: "With different ports",
oldObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
},
ResourceVersion: "1",
Ports: []discoveryv1.EndpointPort{{
Port: new(int32(80)),
}},
},
newObj: &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
},
ResourceVersion: "2",
Ports: []discoveryv1.EndpointPort{{
Port: new(int32(8080)),
}},
+4 -8
View File
@@ -864,20 +864,16 @@ func Test_buildConfiguration(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("foobar"),
KeyFile: types.FileOrContent("foobar"),
},
CertFile: types.FileOrContent("foobar"),
KeyFile: types.FileOrContent("foobar"),
Stores: []string{
"foobar",
"foobar",
},
},
{
Certificate: tls.Certificate{
CertFile: types.FileOrContent("foobar"),
KeyFile: types.FileOrContent("foobar"),
},
CertFile: types.FileOrContent("foobar"),
KeyFile: types.FileOrContent("foobar"),
Stores: []string{
"foobar",
"foobar",
+33 -39
View File
@@ -81,20 +81,16 @@ func TestMergeCollectionSet_BasicMapMerge(t *testing.T) {
func TestMergeCollectionSet_EmbeddedStruct(t *testing.T) {
dst := &testCollectionSetWithEmbedded{
TestEmbedded: TestEmbedded{
EmbeddedItems: map[string]*testResource{
"embedded1": {Value: "dst-embedded"},
},
EmbeddedItems: map[string]*testResource{
"embedded1": {Value: "dst-embedded"},
},
Items: map[string]*testResource{
"item1": {Value: "dst-item"},
},
}
src := &testCollectionSetWithEmbedded{
TestEmbedded: TestEmbedded{
EmbeddedItems: map[string]*testResource{
"embedded2": {Value: "src-embedded"},
},
EmbeddedItems: map[string]*testResource{
"embedded2": {Value: "src-embedded"},
},
Items: map[string]*testResource{
"item2": {Value: "src-item"},
@@ -106,11 +102,9 @@ func TestMergeCollectionSet_EmbeddedStruct(t *testing.T) {
assert.Empty(t, tracker.toDelete)
assert.Equal(t, &testCollectionSetWithEmbedded{
TestEmbedded: TestEmbedded{
EmbeddedItems: map[string]*testResource{
"embedded1": {Value: "dst-embedded"},
"embedded2": {Value: "src-embedded"},
},
EmbeddedItems: map[string]*testResource{
"embedded1": {Value: "dst-embedded"},
"embedded2": {Value: "src-embedded"},
},
Items: map[string]*testResource{
"item1": {Value: "dst-item"},
@@ -348,8 +342,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert1.pem", KeyFile: "key1.pem"},
Stores: []string{"store1"},
CertFile: "cert1.pem", KeyFile: "key1.pem",
Stores: []string{"store1"},
},
},
},
@@ -358,8 +352,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert2.pem", KeyFile: "key2.pem"},
Stores: []string{"store2"},
CertFile: "cert2.pem", KeyFile: "key2.pem",
Stores: []string{"store2"},
},
},
},
@@ -369,12 +363,12 @@ func TestMerge(t *testing.T) {
expected: buildExpectedConfiguration(func(c *dynamic.Configuration) {
c.TLS.Certificates = []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert1.pem", KeyFile: "key1.pem"},
Stores: []string{"store1"},
CertFile: "cert1.pem", KeyFile: "key1.pem",
Stores: []string{"store1"},
},
{
Certificate: tls.Certificate{CertFile: "cert2.pem", KeyFile: "key2.pem"},
Stores: []string{"store2"},
CertFile: "cert2.pem", KeyFile: "key2.pem",
Stores: []string{"store2"},
},
}
}),
@@ -386,8 +380,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1"},
},
},
},
@@ -396,8 +390,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store2"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store2"},
},
},
},
@@ -407,8 +401,8 @@ func TestMerge(t *testing.T) {
expected: buildExpectedConfiguration(func(c *dynamic.Configuration) {
c.TLS.Certificates = []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1", "store2"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1", "store2"},
},
}
}),
@@ -420,8 +414,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1", "store2"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1", "store2"},
},
},
},
@@ -430,8 +424,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store2", "store3"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store2", "store3"},
},
},
},
@@ -441,8 +435,8 @@ func TestMerge(t *testing.T) {
expected: buildExpectedConfiguration(func(c *dynamic.Configuration) {
c.TLS.Certificates = []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1", "store2", "store3"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1", "store2", "store3"},
},
}
}),
@@ -454,8 +448,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1"},
},
},
},
@@ -464,8 +458,8 @@ func TestMerge(t *testing.T) {
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store2"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store2"},
},
},
},
@@ -475,8 +469,8 @@ func TestMerge(t *testing.T) {
expected: buildExpectedConfiguration(func(c *dynamic.Configuration) {
c.TLS.Certificates = []*tls.CertAndStores{
{
Certificate: tls.Certificate{CertFile: "cert.pem", KeyFile: "key.pem"},
Stores: []string{"store1"},
CertFile: "cert.pem", KeyFile: "key.pem",
Stores: []string{"store1"},
},
}
}),
+2 -4
View File
@@ -80,10 +80,8 @@ func Test_globalConfig(t *testing.T) {
for _, test := range cases {
t.Run(test.Name, func(t *testing.T) {
p := Provider{
Configuration: Configuration{
ExposedByDefault: test.ExposedByDefault,
Prefix: test.Prefix,
},
ExposedByDefault: test.ExposedByDefault,
Prefix: test.Prefix,
}
result := p.getExtraConf(test.Tags)
require.Equal(t, test.exp, result)
+4 -4
View File
@@ -175,12 +175,12 @@ func TestProvider_sendDynamicConfig(t *testing.T) {
},
want: []*traefiktls.CertAndStores{
{
Certificate: traefiktls.Certificate{CertFile: "bar.crt", KeyFile: "bar.key"},
Stores: []string{traefiktls.DefaultTLSStoreName},
CertFile: "bar.crt", KeyFile: "bar.key",
Stores: []string{traefiktls.DefaultTLSStoreName},
},
{
Certificate: traefiktls.Certificate{CertFile: "foo.crt", KeyFile: "foo.key"},
Stores: []string{traefiktls.DefaultTLSStoreName},
CertFile: "foo.crt", KeyFile: "foo.key",
Stores: []string{traefiktls.DefaultTLSStoreName},
},
},
},
+69 -90
View File
@@ -24,7 +24,6 @@ import (
"github.com/traefik/traefik/v3/pkg/provider/kubernetes/crd"
"github.com/traefik/traefik/v3/pkg/provider/kubernetes/gateway"
"github.com/traefik/traefik/v3/pkg/provider/kubernetes/ingress"
"github.com/traefik/traefik/v3/pkg/provider/kv"
"github.com/traefik/traefik/v3/pkg/provider/kv/consul"
"github.com/traefik/traefik/v3/pkg/provider/kv/etcd"
"github.com/traefik/traefik/v3/pkg/provider/kv/redis"
@@ -456,11 +455,9 @@ func init() {
},
Certificates: []*traefiktls.CertAndStores{
{
Certificate: traefiktls.Certificate{
CertFile: "cert.pem",
KeyFile: "key.pem",
},
Stores: []string{"foo"},
CertFile: "cert.pem",
KeyFile: "key.pem",
Stores: []string{"foo"},
},
},
Stores: map[string]traefiktls.Store{
@@ -604,46 +601,38 @@ func TestDo_staticConfiguration(t *testing.T) {
}
config.Providers.Docker = &docker.Provider{
Shared: docker.Shared{
ExposedByDefault: true,
Constraints: `Label("foo", "bar")`,
AllowEmptyServices: true,
Network: "MyNetwork",
UseBindPortIP: true,
Watch: true,
DefaultRule: "PathPrefix(`/`)",
},
ClientConfig: docker.ClientConfig{
Endpoint: "MyEndPoint", TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
HTTPClientTimeout: 42,
ExposedByDefault: true,
Constraints: `Label("foo", "bar")`,
AllowEmptyServices: true,
Network: "MyNetwork",
UseBindPortIP: true,
Watch: true,
DefaultRule: "PathPrefix(`/`)",
Endpoint: "MyEndPoint", TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
HTTPClientTimeout: 42,
}
config.Providers.Swarm = &docker.SwarmProvider{
Shared: docker.Shared{
ExposedByDefault: true,
Constraints: `Label("foo", "bar")`,
AllowEmptyServices: true,
Network: "MyNetwork",
UseBindPortIP: true,
Watch: true,
DefaultRule: "PathPrefix(`/`)",
ExposedByDefault: true,
Constraints: `Label("foo", "bar")`,
AllowEmptyServices: true,
Network: "MyNetwork",
UseBindPortIP: true,
Watch: true,
DefaultRule: "PathPrefix(`/`)",
Endpoint: "MyEndPoint", TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
ClientConfig: docker.ClientConfig{
Endpoint: "MyEndPoint", TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
HTTPClientTimeout: 42,
},
RefreshSeconds: 42,
HTTPClientTimeout: 42,
RefreshSeconds: 42,
}
config.Providers.KubernetesIngress = &ingress.Provider{
@@ -685,34 +674,32 @@ func TestDo_staticConfiguration(t *testing.T) {
}
config.Providers.ConsulCatalog = &consulcatalog.ProviderBuilder{
Configuration: consulcatalog.Configuration{
Constraints: `Label("foo", "bar")`,
Endpoint: &consulcatalog.EndpointConfig{
Address: "MyAddress",
Scheme: "MyScheme",
DataCenter: "MyDatacenter",
Token: "MyToken",
TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
HTTPAuth: &consulcatalog.EndpointHTTPAuthConfig{
Username: "MyUsername",
Password: "MyPassword",
},
EndpointWaitTime: 42,
Constraints: `Label("foo", "bar")`,
Endpoint: &consulcatalog.EndpointConfig{
Address: "MyAddress",
Scheme: "MyScheme",
DataCenter: "MyDatacenter",
Token: "MyToken",
TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
Key: "mycert.key",
InsecureSkipVerify: true,
},
Prefix: "MyPrefix",
RefreshInterval: 42,
RequireConsistent: true,
Stale: true,
Cache: true,
ExposedByDefault: true,
DefaultRule: "PathPrefix(`/`)",
HTTPAuth: &consulcatalog.EndpointHTTPAuthConfig{
Username: "MyUsername",
Password: "MyPassword",
},
EndpointWaitTime: 42,
},
Namespaces: []string{"ns1", "ns2"},
Prefix: "MyPrefix",
RefreshInterval: 42,
RequireConsistent: true,
Stale: true,
Cache: true,
ExposedByDefault: true,
DefaultRule: "PathPrefix(`/`)",
Namespaces: []string{"ns1", "ns2"},
}
config.Providers.Ecs = &ecs.Provider{
@@ -729,11 +716,9 @@ func TestDo_staticConfiguration(t *testing.T) {
}
config.Providers.Consul = &consul.ProviderBuilder{
Provider: kv.Provider{
RootKey: "RootKey",
Endpoints: nil,
},
Token: "secret",
RootKey: "RootKey",
Endpoints: nil,
Token: "secret",
TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
@@ -744,12 +729,10 @@ func TestDo_staticConfiguration(t *testing.T) {
}
config.Providers.Etcd = &etcd.Provider{
Provider: kv.Provider{
RootKey: "RootKey",
Endpoints: nil,
},
Username: "username",
Password: "password",
RootKey: "RootKey",
Endpoints: nil,
Username: "username",
Password: "password",
TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
@@ -759,21 +742,17 @@ func TestDo_staticConfiguration(t *testing.T) {
}
config.Providers.ZooKeeper = &zk.Provider{
Provider: kv.Provider{
RootKey: "RootKey",
Endpoints: nil,
},
Username: "username",
Password: "password",
RootKey: "RootKey",
Endpoints: nil,
Username: "username",
Password: "password",
}
config.Providers.Redis = &redis.Provider{
Provider: kv.Provider{
RootKey: "RootKey",
Endpoints: nil,
},
Username: "username",
Password: "password",
RootKey: "RootKey",
Endpoints: nil,
Username: "username",
Password: "password",
TLS: &types.ClientTLS{
CA: "myCa",
Cert: "mycert.pem",
+6 -4
View File
@@ -150,15 +150,17 @@ func Test_mergeConfiguration_tlsCertificates(t *testing.T) {
"tlsalpn.acme": &dynamic.Configuration{
TLS: &dynamic.TLSConfiguration{
Certificates: []*tls.CertAndStores{{
Certificate: tls.Certificate{CertFile: "foo", KeyFile: "bar"},
Stores: []string{tlsalpn01.ACMETLS1Protocol},
CertFile: "foo",
KeyFile: "bar",
Stores: []string{tlsalpn01.ACMETLS1Protocol},
}},
},
},
},
expected: []*tls.CertAndStores{{
Certificate: tls.Certificate{CertFile: "foo", KeyFile: "bar"},
Stores: []string{tlsalpn01.ACMETLS1Protocol},
CertFile: "foo",
KeyFile: "bar",
Stores: []string{tlsalpn01.ACMETLS1Protocol},
}},
},
}
+2 -2
View File
@@ -152,8 +152,8 @@ func Test_Routing(t *testing.T) {
},
},
[]*traefiktls.CertAndStores{{
Certificate: traefiktls.Certificate{CertFile: types.FileOrContent(certPEM), KeyFile: types.FileOrContent(keyPEM)},
Stores: []string{tlsalpn01.ACMETLS1Protocol},
CertFile: types.FileOrContent(certPEM), KeyFile: types.FileOrContent(keyPEM),
Stores: []string{tlsalpn01.ACMETLS1Protocol},
}})
middlewaresBuilder := tcpmiddleware.NewBuilder(conf.TCPMiddlewares)
+8 -7
View File
@@ -773,13 +773,14 @@ func newHTTPServer(ctx context.Context, ln net.Listener, configuration *static.E
}
serverHTTP := &http.Server{
Protocols: &protocols,
Handler: handler,
ErrorLog: stdlog.New(logs.NoLevel(log.Logger, zerolog.DebugLevel), "", 0),
ReadTimeout: time.Duration(configuration.Transport.RespondingTimeouts.ReadTimeout),
WriteTimeout: time.Duration(configuration.Transport.RespondingTimeouts.WriteTimeout),
IdleTimeout: time.Duration(configuration.Transport.RespondingTimeouts.IdleTimeout),
MaxHeaderBytes: configuration.HTTP.MaxHeaderBytes,
Protocols: &protocols,
Handler: handler,
ErrorLog: stdlog.New(logs.NoLevel(log.Logger, zerolog.DebugLevel), "", 0),
ReadTimeout: time.Duration(configuration.Transport.RespondingTimeouts.ReadTimeout),
WriteTimeout: time.Duration(configuration.Transport.RespondingTimeouts.WriteTimeout),
IdleTimeout: time.Duration(configuration.Transport.RespondingTimeouts.IdleTimeout),
MaxHeaderBytes: configuration.HTTP.MaxHeaderBytes,
MaxHeaderValueCount: configuration.HTTP.MaxHeaderValueCount,
HTTP2: &http.HTTP2Config{
MaxConcurrentStreams: int(configuration.HTTP2.MaxConcurrentStreams),
MaxDecoderHeaderTableSize: int(configuration.HTTP2.MaxDecoderHeaderTableSize),
+8 -16
View File
@@ -78,10 +78,8 @@ ZboOWVe3icTy64BT3OQhmg==
func TestTLSInStore(t *testing.T) {
dynamicConfigs := []*CertAndStores{{
Certificate: Certificate{
CertFile: localhostCert,
KeyFile: localhostKey,
},
CertFile: localhostCert,
KeyFile: localhostKey,
}}
tlsManager := NewManager(nil)
@@ -95,10 +93,8 @@ func TestTLSInStore(t *testing.T) {
func TestTLSInvalidStore(t *testing.T) {
dynamicConfigs := []*CertAndStores{{
Certificate: Certificate{
CertFile: localhostCert,
KeyFile: localhostKey,
},
CertFile: localhostCert,
KeyFile: localhostKey,
}}
tlsManager := NewManager(nil)
@@ -120,10 +116,8 @@ func TestTLSInvalidStore(t *testing.T) {
func TestManager_Get(t *testing.T) {
dynamicConfigs := []*CertAndStores{{
Certificate: Certificate{
CertFile: localhostCert,
KeyFile: localhostKey,
},
CertFile: localhostCert,
KeyFile: localhostKey,
}}
tlsConfigs := map[string]Options{
@@ -402,10 +396,8 @@ func TestManager_UpdateConfigs_OCSPConfig(t *testing.T) {
tlsManager.UpdateConfigs(testContext, nil, nil, []*CertAndStores{
{
Certificate: Certificate{
CertFile: certWithOCSPServer,
KeyFile: certKey,
},
CertFile: certWithOCSPServer,
KeyFile: certKey,
},
})