2019-11-28 20:56:04 +00:00
|
|
|
package kv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2022-01-12 13:42:21 +00:00
|
|
|
"github.com/kvtools/valkeyrie/store"
|
2019-11-28 20:56:04 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
2020-08-17 16:04:03 +00:00
|
|
|
ptypes "github.com/traefik/paerser/types"
|
2023-02-03 14:24:05 +00:00
|
|
|
"github.com/traefik/traefik/v3/pkg/config/dynamic"
|
|
|
|
"github.com/traefik/traefik/v3/pkg/tls"
|
|
|
|
"github.com/traefik/traefik/v3/pkg/types"
|
2019-11-28 20:56:04 +00:00
|
|
|
)
|
|
|
|
|
2024-01-29 16:32:05 +00:00
|
|
|
func Bool(v bool) *bool { return &v }
|
|
|
|
func String(v string) *string { return &v }
|
|
|
|
|
2019-11-28 20:56:04 +00:00
|
|
|
func Test_buildConfiguration(t *testing.T) {
|
|
|
|
provider := newProviderMock(mapToPairs(map[string]string{
|
|
|
|
"traefik/http/routers/Router0/entryPoints/0": "foobar",
|
|
|
|
"traefik/http/routers/Router0/entryPoints/1": "foobar",
|
|
|
|
"traefik/http/routers/Router0/middlewares/0": "foobar",
|
|
|
|
"traefik/http/routers/Router0/middlewares/1": "foobar",
|
|
|
|
"traefik/http/routers/Router0/service": "foobar",
|
|
|
|
"traefik/http/routers/Router0/rule": "foobar",
|
|
|
|
"traefik/http/routers/Router0/priority": "42",
|
|
|
|
"traefik/http/routers/Router0/tls": "",
|
|
|
|
"traefik/http/routers/Router1/rule": "foobar",
|
|
|
|
"traefik/http/routers/Router1/priority": "42",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/0/main": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/0/sans/0": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/0/sans/1": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/1/main": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/1/sans/0": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/domains/1/sans/1": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/options": "foobar",
|
|
|
|
"traefik/http/routers/Router1/tls/certResolver": "foobar",
|
|
|
|
"traefik/http/routers/Router1/entryPoints/0": "foobar",
|
|
|
|
"traefik/http/routers/Router1/entryPoints/1": "foobar",
|
|
|
|
"traefik/http/routers/Router1/middlewares/0": "foobar",
|
|
|
|
"traefik/http/routers/Router1/middlewares/1": "foobar",
|
|
|
|
"traefik/http/routers/Router1/service": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/path": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/port": "42",
|
2022-11-16 10:38:07 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/interval": "1s",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/timeout": "1s",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/hostname": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/headers/name0": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/headers/name1": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/scheme": "foobar",
|
2022-09-20 14:54:08 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/mode": "foobar",
|
2020-02-26 16:28:04 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/healthCheck/followredirects": "true",
|
2022-11-16 10:38:07 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/responseForwarding/flushInterval": "1s",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/services/Service01/loadBalancer/passHostHeader": "true",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/sticky/cookie/name": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/sticky/cookie/secure": "true",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/sticky/cookie/httpOnly": "true",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/servers/0/url": "foobar",
|
|
|
|
"traefik/http/services/Service01/loadBalancer/servers/1/url": "foobar",
|
|
|
|
"traefik/http/services/Service02/mirroring/service": "foobar",
|
2020-03-05 17:03:08 +00:00
|
|
|
"traefik/http/services/Service02/mirroring/maxBodySize": "42",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/services/Service02/mirroring/mirrors/0/name": "foobar",
|
|
|
|
"traefik/http/services/Service02/mirroring/mirrors/0/percent": "42",
|
|
|
|
"traefik/http/services/Service02/mirroring/mirrors/1/name": "foobar",
|
|
|
|
"traefik/http/services/Service02/mirroring/mirrors/1/percent": "42",
|
|
|
|
"traefik/http/services/Service03/weighted/sticky/cookie/name": "foobar",
|
|
|
|
"traefik/http/services/Service03/weighted/sticky/cookie/secure": "true",
|
|
|
|
"traefik/http/services/Service03/weighted/sticky/cookie/httpOnly": "true",
|
|
|
|
"traefik/http/services/Service03/weighted/services/0/name": "foobar",
|
|
|
|
"traefik/http/services/Service03/weighted/services/0/weight": "42",
|
|
|
|
"traefik/http/services/Service03/weighted/services/1/name": "foobar",
|
|
|
|
"traefik/http/services/Service03/weighted/services/1/weight": "42",
|
2022-03-17 11:02:09 +00:00
|
|
|
"traefik/http/services/Service04/failover/service": "foobar",
|
|
|
|
"traefik/http/services/Service04/failover/fallback": "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/authResponseHeaders/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/authResponseHeaders/1": "foobar",
|
2020-10-07 14:36:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/authRequestHeaders/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/authRequestHeaders/1": "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/tls/key": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/tls/insecureSkipVerify": "true",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/tls/ca": "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/tls/caOptional": "true",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/tls/cert": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/address": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware08/forwardAuth/trustForwardHeader": "true",
|
|
|
|
"traefik/http/middlewares/Middleware15/redirectScheme/scheme": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware15/redirectScheme/port": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware15/redirectScheme/permanent": "true",
|
|
|
|
"traefik/http/middlewares/Middleware17/replacePathRegex/regex": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware17/replacePathRegex/replacement": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware14/redirectRegex/regex": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware14/redirectRegex/replacement": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware14/redirectRegex/permanent": "true",
|
|
|
|
"traefik/http/middlewares/Middleware16/replacePath/path": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/removeHeader": "true",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/realm": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/headerField": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/users/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/users/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware06/digestAuth/usersFile": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowHeaders/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowHeaders/1": "foobar",
|
2020-03-05 07:18:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowOriginList/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowOriginList/1": "foobar",
|
2020-10-29 09:52:03 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowOriginListRegex/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowOriginListRegex/1": "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/contentTypeNosniff": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowCredentials": "true",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/featurePolicy": "foobar",
|
2021-06-21 13:16:13 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/permissionsPolicy": "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/forceSTSHeader": "true",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslRedirect": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslHost": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslForceHost": "true",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslProxyHeaders/name1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslProxyHeaders/name0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/allowedHosts/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/allowedHosts/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/stsPreload": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/frameDeny": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/isDevelopment": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/customResponseHeaders/name1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/customResponseHeaders/name0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowMethods/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlAllowMethods/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/stsSeconds": "42",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/stsIncludeSubdomains": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/customFrameOptionsValue": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlMaxAge": "42",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/addVaryHeader": "true",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/hostsProxyHeaders/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/hostsProxyHeaders/1": "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/sslTemporaryRedirect": "true",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware09/headers/customBrowserXSSValue": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/referrerPolicy": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlExposeHeaders/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/accessControlExposeHeaders/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/contentSecurityPolicy": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/publicKey": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/customRequestHeaders/name0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/customRequestHeaders/name1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware09/headers/browserXssFilter": "true",
|
2022-10-26 15:16:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware10/ipAllowList/sourceRange/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware10/ipAllowList/sourceRange/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware10/ipAllowList/ipStrategy/excludedIPs/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware10/ipAllowList/ipStrategy/excludedIPs/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware10/ipAllowList/ipStrategy/depth": "42",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/amount": "42",
|
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/sourceCriterion/requestHost": "true",
|
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/sourceCriterion/ipStrategy/depth": "42",
|
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/sourceCriterion/ipStrategy/excludedIPs/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/sourceCriterion/ipStrategy/excludedIPs/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware11/inFlightReq/sourceCriterion/requestHeaderName": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/pem": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/notAfter": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/notBefore": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/sans": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/country": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/province": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/locality": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/organization": "true",
|
2021-07-28 15:42:09 +00:00
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/organizationalunit": "true",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/commonName": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/serialNumber": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/subject/domainComponent": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/country": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/province": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/locality": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/organization": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/commonName": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/serialNumber": "true",
|
|
|
|
"traefik/http/middlewares/Middleware12/passTLSClientCert/info/issuer/domainComponent": "true",
|
|
|
|
"traefik/http/middlewares/Middleware00/addPrefix/prefix": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware03/chain/middlewares/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware03/chain/middlewares/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware04/circuitBreaker/expression": "foobar",
|
2022-04-05 10:30:08 +00:00
|
|
|
"traefik/http/middlewares/Middleware04/circuitBreaker/checkPeriod": "1s",
|
|
|
|
"traefik/http/middlewares/Middleware04/circuitBreaker/fallbackDuration": "1s",
|
|
|
|
"traefik/http/middlewares/Middleware04/circuitBreaker/recoveryDuration": "1s",
|
2024-01-29 09:58:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware04/circuitBreaker/responseCode": "404",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware07/errors/status/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware07/errors/status/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware07/errors/service": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware07/errors/query": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/average": "42",
|
2020-01-08 10:44:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/period": "1s",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/burst": "42",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/sourceCriterion/requestHeaderName": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/sourceCriterion/requestHost": "true",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/sourceCriterion/ipStrategy/depth": "42",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/sourceCriterion/ipStrategy/excludedIPs/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware13/rateLimit/sourceCriterion/ipStrategy/excludedIPs/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware20/stripPrefixRegex/regex/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware20/stripPrefixRegex/regex/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/users/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/users/1": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/usersFile": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/realm": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/removeHeader": "true",
|
|
|
|
"traefik/http/middlewares/Middleware01/basicAuth/headerField": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware02/buffering/maxResponseBodyBytes": "42",
|
|
|
|
"traefik/http/middlewares/Middleware02/buffering/memResponseBodyBytes": "42",
|
|
|
|
"traefik/http/middlewares/Middleware02/buffering/retryExpression": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware02/buffering/maxRequestBodyBytes": "42",
|
|
|
|
"traefik/http/middlewares/Middleware02/buffering/memRequestBodyBytes": "42",
|
2021-09-20 16:00:08 +00:00
|
|
|
"traefik/http/middlewares/Middleware05/compress/minResponseBodyBytes": "42",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/http/middlewares/Middleware18/retry/attempts": "42",
|
|
|
|
"traefik/http/middlewares/Middleware19/stripPrefix/prefixes/0": "foobar",
|
|
|
|
"traefik/http/middlewares/Middleware19/stripPrefix/prefixes/1": "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/http/middlewares/Middleware19/stripPrefix/forceSlash": "true",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/tcp/routers/TCPRouter0/entryPoints/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/entryPoints/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/service": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/rule": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/options": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/certResolver": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/0/main": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/0/sans/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/0/sans/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/1/main": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/1/sans/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/domains/1/sans/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter0/tls/passthrough": "true",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/entryPoints/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/entryPoints/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/service": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/rule": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/0/main": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/0/sans/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/0/sans/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/1/main": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/1/sans/0": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/domains/1/sans/1": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/passthrough": "true",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/options": "foobar",
|
|
|
|
"traefik/tcp/routers/TCPRouter1/tls/certResolver": "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
"traefik/tcp/services/TCPService01/loadBalancer/terminationDelay": "42",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/tcp/services/TCPService01/loadBalancer/servers/0/address": "foobar",
|
|
|
|
"traefik/tcp/services/TCPService01/loadBalancer/servers/1/address": "foobar",
|
|
|
|
"traefik/tcp/services/TCPService02/weighted/services/0/name": "foobar",
|
|
|
|
"traefik/tcp/services/TCPService02/weighted/services/0/weight": "42",
|
|
|
|
"traefik/tcp/services/TCPService02/weighted/services/1/name": "foobar",
|
|
|
|
"traefik/tcp/services/TCPService02/weighted/services/1/weight": "43",
|
2020-02-20 21:24:05 +00:00
|
|
|
"traefik/udp/routers/UDPRouter0/entrypoints/0": "foobar",
|
|
|
|
"traefik/udp/routers/UDPRouter0/entrypoints/1": "foobar",
|
|
|
|
"traefik/udp/routers/UDPRouter0/service": "foobar",
|
|
|
|
"traefik/udp/routers/UDPRouter1/entrypoints/0": "foobar",
|
|
|
|
"traefik/udp/routers/UDPRouter1/entrypoints/1": "foobar",
|
|
|
|
"traefik/udp/routers/UDPRouter1/service": "foobar",
|
|
|
|
"traefik/udp/services/UDPService01/loadBalancer/servers/0/address": "foobar",
|
|
|
|
"traefik/udp/services/UDPService01/loadBalancer/servers/1/address": "foobar",
|
|
|
|
"traefik/udp/services/UDPService02/loadBalancer/servers/0/address": "foobar",
|
|
|
|
"traefik/udp/services/UDPService02/loadBalancer/servers/1/address": "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
"traefik/tls/options/Options0/minVersion": "foobar",
|
|
|
|
"traefik/tls/options/Options0/maxVersion": "foobar",
|
|
|
|
"traefik/tls/options/Options0/cipherSuites/0": "foobar",
|
|
|
|
"traefik/tls/options/Options0/cipherSuites/1": "foobar",
|
|
|
|
"traefik/tls/options/Options0/sniStrict": "true",
|
|
|
|
"traefik/tls/options/Options0/curvePreferences/0": "foobar",
|
|
|
|
"traefik/tls/options/Options0/curvePreferences/1": "foobar",
|
|
|
|
"traefik/tls/options/Options0/clientAuth/caFiles/0": "foobar",
|
|
|
|
"traefik/tls/options/Options0/clientAuth/caFiles/1": "foobar",
|
|
|
|
"traefik/tls/options/Options0/clientAuth/clientAuthType": "foobar",
|
|
|
|
"traefik/tls/options/Options1/sniStrict": "true",
|
|
|
|
"traefik/tls/options/Options1/curvePreferences/0": "foobar",
|
|
|
|
"traefik/tls/options/Options1/curvePreferences/1": "foobar",
|
|
|
|
"traefik/tls/options/Options1/clientAuth/caFiles/0": "foobar",
|
|
|
|
"traefik/tls/options/Options1/clientAuth/caFiles/1": "foobar",
|
|
|
|
"traefik/tls/options/Options1/clientAuth/clientAuthType": "foobar",
|
|
|
|
"traefik/tls/options/Options1/minVersion": "foobar",
|
|
|
|
"traefik/tls/options/Options1/maxVersion": "foobar",
|
|
|
|
"traefik/tls/options/Options1/cipherSuites/0": "foobar",
|
|
|
|
"traefik/tls/options/Options1/cipherSuites/1": "foobar",
|
|
|
|
"traefik/tls/stores/Store0/defaultCertificate/certFile": "foobar",
|
|
|
|
"traefik/tls/stores/Store0/defaultCertificate/keyFile": "foobar",
|
|
|
|
"traefik/tls/stores/Store1/defaultCertificate/certFile": "foobar",
|
|
|
|
"traefik/tls/stores/Store1/defaultCertificate/keyFile": "foobar",
|
|
|
|
"traefik/tls/certificates/0/certFile": "foobar",
|
|
|
|
"traefik/tls/certificates/0/keyFile": "foobar",
|
|
|
|
"traefik/tls/certificates/0/stores/0": "foobar",
|
|
|
|
"traefik/tls/certificates/0/stores/1": "foobar",
|
|
|
|
"traefik/tls/certificates/1/certFile": "foobar",
|
|
|
|
"traefik/tls/certificates/1/keyFile": "foobar",
|
|
|
|
"traefik/tls/certificates/1/stores/0": "foobar",
|
|
|
|
"traefik/tls/certificates/1/stores/1": "foobar",
|
|
|
|
}))
|
|
|
|
|
2022-08-11 13:42:07 +00:00
|
|
|
cfg, err := provider.buildConfiguration(context.Background())
|
2019-11-28 20:56:04 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
|
|
|
|
expected := &dynamic.Configuration{
|
|
|
|
HTTP: &dynamic.HTTPConfiguration{
|
|
|
|
Routers: map[string]*dynamic.Router{
|
|
|
|
"Router1": {
|
|
|
|
EntryPoints: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Middlewares: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Service: "foobar",
|
|
|
|
Rule: "foobar",
|
|
|
|
Priority: 42,
|
|
|
|
TLS: &dynamic.RouterTLSConfig{
|
|
|
|
Options: "foobar",
|
|
|
|
CertResolver: "foobar",
|
|
|
|
Domains: []types.Domain{
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Router0": {
|
|
|
|
EntryPoints: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Middlewares: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Service: "foobar",
|
|
|
|
Rule: "foobar",
|
|
|
|
Priority: 42,
|
|
|
|
TLS: &dynamic.RouterTLSConfig{},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Middlewares: map[string]*dynamic.Middleware{
|
|
|
|
"Middleware10": {
|
2022-10-26 15:16:05 +00:00
|
|
|
IPAllowList: &dynamic.IPAllowList{
|
2019-11-28 20:56:04 +00:00
|
|
|
SourceRange: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
IPStrategy: &dynamic.IPStrategy{
|
|
|
|
Depth: 42,
|
|
|
|
ExcludedIPs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware13": {
|
|
|
|
RateLimit: &dynamic.RateLimit{
|
|
|
|
Average: 42,
|
|
|
|
Burst: 42,
|
2020-08-17 16:04:03 +00:00
|
|
|
Period: ptypes.Duration(time.Second),
|
2019-11-28 20:56:04 +00:00
|
|
|
SourceCriterion: &dynamic.SourceCriterion{
|
|
|
|
IPStrategy: &dynamic.IPStrategy{
|
|
|
|
Depth: 42,
|
|
|
|
ExcludedIPs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
RequestHeaderName: "foobar",
|
|
|
|
RequestHost: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware19": {
|
|
|
|
StripPrefix: &dynamic.StripPrefix{
|
|
|
|
Prefixes: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2024-01-29 16:32:05 +00:00
|
|
|
ForceSlash: Bool(true),
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware00": {
|
|
|
|
AddPrefix: &dynamic.AddPrefix{
|
|
|
|
Prefix: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware02": {
|
|
|
|
Buffering: &dynamic.Buffering{
|
|
|
|
MaxRequestBodyBytes: 42,
|
|
|
|
MemRequestBodyBytes: 42,
|
|
|
|
MaxResponseBodyBytes: 42,
|
|
|
|
MemResponseBodyBytes: 42,
|
|
|
|
RetryExpression: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware04": {
|
|
|
|
CircuitBreaker: &dynamic.CircuitBreaker{
|
2022-04-05 10:30:08 +00:00
|
|
|
Expression: "foobar",
|
|
|
|
CheckPeriod: ptypes.Duration(time.Second),
|
|
|
|
FallbackDuration: ptypes.Duration(time.Second),
|
|
|
|
RecoveryDuration: ptypes.Duration(time.Second),
|
2024-01-29 09:58:05 +00:00
|
|
|
ResponseCode: 404,
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware05": {
|
2021-09-20 16:00:08 +00:00
|
|
|
Compress: &dynamic.Compress{
|
|
|
|
MinResponseBodyBytes: 42,
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
"Middleware08": {
|
|
|
|
ForwardAuth: &dynamic.ForwardAuth{
|
|
|
|
Address: "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
TLS: &dynamic.ClientTLS{
|
2019-11-28 20:56:04 +00:00
|
|
|
CA: "foobar",
|
|
|
|
Cert: "foobar",
|
|
|
|
Key: "foobar",
|
|
|
|
InsecureSkipVerify: true,
|
2024-01-29 16:32:05 +00:00
|
|
|
CAOptional: Bool(true),
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
TrustForwardHeader: true,
|
|
|
|
AuthResponseHeaders: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2020-10-07 14:36:04 +00:00
|
|
|
AuthRequestHeaders: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware06": {
|
|
|
|
DigestAuth: &dynamic.DigestAuth{
|
|
|
|
Users: dynamic.Users{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
UsersFile: "foobar",
|
|
|
|
RemoveHeader: true,
|
|
|
|
Realm: "foobar",
|
|
|
|
HeaderField: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware18": {
|
|
|
|
Retry: &dynamic.Retry{
|
|
|
|
Attempts: 42,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware16": {
|
|
|
|
ReplacePath: &dynamic.ReplacePath{
|
|
|
|
Path: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware20": {
|
|
|
|
StripPrefixRegex: &dynamic.StripPrefixRegex{
|
|
|
|
Regex: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware03": {
|
|
|
|
Chain: &dynamic.Chain{
|
|
|
|
Middlewares: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware11": {
|
|
|
|
InFlightReq: &dynamic.InFlightReq{
|
|
|
|
Amount: 42,
|
|
|
|
SourceCriterion: &dynamic.SourceCriterion{
|
|
|
|
IPStrategy: &dynamic.IPStrategy{
|
|
|
|
Depth: 42,
|
|
|
|
ExcludedIPs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
RequestHeaderName: "foobar",
|
|
|
|
RequestHost: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware12": {
|
|
|
|
PassTLSClientCert: &dynamic.PassTLSClientCert{
|
|
|
|
PEM: true,
|
|
|
|
Info: &dynamic.TLSClientCertificateInfo{
|
|
|
|
NotAfter: true,
|
|
|
|
NotBefore: true,
|
|
|
|
Sans: true,
|
2021-11-08 21:41:43 +00:00
|
|
|
Subject: &dynamic.TLSClientCertificateSubjectDNInfo{
|
2021-07-28 15:42:09 +00:00
|
|
|
Country: true,
|
|
|
|
Province: true,
|
|
|
|
Locality: true,
|
|
|
|
Organization: true,
|
|
|
|
OrganizationalUnit: true,
|
|
|
|
CommonName: true,
|
|
|
|
SerialNumber: true,
|
|
|
|
DomainComponent: true,
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
2021-11-08 21:41:43 +00:00
|
|
|
Issuer: &dynamic.TLSClientCertificateIssuerDNInfo{
|
2019-11-28 20:56:04 +00:00
|
|
|
Country: true,
|
|
|
|
Province: true,
|
|
|
|
Locality: true,
|
|
|
|
Organization: true,
|
|
|
|
CommonName: true,
|
|
|
|
SerialNumber: true,
|
|
|
|
DomainComponent: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware14": {
|
|
|
|
RedirectRegex: &dynamic.RedirectRegex{
|
|
|
|
Regex: "foobar",
|
|
|
|
Replacement: "foobar",
|
|
|
|
Permanent: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware15": {
|
|
|
|
RedirectScheme: &dynamic.RedirectScheme{
|
|
|
|
Scheme: "foobar",
|
|
|
|
Port: "foobar",
|
|
|
|
Permanent: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware01": {
|
|
|
|
BasicAuth: &dynamic.BasicAuth{
|
|
|
|
Users: dynamic.Users{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
UsersFile: "foobar",
|
|
|
|
Realm: "foobar",
|
|
|
|
RemoveHeader: true,
|
|
|
|
HeaderField: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware07": {
|
|
|
|
Errors: &dynamic.ErrorPage{
|
|
|
|
Status: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Service: "foobar",
|
|
|
|
Query: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware09": {
|
|
|
|
Headers: &dynamic.Headers{
|
|
|
|
CustomRequestHeaders: map[string]string{
|
|
|
|
"name0": "foobar",
|
|
|
|
"name1": "foobar",
|
|
|
|
},
|
|
|
|
CustomResponseHeaders: map[string]string{
|
|
|
|
"name0": "foobar",
|
|
|
|
"name1": "foobar",
|
|
|
|
},
|
|
|
|
AccessControlAllowCredentials: true,
|
|
|
|
AccessControlAllowHeaders: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
AccessControlAllowMethods: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2020-03-05 07:18:04 +00:00
|
|
|
AccessControlAllowOriginList: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2020-10-29 09:52:03 +00:00
|
|
|
AccessControlAllowOriginListRegex: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
AccessControlExposeHeaders: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
AccessControlMaxAge: 42,
|
|
|
|
AddVaryHeader: true,
|
|
|
|
AllowedHosts: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
HostsProxyHeaders: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
2024-01-29 16:32:05 +00:00
|
|
|
SSLRedirect: Bool(true),
|
|
|
|
SSLTemporaryRedirect: Bool(true),
|
|
|
|
SSLHost: String("foobar"),
|
2019-11-28 20:56:04 +00:00
|
|
|
SSLProxyHeaders: map[string]string{
|
|
|
|
"name1": "foobar",
|
|
|
|
"name0": "foobar",
|
|
|
|
},
|
2024-01-29 16:32:05 +00:00
|
|
|
SSLForceHost: Bool(true),
|
2019-11-28 20:56:04 +00:00
|
|
|
STSSeconds: 42,
|
|
|
|
STSIncludeSubdomains: true,
|
|
|
|
STSPreload: true,
|
|
|
|
ForceSTSHeader: true,
|
|
|
|
FrameDeny: true,
|
|
|
|
CustomFrameOptionsValue: "foobar",
|
|
|
|
ContentTypeNosniff: true,
|
|
|
|
BrowserXSSFilter: true,
|
|
|
|
CustomBrowserXSSValue: "foobar",
|
|
|
|
ContentSecurityPolicy: "foobar",
|
|
|
|
PublicKey: "foobar",
|
|
|
|
ReferrerPolicy: "foobar",
|
2024-01-29 16:32:05 +00:00
|
|
|
FeaturePolicy: String("foobar"),
|
2021-06-21 13:16:13 +00:00
|
|
|
PermissionsPolicy: "foobar",
|
2019-11-28 20:56:04 +00:00
|
|
|
IsDevelopment: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Middleware17": {
|
|
|
|
ReplacePathRegex: &dynamic.ReplacePathRegex{
|
|
|
|
Regex: "foobar",
|
|
|
|
Replacement: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Services: map[string]*dynamic.Service{
|
|
|
|
"Service01": {
|
|
|
|
LoadBalancer: &dynamic.ServersLoadBalancer{
|
|
|
|
Sticky: &dynamic.Sticky{
|
|
|
|
Cookie: &dynamic.Cookie{
|
|
|
|
Name: "foobar",
|
|
|
|
Secure: true,
|
|
|
|
HTTPOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Servers: []dynamic.Server{
|
|
|
|
{
|
|
|
|
URL: "foobar",
|
|
|
|
Scheme: "http",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
URL: "foobar",
|
|
|
|
Scheme: "http",
|
|
|
|
},
|
|
|
|
},
|
2021-06-25 19:08:11 +00:00
|
|
|
HealthCheck: &dynamic.ServerHealthCheck{
|
2020-02-26 16:28:04 +00:00
|
|
|
Scheme: "foobar",
|
2022-09-20 14:54:08 +00:00
|
|
|
Mode: "foobar",
|
2020-02-26 16:28:04 +00:00
|
|
|
Path: "foobar",
|
|
|
|
Port: 42,
|
2022-11-16 10:38:07 +00:00
|
|
|
Interval: ptypes.Duration(time.Second),
|
|
|
|
Timeout: ptypes.Duration(time.Second),
|
2020-02-26 16:28:04 +00:00
|
|
|
Hostname: "foobar",
|
|
|
|
FollowRedirects: func(v bool) *bool { return &v }(true),
|
2019-11-28 20:56:04 +00:00
|
|
|
Headers: map[string]string{
|
|
|
|
"name0": "foobar",
|
|
|
|
"name1": "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
PassHostHeader: func(v bool) *bool { return &v }(true),
|
|
|
|
ResponseForwarding: &dynamic.ResponseForwarding{
|
2022-11-16 10:38:07 +00:00
|
|
|
FlushInterval: ptypes.Duration(time.Second),
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Service02": {
|
|
|
|
Mirroring: &dynamic.Mirroring{
|
2020-03-05 17:03:08 +00:00
|
|
|
Service: "foobar",
|
|
|
|
MaxBodySize: func(v int64) *int64 { return &v }(42),
|
2019-11-28 20:56:04 +00:00
|
|
|
Mirrors: []dynamic.MirrorService{
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Percent: 42,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Percent: 42,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"Service03": {
|
|
|
|
Weighted: &dynamic.WeightedRoundRobin{
|
|
|
|
Services: []dynamic.WRRService{
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Weight: func(v int) *int { return &v }(42),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Weight: func(v int) *int { return &v }(42),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Sticky: &dynamic.Sticky{
|
|
|
|
Cookie: &dynamic.Cookie{
|
|
|
|
Name: "foobar",
|
|
|
|
Secure: true,
|
|
|
|
HTTPOnly: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-17 11:02:09 +00:00
|
|
|
"Service04": {
|
|
|
|
Failover: &dynamic.Failover{
|
|
|
|
Service: "foobar",
|
|
|
|
Fallback: "foobar",
|
|
|
|
},
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
TCP: &dynamic.TCPConfiguration{
|
|
|
|
Routers: map[string]*dynamic.TCPRouter{
|
|
|
|
"TCPRouter0": {
|
|
|
|
EntryPoints: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Service: "foobar",
|
|
|
|
Rule: "foobar",
|
|
|
|
TLS: &dynamic.RouterTCPTLSConfig{
|
|
|
|
Passthrough: true,
|
|
|
|
Options: "foobar",
|
|
|
|
CertResolver: "foobar",
|
|
|
|
Domains: []types.Domain{
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"TCPRouter1": {
|
|
|
|
EntryPoints: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
Service: "foobar",
|
|
|
|
Rule: "foobar",
|
|
|
|
TLS: &dynamic.RouterTCPTLSConfig{
|
|
|
|
Passthrough: true,
|
|
|
|
Options: "foobar",
|
|
|
|
CertResolver: "foobar",
|
|
|
|
Domains: []types.Domain{
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Main: "foobar",
|
|
|
|
SANs: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Services: map[string]*dynamic.TCPService{
|
|
|
|
"TCPService01": {
|
|
|
|
LoadBalancer: &dynamic.TCPServersLoadBalancer{
|
2024-01-29 16:32:05 +00:00
|
|
|
TerminationDelay: func(v int) *int { return &v }(42),
|
2019-11-28 20:56:04 +00:00
|
|
|
Servers: []dynamic.TCPServer{
|
|
|
|
{Address: "foobar"},
|
|
|
|
{Address: "foobar"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"TCPService02": {
|
|
|
|
Weighted: &dynamic.TCPWeightedRoundRobin{
|
|
|
|
Services: []dynamic.TCPWRRService{
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Weight: func(v int) *int { return &v }(42),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "foobar",
|
|
|
|
Weight: func(v int) *int { return &v }(43),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-02-20 21:24:05 +00:00
|
|
|
UDP: &dynamic.UDPConfiguration{
|
|
|
|
Routers: map[string]*dynamic.UDPRouter{
|
|
|
|
"UDPRouter0": {
|
|
|
|
EntryPoints: []string{"foobar", "foobar"},
|
|
|
|
Service: "foobar",
|
|
|
|
},
|
|
|
|
"UDPRouter1": {
|
|
|
|
EntryPoints: []string{"foobar", "foobar"},
|
|
|
|
Service: "foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Services: map[string]*dynamic.UDPService{
|
|
|
|
"UDPService01": {
|
|
|
|
LoadBalancer: &dynamic.UDPServersLoadBalancer{
|
|
|
|
Servers: []dynamic.UDPServer{
|
|
|
|
{Address: "foobar"},
|
|
|
|
{Address: "foobar"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"UDPService02": {
|
|
|
|
LoadBalancer: &dynamic.UDPServersLoadBalancer{
|
|
|
|
Servers: []dynamic.UDPServer{
|
|
|
|
{Address: "foobar"},
|
|
|
|
{Address: "foobar"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
TLS: &dynamic.TLSConfiguration{
|
|
|
|
Certificates: []*tls.CertAndStores{
|
|
|
|
{
|
|
|
|
Certificate: tls.Certificate{
|
2024-01-11 16:06:06 +00:00
|
|
|
CertFile: types.FileOrContent("foobar"),
|
|
|
|
KeyFile: types.FileOrContent("foobar"),
|
2021-08-23 08:13:31 +00:00
|
|
|
OCSP: tls.OCSPConfig{
|
|
|
|
DisableStapling: false,
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
Stores: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Certificate: tls.Certificate{
|
2024-01-11 16:06:06 +00:00
|
|
|
CertFile: types.FileOrContent("foobar"),
|
|
|
|
KeyFile: types.FileOrContent("foobar"),
|
2021-08-23 08:13:31 +00:00
|
|
|
OCSP: tls.OCSPConfig{
|
|
|
|
DisableStapling: false,
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
Stores: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Options: map[string]tls.Options{
|
|
|
|
"Options0": {
|
|
|
|
MinVersion: "foobar",
|
|
|
|
MaxVersion: "foobar",
|
|
|
|
CipherSuites: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
CurvePreferences: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
ClientAuth: tls.ClientAuth{
|
2024-01-11 16:06:06 +00:00
|
|
|
CAFiles: []types.FileOrContent{
|
|
|
|
types.FileOrContent("foobar"),
|
|
|
|
types.FileOrContent("foobar"),
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
ClientAuthType: "foobar",
|
|
|
|
},
|
|
|
|
SniStrict: true,
|
2021-08-20 16:20:06 +00:00
|
|
|
ALPNProtocols: []string{
|
|
|
|
"h2",
|
|
|
|
"http/1.1",
|
|
|
|
"acme-tls/1",
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
"Options1": {
|
|
|
|
MinVersion: "foobar",
|
|
|
|
MaxVersion: "foobar",
|
|
|
|
CipherSuites: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
CurvePreferences: []string{
|
|
|
|
"foobar",
|
|
|
|
"foobar",
|
|
|
|
},
|
|
|
|
ClientAuth: tls.ClientAuth{
|
2024-01-11 16:06:06 +00:00
|
|
|
CAFiles: []types.FileOrContent{
|
|
|
|
types.FileOrContent("foobar"),
|
|
|
|
types.FileOrContent("foobar"),
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
ClientAuthType: "foobar",
|
|
|
|
},
|
|
|
|
SniStrict: true,
|
2021-08-20 16:20:06 +00:00
|
|
|
ALPNProtocols: []string{
|
|
|
|
"h2",
|
|
|
|
"http/1.1",
|
|
|
|
"acme-tls/1",
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Stores: map[string]tls.Store{
|
|
|
|
"Store0": {
|
|
|
|
DefaultCertificate: &tls.Certificate{
|
2024-01-11 16:06:06 +00:00
|
|
|
CertFile: types.FileOrContent("foobar"),
|
|
|
|
KeyFile: types.FileOrContent("foobar"),
|
2021-08-23 08:13:31 +00:00
|
|
|
OCSP: tls.OCSPConfig{
|
|
|
|
DisableStapling: false,
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"Store1": {
|
|
|
|
DefaultCertificate: &tls.Certificate{
|
2024-01-11 16:06:06 +00:00
|
|
|
CertFile: types.FileOrContent("foobar"),
|
|
|
|
KeyFile: types.FileOrContent("foobar"),
|
2021-08-23 08:13:31 +00:00
|
|
|
OCSP: tls.OCSPConfig{
|
|
|
|
DisableStapling: false,
|
|
|
|
},
|
2019-11-28 20:56:04 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.Equal(t, expected, cfg)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Test_buildConfiguration_KV_error(t *testing.T) {
|
|
|
|
provider := &Provider{
|
|
|
|
RootKey: "traefik",
|
|
|
|
kvClient: &Mock{
|
|
|
|
Error: KvError{
|
|
|
|
List: errors.New("OOPS"),
|
|
|
|
},
|
|
|
|
KVPairs: mapToPairs(map[string]string{
|
|
|
|
"traefik/foo": "bar",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-08-11 13:42:07 +00:00
|
|
|
cfg, err := provider.buildConfiguration(context.Background())
|
2019-11-28 20:56:04 +00:00
|
|
|
require.Error(t, err)
|
|
|
|
assert.Nil(t, cfg)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestKvWatchTree(t *testing.T) {
|
|
|
|
returnedChans := make(chan chan []*store.KVPair)
|
|
|
|
provider := Provider{
|
|
|
|
kvClient: &Mock{
|
|
|
|
WatchTreeMethod: func() <-chan []*store.KVPair {
|
|
|
|
c := make(chan []*store.KVPair, 10)
|
|
|
|
returnedChans <- c
|
|
|
|
return c
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
configChan := make(chan dynamic.Message)
|
|
|
|
go func() {
|
2020-02-10 15:03:39 +00:00
|
|
|
err := provider.watchKv(context.Background(), configChan)
|
2019-11-28 20:56:04 +00:00
|
|
|
require.NoError(t, err)
|
|
|
|
}()
|
|
|
|
|
|
|
|
select {
|
|
|
|
case c1 := <-returnedChans:
|
|
|
|
c1 <- []*store.KVPair{}
|
|
|
|
<-configChan
|
|
|
|
close(c1) // WatchTree chans can close due to error
|
|
|
|
case <-time.After(1 * time.Second):
|
|
|
|
t.Fatalf("Failed to create a new WatchTree chan")
|
|
|
|
}
|
|
|
|
|
|
|
|
select {
|
|
|
|
case c2 := <-returnedChans:
|
|
|
|
c2 <- []*store.KVPair{}
|
|
|
|
<-configChan
|
|
|
|
case <-time.After(1 * time.Second):
|
|
|
|
t.Fatalf("Failed to create a new WatchTree chan")
|
|
|
|
}
|
|
|
|
|
|
|
|
select {
|
|
|
|
case <-configChan:
|
|
|
|
t.Fatalf("configChan should be empty")
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func mapToPairs(in map[string]string) []*store.KVPair {
|
|
|
|
var out []*store.KVPair
|
|
|
|
for k, v := range in {
|
|
|
|
out = append(out, &store.KVPair{Key: k, Value: []byte(v)})
|
|
|
|
}
|
|
|
|
return out
|
|
|
|
}
|