diff --git a/docs/content/contributing/data-collection.md b/docs/content/contributing/data-collection.md index 8a6faa405..467584d7c 100644 --- a/docs/content/contributing/data-collection.md +++ b/docs/content/contributing/data-collection.md @@ -14,9 +14,9 @@ For this very reason, the sendAnonymousUsage option is mandatory: we want you to ??? example "Enabling Data Collection with TOML" ```toml - [Global] - # Send anonymous usage data - sendAnonymousUsage = true + [global] + # Send anonymous usage data + sendAnonymousUsage = true ``` ??? example "Enabling Data Collection with the CLI" @@ -51,24 +51,23 @@ Once a day (the first call begins 10 minutes after the start of Traefik), we col ```toml [entryPoints] - [entryPoints.web] - address = ":80" + [entryPoints.web] + address = ":80" [api] - [Docker] + [providers.docker] endpoint = "tcp://10.10.10.10:2375" - domain = "foo.bir" exposedByDefault = true swarmMode = true - [Docker.TLS] + [providers.docker.TLS] ca = "dockerCA" cert = "dockerCert" key = "dockerKey" insecureSkipVerify = true - [ECS] + [providers.ecs] domain = "foo.bar" exposedByDefault = true clusters = ["foo-bar"] @@ -81,24 +80,24 @@ Once a day (the first call begins 10 minutes after the start of Traefik), we col ```toml [entryPoints] - [entryPoints.web] - address = ":80" + [entryPoints.web] + address = ":80" [api] - [Docker] + [providers.docker] endpoint = "xxxx" domain = "xxxx" exposedByDefault = true swarmMode = true - [Docker.TLS] + [providers.docker.TLS] ca = "xxxx" cert = "xxxx" key = "xxxx" insecureSkipVerify = false - [ECS] + [providers.ecs] domain = "xxxx" exposedByDefault = true clusters = [] diff --git a/docs/content/getting-started/configuration-overview.md b/docs/content/getting-started/configuration-overview.md index 2a8861488..a24aa7b7f 100644 --- a/docs/content/getting-started/configuration-overview.md +++ b/docs/content/getting-started/configuration-overview.md @@ -6,7 +6,7 @@ How the Magic Happens ![Configuration](../assets/img/static-dynamic-configuration.png) Configuration in Traefik can refer to two different things: - + - The fully dynamic routing configuration (referred to as the _dynamic configuration_) - The startup configuration (referred to as the _static configuration_) @@ -24,7 +24,7 @@ This configuration can change and is seamlessly hot-reloaded, without any reques Traefik gets its _dynamic configuration_ from [providers](../providers/overview.md): whether an orchestrator, a service registry, or a plain old configuration file. Since this configuration is specific to your infrastructure choices, we invite you to refer to the [dedicated section of this documentation](../providers/overview.md). !!! Note - + In the [Quick Start example](../getting-started/quick-start.md), the dynamic configuration comes from docker in the form of labels attached to your containers. !!! Note diff --git a/docs/content/getting-started/quick-start.md b/docs/content/getting-started/quick-start.md index c6e976184..abe74af88 100644 --- a/docs/content/getting-started/quick-start.md +++ b/docs/content/getting-started/quick-start.md @@ -14,13 +14,18 @@ version: '3' services: reverse-proxy: - image: traefik:v2.0 # The official v2.0 Traefik docker image - command: --api --providers.docker # Enables the web UI and tells Traefik to listen to docker + # The official v2.0 Traefik docker image + image: traefik:v2.0 + # Enables the web UI and tells Traefik to listen to docker + command: --api --providers.docker ports: - - "80:80" # The HTTP port - - "8080:8080" # The Web UI (enabled by --api) + # The HTTP port + - "80:80" + # The Web UI (enabled by --api) + - "8080:8080" volumes: - - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events + # So that Traefik can listen to the Docker events + - /var/run/docker.sock:/var/run/docker.sock ``` **That's it. Now you can launch Traefik!** @@ -42,7 +47,8 @@ Edit your `docker-compose.yml` file and add the following at the end of your fil ```yaml # ... whoami: - image: containous/whoami # A container that exposes an API to show its IP address + # A container that exposes an API to show its IP address + image: containous/whoami labels: - "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)" ``` diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index ef75ecf5d..e75d26e00 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -12,56 +12,103 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom ??? example "Enabling ACME" - ```toml - [entryPoints] - [entryPoints.web] - address = ":80" - - [entryPoints.http-tls] - address = ":443" - - [acme] # every router with TLS enabled will now be able to use ACME for its certificates - email = "your-email@your-domain.org" - storage = "acme.json" - onHostRule = true # dynamic generation based on the Host() & HostSNI() matchers - [acme.httpChallenge] - entryPoint = "web" # used during the challenge - ``` - -??? example "Configuring Wildcard Certificates" - - ```toml + ```toml tab="TOML" [entryPoints] [entryPoints.web] address = ":80" - + [entryPoints.http-tls] address = ":443" + + # every router with TLS enabled will now be able to use ACME for its certificates + [acme] + email = "your-email@your-domain.org" + storage = "acme.json" + # dynamic generation based on the Host() & HostSNI() matchers + onHostRule = true + [acme.httpChallenge] + # used during the challenge + entryPoint = "web" + ``` + + ```yaml tab="YAML" + entryPoints: + web: + address: ":80" + + http-tls: + address: ":443" + + # every router with TLS enabled will now be able to use ACME for its certificates + acme: + email: your-email@your-domain.org + storage: acme.json + # dynamic generation based on the Host() & HostSNI() matchers + onHostRule: true + httpChallenge: + # used during the challenge + entryPoint: web + ``` +??? example "Configuring Wildcard Certificates" + + ```toml tab="TOML" + [entryPoints] + [entryPoints.web] + address = ":80" + + [entryPoints.http-tls] + address = ":443" + [acme] email = "your-email@your-domain.org" storage = "acme.json" [acme.dnsChallenge] provider = "xxx" - + [[acme.domains]] main = "*.mydomain.com" sans = ["mydomain.com"] ``` + + ```yaml tab="YAML" + entryPoints: + web: + address: ":80" + + http-tls: + address: ":443" + + acme: + email: your-email@your-domain.org + storage: acme.json + dnsChallenge: + provide: xxx + + domains: + - main: "*.mydomain.com" + sans: + - mydomain.com + ``` ??? note "Configuration Reference" - There are many available options for ACME. For a quick glance at what's possible, browse the configuration reference: + There are many available options for ACME. + For a quick glance at what's possible, browse the configuration reference: - ```toml + ```toml tab="TOML" --8<-- "content/https/ref-acme.toml" ``` + + ```yaml tab="YAML" + --8<-- "content/https/ref-acme.yaml" + ``` ## Automatic Renewals Traefik automatically tracks the expiry date of ACME certificates it generates. -If there are less than 30 days remaining before the certificate expires, Traefik will attempt to rewnew it automatically. +If there are less than 30 days remaining before the certificate expires, Traefik will attempt to renew it automatically. !!! note Certificates that are no longer used may still be renewed, as Traefik does not currently check if the certificate is being used before renewing. @@ -77,9 +124,14 @@ when using the `TLS-ALPN-01` challenge, Traefik must be reachable by Let's Encry ??? example "Configuring the `tlsChallenge`" - ```toml + ```toml tab="TOML" [acme] - [acme.tlsChallenge] + [acme.tlsChallenge] + ``` + + ```yaml tab="YAML" + acme: + tlsChallenge: {} ``` ### `httpChallenge` @@ -91,11 +143,18 @@ when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reac ??? example "Using an EntryPoint Called http for the `httpChallenge`" - ```toml + ```toml tab="TOML" [acme] - # ... - [acme.httpChallenge] - entryPoint = "http" + # ... + [acme.httpChallenge] + entryPoint = "http" + ``` + + ```yaml tab="YAML" + acme: + # ... + httpChallenge: + entryPoint: http ``` !!! note @@ -107,12 +166,21 @@ Use the `DNS-01` challenge to generate and renew ACME certificates by provisioni ??? example "Configuring a `dnsChallenge` with the DigitalOcean Provider" - ```toml + ```toml tab="TOML" [acme] - # ... - [acme.dnsChallenge] - provider = "digitalocean" - delayBeforeCheck = 0 + # ... + [acme.dnsChallenge] + provider = "digitalocean" + delayBeforeCheck = 0 + # ... + ``` + + ```yaml tab="YAML" + acme: + # ... + dnsChallenge: + provider: digitalocean + delayBeforeCheck: 0 # ... ``` @@ -200,12 +268,22 @@ For example, `CF_API_EMAIL_FILE=/run/secrets/traefik_cf-api-email` could be used Use custom DNS servers to resolve the FQDN authority. -```toml +```toml tab="TOML" [acme] - # ... - [acme.dnsChallenge] - # ... - resolvers = ["1.1.1.1:53", "8.8.8.8:53"] + # ... + [acme.dnsChallenge] + # ... + resolvers = ["1.1.1.1:53", "8.8.8.8:53"] +``` + +```yaml tab="YAML" +acme: + # ... + dnsChallenge: + # ... + resolvers: + - "1.1.1.1:53" + - "8.8.8.8:53" ``` #### Wildcard Domains @@ -213,12 +291,23 @@ Use custom DNS servers to resolve the FQDN authority. [ACME V2](https://community.letsencrypt.org/t/acme-v2-and-wildcard-certificate-support-is-live/55579) supports wildcard certificates. As described in [Let's Encrypt's post](https://community.letsencrypt.org/t/staging-endpoint-for-acme-v2/49605) wildcard certificates can only be generated through a [`DNS-01` challenge](#dnschallenge). -```toml +```toml tab="TOML" [acme] - # ... - [[acme.domains]] - main = "*.local1.com" - sans = ["local1.com"] + # ... + [[acme.domains]] + main = "*.local1.com" + sans = ["local1.com"] + +# ... +``` + +```yaml tab="YAML" +acme: + # ... + domains: + - main: "*.local1.com" + sans: + - local1.com # ... ``` @@ -240,17 +329,33 @@ You can set SANs (alternative domains) for each main domain. Every domain must have A/AAAA records pointing to Traefik. Each domain & SAN will lead to a certificate request. -```toml +```toml tab="TOML" [acme] - # ... - [[acme.domains]] - main = "local1.com" - sans = ["test1.local1.com", "test2.local1.com"] - [[acme.domains]] - main = "local2.com" - [[acme.domains]] - main = "*.local3.com" - sans = ["local3.com", "test1.test1.local3.com"] + # ... + [[acme.domains]] + main = "local1.com" + sans = ["test1.local1.com", "test2.local1.com"] + [[acme.domains]] + main = "local2.com" + [[acme.domains]] + main = "*.local3.com" + sans = ["local3.com", "test1.test1.local3.com"] +# ... +``` + +```yaml tab="YAML" +acme: + # ... + domains: + - main: "local1.com" + sans: + - "test1.local1.com" + - "test2.local1.com" + - main: "local2.com" + - main: "*.local3.com" + sans: + - "local3.com" + - "test1.test1.local3.com" # ... ``` @@ -264,11 +369,18 @@ Each domain & SAN will lead to a certificate request. ??? example "Using the Let's Encrypt staging server" - ```toml + ```toml tab="TOML" [acme] - # ... - caServer = "https://acme-staging-v02.api.letsencrypt.org/directory" - # ... + # ... + caServer = "https://acme-staging-v02.api.letsencrypt.org/directory" + # ... + ``` + + ```yaml tab="YAML" + acme: + # ... + caServer: https://acme-staging-v02.api.letsencrypt.org/directory + # ... ``` ## `onHostRule` @@ -277,11 +389,18 @@ Enable certificate generation on [routers](../routing/routers/index.md) `Host` & This will request a certificate from Let's Encrypt for each router with a Host rule. -```toml +```toml tab="TOML" [acme] - # ... - onHostRule = true - # ... + # ... + onHostRule = true + # ... +``` + +```yaml tab="YAML" +acme: + # ... + onHostRule: true + # ... ``` !!! note "Multiple Hosts in a Rule" @@ -294,17 +413,23 @@ This will request a certificate from Let's Encrypt for each router with a Host r The `storage` option sets the location where your ACME certificates are saved to. -```toml +```toml tab="TOML" [acme] - # ... - storage = "acme.json" - # ... + # ... + storage = "acme.json" + # ... ``` -The value can refer to two kinds of storage: +```yaml tab="YAML" +acme + # ... + storage: acme.json + # ... +``` + +The value can refer to some kinds of storage: - a JSON file -- a KV store entry ### In a File @@ -323,19 +448,6 @@ docker run -v "/my/host/acme:/etc/traefik/acme" traefik !!! warning For concurrency reason, this file cannot be shared across multiple instances of Traefik. Use a key value store entry instead. -### In a a Key Value Store Entry - -ACME certificates can be stored in a key-value store entry. - -```toml -storage = "traefik/acme/account" -``` - -!!! note "Storage Size" - - Because key-value stores have limited entry size, the certificates list is compressed _before_ it is saved. - For example, it is possible to store up to _approximately_ 100 ACME certificates in Consul. - ## Fallback If Let's Encrypt is not reachable, the following certificates will apply: diff --git a/docs/content/https/ref-acme.toml b/docs/content/https/ref-acme.toml index 4cc44f8e7..b3a1fc031 100644 --- a/docs/content/https/ref-acme.toml +++ b/docs/content/https/ref-acme.toml @@ -7,31 +7,11 @@ # email = "test@traefik.io" -# File used for certificates storage. -# -# Optional (Deprecated) -# -#storageFile = "acme.json" - # File or key used for certificates storage. # # Required # storage = "acme.json" -# or `storage = "traefik/acme/account"` if using KV store. - -# Deprecated, replaced by [acme.dnsChallenge]. -# -# Optional. -# -# dnsProvider = "digitalocean" - -# Deprecated, replaced by [acme.dnsChallenge.delayBeforeCheck]. -# -# Optional -# Default: 0 -# -# delayDontCheckDNS = 0 # If true, display debug log messages from the acme client library. # @@ -47,14 +27,7 @@ storage = "acme.json" # # overrideCertificates = true -# Deprecated. Enable on demand certificate generation. -# -# Optional -# Default: false -# -# onDemand = true - -# Enable certificate generation on frontends host rules. +# Enable certificate generation on routers host rules. # # Optional # Default: false @@ -95,7 +68,7 @@ storage = "acme.json" # # Required # - # entryPoint = "http" + # entryPoint = "web" # Use a DNS-01 ACME challenge rather than HTTP-01 challenge. # Note: mandatory for wildcard certificate generation. diff --git a/docs/content/https/ref-acme.yaml b/docs/content/https/ref-acme.yaml new file mode 100644 index 000000000..23cd9b7a6 --- /dev/null +++ b/docs/content/https/ref-acme.yaml @@ -0,0 +1,127 @@ +# Enable ACME (Let's Encrypt): automatic SSL. +acme: + + # Email address used for registration. + # + # Required + # + email: "test@traefik.io" + + # File or key used for certificates storage. + # + # Required + # + storage: "acme.json" + + # If true, display debug log messages from the acme client library. + # + # Optional + # Default: false + # + # acmeLogging: true + + # If true, override certificates in key-value store when using storeconfig. + # + # Optional + # Default: false + # + # overrideCertificates: true + + # Enable certificate generation on routers host rules. + # + # Optional + # Default: false + # + # onHostRule: true + + # CA server to use. + # Uncomment the line to use Let's Encrypt's staging server, + # leave commented to go to prod. + # + # Optional + # Default: "https://acme-v02.api.letsencrypt.org/directory" + # + # caServer: "https://acme-staging-v02.api.letsencrypt.org/directory" + + # KeyType to use. + # + # Optional + # Default: "RSA4096" + # + # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192" + # + # KeyType: RSA4096 + + # Use a TLS-ALPN-01 ACME challenge. + # + # Optional (but recommended) + # + tlsChallenge: + + # Use a HTTP-01 ACME challenge. + # + # Optional + # + # httpChallenge: + + # EntryPoint to use for the HTTP-01 challenges. + # + # Required + # + # entryPoint: web + + # Use a DNS-01 ACME challenge rather than HTTP-01 challenge. + # Note: mandatory for wildcard certificate generation. + # + # Optional + # + # dnsChallenge: + + # DNS provider used. + # + # Required + # + # provider: digitalocean + + # By default, the provider will verify the TXT DNS challenge record before letting ACME verify. + # If delayBeforeCheck is greater than zero, this check is delayed for the configured duration in seconds. + # Useful if internal networks block external DNS queries. + # + # Optional + # Default: 0 + # + # delayBeforeCheck: 0 + + # Use following DNS servers to resolve the FQDN authority. + # + # Optional + # Default: empty + # + # resolvers + # - "1.1.1.1:53" + # - "8.8.8.8:53" + + # Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. + # + # NOT RECOMMENDED: + # Increase the risk of reaching Let's Encrypt's rate limits. + # + # Optional + # Default: false + # + # disablePropagationCheck: true + + # Domains list. + # Only domains defined here can generate wildcard certificates. + # The certificates for these domains are negotiated at traefik startup only. + # + # domains: + # - main: "local1.com" + # sans: + # - "test1.local1.com" + # - "test2.local1.com" + # - main: "local2.com" + # - main: "*.local3.com" + # sans: + # - "local3.com" + # - "test1.test1.local3.com" diff --git a/docs/content/https/tls.md b/docs/content/https/tls.md index 541495ce2..84dacda11 100644 --- a/docs/content/https/tls.md +++ b/docs/content/https/tls.md @@ -13,7 +13,7 @@ See the [Let's Encrypt](./acme.md) page. To add / remove TLS certificates, even when Traefik is already running, their definition can be added to the [dynamic configuration](../getting-started/configuration-overview.md), in the `[[tls.certificates]]` section: -```toml +```toml tab="TOML" [[tls.certificates]] certFile = "/path/to/domain.cert" keyFile = "/path/to/domain.key" @@ -23,6 +23,15 @@ To add / remove TLS certificates, even when Traefik is already running, their de keyFile = "/path/to/other-domain.key" ``` +```yaml tab="YAML" +tls: + certificates: + - certFile: /path/to/domain.cert + keyFile: /path/to/domain.key + - certFile: /path/to/other-domain.cert + keyFile: /path/to/other-domain.key +``` + !!! important "File Provider Only" In the above example, we've used the [file provider](../providers/file.md) to handle these definitions. @@ -32,23 +41,29 @@ To add / remove TLS certificates, even when Traefik is already running, their de In Traefik, certificates are grouped together in certificates stores, which are defined as such: -```toml +```toml tab="TOML" [tls.stores] [tls.stores.default] ``` +```yaml tab="YAML" +tls: + stores: + default: {} +``` + !!! important "Alpha restriction" During the alpha version, any store definition other than the default one (named `default`) will be ignored, and there is thefore only one globally available TLS store. -In the `[[tls.certificates]]` section, a list of stores can then be specified to indicate where the certificates should be stored: +In the `tls.certificates` section, a list of stores can then be specified to indicate where the certificates should be stored: -```toml +```toml tab="TOML" [[tls.certificates]] - stores = ["default"] certFile = "/path/to/domain.cert" keyFile = "/path/to/domain.key" + stores = ["default"] [[tls.certificates]] # Note that since no store is defined, @@ -57,6 +72,19 @@ In the `[[tls.certificates]]` section, a list of stores can then be specified to keyFile = "/path/to/other-domain.key" ``` +```yaml tab="YAML" +tls: + certificates: + - certFile: /path/to/domain.cert + keyFile: /path/to/domain.key + stores: + - default + # Note that since no store is defined, + # the certificate below will be stored in the `default` store. + - certFile: /path/to/other-domain.cert + keyFile: /path/to/other-domain.key +``` + !!! important "Alpha restriction" During the alpha version, the `stores` list will actually be ignored and automatically set to `["default"]`. @@ -66,7 +94,7 @@ In the `[[tls.certificates]]` section, a list of stores can then be specified to Traefik can use a default certificate for connections without a SNI, or without a matching domain. This default certificate should be defined in a TLS store: -```toml +```toml tab="TOML" [tls.stores] [tls.stores.default] [tls.stores.default.defaultCertificate] @@ -74,6 +102,15 @@ This default certificate should be defined in a TLS store: keyFile = "path/to/cert.key" ``` +```yaml tab="YAML" +tls: + stores: + default: + defaultCertificate: + certFile: path/to/cert.crt + keyFile: path/to/cert.key +``` + If no default certificate is provided, Traefik generates and uses a self-signed certificate. ## TLS Options @@ -82,7 +119,7 @@ The TLS options allow one to configure some parameters of the TLS connection. ### Minimum TLS Version -```toml +```toml tab="TOML" [tls.options] [tls.options.default] @@ -92,6 +129,16 @@ The TLS options allow one to configure some parameters of the TLS connection. minVersion = "VersionTLS13" ``` +```yaml tab="YAML" +tls: + options: + default: + minVersion: VersionTLS12 + + mintls13: + minVersion: VersionTLS13 +``` + ### Mutual Authentication Traefik supports both optional and strict (which is the default) mutual authentication, though the `ClientCA.files` section. @@ -102,20 +149,32 @@ For clients with a certificate, the `optional` option governs the behaviour as f - When `optional = false`, Traefik accepts connections only from clients presenting a certificate signed by a CA listed in `ClientCA.files`. - When `optional = true`, Traefik authorizes connections from clients presenting a certificate signed by an unknown CA. -```toml +```toml tab="TOML" [tls.options] [tls.options.default] - [tls.options.default.ClientCA] + [tls.options.default.clientCA] # in PEM format. each file can contain multiple CAs. files = ["tests/clientca1.crt", "tests/clientca2.crt"] optional = false ``` +```yaml tab="YAML" +tls: + options: + default: + clientCA: + # in PEM format. each file can contain multiple CAs. + files: + - tests/clientca1.crt + - tests/clientca2.crt + optional: false +``` + ### Cipher Suites See [cipherSuites](https://godoc.org/crypto/tls#pkg-constants) for more information. -```toml +```toml tab="TOML" [tls.options] [tls.options.default] cipherSuites = [ @@ -124,13 +183,29 @@ See [cipherSuites](https://godoc.org/crypto/tls#pkg-constants) for more informat ] ``` +```yaml tab="YAML" +tls: + options: + default: + cipherSuites: + - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + - TLS_RSA_WITH_AES_256_GCM_SHA384 +``` + ### Strict SNI Checking With strict SNI checking, Traefik won't allow connections from clients connections that do not specify a server_name extension. -```toml +```toml tab="TOML" [tls.options] [tls.options.default] sniStrict = true ``` + +```yaml tab="YAML" +tls: + options: + default: + sniStrict: true +``` diff --git a/docs/content/middlewares/addprefix.md b/docs/content/middlewares/addprefix.md index 5f3ce6298..0c3ffe998 100644 --- a/docs/content/middlewares/addprefix.md +++ b/docs/content/middlewares/addprefix.md @@ -41,8 +41,8 @@ labels: ```toml tab="File" # Prefixing with /foo [http.middlewares] - [http.middlewares.add-foo.AddPrefix] - prefix = "/foo" + [http.middlewares.add-foo.addPrefix] + prefix = "/foo" ``` ## Configuration Options diff --git a/docs/content/middlewares/basicauth.md b/docs/content/middlewares/basicauth.md index 45455f654..b132eec2c 100644 --- a/docs/content/middlewares/basicauth.md +++ b/docs/content/middlewares/basicauth.md @@ -47,7 +47,7 @@ labels: ```toml tab="File" # Declaring the user list [http.middlewares] - [http.middlewares.test-auth.basicauth] + [http.middlewares.test-auth.basicAuth] users = [ "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", @@ -61,7 +61,7 @@ labels: Passwords must be encoded using MD5, SHA1, or BCrypt. !!! tip - + Use `htpasswd` to generate the passwords. ### `users` @@ -120,7 +120,7 @@ spec: ``` ```toml tab="File" -[http.middlewares.my-auth.basicauth] +[http.middlewares.my-auth.basicAuth] # ... headerField = "X-WebAuth-User" ``` diff --git a/docs/content/middlewares/buffering.md b/docs/content/middlewares/buffering.md index ce76b6599..c29ec3991 100644 --- a/docs/content/middlewares/buffering.md +++ b/docs/content/middlewares/buffering.md @@ -46,7 +46,7 @@ labels: # Sets the maximum request body to 2Mb [http.middlewares] [http.middlewares.limit.buffering] - maxRequestBodyBytes = 250000 + maxRequestBodyBytes = 250000 ``` ## Configuration Options diff --git a/docs/content/middlewares/chain.md b/docs/content/middlewares/chain.md index 79d5444a4..09b16ad95 100644 --- a/docs/content/middlewares/chain.md +++ b/docs/content/middlewares/chain.md @@ -111,27 +111,27 @@ labels: ```toml tab="File" # ... [http.routers] - [http.routers.router1] - service = "service1" - middlewares = ["secured"] - rule = "Host(`mydomain`)" + [http.routers.router1] + service = "service1" + middlewares = ["secured"] + rule = "Host(`mydomain`)" [http.middlewares] - [http.middlewares.secured.Chain] - middlewares = ["https-only", "known-ips", "auth-users"] + [http.middlewares.secured.chain] + middlewares = ["https-only", "known-ips", "auth-users"] - [http.middlewares.auth-users.BasicAuth] - users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] + [http.middlewares.auth-users.basicAuth] + users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] - [http.middlewares.https-only.redirectScheme] - scheme = "https" + [http.middlewares.https-only.redirectScheme] + scheme = "https" - [http.middlewares.known-ips.ipWhiteList] - sourceRange = ["192.168.1.7", "127.0.0.1/32"] + [http.middlewares.known-ips.ipWhiteList] + sourceRange = ["192.168.1.7", "127.0.0.1/32"] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:80" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:80" ``` diff --git a/docs/content/middlewares/circuitbreaker.md b/docs/content/middlewares/circuitbreaker.md index 1a970c24a..1d837a5ed 100644 --- a/docs/content/middlewares/circuitbreaker.md +++ b/docs/content/middlewares/circuitbreaker.md @@ -55,8 +55,8 @@ labels: ```toml tab="File" # Latency Check [http.middlewares] - [http.middlewares.latency-check.circuitBreaker] - expression = "LatencyAtQuantileMS(50.0) > 100" + [http.middlewares.latency-check.circuitBreaker] + expression = "LatencyAtQuantileMS(50.0) > 100" ``` ## Possible States @@ -66,7 +66,7 @@ There are three possible states for your circuit breaker: - Close (your service operates normally) - Open (the fallback mechanism takes over your service) - Recovering (the circuit breaker tries to resume normal operations by progressively sending requests to your service) - + ### Close While close, the circuit breaker only collects metrics to analyze the behavior of the requests. @@ -95,7 +95,7 @@ The `expression` can check three different metrics: - The network error ratio (`NetworkErrorRatio`) - The status code ratio (`ResponseCodeRatio`) - The latency at quantile, in milliseconds (`LatencyAtQuantileMS`) - + #### `NetworkErrorRatio` If you want the circuit breaker to trigger at a 30% ratio of network errors, the expression will be `NetworkErrorRatio() > 0.30` @@ -151,7 +151,7 @@ Here is the list of supported operators: ### Fallback mechanism The fallback mechanism returns a `HTTP 503 Service Unavailable` to the client (instead of calling the target service). This behavior cannot be configured. - + ### `CheckPeriod` The interval used to evaluate `expression` and decide if the state of the circuit breaker must change. By default, `CheckPeriod` is 100Ms. This value cannot be configured. diff --git a/docs/content/middlewares/compress.md b/docs/content/middlewares/compress.md index eb1531a44..67d0b7b08 100644 --- a/docs/content/middlewares/compress.md +++ b/docs/content/middlewares/compress.md @@ -40,7 +40,7 @@ labels: ```toml tab="File" # Enable gzip compression [http.middlewares] - [http.middlewares.test-compress.Compress] + [http.middlewares.test-compress.compress] ``` ## Notes diff --git a/docs/content/middlewares/digestauth.md b/docs/content/middlewares/digestauth.md index 70b6a97a6..d0d00d22b 100644 --- a/docs/content/middlewares/digestauth.md +++ b/docs/content/middlewares/digestauth.md @@ -53,7 +53,7 @@ labels: ## Configuration Options -### `Users` +### `users` The `users` option is an array of authorized users. Each user will be declared using the `name:realm:encoded-password` format. @@ -61,7 +61,7 @@ The `users` option is an array of authorized users. Each user will be declared u If both `users` and `usersFile` are provided, the two are merged. The content of `usersFile` has precedence over `users`. -### `UsersFile` +### `usersFile` The `usersFile` option is the path to an external file that contains the authorized users for the middleware. @@ -78,11 +78,11 @@ The file content is a list of `name:realm:encoded-password`. If both `users` and `usersFile` are provided, the two are merged. The content of `usersFile` has precedence over `users`. -### `Realm` +### `realm` You can customize the realm for the authentication with the `realm` option. The default value is `traefik`. -### `HeaderField` +### `headerField` You can customize the header field for the authenticated user using the `headerField`option. @@ -121,6 +121,6 @@ labels: headerField = "X-WebAuth-User" ``` -### `RemoveHeader` +### `removeHeader` Set the `removeHeader` option to `true` to remove the authorization header before forwarding the request to your service. (Default value is `false`.) diff --git a/docs/content/middlewares/errorpages.md b/docs/content/middlewares/errorpages.md index 6e4b21c1f..601d73b5c 100644 --- a/docs/content/middlewares/errorpages.md +++ b/docs/content/middlewares/errorpages.md @@ -52,7 +52,7 @@ labels: ```toml tab="File" # Custom Error Page for 5XX [http.middlewares] - [http.middlewares.test-errorpage.Errors] + [http.middlewares.test-errorpage.errors] status = ["500-599"] service = "serviceError" query = "/{status}.html" diff --git a/docs/content/middlewares/forwardauth.md b/docs/content/middlewares/forwardauth.md index 63fc37c44..7c96bbd9b 100644 --- a/docs/content/middlewares/forwardauth.md +++ b/docs/content/middlewares/forwardauth.md @@ -14,14 +14,14 @@ Otherwise, the response from the authentication server is returned. ```yaml tab="Docker" # Forward authentication to authserver.com labels: -- "traefik.http.middlewares.test-auth.ForwardAuth.Address=https://authserver.com/auth" -- "traefik.http.middlewares.test-auth.ForwardAuth.AuthResponseHeaders=X-Auth-User, X-Secret" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CA=path/to/local.crt" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CAOptional=true" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Cert=path/to/foo.cert" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.InsecureSkipVerify=true" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Key=path/to/foo.key" -- "traefik.http.middlewares.test-auth.ForwardAuth.TrustForwardHeader=true" +- "traefik.http.middlewares.test-auth.forwardauth.address=https://authserver.com/auth" +- "traefik.http.middlewares.test-auth.forwardauth.authResponseHeaders=X-Auth-User, X-Secret" +- "traefik.http.middlewares.test-auth.forwardauth.tls.ca=path/to/local.crt" +- "traefik.http.middlewares.test-auth.forwardauth.tls.caOptional=true" +- "traefik.http.middlewares.test-auth.forwardauth.tls.cert=path/to/foo.cert" +- "traefik.http.middlewares.test-auth.forwardauth.tls.insecureSkipVerify=true" +- "traefik.http.middlewares.test-auth.forwardauth.tls.key=path/to/foo.key" +- "traefik.http.middlewares.test-auth.forwardauth.trustForwardHeader=true" ``` ```yaml tab="Kubernetes" @@ -45,28 +45,28 @@ spec: ```json tab="Marathon" "labels": { - "traefik.http.middlewares.test-auth.ForwardAuth.Address": "https://authserver.com/auth", - "traefik.http.middlewares.test-auth.ForwardAuth.AuthResponseHeaders": "X-Auth-User,X-Secret", - "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CA": "path/to/local.crt", - "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CAOptional": "true", - "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Cert": "path/to/foo.cert", - "traefik.http.middlewares.test-auth.ForwardAuth.TLS.InsecureSkipVerify": "true", - "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Key": "path/to/foo.key", - "traefik.http.middlewares.test-auth.ForwardAuth.TrustForwardHeader": "true" + "traefik.http.middlewares.test-auth.forwardauth.address": "https://authserver.com/auth", + "traefik.http.middlewares.test-auth.forwardauth.authResponseHeaders": "X-Auth-User,X-Secret", + "traefik.http.middlewares.test-auth.forwardauth.tls.ca": "path/to/local.crt", + "traefik.http.middlewares.test-auth.forwardauth.tls.caOptional": "true", + "traefik.http.middlewares.test-auth.forwardauth.tls.cert": "path/to/foo.cert", + "traefik.http.middlewares.test-auth.forwardauth.tls.insecureSkipVerify": "true", + "traefik.http.middlewares.test-auth.forwardauth.tls.key": "path/to/foo.key", + "traefik.http.middlewares.test-auth.forwardauth.trustForwardHeader": "true" } ``` ```yaml tab="Rancher" # Forward authentication to authserver.com labels: -- "traefik.http.middlewares.test-auth.ForwardAuth.Address=https://authserver.com/auth" -- "traefik.http.middlewares.test-auth.ForwardAuth.AuthResponseHeaders=X-Auth-User, X-Secret" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CA=path/to/local.crt" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.CAOptional=true" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Cert=path/to/foo.cert" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.InsecureSkipVerify=true" -- "traefik.http.middlewares.test-auth.ForwardAuth.TLS.Key=path/to/foo.key" -- "traefik.http.middlewares.test-auth.ForwardAuth.TrustForwardHeader=true" +- "traefik.http.middlewares.test-auth.forwardauth.address=https://authserver.com/auth" +- "traefik.http.middlewares.test-auth.forwardauth.authResponseHeaders=X-Auth-User, X-Secret" +- "traefik.http.middlewares.test-auth.forwardauth.tls.ca=path/to/local.crt" +- "traefik.http.middlewares.test-auth.forwardauth.tls.caOptional=true" +- "traefik.http.middlewares.test-auth.forwardauth.tls.cert=path/to/foo.cert" +- "traefik.http.middlewares.test-auth.forwardauth.tls.InisecureSkipVerify=true" +- "traefik.http.middlewares.test-auth.forwardauth.tls.key=path/to/foo.key" +- "traefik.http.middlewares.test-auth.forwardauth.trustForwardHeader=true" ``` ```toml tab="File" @@ -77,7 +77,7 @@ labels: trustForwardHeader = true authResponseHeaders = ["X-Auth-User", "X-Secret"] - [http.middlewares.test-auth.forwardauth.tls] + [http.middlewares.test-auth.forwardAuth.tls] ca = "path/to/local.crt" caOptional = true cert = "path/to/foo.cert" @@ -92,7 +92,7 @@ The `address` option defines the authentication server address. ### `trustForwardHeader` -Set the `trustForwardHeader` option to true to trust all the existing X-Forwarded-* headers. +Set the `trustForwardHeader` option to `true` to trust all the existing `X-Forwarded-*` headers. ### `authResponseHeaders` @@ -100,4 +100,4 @@ The `authResponseHeaders` option is the list of the headers to copy from the aut ### `tls` -The `tls` option is the tls configuration from Traefik to the authentication server. +The `tls` option is the TLS configuration from Traefik to the authentication server. diff --git a/docs/content/middlewares/headers.md b/docs/content/middlewares/headers.md index 23528b3e2..716d49525 100644 --- a/docs/content/middlewares/headers.md +++ b/docs/content/middlewares/headers.md @@ -15,8 +15,8 @@ Add the `X-Script-Name` header to the proxied request and the `X-Custom-Response ```yaml tab="Docker" labels: -- "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name=test" -- "traefik.http.middlewares.testHeader.Headers.CustomResponseHeaders.X-Custom-Response-Header=True" +- "traefik.http.middlewares.testHeader.headers.customrequestheaders.X-Script-Name=test" +- "traefik.http.middlewares.testHeader.headers.customresponseheaders.X-Custom-Response-Header=True" ``` ```yaml tab="Kubernetes" @@ -34,23 +34,23 @@ spec: ```json tab="Marathon" "labels": { - "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name": "test", - "traefik.http.middlewares.testHeader.Headers.CustomResponseHeaders.X-Custom-Response-Header": "True" + "traefik.http.middlewares.testheader.headers.customrequestheaders.X-Script-Name": "test", + "traefik.http.middlewares.testheader.headers.customresponseheaders.X-Custom-Response-Header": "True" } ``` ```yaml tab="Rancher" labels: -- "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name=test" -- "traefik.http.middlewares.testHeader.Headers.CustomResponseHeaders.X-Custom-Response-Header=True" +- "traefik.http.middlewares.testheader.headers.customrequestheaders.X-Script-Name=test" +- "traefik.http.middlewares.testheader.headers.customresponseheaders.X-Custom-Response-Header=True" ``` ```toml tab="File" [http.middlewares] [http.middlewares.testHeader.headers] - [http.middlewares.testHeader.headers.CustomRequestHeaders] + [http.middlewares.testHeader.headers.customRequestHeaders] X-Script-Name = "test" - [http.middlewares.testHeader.headers.CustomResponseHeaders] + [http.middlewares.testHeader.headers.customResponseHeaders] X-Custom-Response-Header = "True" ``` @@ -77,22 +77,22 @@ spec: ```yaml tab="Rancher" labels: - - "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name=test" + - "traefik.http.middlewares.testheader.headers.customrequestheaders.X-Script-Name=test" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name": "test", + "traefik.http.middlewares.testheader.headers.customrequestheaders.X-Script-Name": "test", } ``` ```toml tab="File" [http.middlewares] [http.middlewares.testHeader.headers] - [http.middlewares.testHeader.headers.CustomRequestHeaders] + [http.middlewares.testHeader.headers.customRequestHeaders] X-Script-Name = "test" # Adds X-Custom-Request-Header = "" # Removes - [http.middlewares.testHeader.headers.CustomResponseHeaders] + [http.middlewares.testHeader.headers.customResponseHeaders] X-Custom-Response-Header = "" # Removes ``` @@ -103,8 +103,8 @@ This functionality allows for some easy security features to quickly be set. ```yaml tab="Docker" labels: - - "traefik.http.middlewares.testHeader.Headers.FrameDeny=true" - - "traefik.http.middlewares.testHeader.Headers.SSLRedirect=true" + - "traefik.http.middlewares.testHeader.headers.framedeny=true" + - "traefik.http.middlewares.testHeader.headers.sslredirect=true" ``` ```yaml tab="Kubernetes" @@ -120,14 +120,14 @@ spec: ```yaml tab="Rancher" labels: - - "traefik.http.middlewares.testHeader.Headers.FrameDeny=true" - - "traefik.http.middlewares.testHeader.Headers.SSLRedirect=true" + - "traefik.http.middlewares.testheader.headers.framedeny=true" + - "traefik.http.middlewares.testheader.headers.sslredirect=true" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.testHeader.Headers.FrameDeny": "true", - "traefik.http.middlewares.testHeader.Headers.SSLRedirect": "true" + "traefik.http.middlewares.testheader.headers.framedeny": "true", + "traefik.http.middlewares.testheader.headers.sslredirect": "true" } ``` @@ -145,10 +145,10 @@ This functionality allows for more advanced security features to quickly be set. ```yaml tab="Docker" labels: - - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowMethods=GET,OPTIONS,PUT" - - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowOrigin=origin-list-or-null" - - "traefik.http.middlewares.testHeader.Headers.AccessControlMaxAge=100" - - "traefik.http.middlewares.testHeader.Headers.AddVaryHeader=true" + - "traefik.http.middlewares.testheader.headers.accesscontrolallowmethods=GET,OPTIONS,PUT" + - "traefik.http.middlewares.testheader.headers.accesscontrolalloworigin=origin-list-or-null" + - "traefik.http.middlewares.testheader.headers.accesscontrolmaxage=100" + - "traefik.http.middlewares.testheader.headers.addvaryheader=true" ``` ```yaml tab="Kubernetes" @@ -158,39 +158,39 @@ metadata: name: testHeader spec: headers: - AccessControlAllowMethods: + accessControlAllowMethods: - "GET" - "OPTIONS" - "PUT" - AccessControlAllowOrigin: "origin-list-or-null" - AccessControlMaxAge: 100 - AddVaryHeader: "true" + accessControlAllowOrigin: "origin-list-or-null" + accessControlMaxAge: 100 + addVaryHeader: "true" ``` ```yaml tab="Rancher" labels: - - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowMethods=GET,OPTIONS,PUT" - - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowOrigin=origin-list-or-null" - - "traefik.http.middlewares.testHeader.Headers.AccessControlMaxAge=100" - - "traefik.http.middlewares.testHeader.Headers.AddVaryHeader=true" + - "traefik.http.middlewares.testheader.headers.accesscontrolallowmethods=GET,OPTIONS,PUT" + - "traefik.http.middlewares.testheader.headers.accesscontrolalloworigin=origin-list-or-null" + - "traefik.http.middlewares.testheader.headers.accesscontrolmaxage=100" + - "traefik.http.middlewares.testheader.headers.addvaryheader=true" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowMethods": "GET,OPTIONS,PUT", - "traefik.http.middlewares.testHeader.Headers.AccessControlAllowOrigin": "origin-list-or-null", - "traefik.http.middlewares.testHeader.Headers.AccessControlMaxAge": "100", - "traefik.http.middlewares.testHeader.Headers.AddVaryHeader": "true" + "traefik.http.middlewares.testheader.headers.accesscontrolallowmethods": "GET,OPTIONS,PUT", + "traefik.http.middlewares.testheader.headers.accesscontrolalloworigin": "origin-list-or-null", + "traefik.http.middlewares.testheader.headers.accesscontrolmaxage": "100", + "traefik.http.middlewares.testheader.headers.addvaryheader": "true" } ``` ```toml tab="File" [http.middlewares] [http.middlewares.testHeader.headers] - AccessControlAllowMethods= ["GET", "OPTIONS", "PUT"] - AccessControlAllowOrigin = "origin-list-or-null" - AccessControlMaxAge = 100 - AddVaryHeader = true + accessControlAllowMethods= ["GET", "OPTIONS", "PUT"] + accessControlAllowOrigin = "origin-list-or-null" + accessControlMaxAge = 100 + addVaryHeader = true ``` ## Configuration Options @@ -225,7 +225,8 @@ The `accessControlAllowMethods` indicates which methods can be used during requ ### `accessControlAllowOrigin` -The `accessControlAllowOrigin` indicates whether a resource can be shared by returning different values. The three options for this value are: +The `accessControlAllowOrigin` indicates whether a resource can be shared by returning different values. +The three options for this value are: - `origin-list-or-null` - `*` @@ -261,11 +262,12 @@ Set the `sslTemporaryRedirect` to `true` to force an SSL redirection using a 302 ### `sslHost` -The `SSLHost` option is the host name that is used to redirect http requests to https. +The `sslHost` option is the host name that is used to redirect http requests to https. ### `sslProxyHeaders` -The `sslProxyHeaders` option is set of header keys with associated values that would indicate a valid https request. Useful when using other proxies with header like: `"X-Forwarded-Proto": "https"`. +The `sslProxyHeaders` option is set of header keys with associated values that would indicate a valid https request. +Useful when using other proxies with header like: `"X-Forwarded-Proto": "https"`. ### `sslForceHost` @@ -273,7 +275,8 @@ Set `sslForceHost` to true and set SSLHost to forced requests to use `SSLHost` e ### `stsSeconds` -The `stsSeconds` is the max-age of the Strict-Transport-Security header. If set to 0, would NOT include the header. +The `stsSeconds` is the max-age of the Strict-Transport-Security header. +If set to 0, would NOT include the header. ### `stsIncludeSubdomains` @@ -281,11 +284,11 @@ The `stsIncludeSubdomains` is set to true, the `includeSubdomains` will be appen ### `stsPreload` -Set `STSPreload` to true to have the `preload` flag appended to the Strict-Transport-Security header. +Set `stsPreload` to true to have the `preload` flag appended to the Strict-Transport-Security header. ### `forceSTSHeader` -Set `ForceSTSHeader` to true, to add the STS header even when the connection is HTTP. +Set `forceSTSHeader` to true, to add the STS header even when the connection is HTTP. ### `frameDeny` @@ -293,7 +296,8 @@ Set `frameDeny` to true to add the `X-Frame-Options` header with the value of `D ### `customFrameOptionsValue` -The `customFrameOptionsValue` allows the `X-Frame-Options` header value to be set with a custom value. This overrides the FrameDeny option. +The `customFrameOptionsValue` allows the `X-Frame-Options` header value to be set with a custom value. +This overrides the FrameDeny option. ### `contentTypeNosniff` @@ -301,11 +305,12 @@ Set `contentTypeNosniff` to true to add the `X-Content-Type-Options` header with ### `browserXssFilter` -Set `BrowserXssFilter` to true to add the `X-XSS-Protection` header with the value `1; mode=block`. +Set `browserXssFilter` to true to add the `X-XSS-Protection` header with the value `1; mode=block`. ### `customBrowserXSSValue` -The `customBrowserXssValue` option allows the `X-XSS-Protection` header value to be set with a custom value. This overrides the BrowserXssFilter option. +The `customBrowserXssValue` option allows the `X-XSS-Protection` header value to be set with a custom value. +This overrides the BrowserXssFilter option. ### `contentSecurityPolicy` @@ -321,5 +326,7 @@ The `referrerPolicy` allows sites to control when browsers will pass the Referer ### `isDevelopment` -Set `isDevelopment` to true when developing. The AllowedHosts, SSL, and STS options can cause some unwanted effects. Usually testing happens on http, not https, and on localhost, not your production domain. +Set `isDevelopment` to true when developing. +The AllowedHosts, SSL, and STS options can cause some unwanted effects. +Usually testing happens on http, not https, and on localhost, not your production domain. If you would like your development environment to mimic production with complete Host blocking, SSL redirects, and STS headers, leave this as false. diff --git a/docs/content/middlewares/ipwhitelist.md b/docs/content/middlewares/ipwhitelist.md index 1d038eaa8..c39e42b54 100644 --- a/docs/content/middlewares/ipwhitelist.md +++ b/docs/content/middlewares/ipwhitelist.md @@ -12,7 +12,7 @@ IPWhitelist accepts / refuses requests based on the client IP. ```yaml tab="Docker" # Accepts request from defined IP labels: -- "traefik.http.middlewares.test-ipwhitelist.IPWhiteList.SourceRange=127.0.0.1/32, 192.168.1.7" +- "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.sourcerange=127.0.0.1/32, 192.168.1.7" ``` ```yaml tab="Kubernetes" @@ -29,14 +29,14 @@ spec: ```json tab="Marathon" "labels": { - "traefik.http.middlewares.test-ipwhitelist.IPWhiteList.SourceRange": "127.0.0.1/32,192.168.1.7" + "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.sourcerange": "127.0.0.1/32,192.168.1.7" } ``` ```yaml tab="Rancher" # Accepts request from defined IP labels: -- "traefik.http.middlewares.test-ipwhitelist.IPWhiteList.SourceRange=127.0.0.1/32, 192.168.1.7" +- "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.sourcerange=127.0.0.1/32, 192.168.1.7" ``` ```toml tab="File" @@ -75,7 +75,7 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th ```yaml tab="Docker" # Whitelisting Based on `X-Forwarded-For` with `depth=2` labels: - - "traefik.http.middlewares.testIPwhitelist.ipWhiteList.SourceRange=127.0.0.1/32, 192.168.1.7" + - "traefik.http.middlewares.testIPwhitelist.ipwhitelist.sourcerange=127.0.0.1/32, 192.168.1.7" - "traefik.http.middlewares.testIPwhitelist.ipwhitelist.ipstrategy.depth=2" ``` @@ -87,23 +87,23 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th name: testIPwhitelist spec: ipWhiteList: - SourceRange: + sourceRange: - 127.0.0.1/32 - 192.168.1.7 - ipstrategy: + ipStrategy: depth: 2 ``` ```yaml tab="Rancher" # Whitelisting Based on `X-Forwarded-For` with `depth=2` labels: - - "traefik.http.middlewares.testIPwhitelist.ipWhiteList.SourceRange=127.0.0.1/32, 192.168.1.7" + - "traefik.http.middlewares.testIPwhitelist.ipwhitelist.sourcerange=127.0.0.1/32, 192.168.1.7" - "traefik.http.middlewares.testIPwhitelist.ipwhitelist.ipstrategy.depth=2" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.testIPwhitelist.ipWhiteList.SourceRange": "127.0.0.1/32, 192.168.1.7", + "traefik.http.middlewares.testIPwhitelist.ipwhitelist.sourcerange": "127.0.0.1/32, 192.168.1.7", "traefik.http.middlewares.testIPwhitelist.ipwhitelist.ipstrategy.depth": "2" } ``` @@ -114,7 +114,7 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th [http.middlewares.test-ipwhitelist.ipWhiteList] sourceRange = ["127.0.0.1/32", "192.168.1.7"] [http.middlewares.test-ipwhitelist.ipWhiteList.ipStrategy] - depth = 2 + depth = 2 ``` !!! note @@ -142,7 +142,7 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th ```yaml tab="Docker" # Exclude from `X-Forwarded-For` labels: - - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedIPs=127.0.0.1/32, 192.168.1.7" + - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedips=127.0.0.1/32, 192.168.1.7" ``` ```yaml tab="Kubernetes" @@ -153,7 +153,7 @@ metadata: name: test-ipwhitelist spec: ipWhiteList: - ipstrategy: + ipStrategy: excludedIPs: - 127.0.0.1/32 - 192.168.1.7 @@ -162,12 +162,12 @@ spec: ```yaml tab="Rancher" # Exclude from `X-Forwarded-For` labels: - - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedIPs=127.0.0.1/32, 192.168.1.7" + - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedips=127.0.0.1/32, 192.168.1.7" ``` ```json tab="Marathon" "labels": { - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedIPs": "127.0.0.1/32, 192.168.1.7" + "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.ipstrategy.excludedips": "127.0.0.1/32, 192.168.1.7" } ``` diff --git a/docs/content/middlewares/maxconnection.md b/docs/content/middlewares/maxconnection.md index 6c13363d0..b0523d790 100644 --- a/docs/content/middlewares/maxconnection.md +++ b/docs/content/middlewares/maxconnection.md @@ -40,8 +40,8 @@ labels: ```toml tab="File" # Limiting to 10 simultaneous connections [http.middlewares] - [http.middlewares.test-maxconn.maxconn] - amount = 10 + [http.middlewares.test-maxconn.maxConn] + amount = 10 ``` ## Configuration Options diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index 335a824ca..102f10d03 100644 --- a/docs/content/middlewares/overview.md +++ b/docs/content/middlewares/overview.md @@ -22,7 +22,7 @@ whoami: # Create a middleware named `foo-add-prefix` - "traefik.http.middlewares.foo-add-prefix.addprefix.prefix=/foo" # Apply the middleware named `foo-add-prefix` to the router named `router1` - - "traefik.http.router.router1.Middlewares=foo-add-prefix@docker" + - "traefik.http.router.router1.middlewares=foo-add-prefix@docker" ``` ```yaml tab="Kubernetes" @@ -46,7 +46,7 @@ kind: Middleware metadata: name: stripprefix spec: - stripprefix: + stripPrefix: prefixes: - /stripit @@ -66,7 +66,7 @@ spec: ```json tab="Marathon" "labels": { "traefik.http.middlewares.foo-add-prefix.addprefix.prefix": "/foo", - "traefik.http.router.router1.Middlewares": "foo-add-prefix@marathon" + "traefik.http.router.router1.middlewares": "foo-add-prefix@marathon" } ``` @@ -76,30 +76,30 @@ labels: # Create a middleware named `foo-add-prefix` - "traefik.http.middlewares.foo-add-prefix.addprefix.prefix=/foo" # Apply the middleware named `foo-add-prefix` to the router named `router1` - - "traefik.http.router.router1.Middlewares=foo-add-prefix@rancher" + - "traefik.http.router.router1.middlewares=foo-add-prefix@rancher" ``` ```toml tab="File" # As Toml Configuration File [providers] - [providers.file] + [providers.file] [http.routers] [http.routers.router1] - Service = "myService" - Middlewares = ["foo-add-prefix"] - Rule = "Host(`example.com`)" + service = "myService" + middlewares = ["foo-add-prefix"] + rule = "Host(`example.com`)" [http.middlewares] - [http.middlewares.foo-add-prefix.AddPrefix] + [http.middlewares.foo-add-prefix.addPrefix] prefix = "/foo" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:80" + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:80" ``` ## Provider Namespace @@ -132,7 +132,7 @@ and therefore this specification would be ignored even if present. [providers.file] [http.middlewares] - [http.middlewares.add-foo-prefix.AddPrefix] + [http.middlewares.add-foo-prefix.addPrefix] prefix = "/foo" ``` diff --git a/docs/content/middlewares/passtlsclientcert.md b/docs/content/middlewares/passtlsclientcert.md index ed4c073a9..4824845b5 100644 --- a/docs/content/middlewares/passtlsclientcert.md +++ b/docs/content/middlewares/passtlsclientcert.md @@ -23,7 +23,7 @@ kind: Middleware metadata: name: addprefix spec: - passtlsclientcert: + passTLSClientCert: pem: true ``` @@ -42,7 +42,7 @@ labels: ```toml tab="File" # Pass the escaped pem in the `X-Forwarded-Tls-Client-Cert` header. [http.middlewares] - [http.middlewares.test-passtlsclientcert.passtlsclientcert] + [http.middlewares.test-passtlsclientcert.passTLSClientCert] pem = true ``` @@ -77,7 +77,7 @@ labels: metadata: name: test-passtlsclientcert spec: - passtlsclientcert: + passTLSClientCert: info: notAfter: true notBefore: true @@ -147,12 +147,12 @@ labels: ```toml tab="File" # Pass all the available info in the `X-Forwarded-Tls-Client-Cert-Info` header [http.middlewares] - [http.middlewares.test-passtlsclientcert.passtlsclientcert] - [http.middlewares.test-passtlsclientcert.passtlsclientcert.info] + [http.middlewares.test-passtlsclientcert.passTLSClientCert] + [http.middlewares.test-passtlsclientcert.passTLSClientCert.info] notAfter = true notBefore = true sans = true - [http.middlewares.test-passtlsclientcert.passtlsclientcert.info.subject] + [http.middlewares.test-passtlsclientcert.passTLSClientCert.info.subject] country = true province = true locality = true @@ -160,7 +160,7 @@ labels: commonName = true serialNumber = true domainComponent = true - [http.middlewares.test-passtlsclientcert.passtlsclientcert.info.issuer] + [http.middlewares.test-passtlsclientcert.passTLSClientCert.info.issuer] country = true province = true locality = true @@ -360,9 +360,9 @@ Subject="DC=org,DC=cheese,C=FR,C=US,ST=Cheese org state,ST=Cheese com state,L=TO If there are more than one certificate, they are separated by a `;`. -#### `info.notafter` +#### `info.notAfter` -Set the `info.notafter` option to `true` to add the `Not After` information from the `Validity` part. +Set the `info.notAfter` option to `true` to add the `Not After` information from the `Validity` part. The data are taken from the following certificate part: @@ -371,15 +371,15 @@ The data are taken from the following certificate part: Not After : Dec 5 11:10:16 2020 GMT ``` -The escape `notafter` info part will be like: +The escape `notAfter` info part will be like: ```text NA=1607166616 ``` -#### `info.notbefore` +#### `info.notBefore` -Set the `info.notafter` option to `true` to add the `Not Before` information from the `Validity` part. +Set the `info.notBefore` option to `true` to add the `Not Before` information from the `Validity` part. The data are taken from the following certificate part: @@ -388,7 +388,7 @@ Validity Not Before: Dec 6 11:10:16 2018 GMT ``` -The escape `notafter` info part will be like: +The escape `notBefore` info part will be like: ```text NB=1544094616 @@ -471,9 +471,9 @@ The escape organization info in the subject part will be like : O=Cheese,O=Cheese 2 ``` -##### `info.subject.commonname` +##### `info.subject.commonName` -Set the `info.subject.commonname` option to true to add the `commonname` information into the subject. +Set the `info.subject.commonName` option to true to add the `commonName` information into the subject. The data are taken from the subject part with the `CN` key. @@ -483,9 +483,9 @@ The escape common name info in the subject part will be like : CN=*.cheese.com ``` -##### `info.subject.serialnumber` +##### `info.subject.serialNumber` -Set the `info.subject.serialnumber` option to true to add the `serialnumber` information into the subject. +Set the `info.subject.serialNumber` option to true to add the `serialNumber` information into the subject. The data are taken from the subject part with the `SN` key. @@ -495,9 +495,9 @@ The escape serial number info in the subject part will be like : SN=1234567890 ``` -##### `info.subject.domaincomponent` +##### `info.subject.domainComponent` -Set the `info.subject.domaincomponent` option to true to add the `domaincomponent` information into the subject. +Set the `info.subject.domainComponent` option to true to add the `domainComponent` information into the subject. The data are taken from the subject part with the `DC` key. @@ -563,9 +563,9 @@ The escape organization info in the issuer part will be like : O=Cheese,O=Cheese 2 ``` -##### `info.issuer.commonname` +##### `info.issuer.commonName` -Set the `info.issuer.commonname` option to true to add the `commonname` information into the issuer. +Set the `info.issuer.commonName` option to true to add the `commonName` information into the issuer. The data are taken from the issuer part with the `CN` key. @@ -575,9 +575,9 @@ The escape common name info in the issuer part will be like : CN=Simple Signing CA 2 ``` -##### `info.issuer.serialnumber` +##### `info.issuer.serialNumber` -Set the `info.issuer.serialnumber` option to true to add the `serialnumber` information into the issuer. +Set the `info.issuer.serialNumber` option to true to add the `serialNumber` information into the issuer. The data are taken from the issuer part with the `SN` key. @@ -587,9 +587,9 @@ The escape serial number info in the issuer part will be like : SN=1234567890 ``` -##### `info.issuer.domaincomponent` +##### `info.issuer.domainComponent` -Set the `info.issuer.domaincomponent` option to true to add the `domaincomponent` information into the issuer. +Set the `info.issuer.domainComponent` option to true to add the `domainComponent` information into the issuer. The data are taken from the issuer part with the `DC` key. diff --git a/docs/content/middlewares/ratelimit.md b/docs/content/middlewares/ratelimit.md index 29add7f32..65dbc84ba 100644 --- a/docs/content/middlewares/ratelimit.md +++ b/docs/content/middlewares/ratelimit.md @@ -33,7 +33,7 @@ metadata: spec: rateLimit: extractorFunc: client.ip - rateset: + rateSet: rate0: period: 10s average: 100 @@ -74,15 +74,15 @@ labels: # Here, an average of 5 requests every 3 seconds is allowed and an average of 100 requests every 10 seconds. # These can "burst" up to 10 and 200 in each period, respectively. [http.middlewares] - [http.middlewares.test-ratelimit.ratelimit] + [http.middlewares.test-ratelimit.rateLimit] extractorfunc = "client.ip" - [http.middlewares.test-ratelimit.ratelimit.rateset.rate0] + [http.middlewares.test-ratelimit.rateLimit.rateSet.rate0] period = "10s" average = 100 burst = 200 - [http.middlewares.test-ratelimit.ratelimit.rateset.rate1] + [http.middlewares.test-ratelimit.rateLimit.rateSet.rate1] period = "3s" average = 5 burst = 10 @@ -100,7 +100,7 @@ The possible values are: - `client.ip` categorizes requests based on the client ip. - `request.header.ANY_HEADER` categorizes requests based on the provided `ANY_HEADER` value. -### `ratelimit` +### `rateSet` You can combine multiple rate limits. The rate limit will trigger with the first reached limit. diff --git a/docs/content/middlewares/redirectregex.md b/docs/content/middlewares/redirectregex.md index 5fcd90652..6a1d89255 100644 --- a/docs/content/middlewares/redirectregex.md +++ b/docs/content/middlewares/redirectregex.md @@ -45,7 +45,7 @@ labels: ```toml tab="File" # Redirect with domain replacement [http.middlewares] - [http.middlewares.test-redirectregex.redirectregex] + [http.middlewares.test-redirectregex.redirectRegex] regex = "^http://localhost/(.*)" replacement = "http://mydomain/$1" ``` @@ -58,7 +58,7 @@ Set the `permanent` option to `true` to apply a permanent redirection. ### `regex` -The `Regex` option is the regular expression to match and capture elements from the request URL. +The `regex` option is the regular expression to match and capture elements from the request URL. !!! warning diff --git a/docs/content/middlewares/redirectscheme.md b/docs/content/middlewares/redirectscheme.md index acf3f4279..d658e3c7b 100644 --- a/docs/content/middlewares/redirectscheme.md +++ b/docs/content/middlewares/redirectscheme.md @@ -41,7 +41,7 @@ labels: ```toml tab="File" # Redirect to https [http.middlewares] - [http.middlewares.test-redirectscheme.redirectscheme] + [http.middlewares.test-redirectscheme.redirectScheme] scheme = "https" ``` diff --git a/docs/content/middlewares/replacepath.md b/docs/content/middlewares/replacepath.md index 6270b8f9c..d8c1a771f 100644 --- a/docs/content/middlewares/replacepath.md +++ b/docs/content/middlewares/replacepath.md @@ -41,8 +41,8 @@ labels: ```toml tab="File" # Replace the path by /foo [http.middlewares] - [http.middlewares.test-replacepath.ReplacePath] - path = "/foo" + [http.middlewares.test-replacepath.replacePath] + path = "/foo" ``` ## Configuration Options diff --git a/docs/content/middlewares/replacepathregex.md b/docs/content/middlewares/replacepathregex.md index 2b977c3bb..3c8e242d9 100644 --- a/docs/content/middlewares/replacepathregex.md +++ b/docs/content/middlewares/replacepathregex.md @@ -61,7 +61,7 @@ The ReplacePathRegex middleware will: ### `regex` -The `Regex` option is the regular expression to match and capture the path from the request URL. +The `regex` option is the regular expression to match and capture the path from the request URL. !!! warning diff --git a/docs/content/middlewares/retry.md b/docs/content/middlewares/retry.md index 7cdd590b2..d07c0aebf 100644 --- a/docs/content/middlewares/retry.md +++ b/docs/content/middlewares/retry.md @@ -41,7 +41,7 @@ labels: ```toml tab="File" # Retry to send request 4 times [http.middlewares] - [http.middlewares.test-retry.Retry] + [http.middlewares.test-retry.retry] attempts = 4 ``` diff --git a/docs/content/middlewares/stripprefix.md b/docs/content/middlewares/stripprefix.md index 806687367..0b7ff50f7 100644 --- a/docs/content/middlewares/stripprefix.md +++ b/docs/content/middlewares/stripprefix.md @@ -43,8 +43,8 @@ labels: ```toml tab="File" # Strip prefix /foobar and /fiibar [http.middlewares] - [http.middlewares.test-stripprefix.StripPrefix] - prefixes = ["/foobar", "/fiibar"] + [http.middlewares.test-stripprefix.stripPrefix] + prefixes = ["/foobar", "/fiibar"] ``` ## Configuration Options diff --git a/docs/content/middlewares/stripprefixregex.md b/docs/content/middlewares/stripprefixregex.md index 484168e7f..e51e4ccdc 100644 --- a/docs/content/middlewares/stripprefixregex.md +++ b/docs/content/middlewares/stripprefixregex.md @@ -41,7 +41,7 @@ labels: ```toml tab="File" # Replace the path by /foo [http.middlewares] - [http.middlewares.test-stripprefixregex.StripPrefixRegex] + [http.middlewares.test-stripprefixregex.stripPrefixRegex] regex: "^/foo/(.*)" ``` @@ -56,7 +56,7 @@ The StripPrefixRegex middleware will: !!! tip - Use a `StripPrefixRegex` middleware if your backend listens on the root path (`/`) but should be routeable on a specific prefix. + Use a `stripPrefixRegex` middleware if your backend listens on the root path (`/`) but should be routeable on a specific prefix. ### `regex` diff --git a/docs/content/observability/tracing/datadog.md b/docs/content/observability/tracing/datadog.md index c32888391..5d68d399d 100644 --- a/docs/content/observability/tracing/datadog.md +++ b/docs/content/observability/tracing/datadog.md @@ -4,7 +4,7 @@ To enable the DataDog: ```toml tab="File" [tracing] - [tracing.datadog] + [tracing.dataDog] ``` ```bash tab="CLI" @@ -20,7 +20,7 @@ Local Agent Host Port instructs reporter to send spans to datadog-tracing-agent ```toml tab="File" [tracing] - [tracing.datadog] + [tracing.dataDog] localAgentHostPort = "127.0.0.1:8126" ``` @@ -37,7 +37,7 @@ Enable DataDog debug. ```toml tab="File" [tracing] - [tracing.datadog] + [tracing.dataDog] debug = true ``` @@ -54,7 +54,7 @@ Apply shared tag in a form of Key:Value to all the traces. ```toml tab="File" [tracing] - [tracing.datadog] + [tracing.dataDog] globalTag = "sample" ``` @@ -72,7 +72,7 @@ this option must be enabled in order to get all the parts of a distributed trace ```toml tab="File" [tracing] - [tracing.datadog] + [tracing.dataDog] prioritySampling = true ``` diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index 0bbf0a185..a7a4c41f1 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -128,19 +128,19 @@ You can define a custom address/port like this: ```toml [entryPoints] [entryPoints.web] - address = ":80" + address = ":80" [entryPoints.foo] - address = ":8082" + address = ":8082" [entryPoints.bar] - address = ":8083" + address = ":8083" [ping] -entryPoint = "foo" + entryPoint = "foo" [api] -entryPoint = "bar" + entryPoint = "bar" ``` In the above example, you would access a service at /foo, an api endpoint, or the health-check as follows: @@ -160,9 +160,9 @@ To restrict access to the API handler, one can add authentication with the [basi ```toml [http.middlewares] - [http.middlewares.api-auth.basicauth] - users = [ - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", - "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", - ] + [http.middlewares.api-auth.basicAuth] + users = [ + "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", + "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", + ] ``` diff --git a/docs/content/operations/dashboard.md b/docs/content/operations/dashboard.md index c8c4c02dc..a867c1976 100644 --- a/docs/content/operations/dashboard.md +++ b/docs/content/operations/dashboard.md @@ -10,13 +10,13 @@ The dashboard is the central place that shows you the current active routes hand Therefore, the dashboard is currently not working.
- Dashboard - Providers -
The dashboard in action with Traefik listening to 3 different providers
+ Dashboard - Providers +
The dashboard in action with Traefik listening to 3 different providers
- Dashboard - Health -
The dashboard shows the health of the system.
+ Dashboard - Health +
The dashboard shows the health of the system.
By default, the dashboard is available on `/` on port `:8080`. diff --git a/docs/content/operations/ping.md b/docs/content/operations/ping.md index 0cde3ec6e..694e220dd 100644 --- a/docs/content/operations/ping.md +++ b/docs/content/operations/ping.md @@ -22,7 +22,7 @@ Checking the Health of Your Traefik Instances address = ":8082" [ping] - entryPoint = "ping" + entryPoint = "ping" ``` | Path | Method | Description | diff --git a/docs/content/providers/docker.md b/docs/content/providers/docker.md index 3fc1daabc..fb25b14ea 100644 --- a/docs/content/providers/docker.md +++ b/docs/content/providers/docker.md @@ -18,7 +18,7 @@ Attach labels to your containers and let Traefik do the rest! ```toml [providers.docker] - endpoint = "unix:///var/run/docker.sock" + endpoint = "unix:///var/run/docker.sock" ``` Attaching labels to containers (in your docker compose file) @@ -136,8 +136,8 @@ Traefik requires access to the docker socket to get its dynamic configuration. ```toml # ... [providers] - [providers.docker] - endpoint = "unix:///var/run/docker.sock" + [providers.docker] + endpoint = "unix:///var/run/docker.sock" ``` ### `usebindportip` @@ -194,8 +194,8 @@ and the template has access to all the labels defined on this container. ```toml tab="File" [providers.docker] -defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -# ... + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... ``` ```txt tab="CLI" diff --git a/docs/content/providers/file.md b/docs/content/providers/file.md index 8a940b943..689238e05 100644 --- a/docs/content/providers/file.md +++ b/docs/content/providers/file.md @@ -45,7 +45,7 @@ You can write these configuration elements: # Add the middleware [http.middlewares] - [http.middlewares.my-basic-auth.BasicAuth] + [http.middlewares.my-basic-auth.basicAuth] users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] usersFile = "etc/traefik/.htpasswd" @@ -53,37 +53,42 @@ You can write these configuration elements: # Add the service [http.services] [http.services.service-foo] - [http.services.service-foo.LoadBalancer] - [[http.services.service-foo.LoadBalancer.Servers]] + [http.services.service-foo.loadBalancer] + [[http.services.service-foo.loadBalancer.servers]] url = "http://foo/" - [[http.services.service-foo.LoadBalancer.Servers]] + [[http.services.service-foo.loadBalancer.servers]] url = "http://bar/" ``` ```yaml tab="YAML" http: + # Add the router routers: router0: - entrypoints: + entryPoints: - web middlewares: - my-basic-auth service: service-foo rule: Path(`foo`) + + # Add the middleware middlewares: my-basic-auth: basicAuth: users: - test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/ - test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0 - usersfile: etc/traefik/.htpasswd - headerfield: "" + usersFile: etc/traefik/.htpasswd + + # Add the service services: service-foo: - loadbalancer: + loadBalancer: servers: - url: http://foo/ - url: http://bar/ + passHostHeader: false ``` ## Provider Configuration Options @@ -170,7 +175,7 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat {{ end }} - [http.Services] + [http.services] {{ range $i, $e := until 100 }} [http.services.service{{ $e }}] # ... @@ -185,7 +190,7 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat {{ end }} - [tcp.Services] + [tcp.services] {{ range $i, $e := until 100 }} [http.services.service{{ $e }}] # ... @@ -193,9 +198,9 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat {{ range $i, $e := until 10 }} [[tls.certificates]] - CertFile = "/etc/traefik/cert-{{ $e }}.pem" - KeyFile = "/etc/traefik/cert-{{ $e }}.key" - Store = ["my-store-foo-{{ $e }}", "my-store-bar-{{ $e }}"] + certFile = "/etc/traefik/cert-{{ $e }}.pem" + keyFile = "/etc/traefik/cert-{{ $e }}.key" + store = ["my-store-foo-{{ $e }}", "my-store-bar-{{ $e }}"] {{ end }} [tls.config] @@ -237,8 +242,8 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat {{ range $i, $e := until 10 }} tls: certificates: - - certfile: "/etc/traefik/cert-{{ $e }}.pem" - keyfile: "/etc/traefik/cert-{{ $e }}.key" + - certFile: "/etc/traefik/cert-{{ $e }}.pem" + keyFile: "/etc/traefik/cert-{{ $e }}.key" store: - "my-store-foo-{{ $e }}" - "my-store-bar-{{ $e }}" diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index 95a2885e8..b0f35ae94 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -33,7 +33,7 @@ In this case, the endpoint is required. Specifically, it may be set to the URL used by `kubectl proxy` to connect to a Kubernetes cluster using the granted authentication and authorization of the associated kubeconfig. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] endpoint = "http://localhost:8080" # ... ``` @@ -50,7 +50,7 @@ _Optional, Default=empty_ Bearer token used for the Kubernetes client configuration. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] token = "mytoken" # ... ``` @@ -68,7 +68,7 @@ Path to the certificate authority file. Used for the Kubernetes client configuration. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] certAuthFilePath = "/my/ca.crt" # ... ``` @@ -85,7 +85,7 @@ _Optional, Default: all namespaces (empty array)_ Array of namespaces to watch. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] namespaces = ["default", "production"] # ... ``` @@ -105,7 +105,7 @@ A label selector can be defined to filter on specific Ingress objects only. See [label-selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) for details. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] labelselector = "A and not B" # ... ``` @@ -125,7 +125,7 @@ If the parameter is non-empty, only Ingresses containing an annotation with the Otherwise, Ingresses missing the annotation, having an empty value, or the value `traefik` are processed. ```toml tab="File" -[Providers.KubernetesCRD] +[providers.kubernetesCRD] ingressClass = "traefik-internal" # ... ``` diff --git a/docs/content/providers/marathon.md b/docs/content/providers/marathon.md index 178bb01ff..d37e3ed78 100644 --- a/docs/content/providers/marathon.md +++ b/docs/content/providers/marathon.md @@ -13,7 +13,7 @@ See also [Marathon user guide](../user-guides/marathon.md). ```toml tab="File" [providers.marathon] - endpoint = "http://127.0.0.1:8080" + endpoint = "http://127.0.0.1:8080" ``` ```txt tab="CLI" @@ -58,9 +58,9 @@ _Optional_ Enables Marathon basic authentication. ```toml tab="File" -[marathon.basic] -httpBasicAuthUser = "foo" -httpBasicPassword = "bar" +[providers.marathon.basic] + httpBasicAuthUser = "foo" + httpBasicPassword = "bar" ``` ```txt tab="CLI" @@ -79,8 +79,8 @@ If set, it overrides the Authorization header. ```toml tab="File" [providers.marathon] -dcosToken = "xxxxxx" -# ... + dcosToken = "xxxxxx" + # ... ``` ```txt tab="CLI" @@ -102,8 +102,8 @@ and the template has access to all the labels defined on this Marathon applicati ```toml tab="File" [providers.marathon] -defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -# ... + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... ``` ```txt tab="CLI" @@ -133,8 +133,8 @@ You can optionally specify multiple endpoints: ```toml tab="File" [providers.marathon] -endpoint = "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080" -# ... + endpoint = "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080" + # ... ``` ```txt tab="CLI" @@ -247,11 +247,11 @@ _Optional_ TLS client configuration. [tls/#Config](https://golang.org/pkg/crypto/tls/#Config). ```toml tab="File" -[marathon.TLS] -CA = "/etc/ssl/ca.crt" -Cert = "/etc/ssl/marathon.cert" -Key = "/etc/ssl/marathon.key" -insecureSkipVerify = true +[providers.marathon.tls] + ca = "/etc/ssl/ca.crt" + cert = "/etc/ssl/marathon.cert" + key = "/etc/ssl/marathon.key" + insecureSkipVerify = true ``` ```txt tab="CLI" @@ -296,23 +296,23 @@ and the router automatically gets a rule defined by defaultRule (if no rule for ### Routers To update the configuration of the Router automatically attached to the application, -add labels starting with `traefik.HTTP.Routers.{router-name-of-your-choice}.` and followed by the option you want to change. -For example, to change the routing rule, you could add the label ```traefik.HTTP.Routers.Routername.Rule=Host(`my-domain`)```. +add labels starting with `traefik.http.routers.{router-name-of-your-choice}.` and followed by the option you want to change. +For example, to change the routing rule, you could add the label ```traefik.http.routers.routername.rule=Host(`my-domain`)```. Every [Router](../routing/routers/index.md) parameter can be updated this way. ### Services To update the configuration of the Service automatically attached to the container, -add labels starting with `traefik.HTTP.Services.{service-name-of-your-choice}.`, followed by the option you want to change. -For example, to change the passhostheader behavior, you'd add the label `traefik.HTTP.Services.Servicename.LoadBalancer.PassHostHeader=false`. +add labels starting with `traefik.http.services.{service-name-of-your-choice}.`, followed by the option you want to change. +For example, to change the passHostHeader behavior, you'd add the label `traefik.http.services.servicename.loadbalancer.passhostheader=false`. Every [Service](../routing/services/index.md) parameter can be updated this way. ### Middleware -You can declare pieces of middleware using labels starting with `traefik.HTTP.Middlewares.{middleware-name-of-your-choice}.`, followed by the middleware type/options. -For example, to declare a middleware [`redirectscheme`](../middlewares/redirectscheme.md) named `my-redirect`, you'd write `traefik.HTTP.Middlewares.my-redirect.RedirectScheme.Scheme: https`. +You can declare pieces of middleware using labels starting with `traefik.http.middlewares.{middleware-name-of-your-choice}.`, followed by the middleware type/options. +For example, to declare a middleware [`redirectscheme`](../middlewares/redirectscheme.md) named `my-redirect`, you'd write `traefik.http.middlewares.my-redirect.redirectscheme.scheme: https`. ??? example "Declaring and Referencing a Middleware" diff --git a/docs/content/providers/rancher.md b/docs/content/providers/rancher.md index a9572d61b..a5662f31f 100644 --- a/docs/content/providers/rancher.md +++ b/docs/content/providers/rancher.md @@ -19,7 +19,7 @@ Attach labels to your services and let Traefik do the rest! Enabling the rancher provider ```toml - [Providers.Rancher] + [providers.rancher] ``` Attaching labels to services @@ -58,9 +58,9 @@ The service name can be accessed as the `Name` identifier, and the template has access to all the labels defined on this container. ```toml tab="File" -[Providers.Rancher] -defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -# ... +[providers.rancher] + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... ``` ```txt tab="CLI" diff --git a/docs/content/providers/rancher.toml b/docs/content/providers/rancher.toml index 5ce4bac50..b209fb8cb 100644 --- a/docs/content/providers/rancher.toml +++ b/docs/content/providers/rancher.toml @@ -1,20 +1,20 @@ # Enable Rancher Provider. -[Providers.Rancher] +[providers.rancher] # Expose Rancher services by default in Traefik. - ExposedByDefault = true + exposedByDefault = true # Enable watch Rancher changes. - Watch = true + watch = true # Filter services with unhealthy states and inactive states. - EnableServiceHealthFilter = true + enableServiceHealthFilter = true # Defines the polling interval (in seconds). - RefreshSeconds = true + refreshSeconds = true # Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate - IntervalPoll = false + intervalPoll = false # Prefix used for accessing the Rancher metadata service - Prefix = "/latest" + prefix = "/latest" diff --git a/docs/content/reference/dynamic-configuration/docker.md b/docs/content/reference/dynamic-configuration/docker.md index 1ba5becff..b8c137743 100644 --- a/docs/content/reference/dynamic-configuration/docker.md +++ b/docs/content/reference/dynamic-configuration/docker.md @@ -3,6 +3,8 @@ Dynamic configuration with Docker Labels {: .subtitle } +The labels are case insensitive. + ```yaml --8<-- "content/reference/dynamic-configuration/labels.yml" ``` diff --git a/docs/content/reference/dynamic-configuration/file.toml b/docs/content/reference/dynamic-configuration/file.toml index 1879364b9..8dab9ba61 100644 --- a/docs/content/reference/dynamic-configuration/file.toml +++ b/docs/content/reference/dynamic-configuration/file.toml @@ -1,259 +1,248 @@ -[HTTP] - - [HTTP.Routers] - - [HTTP.Routers.Router0] - EntryPoints = ["foobar", "foobar"] - Middlewares = ["foobar", "foobar"] - Service = "foobar" - Rule = "foobar" +[http] + [http.routers] + [http.routers.Router0] + entryPoints = ["foobar", "foobar"] + middlewares = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" priority = 42 - [HTTP.Routers.Router0.tls] + [http.routers.Router0.tls] options = "TLS0" - - [HTTP.Middlewares] - - [HTTP.Middlewares.Middleware0.AddPrefix] - Prefix = "foobar" - - [HTTP.Middlewares.Middleware1.StripPrefix] - Prefixes = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware2.StripPrefixRegex] - Regex = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware3.ReplacePath] - Path = "foobar" - - [HTTP.Middlewares.Middleware4.ReplacePathRegex] - Regex = "foobar" - Replacement = "foobar" - - [HTTP.Middlewares.Middleware5.Chain] - Middlewares = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware6.IPWhiteList] - SourceRange = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware7.IPWhiteList.IPStrategy] - Depth = 42 - ExcludedIPs = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware8.Headers] - AccessControlAllowCredentials = true - AccessControlAllowHeaders = ["foobar", "foobar"] - AccessControlAllowMethods = ["foobar", "foobar"] - AccessControlAllowOrigin = "foobar" - AccessControlExposeHeaders = ["foobar", "foobar"] - AccessControlMaxAge = 42 - AddVaryHeader = true - AllowedHosts = ["foobar", "foobar"] - HostsProxyHeaders = ["foobar", "foobar"] - SSLRedirect = true - SSLTemporaryRedirect = true - SSLHost = "foobar" - SSLForceHost = true - STSSeconds = 42 - STSIncludeSubdomains = true - STSPreload = true - ForceSTSHeader = true - FrameDeny = true - CustomFrameOptionsValue = "foobar" - ContentTypeNosniff = true - BrowserXSSFilter = true - CustomBrowserXSSValue = "foobar" - ContentSecurityPolicy = "foobar" - PublicKey = "foobar" - ReferrerPolicy = "foobar" - IsDevelopment = true - [HTTP.Middlewares.Middleware8.Headers.CustomRequestHeaders] + [http.middlewares] + [http.middlewares.Middleware0] + [http.middlewares.Middleware0.addPrefix] + prefix = "foobar" + [http.middlewares.Middleware1] + [http.middlewares.Middleware1.stripPrefix] + prefixes = ["foobar", "foobar"] + [http.middlewares.Middleware10] + [http.middlewares.Middleware10.rateLimit] + extractorFunc = "foobar" + [http.middlewares.Middleware10.rateLimit.rateSet] + [http.middlewares.Middleware10.rateLimit.rateSet.Rate0] + period = 42 + average = 42 + burst = 42 + [http.middlewares.Middleware10.rateLimit.rateSet.Rate1] + period = 42 + average = 42 + burst = 42 + [http.middlewares.Middleware11] + [http.middlewares.Middleware11.redirectRegex] + regex = "foobar" + replacement = "foobar" + permanent = true + [http.middlewares.Middleware12] + [http.middlewares.Middleware12.redirectScheme] + scheme = "foobar" + port = "foobar" + permanent = true + [http.middlewares.Middleware13] + [http.middlewares.Middleware13.basicAuth] + users = ["foobar", "foobar"] + usersFile = "foobar" + realm = "foobar" + removeHeader = true + headerField = "foobar" + [http.middlewares.Middleware14] + [http.middlewares.Middleware14.digestAuth] + users = ["foobar", "foobar"] + usersFile = "foobar" + removeHeader = true + realm = "foobar" + headerField = "foobar" + [http.middlewares.Middleware15] + [http.middlewares.Middleware15.forwardAuth] + address = "foobar" + trustForwardHeader = true + authResponseHeaders = ["foobar", "foobar"] + [http.middlewares.Middleware15.forwardAuth.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [http.middlewares.Middleware16] + [http.middlewares.Middleware16.maxConn] + amount = 42 + extractorFunc = "foobar" + [http.middlewares.Middleware17] + [http.middlewares.Middleware17.buffering] + maxRequestBodyBytes = 42 + memRequestBodyBytes = 42 + maxResponseBodyBytes = 42 + memResponseBodyBytes = 42 + retryExpression = "foobar" + [http.middlewares.Middleware18] + [http.middlewares.Middleware18.circuitBreaker] + expression = "foobar" + [http.middlewares.Middleware19] + [http.middlewares.Middleware19.compress] + [http.middlewares.Middleware2] + [http.middlewares.Middleware2.stripPrefixRegex] + regex = ["foobar", "foobar"] + [http.middlewares.Middleware20] + [http.middlewares.Middleware20.passTLSClientCert] + pem = true + [http.middlewares.Middleware20.passTLSClientCert.info] + notAfter = true + notBefore = true + sans = true + [http.middlewares.Middleware20.passTLSClientCert.info.subject] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware20.passTLSClientCert.info.issuer] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware21] + [http.middlewares.Middleware21.retry] + attemps = 42 + [http.middlewares.Middleware3] + [http.middlewares.Middleware3.replacePath] + path = "foobar" + [http.middlewares.Middleware4] + [http.middlewares.Middleware4.replacePathRegex] + regex = "foobar" + replacement = "foobar" + [http.middlewares.Middleware5] + [http.middlewares.Middleware5.chain] + middlewares = ["foobar", "foobar"] + [http.middlewares.Middleware6] + [http.middlewares.Middleware6.ipWhiteList] + sourceRange = ["foobar", "foobar"] + [http.middlewares.Middleware7] + [http.middlewares.Middleware7.ipWhiteList] + [http.middlewares.Middleware7.ipWhiteList.ipStrategy] + depth = 42 + excludedIPs = ["foobar", "foobar"] + [http.middlewares.Middleware8] + [http.middlewares.Middleware8.headers] + accessControlAllowCredentials = true + accessControlAllowHeaders = ["foobar", "foobar"] + accessControlAllowMethods = ["foobar", "foobar"] + accessControlAllowOrigin = "foobar" + accessControlExposeHeaders = ["foobar", "foobar"] + accessControlMaxAge = 42 + addVaryHeader = true + allowedHosts = ["foobar", "foobar"] + hostsProxyHeaders = ["foobar", "foobar"] + sslRedirect = true + sslTemporaryRedirect = true + sslHost = "foobar" + sslForceHost = true + stsSeconds = 42 + stsIncludeSubdomains = true + stsPreload = true + forceSTSHeader = true + frameDeny = true + customFrameOptionsValue = "foobar" + contentTypeNosniff = true + browserXssFilter = true + customBrowserXSSValue = "foobar" + contentSecurityPolicy = "foobar" + publicKey = "foobar" + referrerPolicy = "foobar" + isDevelopment = true + [http.middlewares.Middleware8.headers.customRequestHeaders] name0 = "foobar" name1 = "foobar" - [HTTP.Middlewares.Middleware8.Headers.CustomResponseHeaders] + [http.middlewares.Middleware8.headers.customResponseHeaders] name0 = "foobar" name1 = "foobar" - [HTTP.Middlewares.Middleware8.Headers.SSLProxyHeaders] + [http.middlewares.Middleware8.headers.sslProxyHeaders] name0 = "foobar" name1 = "foobar" + [http.middlewares.Middleware9] + [http.middlewares.Middleware9.errors] + status = ["foobar", "foobar"] + service = "foobar" + query = "foobar" + [http.services] + [http.services.Service0] + [http.services.Service0.loadBalancer] + passHostHeader = true + [http.services.Service0.loadBalancer.stickiness] + cookieName = "foobar" - [HTTP.Middlewares.Middleware9.Errors] - Status = ["foobar", "foobar"] - Service = "foobar" - Query = "foobar" + [[http.services.Service0.loadBalancer.servers]] + url = "foobar" - [HTTP.Middlewares.Middleware10.RateLimit] - ExtractorFunc = "foobar" - [HTTP.Middlewares.Middleware10.RateLimit.RateSet] - [HTTP.Middlewares.Middleware10.RateLimit.RateSet.Rate0] - Period = 42 - Average = 42 - Burst = 42 - [HTTP.Middlewares.Middleware10.RateLimit.RateSet.Rate1] - Period = 42 - Average = 42 - Burst = 42 - - [HTTP.Middlewares.Middleware11.RedirectRegex] - Regex = "foobar" - Replacement = "foobar" - Permanent = true - - [HTTP.Middlewares.Middleware12.RedirectScheme] - Scheme = "foobar" - Port = "foobar" - Permanent = true - - [HTTP.Middlewares.Middleware13.BasicAuth] - Users = ["foobar", "foobar"] - UsersFile = "foobar" - Realm = "foobar" - RemoveHeader = true - HeaderField = "foobar" - - [HTTP.Middlewares.Middleware14.DigestAuth] - Users = ["foobar", "foobar"] - UsersFile = "foobar" - RemoveHeader = true - Realm = "foobar" - HeaderField = "foobar" - - [HTTP.Middlewares.Middleware15.ForwardAuth] - Address = "foobar" - TrustForwardHeader = true - AuthResponseHeaders = ["foobar", "foobar"] - [HTTP.Middlewares.Middleware15.ForwardAuth.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true - - [HTTP.Middlewares.Middleware16.MaxConn] - Amount = 42 - ExtractorFunc = "foobar" - - [HTTP.Middlewares.Middleware17.Buffering] - MaxRequestBodyBytes = 42 - MemRequestBodyBytes = 42 - MaxResponseBodyBytes = 42 - MemResponseBodyBytes = 42 - RetryExpression = "foobar" - - [HTTP.Middlewares.Middleware18.CircuitBreaker] - Expression = "foobar" - - [HTTP.Middlewares.Middleware19.Compress] - - [HTTP.Middlewares.Middleware20.PassTLSClientCert] - PEM = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info] - NotAfter = true - NotBefore = true - Sans = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info.Subject] - Country = true - Province = true - Locality = true - Organization = true - CommonName = true - SerialNumber = true - DomainComponent = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info.Issuer] - Country = true - Province = true - Locality = true - Organization = true - CommonName = true - SerialNumber = true - DomainComponent = true - - [HTTP.Middlewares.Middleware21.Retry] - Attempts = 42 - - [HTTP.Services] - [HTTP.Services.Service0] - [HTTP.Services.Service0.LoadBalancer] - PassHostHeader = true - - [[HTTP.Services.Service0.LoadBalancer.Servers]] - URL = "foobar" - - [HTTP.Services.Service0.LoadBalancer.Stickiness] - CookieName = "foobar" - - [[HTTP.Services.Service0.LoadBalancer.Servers]] - URL = "foobar" - - [HTTP.Services.Service0.LoadBalancer.HealthCheck] - Scheme = "foobar" - Path = "foobar" - Port = 42 - Interval = "foobar" - Timeout = "foobar" - Hostname = "foobar" - [HTTP.Services.Service0.LoadBalancer.HealthCheck.Headers] + [[http.services.Service0.loadBalancer.servers]] + url = "foobar" + [http.services.Service0.loadBalancer.healthCheck] + scheme = "foobar" + path = "foobar" + port = 42 + interval = "foobar" + timeout = "foobar" + hostname = "foobar" + [http.services.Service0.loadBalancer.healthCheck.headers] name0 = "foobar" name1 = "foobar" - [HTTP.Services.Service0.LoadBalancer.ResponseForwarding] - FlushInterval = "foobar" + [http.services.Service0.loadBalancer.responseForwarding] + flushInterval = "foobar" -[TCP] - - [TCP.Routers] - - [TCP.Routers.TCPRouter0] - EntryPoints = ["foobar", "foobar"] - Service = "foobar" - Rule = "foobar" - [TCP.Routers.TCPRouter0.tls] +[tcp] + [tcp.routers] + [tcp.routers.TCPRouter0] + entryPoints = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" + [tcp.routers.TCPRouter0.tls] passthrough = true options = "TLS1" + [tcp.services] + [tcp.services.TCPService0] + [tcp.services.TCPService0.loadBalancer] - [TCP.Services] + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" - [TCP.Services.TCPService0] - [TCP.Services.TCPService0.LoadBalancer] + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" - [[TCP.Services.TCPService0.LoadBalancer.Servers]] - Address = "foobar" +[tls] - [[TCP.Services.TCPService0.LoadBalancer.Servers]] - Address = "foobar" + [[tls.certificates]] + certFile = "foobar" + keyFile = "foobar" + stores = ["foobar", "foobar"] -[TLS] - - [[TLS.Certificates]] - Stores = ["foobar", "foobar"] - CertFile = "foobar" - KeyFile = "foobar" - - [[TLS.Certificates]] - Stores = ["foobar", "foobar"] - CertFile = "foobar" - KeyFile = "foobar" - - [TLS.Options] - [TLS.Options.TLS0] - MinVersion = "foobar" - CipherSuites = ["foobar", "foobar"] - SniStrict = true - [TLS.Options.TLS0.ClientCA] - Files = ["foobar", "foobar"] - Optional = true - [TLS.Options.TLS1] - MinVersion = "foobar" - CipherSuites = ["foobar", "foobar"] - SniStrict = true - [TLS.Options.TLS1.ClientCA] - Files = ["foobar", "foobar"] - Optional = true - - [TLS.Stores] - [TLS.Stores.Store0] - [TLS.Stores.Store0.DefaultCertificate] - CertFile = "foobar" - KeyFile = "foobar" - [TLS.Stores.Store1] - [TLS.Stores.Store1.DefaultCertificate] - CertFile = "foobar" - KeyFile = "foobar" + [[tls.certificates]] + certFile = "foobar" + keyFile = "foobar" + stores = ["foobar", "foobar"] + [tls.options] + [tls.options.TLS0] + minVersion = "foobar" + cipherSuites = ["foobar", "foobar"] + sniStrict = true + [tls.options.TLS0.clientCA] + files = ["foobar", "foobar"] + optional = true + [tls.options.TLS1] + minVersion = "foobar" + cipherSuites = ["foobar", "foobar"] + sniStrict = true + [tls.options.TLS1.clientCA] + files = ["foobar", "foobar"] + optional = true + [tls.stores] + [tls.stores.Store0] + [tls.stores.Store0.defaultCertificate] + certFile = "foobar" + keyFile = "foobar" + [tls.stores.Store1] + [tls.stores.Store1.defaultCertificate] + certFile = "foobar" + keyFile = "foobar" diff --git a/docs/content/reference/dynamic-configuration/file.yaml b/docs/content/reference/dynamic-configuration/file.yaml index 0587df582..1e72d988a 100644 --- a/docs/content/reference/dynamic-configuration/file.yaml +++ b/docs/content/reference/dynamic-configuration/file.yaml @@ -1,7 +1,7 @@ http: routers: Router0: - entrypoints: + entryPoints: - foobar - foobar middlewares: @@ -10,8 +10,7 @@ http: service: foobar rule: foobar priority: 42 - tls: - options: TLS0 + tls: {} middlewares: Middleware0: addPrefix: @@ -40,65 +39,63 @@ http: - foobar Middleware6: ipWhiteList: - sourcerange: + sourceRange: - foobar - foobar - ipstrategy: null Middleware7: ipWhiteList: - sourcerange: [] - ipstrategy: + ipStrategy: depth: 42 - excludedips: + excludedIPs: - foobar - foobar Middleware8: headers: - customrequestheaders: + customRequestHeaders: name0: foobar name1: foobar - customresponseheaders: + customResponseHeaders: name0: foobar name1: foobar - accesscontrolallowcredentials: true - accesscontrolallowheaders: + accessControlAllowCredentials: true + accessControlAllowHeaders: - foobar - foobar - accesscontrolallowmethods: + accessControlAllowMethods: - foobar - foobar - accesscontrolalloworigin: foobar - accesscontrolexposeheaders: + accessControlAllowOrigin: foobar + accessControlExposeHeaders: - foobar - foobar - accesscontrolmaxage: 42 - addvaryheader: true - allowedhosts: + accessControlMaxAge: 42 + addVaryHeader: true + allowedHosts: - foobar - foobar - hostsproxyheaders: + hostsProxyHeaders: - foobar - foobar - sslredirect: true - ssltemporaryredirect: true - sslhost: foobar - sslproxyheaders: + sslRedirect: true + sslTemporaryRedirect: true + sslHost: foobar + sslProxyHeaders: name0: foobar name1: foobar - sslforcehost: true - stsseconds: 42 - stsincludesubdomains: true - stspreload: true - forcestsheader: true - framedeny: true - customframeoptionsvalue: foobar - contenttypenosniff: true - browserxssfilter: true - custombrowserxssvalue: foobar - contentsecuritypolicy: foobar - publickey: foobar - referrerpolicy: foobar - isdevelopment: true + sslForceHost: true + stsSeconds: 42 + stsIncludeSubdomains: true + stsPreload: true + forceSTSHeader: true + frameDeny: true + customFrameOptionsValue: foobar + contentTypeNosniff: true + browserXssFilter: true + customBrowserXSSValue: foobar + contentSecurityPolicy: foobar + publicKey: foobar + referrerPolicy: foobar + isDevelopment: true Middleware9: errors: status: @@ -108,7 +105,7 @@ http: query: foobar Middleware10: rateLimit: - rateset: + rateSet: Rate0: period: 42000000000 average: 42 @@ -117,7 +114,7 @@ http: period: 42000000000 average: 42 burst: 42 - extractorfunc: foobar + extractorFunc: foobar Middleware11: redirectRegex: regex: foobar @@ -133,43 +130,43 @@ http: users: - foobar - foobar - usersfile: foobar + usersFile: foobar realm: foobar - removeheader: true - headerfield: foobar + removeHeader: true + headerField: foobar Middleware14: digestAuth: users: - foobar - foobar - usersfile: foobar - removeheader: true + usersFile: foobar + removeHeader: true realm: foobar - headerfield: foobar + headerField: foobar Middleware15: forwardAuth: address: foobar tls: ca: foobar - caoptional: true + caOptional: true cert: foobar key: foobar - insecureskipverify: true - trustforwardheader: true - authresponseheaders: + insecureSkipVerify: true + trustForwardHeader: true + authResponseHeaders: - foobar - foobar Middleware16: maxConn: amount: 42 - extractorfunc: foobar + extractorFunc: foobar Middleware17: buffering: - maxrequestbodybytes: 42 - memrequestbodybytes: 42 - maxresponsebodybytes: 42 - memresponsebodybytes: 42 - retryexpression: foobar + maxRequestBodyBytes: 42 + memRequestBodyBytes: 42 + maxResponseBodyBytes: 42 + memResponseBodyBytes: 42 + retryExpression: foobar Middleware18: circuitBreaker: expression: foobar @@ -179,43 +176,37 @@ http: passTLSClientCert: pem: true info: - notafter: true - notbefore: true + notAfter: true + notBefore: true sans: true subject: country: true province: true locality: true organization: true - commonname: true - serialnumber: true - domaincomponent: true + commonName: true + serialNumber: true + domainComponent: true issuer: country: true province: true locality: true organization: true - commonname: true - serialnumber: true - domaincomponent: true + commonName: true + serialNumber: true + domainComponent: true Middleware21: retry: - attempts: 42 + attemps: 42 services: Service0: - loadbalancer: + loadBalancer: stickiness: - cookiename: foobar - securecookie: false - httponlycookie: false + cookieName: foobar servers: - url: foobar - scheme: "" - port: "" - url: foobar - scheme: "" - port: "" - healthcheck: + healthCheck: scheme: foobar path: foobar port: 42 @@ -225,70 +216,66 @@ http: headers: name0: foobar name1: foobar - passhostheader: true - responseforwarding: - flushinterval: foobar + passHostHeader: true + responseForwarding: + flushInterval: foobar tcp: routers: TCPRouter0: - entrypoints: + entryPoints: - foobar - foobar service: foobar rule: foobar tls: passthrough: true - options: TLS1 services: TCPService0: - loadbalancer: + loadBalancer: servers: - address: foobar - port: "" - address: foobar - port: "" tls: - - stores: - - foobar - - foobar - certificate: - certfile: foobar - keyfile: foobar - - stores: - - foobar - - foobar - certificate: - certfile: foobar - keyfile: foobar -tlsoptions: - TLS0: - minversion: foobar - ciphersuites: - - foobar - - foobar - clientca: - files: + certificates: + - certFile: foobar + keyFile: foobar + stores: - foobar - foobar - optional: true - snistrict: true - TLS1: - minversion: foobar - ciphersuites: - - foobar - - foobar - clientca: - files: + - certFile: foobar + keyFile: foobar + stores: - foobar - foobar - optional: true - snistrict: true -tlsstores: - Store0: - defaultcertificate: - certfile: foobar - keyfile: foobar - Store1: - defaultcertificate: - certfile: foobar - keyfile: foobar + options: + TLS0: + minVersion: foobar + cipherSuites: + - foobar + - foobar + clientCA: + files: + - foobar + - foobar + optional: true + sniStrict: true + TLS1: + minVersion: foobar + cipherSuites: + - foobar + - foobar + clientCA: + files: + - foobar + - foobar + optional: true + sniStrict: true + stores: + Store0: + defaultCertificate: + certFile: foobar + keyFile: foobar + Store1: + defaultCertificate: + certFile: foobar + keyFile: foobar diff --git a/docs/content/reference/dynamic-configuration/labels.yml b/docs/content/reference/dynamic-configuration/labels.yml index c7ba2981e..a1b557cfb 100644 --- a/docs/content/reference/dynamic-configuration/labels.yml +++ b/docs/content/reference/dynamic-configuration/labels.yml @@ -1,154 +1,154 @@ labels: -- "traefik.HTTP.Middlewares.Middleware0.AddPrefix.Prefix=foobar" -- "traefik.HTTP.Middlewares.Middleware1.BasicAuth.HeaderField=foobar" -- "traefik.HTTP.Middlewares.Middleware1.BasicAuth.Realm=foobar" -- "traefik.HTTP.Middlewares.Middleware1.BasicAuth.RemoveHeader=true" -- "traefik.HTTP.Middlewares.Middleware1.BasicAuth.Users=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware1.BasicAuth.UsersFile=foobar" -- "traefik.HTTP.Middlewares.Middleware2.Buffering.MaxRequestBodyBytes=42" -- "traefik.HTTP.Middlewares.Middleware2.Buffering.MaxResponseBodyBytes=42" -- "traefik.HTTP.Middlewares.Middleware2.Buffering.MemRequestBodyBytes=42" -- "traefik.HTTP.Middlewares.Middleware2.Buffering.MemResponseBodyBytes=42" -- "traefik.HTTP.Middlewares.Middleware2.Buffering.RetryExpression=foobar" -- "traefik.HTTP.Middlewares.Middleware3.Chain.Middlewares=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware4.CircuitBreaker.Expression=foobar" -- "traefik.HTTP.Middlewares.Middleware5.DigestAuth.HeaderField=foobar" -- "traefik.HTTP.Middlewares.Middleware5.DigestAuth.Realm=foobar" -- "traefik.HTTP.Middlewares.Middleware5.DigestAuth.RemoveHeader=true" -- "traefik.HTTP.Middlewares.Middleware5.DigestAuth.Users=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware5.DigestAuth.UsersFile=foobar" -- "traefik.HTTP.Middlewares.Middleware6.Errors.Query=foobar" -- "traefik.HTTP.Middlewares.Middleware6.Errors.Service=foobar" -- "traefik.HTTP.Middlewares.Middleware6.Errors.Status=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.Address=foobar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.AuthResponseHeaders=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TLS.CA=foobar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TLS.CAOptional=true" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TLS.Cert=foobar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TLS.InsecureSkipVerify=true" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TLS.Key=foobar" -- "traefik.HTTP.Middlewares.Middleware7.ForwardAuth.TrustForwardHeader=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlAllowCredentials=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlAllowHeaders=X-foobar, X-fiibar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlAllowMethods=GET, PUT" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlAllowOrigin=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlExposeHeaders=X-foobar, X-fiibar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AccessControlMaxAge=200" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AddVaryHeader=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.AllowedHosts=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.BrowserXSSFilter=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.ContentSecurityPolicy=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.ContentTypeNosniff=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomBrowserXSSValue=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomFrameOptionsValue=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomRequestHeaders.name0=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomRequestHeaders.name1=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomResponseHeaders.name0=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.CustomResponseHeaders.name1=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.ForceSTSHeader=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.FrameDeny=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.HostsProxyHeaders=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.IsDevelopment=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.PublicKey=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.ReferrerPolicy=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLForceHost=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLHost=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLProxyHeaders.name0=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLProxyHeaders.name1=foobar" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLRedirect=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.SSLTemporaryRedirect=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.STSIncludeSubdomains=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.STSPreload=true" -- "traefik.HTTP.Middlewares.Middleware8.Headers.STSSeconds=42" -- "traefik.HTTP.Middlewares.Middleware9.IPWhiteList.IPStrategy.Depth=42" -- "traefik.HTTP.Middlewares.Middleware9.IPWhiteList.IPStrategy.ExcludedIPs=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware9.IPWhiteList.SourceRange=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware10.MaxConn.Amount=42" -- "traefik.HTTP.Middlewares.Middleware10.MaxConn.ExtractorFunc=foobar" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.NotAfter=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.NotBefore=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Sans=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.Country=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.Province=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.Locality=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.Organization=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.CommonName=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.SerialNumber=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Subject.DomainComponent=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.Country=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.Province=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.Locality=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.Organization=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.CommonName=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.SerialNumber=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.Info.Issuer.DomainComponent=true" -- "traefik.HTTP.Middlewares.Middleware11.PassTLSClientCert.PEM=true" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.ExtractorFunc=foobar" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate0.Average=42" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate0.Burst=42" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate0.Period=42" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate1.Average=42" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate1.Burst=42" -- "traefik.HTTP.Middlewares.Middleware12.RateLimit.RateSet.Rate1.Period=42" -- "traefik.HTTP.Middlewares.Middleware13.RedirectRegex.Regex=foobar" -- "traefik.HTTP.Middlewares.Middleware13.RedirectRegex.Replacement=foobar" -- "traefik.HTTP.Middlewares.Middleware13.RedirectRegex.Permanent=true" -- "traefik.HTTP.Middlewares.Middleware13b.RedirectScheme.Scheme=https" -- "traefik.HTTP.Middlewares.Middleware13b.RedirectScheme.Port=80" -- "traefik.HTTP.Middlewares.Middleware13b.RedirectScheme.Permanent=true" -- "traefik.HTTP.Middlewares.Middleware14.ReplacePath.Path=foobar" -- "traefik.HTTP.Middlewares.Middleware15.ReplacePathRegex.Regex=foobar" -- "traefik.HTTP.Middlewares.Middleware15.ReplacePathRegex.Replacement=foobar" -- "traefik.HTTP.Middlewares.Middleware16.Retry.Attempts=42" -- "traefik.HTTP.Middlewares.Middleware17.StripPrefix.Prefixes=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware18.StripPrefixRegex.Regex=foobar, fiibar" -- "traefik.HTTP.Middlewares.Middleware19.Compress=true" -- "traefik.HTTP.Routers.Router0.EntryPoints=foobar, fiibar" -- "traefik.HTTP.Routers.Router0.Middlewares=foobar, fiibar" -- "traefik.HTTP.Routers.Router0.Priority=42" -- "traefik.HTTP.Routers.Router0.Rule=foobar" -- "traefik.HTTP.Routers.Router0.Service=foobar" -- "traefik.HTTP.Routers.Router0.TLS=true" -- "traefik.HTTP.Routers.Router0.TLS.options=foo" -- "traefik.HTTP.Routers.Router1.EntryPoints=foobar, fiibar" -- "traefik.HTTP.Routers.Router1.Middlewares=foobar, fiibar" -- "traefik.HTTP.Routers.Router1.Priority=42" -- "traefik.HTTP.Routers.Router1.Rule=foobar" -- "traefik.HTTP.Routers.Router1.Service=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Headers.name0=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Headers.name1=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Hostname=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Interval=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Path=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Port=42" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Scheme=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.HealthCheck.Timeout=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.PassHostHeader=true" -- "traefik.HTTP.Services.Service0.LoadBalancer.ResponseForwarding.FlushInterval=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.server.Port=8080" -- "traefik.HTTP.Services.Service0.LoadBalancer.server.Scheme=foobar" -- "traefik.HTTP.Services.Service0.LoadBalancer.Stickiness.CookieName=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Headers.name0=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Headers.name1=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Hostname=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Interval=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Path=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Port=42" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Scheme=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.HealthCheck.Timeout=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.PassHostHeader=true" -- "traefik.HTTP.Services.Service1.LoadBalancer.ResponseForwarding.FlushInterval=foobar" -- "traefik.HTTP.Services.Service1.LoadBalancer.server.Port=8080" -- "traefik.HTTP.Services.Service1.LoadBalancer.server.Scheme=foobar" -- "traefik.TCP.Routers.Router0.Rule=foobar" -- "traefik.TCP.Routers.Router0.EntryPoints=foobar, fiibar" -- "traefik.TCP.Routers.Router0.Service=foobar" -- "traefik.TCP.Routers.Router0.TLS.Passthrough=false" -- "traefik.TCP.Routers.Router0.TLS.options=bar" -- "traefik.TCP.Routers.Router1.Rule=foobar" -- "traefik.TCP.Routers.Router1.EntryPoints=foobar, fiibar" -- "traefik.TCP.Routers.Router1.Service=foobar" -- "traefik.TCP.Routers.Router1.TLS.Passthrough=false" -- "traefik.TCP.Routers.Router1.TLS.options=foobar" -- "traefik.TCP.Services.Service0.LoadBalancer.server.Port=42" -- "traefik.TCP.Services.Service1.LoadBalancer.server.Port=42" +- "traefik.http.middlewares.Middleware0.addprefix.prefix=foobar" +- "traefik.http.middlewares.Middleware1.basicauth.headerfield=foobar" +- "traefik.http.middlewares.Middleware1.basicauth.realm=foobar" +- "traefik.http.middlewares.Middleware1.basicauth.removeheader=true" +- "traefik.http.middlewares.Middleware1.basicauth.users=foobar, fiibar" +- "traefik.http.middlewares.Middleware1.basicauth.usersfile=foobar" +- "traefik.http.middlewares.Middleware2.buffering.maxrequestbodybytes=42" +- "traefik.http.middlewares.Middleware2.buffering.maxresponsebodybytes=42" +- "traefik.http.middlewares.Middleware2.buffering.memrequestbodybytes=42" +- "traefik.http.middlewares.Middleware2.buffering.memresponsebodybytes=42" +- "traefik.http.middlewares.Middleware2.buffering.retryexpression=foobar" +- "traefik.http.middlewares.Middleware3.chain.middlewares=foobar, fiibar" +- "traefik.http.middlewares.Middleware4.circuitbreaker.expression=foobar" +- "traefik.http.middlewares.Middleware5.digestauth.headerfield=foobar" +- "traefik.http.middlewares.Middleware5.digestauth.realm=foobar" +- "traefik.http.middlewares.Middleware5.digestauth.removeheader=true" +- "traefik.http.middlewares.Middleware5.digestauth.users=foobar, fiibar" +- "traefik.http.middlewares.Middleware5.digestauth.usersfile=foobar" +- "traefik.http.middlewares.Middleware6.errors.query=foobar" +- "traefik.http.middlewares.Middleware6.errors.service=foobar" +- "traefik.http.middlewares.Middleware6.errors.status=foobar, fiibar" +- "traefik.http.middlewares.Middleware7.forwardauth.address=foobar" +- "traefik.http.middlewares.Middleware7.forwardauth.authresponseheaders=foobar, fiibar" +- "traefik.http.middlewares.Middleware7.forwardauth.tls.ca=foobar" +- "traefik.http.middlewares.Middleware7.forwardauth.tls.caoptional=true" +- "traefik.http.middlewares.Middleware7.forwardauth.tls.cert=foobar" +- "traefik.http.middlewares.Middleware7.forwardauth.tls.insecureskipverify=true" +- "traefik.http.middlewares.Middleware7.forwardauth.tls.key=foobar" +- "traefik.http.middlewares.Middleware7.forwardauth.trustforwardheader=true" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolallowcredentials=true" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolallowheaders=x-foobar, x-fiibar" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolallowmethods=get, put" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolalloworigin=foobar" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolexposeheaders=x-foobar, x-fiibar" +- "traefik.http.middlewares.Middleware8.headers.accesscontrolmaxage=200" +- "traefik.http.middlewares.Middleware8.headers.addvaryheader=true" +- "traefik.http.middlewares.Middleware8.headers.allowedhosts=foobar, fiibar" +- "traefik.http.middlewares.Middleware8.headers.browserxssfilter=true" +- "traefik.http.middlewares.Middleware8.headers.contentsecuritypolicy=foobar" +- "traefik.http.middlewares.Middleware8.headers.contenttypenosniff=true" +- "traefik.http.middlewares.Middleware8.headers.custombrowserxssvalue=foobar" +- "traefik.http.middlewares.Middleware8.headers.customframeoptionsvalue=foobar" +- "traefik.http.middlewares.Middleware8.headers.customrequestheaders.name0=foobar" +- "traefik.http.middlewares.Middleware8.headers.customrequestheaders.name1=foobar" +- "traefik.http.middlewares.Middleware8.headers.customresponseheaders.name0=foobar" +- "traefik.http.middlewares.Middleware8.headers.customresponseheaders.name1=foobar" +- "traefik.http.middlewares.Middleware8.headers.forcestsheader=true" +- "traefik.http.middlewares.Middleware8.headers.framedeny=true" +- "traefik.http.middlewares.Middleware8.headers.hostsproxyheaders=foobar, fiibar" +- "traefik.http.middlewares.Middleware8.headers.isdevelopment=true" +- "traefik.http.middlewares.Middleware8.headers.publickey=foobar" +- "traefik.http.middlewares.Middleware8.headers.referrerpolicy=foobar" +- "traefik.http.middlewares.Middleware8.headers.sslforcehost=true" +- "traefik.http.middlewares.Middleware8.headers.sslhost=foobar" +- "traefik.http.middlewares.Middleware8.headers.sslproxyheaders.name0=foobar" +- "traefik.http.middlewares.Middleware8.headers.sslproxyheaders.name1=foobar" +- "traefik.http.middlewares.Middleware8.headers.sslredirect=true" +- "traefik.http.middlewares.Middleware8.headers.ssltemporaryredirect=true" +- "traefik.http.middlewares.Middleware8.headers.stsincludesubdomains=true" +- "traefik.http.middlewares.Middleware8.headers.stspreload=true" +- "traefik.http.middlewares.Middleware8.headers.stsseconds=42" +- "traefik.http.middlewares.Middleware9.ipwhitelist.ipstrategy.depth=42" +- "traefik.http.middlewares.Middleware9.ipwhitelist.ipstrategy.excludedips=foobar, fiibar" +- "traefik.http.middlewares.Middleware9.ipwhitelist.sourcerange=foobar, fiibar" +- "traefik.http.middlewares.Middleware10.maxconn.amount=42" +- "traefik.http.middlewares.Middleware10.maxconn.extractorfunc=foobar" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.notafter=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.notbefore=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.sans=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.country=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.province=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.locality=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.organization=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.commonname=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.serialnumber=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.subject.domaincomponent=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.country=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.province=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.locality=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.organization=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.commonname=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.serialnumber=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.domaincomponent=true" +- "traefik.http.middlewares.Middleware11.passtlsclientcert.pem=true" +- "traefik.http.middlewares.Middleware12.ratelimit.extractorfunc=foobar" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate0.average=42" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate0.burst=42" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate0.period=42" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate1.average=42" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate1.burst=42" +- "traefik.http.middlewares.Middleware12.ratelimit.rateset.rate1.period=42" +- "traefik.http.middlewares.Middleware13.redirectregex.regex=foobar" +- "traefik.http.middlewares.Middleware13.redirectregex.replacement=foobar" +- "traefik.http.middlewares.Middleware13.redirectregex.permanent=true" +- "traefik.http.middlewares.Middleware13b.redirectscheme.scheme=https" +- "traefik.http.middlewares.Middleware13b.redirectscheme.port=80" +- "traefik.http.middlewares.Middleware13b.redirectscheme.permanent=true" +- "traefik.http.middlewares.Middleware14.replacepath.path=foobar" +- "traefik.http.middlewares.Middleware15.replacepathregex.regex=foobar" +- "traefik.http.middlewares.Middleware15.replacepathregex.replacement=foobar" +- "traefik.http.middlewares.Middleware16.retry.attempts=42" +- "traefik.http.middlewares.Middleware17.stripprefix.prefixes=foobar, fiibar" +- "traefik.http.middlewares.Middleware18.stripprefixregex.regex=foobar, fiibar" +- "traefik.http.middlewares.Middleware19.compress=true" +- "traefik.http.routers.Router0.entrypoints=foobar, fiibar" +- "traefik.http.routers.Router0.middlewares=foobar, fiibar" +- "traefik.http.routers.Router0.priority=42" +- "traefik.http.routers.Router0.rule=foobar" +- "traefik.http.routers.Router0.service=foobar" +- "traefik.http.routers.Router0.tls=true" +- "traefik.http.routers.Router0.tls.options=foo" +- "traefik.http.routers.Router1.entrypoints=foobar, fiibar" +- "traefik.http.routers.Router1.middlewares=foobar, fiibar" +- "traefik.http.routers.Router1.priority=42" +- "traefik.http.routers.Router1.rule=foobar" +- "traefik.http.routers.Router1.service=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.headers.name0=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.headers.name1=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.hostname=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.interval=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.path=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.port=42" +- "traefik.http.services.Service0.loadbalancer.healthcheck.scheme=foobar" +- "traefik.http.services.Service0.loadbalancer.healthcheck.timeout=foobar" +- "traefik.http.services.Service0.loadbalancer.passhostheader=true" +- "traefik.http.services.Service0.loadbalancer.responseforwarding.flushinterval=foobar" +- "traefik.http.services.Service0.loadbalancer.server.port=8080" +- "traefik.http.services.Service0.loadbalancer.server.scheme=foobar" +- "traefik.http.services.Service0.loadbalancer.stickiness.cookiename=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.headers.name0=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.headers.name1=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.hostname=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.interval=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.path=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.port=42" +- "traefik.http.services.Service1.loadbalancer.healthcheck.scheme=foobar" +- "traefik.http.services.Service1.loadbalancer.healthcheck.timeout=foobar" +- "traefik.http.services.Service1.loadbalancer.passhostheader=true" +- "traefik.http.services.Service1.loadbalancer.responseforwarding.flushinterval=foobar" +- "traefik.http.services.Service1.loadbalancer.server.port=8080" +- "traefik.http.services.Service1.loadbalancer.server.scheme=foobar" +- "traefik.tcp.routers.Router0.rule=foobar" +- "traefik.tcp.routers.Router0.entrypoints=foobar, fiibar" +- "traefik.tcp.routers.Router0.service=foobar" +- "traefik.tcp.routers.Router0.tls.passthrough=false" +- "traefik.tcp.routers.Router0.tls.options=bar" +- "traefik.tcp.routers.Router1.rule=foobar" +- "traefik.tcp.routers.Router1.entrypoints=foobar, fiibar" +- "traefik.tcp.routers.Router1.service=foobar" +- "traefik.tcp.routers.Router1.tls.passthrough=false" +- "traefik.tcp.routers.Router1.tls.options=foobar" +- "traefik.tcp.services.Service0.loadbalancer.server.port=42" +- "traefik.tcp.services.Service1.loadbalancer.server.port=42" diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index 4c7d08810..c53815310 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -1,254 +1,232 @@ -[Global] - CheckNewVersion = true - SendAnonymousUsage = true +[global] + checkNewVersion = true + sendAnonymousUsage = true -[ServersTransport] - InsecureSkipVerify = true - RootCAs = ["foobar", "foobar"] - MaxIdleConnsPerHost = 42 - [ServersTransport.ForwardingTimeouts] - DialTimeout = 42 - ResponseHeaderTimeout = 42 - IdleConnTimeout = 5 +[serversTransport] + insecureSkipVerify = true + rootCAs = ["foobar", "foobar"] + maxIdleConnsPerHost = 42 + [serversTransport.forwardingTimeouts] + dialTimeout = 42 + responseHeaderTimeout = 42 + idleConnTimeout = 42 -[EntryPoints] +[entryPoints] + [entryPoints.EntryPoint0] + address = "foobar" + [entryPoints.EntryPoint0.transport] + [entryPoints.EntryPoint0.transport.lifeCycle] + requestAcceptGraceTimeout = 42 + graceTimeOut = 42 + [entryPoints.EntryPoint0.transport.respondingTimeouts] + readTimeout = 42 + writeTimeout = 42 + idleTimeout = 42 + [entryPoints.EntryPoint0.proxyProtocol] + insecure = true + trustedIPs = ["foobar", "foobar"] + [entryPoints.EntryPoint0.forwardedHeaders] + insecure = true + trustedIPs = ["foobar", "foobar"] - [EntryPoints.EntryPoint0] - Address = "foobar" - [EntryPoints.EntryPoint0.Transport] - [EntryPoints.EntryPoint0.Transport.LifeCycle] - RequestAcceptGraceTimeout = 42 - GraceTimeOut = 42 - [EntryPoints.EntryPoint0.Transport.RespondingTimeouts] - ReadTimeout = 42 - WriteTimeout = 42 - IdleTimeout = 42 - [EntryPoints.EntryPoint0.ProxyProtocol] - Insecure = true - TrustedIPs = ["foobar", "foobar"] - [EntryPoints.EntryPoint0.ForwardedHeaders] - Insecure = true - TrustedIPs = ["foobar", "foobar"] +[providers] + providersThrottleDuration = 42 + [providers.docker] + constraints = "foobar" + watch = true + endpoint = "foobar" + defaultRule = "foobar" + exposedByDefault = true + useBindPortIP = true + swarmMode = true + network = "foobar" + swarmModeRefreshSeconds = 42 + [providers.docker.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [providers.file] + directory = "foobar" + watch = true + filename = "foobar" + debugLogGeneratedTemplate = true + traefikFile = "foobar" + [providers.marathon] + constraints = "foobar" + trace = true + watch = true + endpoint = "foobar" + defaultRule = "foobar" + exposedByDefault = true + dcosToken = "foobar" + dialerTimeout = 42 + responseHeaderTimeout = 42 + tlsHandshakeTimeout = 42 + keepAlive = 42 + forceTaskHostname = true + respectReadinessChecks = true + [providers.marathon.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [providers.marathon.basic] + httpBasicAuthUser = "foobar" + httpBasicPassword = "foobar" + [providers.kubernetes] + endpoint = "foobar" + token = "foobar" + certAuthFilePath = "foobar" + disablePassHostHeaders = true + namespaces = ["foobar", "foobar"] + labelSelector = "foobar" + ingressClass = "foobar" + [providers.kubernetes.ingressEndpoint] + ip = "foobar" + hostname = "foobar" + publishedService = "foobar" + [providers.kubernetesCRD] + endpoint = "foobar" + token = "foobar" + certAuthFilePath = "foobar" + disablePassHostHeaders = true + namespaces = ["foobar", "foobar"] + labelSelector = "foobar" + ingressClass = "foobar" + [providers.rest] + entryPoint = "foobar" + [providers.rancher] + constraints = "foobar" + watch = true + defaultRule = "foobar" + exposedByDefault = true + enableServiceHealthFilter = true + refreshSeconds = 42 + intervalPoll = true + prefix = "foobar" -[Providers] - ProvidersThrottleDuration = 42 +[api] + entryPoint = "foobar" + dashboard = true + middlewares = ["foobar", "foobar"] + [api.statistics] + recentErrors = 42 - [Providers.Docker] - Watch = true - Endpoint = "foobar" - DefaultRule = "foobar" - ExposedByDefault = true - UseBindPortIP = true - SwarmMode = true - Network = "foobar" - SwarmModeRefreshSeconds = 42 - Constraints = "foobar" +[metrics] + [metrics.prometheus] + buckets = [42.0, 42.0] + entryPoint = "foobar" + middlewares = ["foobar", "foobar"] + [metrics.dataDog] + address = "foobar" + pushInterval = "10s" + [metrics.statsD] + address = "foobar" + pushInterval = "10s" + [metrics.influxDB] + address = "foobar" + protocol = "foobar" + pushInterval = "10s" + database = "foobar" + retentionPolicy = "foobar" + username = "foobar" + password = "foobar" - [Providers.Docker.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true +[ping] + entryPoint = "foobar" + middlewares = ["foobar", "foobar"] - [Providers.File] - Directory = "foobar" - Watch = true - Filename = "foobar" - DebugLogGeneratedTemplate = true - TraefikFile = "foobar" +[log] + level = "foobar" + filePath = "foobar" + format = "foobar" - [Providers.Marathon] - Trace = true - Watch = true - Endpoint = "foobar" - DefaultRule = "foobar" - ExposedByDefault = true - DCOSToken = "foobar" - DialerTimeout = 42 - ResponseHeaderTimeout = 42 - TLSHandshakeTimeout = 42 - KeepAlive = 42 - ForceTaskHostname = true - RespectReadinessChecks = true - Constraints = "foobar" - - [Providers.Marathon.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true - [Providers.Marathon.Basic] - HTTPBasicAuthUser = "foobar" - HTTPBasicPassword = "foobar" - - [Providers.Kubernetes] - Endpoint = "foobar" - Token = "foobar" - CertAuthFilePath = "foobar" - DisablePassHostHeaders = true - Namespaces = ["foobar", "foobar"] - LabelSelector = "foobar" - IngressClass = "foobar" - [Providers.Kubernetes.IngressEndpoint] - IP = "foobar" - Hostname = "foobar" - PublishedService = "foobar" - - [Providers.KubernetesCRD] - Endpoint = "foobar" - Token = "foobar" - CertAuthFilePath = "foobar" - DisablePassHostHeaders = true - Namespaces = ["foobar", "foobar"] - LabelSelector = "foobar" - IngressClass = "foobar" - - [Providers.Rest] - EntryPoint = "foobar" - - [Providers.Rancher] - Watch = true - DefaultRule = "foobar" - ExposedByDefault = true - EnableServiceHealthFilter = true - RefreshSeconds = 42 - IntervalPoll = true - Prefix = "foobar" - Constraints = "foobar" - -[API] - EntryPoint = "foobar" - Dashboard = true - Middlewares = ["foobar", "foobar"] - [API.Statistics] - RecentErrors = 42 - -[Metrics] - - [Metrics.Prometheus] - Buckets = [42.0, 42.0] - EntryPoint = "foobar" - Middlewares = ["foobar", "foobar"] - - [Metrics.Datadog] - Address = "foobar" - PushInterval = "10s" - - [Metrics.StatsD] - Address = "foobar" - PushInterval = "10s" - - [Metrics.InfluxDB] - Address = "foobar" - Protocol = "foobar" - PushInterval = "10s" - Database = "foobar" - RetentionPolicy = "foobar" - Username = "foobar" - Password = "foobar" - -[Ping] - EntryPoint = "foobar" - Middlewares = ["foobar", "foobar"] - -[Log] - Level = "foobar" - FilePath = "foobar" - Format = "foobar" - -[AccessLog] - FilePath = "foobar" - Format = "foobar" - BufferingSize = 42 - [AccessLog.Filters] - StatusCodes = ["foobar", "foobar"] - RetryAttempts = true - MinDuration = 42 - [AccessLog.Fields] - DefaultMode = "foobar" - [AccessLog.Fields.Names] +[accessLog] + filePath = "foobar" + format = "foobar" + bufferingSize = 42 + [accessLog.filters] + statusCodes = ["foobar", "foobar"] + retryAttempts = true + minDuration = 42 + [accessLog.fields] + defaultMode = "foobar" + [accessLog.fields.names] name0 = "foobar" name1 = "foobar" - [AccessLog.Fields.Headers] - DefaultMode = "foobar" - [AccessLog.Fields.Headers.Names] + [accessLog.fields.headers] + defaultMode = "foobar" + [accessLog.fields.headers.names] name0 = "foobar" name1 = "foobar" -[Tracing] - ServiceName = "foobar" - SpanNameLimit = 42 +[tracing] + serviceName = "foobar" + spanNameLimit = 42 + [tracing.jaeger] + samplingServerURL = "foobar" + samplingType = "foobar" + samplingParam = 42.0 + localAgentHostPort = "foobar" + gen128Bit = true + propagation = "foobar" + traceContextHeaderName = "foobar" + [tracing.zipkin] + httpEndpoint = "foobar" + sameSpan = true + id128Bit = true + debug = true + sampleRate = 42.0 + [tracing.dataDog] + localAgentHostPort = "foobar" + globalTag = "foobar" + debug = true + prioritySampling = true + traceIDHeaderName = "foobar" + parentIDHeaderName = "foobar" + samplingPriorityHeaderName = "foobar" + bagagePrefixHeaderName = "foobar" + [tracing.instana] + localAgentHost = "foobar" + localAgentPort = 42 + logLevel = "foobar" + [tracing.haystack] + localAgentHost = "foobar" + localAgentPort = 42 + globalTag = "foobar" + traceIDHeaderName = "foobar" + parentIDHeaderName = "foobar" + spanIDHeaderName = "foobar" - [Tracing.Jaeger] - SamplingServerURL = "foobar" - SamplingType = "foobar" - SamplingParam = 42.0 - LocalAgentHostPort = "foobar" - Gen128Bit = true - Propagation = "foobar" - TraceContextHeaderName = "foobar" +[hostResolver] + cnameFlattening = true + resolvConfig = "foobar" + resolvDepth = 42 - [Tracing.Zipkin] - HTTPEndpoint = "foobar" - SameSpan = true - ID128Bit = true - Debug = true - SampleRate = 42.0 +[acme] + email = "foobar" + acmeLogging = true + caServer = "foobar" + storage = "foobar" + entryPoint = "foobar" + keyType = "foobar" + onHostRule = true + [acme.dnsChallenge] + provider = "foobar" + delayBeforeCheck = 42 + resolvers = ["foobar", "foobar"] + disablePropagationCheck = true + [acme.httpChallenge] + entryPoint = "foobar" + [acme.tlsChallenge] - [Tracing.DataDog] - LocalAgentHostPort = "foobar" - GlobalTag = "foobar" - Debug = true - PrioritySampling = true - TraceIDHeaderName = "foobar" - ParentIDHeaderName = "foobar" - SamplingPriorityHeaderName = "foobar" - BagagePrefixHeaderName = "foobar" + [[acme.domains]] + main = "foobar" + sans = ["foobar", "foobar"] - [Tracing.Instana] - LocalAgentHost = "foobar" - LocalAgentPort = 42 - LogLevel = "foobar" - - [Tracing.Haystack] - LocalAgentHost = "foobar" - LocalAgentPort = 42 - GlobalTag = "foobar" - ParentIDHeaderName = "foobar" - SpanIDHeaderName = "foobar" - TraceIDHeaderName = "foobar" - -[HostResolver] - CnameFlattening = true - ResolvConfig = "foobar" - ResolvDepth = 42 - -[ACME] - Email = "foobar" - ACMELogging = true - CAServer = "foobar" - Storage = "foobar" - EntryPoint = "foobar" - KeyType = "foobar" - OnHostRule = true - - [ACME.DNSChallenge] - Provider = "foobar" - DelayBeforeCheck = 42 - Resolvers = ["foobar", "foobar"] - DisablePropagationCheck = true - - [ACME.HTTPChallenge] - EntryPoint = "foobar" - - [ACME.TLSChallenge] - - [[ACME.Domains]] - Main = "foobar" - SANs = ["foobar", "foobar"] - - [[ACME.Domains]] - Main = "foobar" - SANs = ["foobar", "foobar"] + [[acme.domains]] + main = "foobar" + sans = ["foobar", "foobar"] diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index b616be96a..f0ac4f3db 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -1,234 +1,238 @@ global: - checknewversion: true - sendanonymoususage: true -serverstransport: - insecureskipverify: true - rootcas: + checkNewVersion: true + sendAnonymousUsage: true +serversTransport: + insecureSkipVerify: true + rootCAs: - foobar - foobar - maxidleconnsperhost: 42 - forwardingtimeouts: - dialtimeout: 42000000000 - responseheadertimeout: 42000000000 -entrypoints: + maxIdleConnsPerHost: 42 + forwardingTimeouts: + dialTimeout: 42000000000 + responseHeaderTimeout: 42000000000 + idleConnTimeout: 42000000000 +entryPoints: EntryPoint0: address: foobar transport: - lifecycle: - requestacceptgracetimeout: 42000000000 - gracetimeout: 42000000000 - respondingtimeouts: - readtimeout: 42000000000 - writetimeout: 42000000000 - idletimeout: 42000000000 - proxyprotocol: + lifeCycle: + requestAcceptGraceTimeout: 42000000000 + graceTimeOut: 42000000000 + respondingTimeouts: + readTimeout: 42000000000 + writeTimeout: 42000000000 + idleTimeout: 42000000000 + proxyProtocol: insecure: true - trustedips: + trustedIPs: - foobar - foobar - forwardedheaders: + forwardedHeaders: insecure: true - trustedips: + trustedIPs: - foobar - foobar providers: - providersthrottleduration: 42000000000 + providersThrottleDuration: 42000000000 docker: constraints: foobar watch: true endpoint: foobar - defaultrule: foobar + defaultRule: foobar tls: ca: foobar - caoptional: true + caOptional: true cert: foobar key: foobar - insecureskipverify: true - exposedbydefault: true - usebindportip: true - swarmmode: true + insecureSkipVerify: true + exposedByDefault: true + useBindPortIP: true + swarmMode: true network: foobar - swarmmoderefreshseconds: 42000000000 + swarmModeRefreshSeconds: 42000000000 file: directory: foobar watch: true filename: foobar - debugloggeneratedtemplate: true - traefikfile: foobar + debugLogGeneratedTemplate: true + traefikFile: foobar marathon: constraints: foobar trace: true watch: true endpoint: foobar - defaultrule: foobar - exposedbydefault: true - dcostoken: foobar + defaultRule: foobar + exposedByDefault: true + dcosToken: foobar tls: ca: foobar - caoptional: true + caOptional: true cert: foobar key: foobar - insecureskipverify: true - dialertimeout: 42000000000 - responseheadertimeout: 42000000000 - tlshandshaketimeout: 42000000000 - keepalive: 42000000000 - forcetaskhostname: true + insecureSkipVerify: true + dialerTimeout: 42000000000 + responseHeaderTimeout: 42000000000 + tlsHandshakeTimeout: 42000000000 + keepAlive: 42000000000 + forceTaskHostname: true basic: - httpbasicauthuser: foobar - httpbasicpassword: foobar - respectreadinesschecks: true + httpBasicAuthUser: foobar + httpBasicPassword: foobar + respectReadinessChecks: true kubernetes: endpoint: foobar token: foobar - certauthfilepath: foobar - disablepasshostheaders: true + certAuthFilePath: foobar + disablePassHostHeaders: true namespaces: - foobar - foobar - labelselector: foobar - ingressclass: foobar - ingressendpoint: + labelSelector: foobar + ingressClass: foobar + ingressEndpoint: ip: foobar hostname: foobar - publishedservice: foobar - kubernetescrd: + publishedService: foobar + kubernetesCRD: endpoint: foobar token: foobar - certauthfilepath: foobar - disablepasshostheaders: true + certAuthFilePath: foobar + disablePassHostHeaders: true namespaces: - foobar - foobar - labelselector: foobar - ingressclass: foobar + labelSelector: foobar + ingressClass: foobar rest: - entrypoint: foobar + entryPoint: foobar rancher: constraints: foobar watch: true - defaultrule: foobar - exposedbydefault: true - enableservicehealthfilter: true - refreshseconds: 42 - intervalpoll: true + defaultRule: foobar + exposedByDefault: true + enableServiceHealthFilter: true + refreshSeconds: 42 + intervalPoll: true prefix: foobar api: - entrypoint: foobar + entryPoint: foobar dashboard: true - debug: false statistics: - recenterrors: 42 + recentErrors: 42 middlewares: - foobar - foobar - dashboardassets: null metrics: prometheus: buckets: - 42 - 42 - entrypoint: foobar + entryPoint: foobar middlewares: - foobar - foobar - datadog: + dataDog: address: foobar - pushinterval: 10000000000 - statsd: + pushInterval: 10000000000 + statsD: address: foobar - pushinterval: 10000000000 - influxdb: + pushInterval: 10000000000 + influxDB: address: foobar protocol: foobar - pushinterval: 10000000000 + pushInterval: 10000000000 database: foobar - retentionpolicy: foobar + retentionPolicy: foobar username: foobar password: foobar ping: - entrypoint: foobar + entryPoint: foobar middlewares: - foobar - foobar log: level: foobar - filepath: foobar + filePath: foobar format: foobar -accesslog: - filepath: foobar +accessLog: + filePath: foobar format: foobar filters: - statuscodes: + statusCodes: - foobar - foobar - retryattempts: true - minduration: 42000000000 + retryAttempts: true + minDuration: 42000000000 fields: - defaultmode: foobar + defaultMode: foobar names: name0: foobar name1: foobar headers: - defaultmode: foobar + defaultMode: foobar names: name0: foobar name1: foobar - bufferingsize: 42 + bufferingSize: 42 tracing: - backend: foobar - servicename: foobar - spannamelimit: 42 + serviceName: foobar + spanNameLimit: 42 jaeger: - samplingserverurl: foobar - samplingtype: foobar - samplingparam: 42 - localagenthostport: foobar - gen128bit: true + samplingServerURL: foobar + samplingType: foobar + samplingParam: 42 + localAgentHostPort: foobar + gen128Bit: true propagation: foobar - tracecontextheadername: foobar + traceContextHeaderName: foobar zipkin: - httpendpoint: foobar - samespan: true - id128bit: true + httpEndpoint: foobar + sameSpan: true + id128Bit: true debug: true - samplerate: 42 - datadog: - localagenthostport: foobar - globaltag: foobar + sampleRate: 42 + dataDog: + localAgentHostPort: foobar + globalTag: foobar debug: true - prioritysampling: true - traceidheadername: foobar - parentidheadername: foobar - samplingpriorityheadername: foobar - bagageprefixheadername: foobar + prioritySampling: true + traceIDHeaderName: foobar + parentIDHeaderName: foobar + samplingPriorityHeaderName: foobar + bagagePrefixHeaderName: foobar instana: - localagenthost: foobar - localagentport: 42 - loglevel: foobar - haystack: null -hostresolver: - cnameflattening: true - resolvconfig: foobar - resolvdepth: 42 + localAgentHost: foobar + localAgentPort: 42 + logLevel: foobar + haystack: + localAgentHost: foobar + localAgentPort: 42 + globalTag: foobar + traceIDHeaderName: foobar + parentIDHeaderName: foobar + spanIDHeaderName: foobar +hostResolver: + cnameFlattening: true + resolvConfig: foobar + resolvDepth: 42 acme: email: foobar - acmelogging: true - caserver: foobar + acmeLogging: true + caServer: foobar storage: foobar - entrypoint: foobar - keytype: foobar - onhostrule: true - dnschallenge: + entryPoint: foobar + keyType: foobar + onHostRule: true + dnsChallenge: provider: foobar - delaybeforecheck: 42000000000 + delayBeforeCheck: 42000000000 resolvers: - foobar - foobar - disablepropagationcheck: true - httpchallenge: - entrypoint: foobar - tlschallenge: {} + disablePropagationCheck: true + httpChallenge: + entryPoint: foobar + tlsChallenge: {} domains: - main: foobar sans: diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index 976ca244c..78534aa9b 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -3,7 +3,7 @@ Opening Connections for Incoming Requests {: .subtitle } -![EntryPoints](../assets/img/entrypoints.png) +![entryPoints](../assets/img/entrypoints.png) EntryPoints are the network entry points into Traefik. They define the port which will receive the requests (whether HTTP or TCP). @@ -12,17 +12,27 @@ They define the port which will receive the requests (whether HTTP or TCP). ??? example "Port 80 only" - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] - address = ":80" + address = ":80" + ``` + + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 ``` We define an `entrypoint` called `web` that will listen on port `80`. ??? example "Port 80 & 443" - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -30,6 +40,20 @@ They define the port which will receive the requests (whether HTTP or TCP). [entryPoints.web-secure] address = ":443" ``` + + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + + web-secure: + address: ":443" + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 + --entryPoints.web-secure.address=:443 + ``` - Two entrypoints are defined: one called `web`, and the other called `web-secure`. - `web` listens on port `80`, and `web-secure` on port `443`. @@ -43,38 +67,63 @@ You can define them using a toml file, CLI arguments, or a key-value store. See the complete reference for the list of available options: -```toml tab="File" +```toml tab="File (TOML)" [entryPoints] [entryPoints.EntryPoint0] - Address = ":8888" - [entryPoints.EntryPoint0.Transport] - [entryPoints.EntryPoint0.Transport.LifeCycle] - RequestAcceptGraceTimeout = 42 - GraceTimeOut = 42 - [entryPoints.EntryPoint0.Transport.RespondingTimeouts] - ReadTimeout = 42 - WriteTimeout = 42 - IdleTimeout = 42 - [entryPoints.EntryPoint0.ProxyProtocol] - Insecure = true - TrustedIPs = ["foobar", "foobar"] - [entryPoints.EntryPoint0.ForwardedHeaders] - Insecure = true - TrustedIPs = ["foobar", "foobar"] + address = ":8888" + [entryPoints.EntryPoint0.transport] + [entryPoints.EntryPoint0.transport.lifeCycle] + requestAcceptGraceTimeout = 42 + graceTimeOut = 42 + [entryPoints.EntryPoint0.transport.respondingTimeouts] + readTimeout = 42 + writeTimeout = 42 + idleTimeout = 42 + [entryPoints.EntryPoint0.proxyProtocol] + insecure = true + trustedIPs = ["foobar", "foobar"] + [entryPoints.EntryPoint0.forwardedHeaders] + insecure = true + trustedIPs = ["foobar", "foobar"] +``` + +```yaml tab="File (YAML)" +entryPoints: + + EntryPoint0: + address: ":8888" + transport: + lifeCycle: + requestAcceptGraceTimeout: 42 + graceTimeOut: 42 + respondingTimeouts: + readTimeout: 42 + writeTimeout: 42 + idleTimeout: 42 + proxyProtocol: + insecure: true + trustedIPs: + - "foobar" + - "foobar" + forwardedHeaders: + insecure: true + trustedIPs: + - "foobar" + - "foobar" ``` ```ini tab="CLI" ---entryPoints.EntryPoint0.Address=:8888 ---entryPoints.EntryPoint0.Transport.LifeCycle.RequestAcceptGraceTimeout=42 ---entryPoints.EntryPoint0.Transport.LifeCycle.GraceTimeOut=42 ---entryPoints.EntryPoint0.Transport.RespondingTimeouts.ReadTimeout=42 ---entryPoints.EntryPoint0.Transport.RespondingTimeouts.WriteTimeout=42 ---entryPoints.EntryPoint0.Transport.RespondingTimeouts.IdleTimeout=42 ---entryPoints.EntryPoint0.ProxyProtocol.Insecure=true ---entryPoints.EntryPoint0.ProxyProtocol.TrustedIPs=foobar,foobar ---entryPoints.EntryPoint0.ForwardedHeaders.Insecure=true ---entryPoints.EntryPoint0.ForwardedHeaders.TrustedIPs=foobar,foobar +--entryPoints.EntryPoint0.address=:8888 +--entryPoints.EntryPoint0.transport.lifeCycle.requestAcceptGraceTimeout=42 +--entryPoints.EntryPoint0.transport.lifeCycle.graceTimeOut=42 +--entryPoints.EntryPoint0.transport.respondingTimeouts.readTimeout=42 +--entryPoints.EntryPoint0.transport.respondingTimeouts.writeTimeout=42 +--entryPoints.EntryPoint0.transport.respondingTimeouts.idleTimeout=42 +--entryPoints.EntryPoint0.proxyProtocol.insecure=true +--entryPoints.EntryPoint0.proxyProtocol.trustedIPs=foobar,foobar +--entryPoints.EntryPoint0.forwardedHeaders.insecure=true +--entryPoints.EntryPoint0.forwardedHeaders.trustedIPs=foobar,foobar ``` ## ProxyProtocol @@ -83,7 +132,7 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- ??? example "Enabling Proxy Protocol with Trusted IPs" - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -92,6 +141,21 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- trustedIPs = ["127.0.0.1/32", "192.168.1.7"] ``` + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + proxyProtocol + trustedIPs: + - "127.0.0.1/32" + - "192.168.1.7" + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 + --entryPoints.web.proxyProtocol.trustedIPs=127.0.0.1/32,192.168.1.7 + ``` + IPs in `trustedIPs` only will lead to remote client address replacement: Declare load-balancer IPs or CIDR range here. ??? example "Insecure Mode -- Testing Environment Only" @@ -99,7 +163,7 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- In a test environments, you can configure Traefik to trust every incoming connection. Doing so, every remote client address will be replaced (`trustedIPs` won't have any effect) - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -107,7 +171,20 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- [entryPoints.web.proxyProtocol] insecure = true ``` - + + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + proxyProtocol: + insecure: true + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 + --entryPoints.web.proxyProtocol.insecure + ``` + !!! warning "Queuing Traefik behind Another Load Balancer" When queuing Traefik behind another load-balancer, make sure to configure Proxy Protocol on both sides. @@ -119,7 +196,7 @@ You can configure Traefik to trust the forwarded headers information (`X-Forward ??? example "Trusting Forwarded Headers from specific IPs" - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -128,13 +205,41 @@ You can configure Traefik to trust the forwarded headers information (`X-Forward trustedIPs = ["127.0.0.1/32", "192.168.1.7"] ``` + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + forwardedHeaders + trustedIPs: + - "127.0.0.1/32" + - "192.168.1.7" + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 + --entryPoints.web.forwardedHeaders.trustedIPs=127.0.0.1/32,192.168.1.7 + ``` + ??? example "Insecure Mode -- Always Trusting Forwarded Headers" - ```toml + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" [entryPoints.web.forwardedHeaders] - insecure = true + insecure = true + ``` + + ```yaml tab="File (YAML)" + entryPoints: + web: + address: ":80" + forwardedHeaders: + insecure: true + ``` + + ```ini tab="CLI" + --entryPoints.web.address=:80 + --entryPoints.web.forwardedHeaders.insecure ``` diff --git a/docs/content/routing/overview.md b/docs/content/routing/overview.md index 072b93f01..39247cda6 100644 --- a/docs/content/routing/overview.md +++ b/docs/content/routing/overview.md @@ -38,10 +38,11 @@ Static configuration: ``` ```yaml tab="YAML" -entrypoints: +entryPoints: web: # Listen on port 8081 for incoming requests address: :8081 + providers: # Enable the file provider to define routers / middlewares / services in a file file: {} @@ -63,13 +64,13 @@ Dynamic configuration: [http.middlewares] # Define an authentication mechanism - [http.middlewares.test-user.basicauth] + [http.middlewares.test-user.basicAuth] users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] [http.services] # Define how to reach an existing service on our infrastructure - [http.services.whoami.loadbalancer] - [[http.services.whoami.loadbalancer.servers]] + [http.services.whoami.loadBalancer] + [[http.services.whoami.loadBalancer.servers]] url = "http://private/whoami-service" ``` @@ -85,16 +86,18 @@ http: - test-user # If the rule matches, forward to the whoami service (declared below) service: whoami + middlewares: # Define an authentication mechanism test-user: basicAuth: users: - test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/ + services: # Define how to reach an existing service on our infrastructure whoami: - loadbalancer: + loadBalancer: servers: - url: http://private/whoami-service ``` @@ -115,17 +118,17 @@ http: ```toml tab="TOML" [entryPoints] - [entryPoints.web] - # Listen on port 8081 for incoming requests - address = ":8081" + [entryPoints.web] + # Listen on port 8081 for incoming requests + address = ":8081" [providers] - # Enable the file provider to define routers / middlewares / services in a file - [providers.file] + # Enable the file provider to define routers / middlewares / services in a file + [providers.file] ``` ```yaml tab="YAML" - entrypoints: + entryPoints: web: # Listen on port 8081 for incoming requests address: :8081 @@ -139,42 +142,43 @@ http: ```toml tab="TOML" # http routing section [http] - [http.routers] - # Define a connection between requests and services - [http.routers.to-whoami] - rule = "Host(`domain`) && PathPrefix(`/whoami/`)" - # If the rule matches, applies the middleware - middlewares = ["test-user"] - # If the rule matches, forward to the whoami service (declared below) - service = "whoami" + [http.routers] + # Define a connection between requests and services + [http.routers.to-whoami] + rule = "Host(`domain`) && PathPrefix(`/whoami/`)" + # If the rule matches, applies the middleware + middlewares = ["test-user"] + # If the rule matches, forward to the whoami service (declared below) + service = "whoami" - [http.middlewares] - # Define an authentication mechanism - [http.middlewares.test-user.basicauth] - users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] + [http.middlewares] + # Define an authentication mechanism + [http.middlewares.test-user.basicAuth] + users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"] - [http.services] - # Define how to reach an existing service on our infrastructure - [http.services.whoami.loadbalancer] - [[http.services.whoami.loadbalancer.servers]] - url = "http://private/whoami-service" + [http.services] + # Define how to reach an existing service on our infrastructure + [http.services.whoami.loadBalancer] + [[http.services.whoami.loadBalancer.servers]] + url = "http://private/whoami-service" - [tcp] - [tcp.routers] - [tcp.routers.to-whoami-tcp] - rule = "HostSNI(`whoami-tcp.traefik.io`)" - service = "whoami-tcp" - [tcp.routers.to-whoami-tcp.tls] + [tcp] + [tcp.routers] + [tcp.routers.to-whoami-tcp] + rule = "HostSNI(`whoami-tcp.traefik.io`)" + service = "whoami-tcp" + [tcp.routers.to-whoami-tcp.tls] - [tcp.services] - [tcp.services.whoami-tcp.loadbalancer] - [[tcp.services.whoami-tcp.loadbalancer.servers]] - address = "xx.xx.xx.xx:xx" + [tcp.services] + [tcp.services.whoami-tcp.loadBalancer] + [[tcp.services.whoami-tcp.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" ``` ```yaml tab="YAML" # http routing section http: + routers: # Define a connection between requests and services to-whoami: @@ -184,26 +188,30 @@ http: - test-user # If the rule matches, forward to the whoami service (declared below) service: whoami + middlewares: # Define an authentication mechanism test-user: basicAuth: users: - test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/ + services: # Define how to reach an existing service on our infrastructure whoami: - loadbalancer: + loadBalancer: servers: - url: http://private/whoami-service tcp: + routers: to-whoami-tcp: service: whoami-tcp rule: HostSNI(`whoami-tcp.traefik.io`) + services: whoami-tcp: - loadbalancer: + loadBalancer: servers: - address: xx.xx.xx.xx:xx ``` diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index b59513e75..811783f04 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -12,40 +12,84 @@ In the process, routers may use pieces of [middleware](../../middlewares/overvie ??? example "Requests /foo are Handled by service-foo -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.routers] [http.routers.my-router] - rule = "Path(`/foo`)" - service = "service-foo" + rule = "Path(`/foo`)" + service = "service-foo" + ``` + + ```yaml tab="YAML" + http: + routers: + my-router: + rule: "Path(`/foo`)" + service: service-foo ``` ??? example "With a [middleware](../../middlewares/overview.md) -- using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.routers] [http.routers.my-router] - rule = "Path(`/foo`)" - middlewares = ["authentication"] # declared elsewhere - service = "service-foo" + rule = "Path(`/foo`)" + # declared elsewhere + middlewares = ["authentication"] + service = "service-foo" + ``` + + ```yaml tab="YAML" + http: + routers: + my-router: + rule: "Path(`/foo`)" + # declared elsewhere + middlewares: + - authentication + service: service-foo ``` ??? example "Forwarding all (non-tls) requests on port 3306 to a database service" - - ```toml - [entryPoints] - [entryPoints.mysql-default] - address = ":80" - [entryPoints.mysql-default] - address = ":3306" + + ```toml tab="TOML" + ## Static configuration ## + + [entryPoints] + [entryPoints.web] + address = ":80" + [entryPoints.mysql-default] + address = ":3306" + + ## Dynamic configuration ## + + [tcp] + [tcp.routers] + [tcp.routers.to-database] + entryPoints = ["mysql-default"] + # Catch every request (only available rule for non-tls routers. See below.) + rule = "HostSNI(`*`)" + service = "database" ``` - ```toml - [tcp] - [tcp.routers] - [tcp.routers.to-database] - entryPoints = ["mysql-default"] - rule = "HostSNI(`*`)" # Catch every request (only available rule for non-tls routers. See below.) - service = "database" + ```yaml tab="YAML" + ## Static configuration ## + + entryPoints: + web: + address: ":80" + mysql-default: + address: ":3306" + + ## Dynamic configuration ## + + tcp: + routers: + to-database: + entryPoints: + - "mysql-default" + # Catch every request (only available rule for non-tls routers. See below.) + rule: "HostSNI(`*`)" + service: database ``` ## Configuring HTTP Routers @@ -56,43 +100,94 @@ If not specified, HTTP routers will accept requests from all defined entry point If you want to limit the router scope to a set of entry points, set the `entryPoints` option. ??? example "Listens to Every EntryPoint" - - ```toml + + ```toml tab="TOML" + ## Static configuration ## + [entryPoints] - [entryPoints.web] - # ... - [entryPoints.web-secure] - # ... - [entryPoints.other] - # ... + [entryPoints.web] + # ... + [entryPoints.web-secure] + # ... + [entryPoints.other] + # ... + + + ## Dynamic configuration ## + + [http.routers] + [http.routers.Router-1] + # By default, routers listen to every entry points + rule = "Host(`traefik.io`)" + service = "service-1" ``` - ```toml - [http.routers] - [http.routers.Router-1] - # By default, routers listen to every entrypoints - rule = "Host(`traefik.io`)" - service = "service-1" + ```yaml tab="YAML" + ## Static configuration ## + + entryPoints: + web: + # ... + web-secure: + # ... + other: + # ... + + ## Dynamic configuration ## + + http: + routers: + Router-1: + # By default, routers listen to every entry points + rule: "Host(`traefik.io`)" + service: "service-1" ``` ??? example "Listens to Specific EntryPoints" - - ```toml + + ```toml tab="TOML" + ## Static configuration ## + [entryPoints] - [entryPoints.web] - # ... - [entryPoints.web-secure] - # ... - [entryPoints.other] - # ... + [entryPoints.web] + # ... + [entryPoints.web-secure] + # ... + [entryPoints.other] + # ... + + ## Dynamic configuration ## + + [http.routers] + [http.routers.Router-1] + # won't listen to entry point web + entryPoints = ["web-secure", "other"] + rule = "Host(`traefik.io`)" + service = "service-1" ``` - ```toml - [http.routers] - [http.routers.Router-1] - entryPoints = ["web-secure", "other"] # won't listen to entrypoint web - rule = "Host(`traefik.io`)" - service = "service-1" + ```yaml tab="YAML" + ## Static configuration ## + + entryPoints: + web: + # ... + web-secure: + # ... + other: + # ... + + ## Dynamic configuration ## + + http: + routers: + Router-1: + # won't listen to entry point web + entryPoints: + - "web-secure" + - "other" + rule: "Host(`traefik.io`)" + service: "service-1" ``` ### Rule @@ -170,12 +265,23 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted ??? example "Configuring the router to accept HTTPS requests only" - ```toml + ```toml tab="TOML" [http.routers] - [http.routers.Router-1] - rule = "Host(`foo-domain`) && Path(`/foo-path/`)" - service = "service-id" - [http.routers.Router-1.tls] # will terminate the TLS request + [http.routers.Router-1] + rule = "Host(`foo-domain`) && Path(`/foo-path/`)" + service = "service-id" + # will terminate the TLS request + [http.routers.Router-1.tls] + ``` + + ```yaml tab="YAML" + http: + routers: + Router-1: + rule: "Host(`foo-domain`) && Path(`/foo-path/`)" + service: service-id + # will terminate the TLS request + tls: {} ``` !!! note "HTTPS & ACME" @@ -192,16 +298,31 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted ??? example "HTTP & HTTPS routes" - ```toml + ```toml tab="TOML" [http.routers] - [http.routers.my-https-router] - rule = "Host(`foo-domain`) && Path(`/foo-path/`)" - service = "service-id" - [http.routers.my-https-router.tls] # will terminate the TLS request + [http.routers.my-https-router] + rule = "Host(`foo-domain`) && Path(`/foo-path/`)" + service = "service-id" + # will terminate the TLS request + [http.routers.my-https-router.tls] - [http.routers.my-http-router] - rule = "Host(`foo-domain`) && Path(`/foo-path/`)" - service = "service-id" + [http.routers.my-http-router] + rule = "Host(`foo-domain`) && Path(`/foo-path/`)" + service = "service-id" + ``` + + ```yaml tab="YAML" + http: + routers: + my-https-router: + rule: "Host(`foo-domain`) && Path(`/foo-path/`)" + service: service-id + # will terminate the TLS request + tls: {} + + my-http-router: + rule: "Host(`foo-domain`) && Path(`/foo-path/`)" + service: service-id ``` #### `Options` @@ -209,23 +330,43 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted The `Options` field enables fine-grained control of the TLS parameters. It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied only if a `Host` rule is defined. -??? example "Configuring the tls options" +??? example "Configuring the TLS options" - ```toml + ```toml tab="TOML" [http.routers] - [http.routers.Router-1] - rule = "Host(`foo-domain`) && Path(`/foo-path/`)" - service = "service-id" - [http.routers.Router-1.tls] # will terminate the TLS request - options = "foo" + [http.routers.Router-1] + rule = "Host(`foo-domain`) && Path(`/foo-path/`)" + service = "service-id" + # will terminate the TLS request + [http.routers.Router-1.tls] + options = "foo" [tls.options] [tls.options.foo] - minVersion = "VersionTLS12" - cipherSuites = [ - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - "TLS_RSA_WITH_AES_256_GCM_SHA384" - ] + minVersion = "VersionTLS12" + cipherSuites = [ + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + "TLS_RSA_WITH_AES_256_GCM_SHA384" + ] + ``` + + ```yaml tab="YAML" + http: + routers: + Router-1: + rule: "Host(`foo-domain`) && Path(`/foo-path/`)" + service: service-id + # will terminate the TLS request + tls: + options: foo + + tls: + options: + foo: + minVersion: VersionTLS12 + cipherSuites: + - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + - TLS_RSA_WITH_AES_256_GCM_SHA384 ``` ## Configuring TCP Routers @@ -242,44 +383,100 @@ If you want to limit the router scope to a set of entry points, set the entry po ??? example "Listens to Every Entry Point" - ```toml + ```toml tab="TOML" + ## Static configuration ## + [entryPoints] - [entryPoints.web] - # ... - [entryPoints.web-secure] - # ... - [entryPoints.other] - # ... + [entryPoints.web] + # ... + [entryPoints.web-secure] + # ... + [entryPoints.other] + # ... + + ## Dynamic configuration ## + + [tcp.routers] + [tcp.routers.Router-1] + # By default, routers listen to every entrypoints + rule = "HostSNI(`traefik.io`)" + service = "service-1" + # will route TLS requests (and ignore non tls requests) + [tcp.routers.Router-1.tls] ``` - ```toml - [tcp.routers] - [tcp.routers.Router-1] + ```yaml tab="YAML" + ## Static configuration ## + + entryPoints: + web: + # ... + web-secure: + # ... + other: + # ... + + ## Dynamic configuration ## + + tcp: + routers: + Router-1: # By default, routers listen to every entrypoints - rule = "HostSNI(`traefik.io`)" - service = "service-1" - [tcp.routers.Router-1.tls] # will route TLS requests (and ignore non tls requests) + rule: "HostSNI(`traefik.io`)" + service: "service-1" + # will route TLS requests (and ignore non tls requests) + tls: {} ``` ??? example "Listens to Specific Entry Points" - - ```toml + + ```toml tab="TOML" + ## Static configuration ## + [entryPoints] - [entryPoints.web] - # ... - [entryPoints.web-secure] - # ... - [entryPoints.other] - # ... - ``` - - ```toml + [entryPoints.web] + # ... + [entryPoints.web-secure] + # ... + [entryPoints.other] + # ... + + ## Dynamic configuration ## + [tcp.routers] - [tcp.routers.Router-1] - entryPoints = ["web-secure", "other"] # won't listen to entrypoint web - rule = "HostSNI(`traefik.io`)" - service = "service-1" - [tcp.routers.Router-1.tls] # will route TLS requests (and ignore non tls requests) + [tcp.routers.Router-1] + # won't listen to entry point web + entryPoints = ["web-secure", "other"] + rule = "HostSNI(`traefik.io`)" + service = "service-1" + # will route TLS requests (and ignore non tls requests) + [tcp.routers.Router-1.tls] + ``` + + ```yaml tab="YAML" + ## Static configuration ## + + entryPoints: + web: + # ... + web-secure: + # ... + other: + # ... + + ## Dynamic configuration ## + + tcp: + routers: + Router-1: + # won't listen to entry point web + entryPoints: + - "web-secure" + - "other" + rule: "HostSNI(`traefik.io`)" + service: "service-1" + # will route TLS requests (and ignore non tls requests) + tls: {} ``` ### Rule @@ -312,23 +509,44 @@ Services are the target for the router. ??? example "Configuring TLS Termination" - ```toml + ```toml tab="TOML" [tcp.routers] - [tcp.routers.Router-1] - rule = "HostSNI(`foo-domain`)" - service = "service-id" - [tcp.routers.Router-1.tls] # will terminate the TLS request by default + [tcp.routers.Router-1] + rule = "HostSNI(`foo-domain`)" + service = "service-id" + # will terminate the TLS request by default + [tcp.routers.Router-1.tls] + ``` + + ```yaml tab="YAML" + tcp: + routers: + Router-1: + rule: "HostSNI(`foo-domain`)" + service: service-id + # will terminate the TLS request by default + tld: {} ``` ??? example "Configuring passthrough" - ```toml + ```toml tab="TOML" [tcp.routers] - [tcp.routers.Router-1] - rule = "HostSNI(`foo-domain`)" - service = "service-id" - [tcp.routers.Router-1.tls] - passthrough=true + [tcp.routers.Router-1] + rule = "HostSNI(`foo-domain`)" + service = "service-id" + [tcp.routers.Router-1.tls] + passthrough = true + ``` + + ```yaml tab="YAML" + tcp: + routers: + Router-1: + rule: "HostSNI(`foo-domain`)" + service: service-id + tls: + passthrough: true ``` !!! note "TLS & ACME" @@ -342,19 +560,39 @@ It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied ??? example "Configuring the tls options" - ```toml + ```toml tab="TOML" [tcp.routers] - [tcp.routers.Router-1] - rule = "HostSNI(`foo-domain`)" - service = "service-id" - [tcp.routers.Router-1.tls] # will terminate the TLS request - options = "foo" + [tcp.routers.Router-1] + rule = "HostSNI(`foo-domain`)" + service = "service-id" + # will terminate the TLS request + [tcp.routers.Router-1.tls] + options = "foo" [tls.options] [tls.options.foo] - minVersion = "VersionTLS12" - cipherSuites = [ - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", - "TLS_RSA_WITH_AES_256_GCM_SHA384" - ] + minVersion = "VersionTLS12" + cipherSuites = [ + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", + "TLS_RSA_WITH_AES_256_GCM_SHA384" + ] + ``` + + ```yaml tab="YAML" + tcp: + routers: + Router-1: + rule: "HostSNI(`foo-domain`)" + service: service-id + # will terminate the TLS request + tls: + options: foo + + tls: + options: + foo: + minVersion: VersionTLS12 + cipherSuites: + - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" + - "TLS_RSA_WITH_AES_256_GCM_SHA384" ``` diff --git a/docs/content/routing/services/index.md b/docs/content/routing/services/index.md index b3fc7c03d..cef456c93 100644 --- a/docs/content/routing/services/index.md +++ b/docs/content/routing/services/index.md @@ -11,25 +11,45 @@ The `Services` are responsible for configuring how to reach the actual services ??? example "Declaring an HTTP Service with Two Servers -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.services] - [http.services.my-service.LoadBalancer] - - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-1/" - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-2/" + [http.services.my-service.loadBalancer] + + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-1/" + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-2/" + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + servers: + - url: "http://private-ip-server-1/" + - url: "http://private-ip-server-2/" ``` ??? example "Declaring a TCP Service with Two Servers -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [tcp.services] - [tcp.services.my-service.LoadBalancer] - [[tcp.services.my-service.LoadBalancer.servers]] - address = "xx.xx.xx.xx:xx" - [[tcp.services.my-service.LoadBalancer.servers]] - address = "xx.xx.xx.xx:xx" + [tcp.services.my-service.loadBalancer] + [[tcp.services.my-service.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" + [[tcp.services.my-service.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" + ``` + + ```yaml tab="YAML" + tcp: + services: + my-service: + loadBalancer: + servers: + - address: "xx.xx.xx.xx:xx" + - address: "xx.xx.xx.xx:xx" ``` ## Configuring HTTP Services @@ -46,14 +66,24 @@ The load balancers are able to load balance the requests between multiple instan ??? example "Declaring a Service with Two Servers (with Load Balancing) -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.services] - [http.services.my-service.LoadBalancer] - - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-1/" - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-2/" + [http.services.my-service.loadBalancer] + + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-1/" + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-2/" + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + servers: + - url: "http://private-ip-server-1/" + - url: "http://private-ip-server-2/" ``` #### Servers @@ -68,11 +98,20 @@ The `url` option point to a specific instance. ??? example "A Service with One Server -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.services] - [http.services.my-service.LoadBalancer] - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-1/" + [http.services.my-service.loadBalancer] + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-1/" + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + servers: + url: "http://private-ip-server-1/" ``` #### Load-balancing @@ -81,13 +120,23 @@ For now, only round robin load balancing is supported: ??? example "Load Balancing -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.services] - [http.services.my-service.LoadBalancer] - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-1/" - [[http.services.my-service.LoadBalancer.servers]] - url = "http://private-ip-server-1/" + [http.services.my-service.loadBalancer] + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-1/" + [[http.services.my-service.loadBalancer.servers]] + url = "http://private-ip-server-2/" + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + servers: + - url: "http://private-ip-server-1/" + - url: "http://private-ip-server-2/" ``` #### Sticky sessions @@ -109,39 +158,56 @@ On subsequent requests, the client is forwarded to the same server. ??? example "Adding Stickiness" - ```toml + ```toml tab="TOML" [http.services] [http.services.my-service] - [http.services.my-service.LoadBalancer.stickiness] - secureCookie = true - httpOnlyCookie = true + [http.services.my-service.loadBalancer.stickiness] + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + stickiness: {} ``` ??? example "Adding Stickiness with a Custom Cookie Name" - ```toml + ```toml tab="TOML" [http.services] [http.services.my-service] - [http.services.my-service.LoadBalancer.stickiness] - cookieName = "my_stickiness_cookie_name" - secureCookie = true - httpOnlyCookie = true + [http.services.my-service.loadBalancer.stickiness] + cookieName = "my_stickiness_cookie_name" + secureCookie = true + httpOnlyCookie = true + ``` + + ```yaml tab="YAML" + http: + services: + my-service: + loadBalancer: + stickiness: + cookieName: my_stickiness_cookie_name + secureCookie: true + httpOnlyCookie: true ``` #### Health Check -Configure healthcheck to remove unhealthy servers from the load balancing rotation. +Configure health check to remove unhealthy servers from the load balancing rotation. Traefik will consider your servers healthy as long as they return status codes between `2XX` and `3XX` to the health check requests (carried out every `interval`). Below are the available options for the health check mechanism: -- `path` is appended to the server URL to set the healcheck endpoint. -- `scheme`, if defined, will replace the server URL `scheme` for the healthcheck endpoint -- `hostname`, if defined, will replace the server URL `hostname` for the healthcheck endpoint. -- `port`, if defined, will replace the server URL `port` for the healthcheck endpoint. -- `interval` defines the frequency of the healthcheck calls. -- `timeout` defines the maximum duration Traefik will wait for a healthcheck request before considering the server failed (unhealthy). -- `headers` defines custom headers to be sent to the healthcheck endpoint. +- `path` is appended to the server URL to set the health check endpoint. +- `scheme`, if defined, will replace the server URL `scheme` for the health check endpoint +- `hostname`, if defined, will replace the server URL `hostname` for the health check endpoint. +- `port`, if defined, will replace the server URL `port` for the health check endpoint. +- `interval` defines the frequency of the health check calls. +- `timeout` defines the maximum duration Traefik will wait for a health check request before considering the server failed (unhealthy). +- `headers` defines custom headers to be sent to the health check endpoint. !!! note "Interval & Timeout Format" @@ -153,50 +219,93 @@ Below are the available options for the health check mechanism: Traefik keeps monitoring the health of unhealthy servers. If a server has recovered (returning `2xx` -> `3xx` responses again), it will be added back to the load balacer rotation pool. -??? example "Custom Interval & Timeout -- Using the File Provider" +??? example "Custom Interval & Timeout -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [http.services] [http.servicess.Service-1] - [http.services.Service-1.healthcheck] - path = "/health" - interval = "10s" - timeout = "3s" + [http.services.Service-1.loadBalancer.healthCheck] + path = "/health" + interval = "10s" + timeout = "3s" ``` -??? example "Custom Port -- Using the File Provider" + ```yaml tab="YAML" + http: + servicess: + Service-1: + loadBalancer: + healthCheck: + path: /health + interval: "10s" + timeout: "3s" + ``` - ```toml +??? example "Custom Port -- Using the [File Provider](../../providers/file.md)" + + ```toml tab="TOML" [http.services] [http.services.Service-1] - [http.services.Service-1.healthcheck] - path = "/health" - port = 8080 - ``` - -??? example "Custom Scheme -- Using the File Provider" - - ```toml - [http.services] - [http.services.Service-1] - [http.services.Service-1.healthcheck] - path = "/health" - scheme = "http" - ``` - -??? example "Additional HTTP Headers -- Using the File Provider" - - ```toml - [http.services] - [http.services.Service-1] - [http.servicess.Service-1.healthcheck] - path = "/health" - - [Service.Service-1.healthcheck.headers] - My-Custom-Header = "foo" - My-Header = "bar" + [http.services.Service-1.loadBalancer.healthCheck] + path = "/health" + port = 8080 ``` + ```yaml tab="YAML" + http: + services: + Service-1: + loadBalancer: + healthCheck: + path: /health + port: 8080 + ``` + +??? example "Custom Scheme -- Using the [File Provider](../../providers/file.md)" + + ```toml tab="TOML" + [http.services] + [http.services.Service-1] + [http.services.Service-1.loadBalancer.healthCheck] + path = "/health" + scheme = "http" + ``` + + ```yaml tab="YAML" + http: + services: + Service-1: + loadBalancer: + healthCheck: + path: /health + scheme: http + ``` + +??? example "Additional HTTP Headers -- Using the [File Provider](../../providers/file.md)" + + ```toml tab="TOML" + [http.services] + [http.services.Service-1] + [http.services.Service-1.loadBalancer.healthCheck] + path = "/health" + + [http.services.Service-1.loadBalancer.healthCheck.headers] + My-Custom-Header = "foo" + My-Header = "bar" + ``` + + ```yaml tab="YAML" + http: + services: + Service-1: + loadBalancer: + healthCheck: + path: /health + headers: + My-Custom-Header: foo + My-Header: bar + ``` + ## Configuring TCP Services ### General @@ -211,13 +320,23 @@ The load balancers are able to load balance the requests between multiple instan ??? example "Declaring a Service with Two Servers -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [tcp.services] - [tcp.services.my-service.LoadBalancer] - [[tcp.services.my-service.LoadBalancer.servers]] - address = "xx.xx.xx.xx:xx" - [[tcp.services.my-service.LoadBalancer.servers]] - address = "xx.xx.xx.xx:xx" + [tcp.services.my-service.loadBalancer] + [[tcp.services.my-service.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" + [[tcp.services.my-service.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" + ``` + + ```yaml tab="YAML" + tcp: + services: + my-service: + loadBalancer: + servers: + - address: "xx.xx.xx.xx:xx" + - address: "xx.xx.xx.xx:xx" ``` #### Servers @@ -227,9 +346,18 @@ The `address` option (IP:Port) point to a specific instance. ??? example "A Service with One Server -- Using the [File Provider](../../providers/file.md)" - ```toml + ```toml tab="TOML" [tcp.services] - [tcp.services.my-service.LoadBalancer] - [[tcp.services.my-service.LoadBalancer.servers]] - address = "xx.xx.xx.xx:xx" + [tcp.services.my-service.loadBalancer] + [[tcp.services.my-service.loadBalancer.servers]] + address = "xx.xx.xx.xx:xx" + ``` + + ```yaml tab="YAML" + tcp: + services: + my-service: + loadBalancer: + servers: + address: "xx.xx.xx.xx:xx" ``` diff --git a/docs/content/user-guides/marathon.md b/docs/content/user-guides/marathon.md index e1dc501ba..e47489e91 100644 --- a/docs/content/user-guides/marathon.md +++ b/docs/content/user-guides/marathon.md @@ -17,10 +17,10 @@ Traefik tries to detect the configured mode and route traffic to the right IP ad Traefik also attempts to determine the right port (which is a [non-trivial matter in Marathon](https://mesosphere.github.io/marathon/docs/ports.html)). Following is the order by which Traefik tries to identify the port (the first one that yields a positive result will be used): -1. A arbitrary port specified through the `traefik.HTTP.Services.ServiceName.LoadBalancer.server.Port=8080` -1. The task port (possibly indexed through the `traefik.HTTP.Services.ServiceName.LoadBalancer.server.Port=index:0` label, otherwise the first one). -1. The port from the application's `portDefinitions` field (possibly indexed through the `traefik.HTTP.Services.ServiceName.LoadBalancer.server.Port=index:0` label, otherwise the first one). -1. The port from the application's `ipAddressPerTask` field (possibly indexed through the `traefik.HTTP.Services.ServiceName.LoadBalancer.server.Port=index:0` label, otherwise the first one). +1. A arbitrary port specified through the `traefik.http.services.serviceName.loadbalancer.server.port=8080` +1. The task port (possibly indexed through the `traefik.http.services.serviceName.loadbalancer.server.port=index:0` label, otherwise the first one). +1. The port from the application's `portDefinitions` field (possibly indexed through the `traefik.http.services.serviceName.loadbalancer.server.port=index:0` label, otherwise the first one). +1. The port from the application's `ipAddressPerTask` field (possibly indexed through the `traefik.http.services.serviceName.loadbalancer.server.port=index:0` label, otherwise the first one). ## Achieving high availability @@ -47,7 +47,7 @@ Beginning with version 1.4, Traefik respects readiness check results if the Trae !!! note Due to the way readiness check results are currently exposed by the Marathon API, ready tasks may be taken into rotation with a small delay. - It is on the order of one readiness check timeout interval (as configured on the application specifiation) and guarantees that non-ready tasks do not receive traffic prematurely. + It is on the order of one readiness check timeout interval (as configured on the application specification) and guarantees that non-ready tasks do not receive traffic prematurely. If readiness checks are not possible, a current mitigation strategy is to enable [retries](../middlewares/retry.md) and make sure that a sufficient number of healthy application tasks exist so that one retry will likely hit one of those. Apart from its probabilistic nature, the workaround comes at the price of increased latency. @@ -80,7 +80,7 @@ Failure reasons vary broadly and could stretch from unacceptable slowness, a tas There are two mitigaton efforts: 1. Configure [Marathon health checks](https://mesosphere.github.io/marathon/docs/health-checks.html) on each application. -2. Configure Traefik health checks (possibly via the `traefik.HTTP.Services.YourServiceName.LoadBalancer.HealthCheck.*` labels) and make sure they probe with proper frequency. +2. Configure Traefik health checks (possibly via the `traefik.http.services.yourServiceName.loadbalancer.healthcheck.*` labels) and make sure they probe with proper frequency. The Marathon health check makes sure that applications once deemed dysfunctional are being rescheduled to different slaves. However, they might take a while to get triggered and the follow-up processes to complete. diff --git a/integration/fixtures/access_log_config.toml b/integration/fixtures/access_log_config.toml index bd27bbf48..19f5416e3 100644 --- a/integration/fixtures/access_log_config.toml +++ b/integration/fixtures/access_log_config.toml @@ -1,10 +1,10 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "ERROR" -filePath = "traefik.log" + level = "ERROR" + filePath = "traefik.log" [accessLog] filePath = "access.log" @@ -24,7 +24,7 @@ filePath = "traefik.log" [api] [providers] - [providers.docker] - exposedByDefault = false - defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" - watch = true + [providers.docker] + exposedByDefault = false + defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" + watch = true diff --git a/integration/fixtures/acme/acme_base.toml b/integration/fixtures/acme/acme_base.toml index 9d7deab1b..0628cc57b 100644 --- a/integration/fixtures/acme/acme_base.toml +++ b/integration/fixtures/acme/acme_base.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -40,11 +40,13 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.services] - [http.services.test.loadbalancer] - [[http.services.test.loadbalancer.servers]] + [http.services.test.loadBalancer] + [[http.services.test.loadBalancer.servers]] url = "http://127.0.0.1:9010" [http.routers] diff --git a/integration/fixtures/acme/acme_tls.toml b/integration/fixtures/acme/acme_tls.toml index b7ffe5477..a977c21ac 100644 --- a/integration/fixtures/acme/acme_tls.toml +++ b/integration/fixtures/acme/acme_tls.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -40,19 +40,21 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.services] - [http.services.test.loadbalancer] - [[http.services.test.loadbalancer.servers]] - url = "http://127.0.0.1:9010" + [http.services.test.loadBalancer] + [[http.services.test.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.routers] [http.routers.test] - entryPoints = ["web-secure"] - rule = "Host(`traefik.acme.wtf`)" - service = "test" - [http.routers.test.tls] + entryPoints = ["web-secure"] + rule = "Host(`traefik.acme.wtf`)" + service = "test" + [http.routers.test.tls] [tls.stores] [tls.stores.default.defaultCertificate] diff --git a/integration/fixtures/acme/acme_tls_dynamic.toml b/integration/fixtures/acme/acme_tls_dynamic.toml index 2de71cca5..a538796ba 100644 --- a/integration/fixtures/acme/acme_tls_dynamic.toml +++ b/integration/fixtures/acme/acme_tls_dynamic.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -36,6 +36,6 @@ level = "DEBUG" [api] [providers] - [providers.file] - filename = "fixtures/acme/certificates.toml" - watch = true + [providers.file] + filename = "fixtures/acme/certificates.toml" + watch = true diff --git a/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml b/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml index 8d8629ddd..757414ee4 100644 --- a/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml +++ b/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -16,7 +16,7 @@ level = "DEBUG" address = ":9000" # FIXME # [entryPoints.traefik.tls] -# [entryPoints.traefik.tls.DefaultCertificate] +# [entryPoints.traefik.tls.defaultCertificate] # certFile = "fixtures/acme/ssl/wildcard.crt" # keyFile = "fixtures/acme/ssl/wildcard.key" diff --git a/integration/fixtures/acme/certificates.toml b/integration/fixtures/acme/certificates.toml index f0a2c8412..4ee5ced2d 100644 --- a/integration/fixtures/acme/certificates.toml +++ b/integration/fixtures/acme/certificates.toml @@ -1,6 +1,6 @@ [http.services] - [http.services.test.loadbalancer] - [[http.services.test.loadbalancer.servers]] + [http.services.test.loadBalancer] + [[http.services.test.loadBalancer.servers]] url = "http://127.0.0.1:9010" [http.routers] diff --git a/integration/fixtures/docker/minimal.toml b/integration/fixtures/docker/minimal.toml index f3c89cba7..4ba52559e 100644 --- a/integration/fixtures/docker/minimal.toml +++ b/integration/fixtures/docker/minimal.toml @@ -1,18 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.docker] - endpoint = "{{ .DockerHost }}" - defaultRule = "{{ .DefaultRule }}" - exposedByDefault = false + [providers.docker] + endpoint = "{{ .DockerHost }}" + defaultRule = "{{ .DefaultRule }}" + exposedByDefault = false diff --git a/integration/fixtures/docker/simple.toml b/integration/fixtures/docker/simple.toml index 767abfd82..630fd5549 100644 --- a/integration/fixtures/docker/simple.toml +++ b/integration/fixtures/docker/simple.toml @@ -1,18 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.docker] - endpoint = "{{ .DockerHost }}" - defaultRule = "{{ .DefaultRule }}" - exposedByDefault = true + [providers.docker] + endpoint = "{{ .DockerHost }}" + defaultRule = "{{ .DefaultRule }}" + exposedByDefault = true diff --git a/integration/fixtures/error_pages/error.toml b/integration/fixtures/error_pages/error.toml index c4d6d4c32..801b28152 100644 --- a/integration/fixtures/error_pages/error.toml +++ b/integration/fixtures/error_pages/error.toml @@ -1,35 +1,37 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8080" + address = ":8080" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Rule = "Host(`test.local`)" + rule = "Host(`test.local`)" service = "service1" middlewares = ["error"] [http.middlewares] - [http.middlewares.error.errors] - status = ["500-502", "503-599"] - service = "error" - query = "/50x.html" + [http.middlewares.error.errors] + status = ["500-502", "503-599"] + service = "error" + query = "/50x.html" [http.services] - [http.services.service1.loadbalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.loadbalancer.servers]] - url = "http://{{.Server1}}:8989474" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.Server1}}:8989474" - [http.services.error.loadbalancer] - [[http.services.error.loadbalancer.servers]] - url = "http://{{.Server2}}:80" + [http.services.error.loadBalancer] + [[http.services.error.loadBalancer.servers]] + url = "http://{{.Server2}}:80" diff --git a/integration/fixtures/error_pages/simple.toml b/integration/fixtures/error_pages/simple.toml index f34230ff2..284ad1779 100644 --- a/integration/fixtures/error_pages/simple.toml +++ b/integration/fixtures/error_pages/simple.toml @@ -1,35 +1,37 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8080" + address = ":8080" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Rule = "Host(`test.local`)" - service = "service1" - middlewares = ["error"] + rule = "Host(`test.local`)" + service = "service1" + middlewares = ["error"] [http.middlewares] - [http.middlewares.error.errors] - status = ["500-502", "503-599"] - service = "error" - query = "/50x.html" + [http.middlewares.error.errors] + status = ["500-502", "503-599"] + service = "error" + query = "/50x.html" [http.services] - [http.services.service1.loadbalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.loadbalancer.servers]] - url = "http://{{.Server1}}:80" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.Server1}}:80" - [http.services.error.loadbalancer] - [[http.services.error.loadbalancer.servers]] - url = "http://{{.Server2}}:80" + [http.services.error.loadBalancer] + [[http.services.error.loadBalancer.servers]] + url = "http://{{.Server2}}:80" diff --git a/integration/fixtures/file/56-simple-panic.toml b/integration/fixtures/file/56-simple-panic.toml index fd94864de..a890ef539 100644 --- a/integration/fixtures/file/56-simple-panic.toml +++ b/integration/fixtures/file/56-simple-panic.toml @@ -1,14 +1,13 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" - + address = ":8000" [providers] - [providers.file] + [providers.file] diff --git a/integration/fixtures/file/dir/simple1.toml b/integration/fixtures/file/dir/simple1.toml index 0fd29bce1..2506bca2f 100644 --- a/integration/fixtures/file/dir/simple1.toml +++ b/integration/fixtures/file/dir/simple1.toml @@ -4,6 +4,6 @@ service = "service1" [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://172.17.0.2:80" diff --git a/integration/fixtures/file/dir/simple2.toml b/integration/fixtures/file/dir/simple2.toml index b7c92dc0b..a9c390bee 100644 --- a/integration/fixtures/file/dir/simple2.toml +++ b/integration/fixtures/file/dir/simple2.toml @@ -4,6 +4,6 @@ service = "service2" [http.services] - [http.services.service2.loadbalancer] - [[http.services.service2.loadbalancer.servers]] + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] url = "http://172.17.0.123:80" diff --git a/integration/fixtures/file/directory.toml b/integration/fixtures/file/directory.toml index 9bde5a91e..b60354f0f 100644 --- a/integration/fixtures/file/directory.toml +++ b/integration/fixtures/file/directory.toml @@ -1,14 +1,14 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [providers] - [providers.file] - directory = "fixtures/file/dir/" + [providers.file] + directory = "fixtures/file/dir/" diff --git a/integration/fixtures/file/simple-hosts.toml b/integration/fixtures/file/simple-hosts.toml index 2aea9d96b..91d379c01 100644 --- a/integration/fixtures/file/simple-hosts.toml +++ b/integration/fixtures/file/simple-hosts.toml @@ -1,16 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] address = ":8000" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -22,6 +24,6 @@ level = "DEBUG" service = "service1" [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] - URL = "{{.Server}}" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "{{.Server}}" diff --git a/integration/fixtures/file/simple.toml b/integration/fixtures/file/simple.toml index e152729a2..96a6dea17 100644 --- a/integration/fixtures/file/simple.toml +++ b/integration/fixtures/file/simple.toml @@ -1,16 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] address = ":8000" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -23,19 +25,19 @@ level = "DEBUG" service = "service1" [http.middlewares] - [http.middlewares.circuitbreaker.circuitbreaker] + [http.middlewares.circuitbreaker.circuitBreaker] expression = "NetworkErrorRatio() > 0.5" [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://172.17.0.2:80" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://172.17.0.3:80" [http.services.service2] - [http.services.service2.loadbalancer] - [[http.services.service2.loadbalancer.servers]] + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] url = "http://172.17.0.4:80" - [[http.services.service2.loadbalancer.servers]] + [[http.services.service2.loadBalancer.servers]] url = "http://172.17.0.5:80" diff --git a/integration/fixtures/grpc/config.toml b/integration/fixtures/grpc/config.toml index b38ab2ffa..7e8277d8a 100644 --- a/integration/fixtures/grpc/config.toml +++ b/integration/fixtures/grpc/config.toml @@ -1,12 +1,12 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -rootCAs = [ """{{ .CertContent }}""" ] + rootCAs = [ """{{ .CertContent }}""" ] [entryPoints] [entryPoints.web-secure] @@ -15,7 +15,9 @@ rootCAs = [ """{{ .CertContent }}""" ] [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -24,11 +26,11 @@ rootCAs = [ """{{ .CertContent }}""" ] [http.routers.router1.tls] [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "https://127.0.0.1:{{ .GRPCServerPort }}" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = """{{ .CertContent }}""" keyFile = """{{ .KeyContent }}""" diff --git a/integration/fixtures/grpc/config_h2c.toml b/integration/fixtures/grpc/config_h2c.toml index b9d317e39..096a20e78 100644 --- a/integration/fixtures/grpc/config_h2c.toml +++ b/integration/fixtures/grpc/config_h2c.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -12,7 +12,9 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -20,6 +22,6 @@ level = "DEBUG" service = "service1" [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "h2c://127.0.0.1:{{ .GRPCServerPort }}" diff --git a/integration/fixtures/grpc/config_h2c_termination.toml b/integration/fixtures/grpc/config_h2c_termination.toml index 71d3aec6b..ee48c3334 100644 --- a/integration/fixtures/grpc/config_h2c_termination.toml +++ b/integration/fixtures/grpc/config_h2c_termination.toml @@ -1,19 +1,20 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] address = ":4443" - [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -22,11 +23,11 @@ level = "DEBUG" [http.routers.router1.tls] [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] - url = "h2c://127.0.0.1:{{ .GRPCServerPort }}" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "h2c://127.0.0.1:{{ .GRPCServerPort }}" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = """{{ .CertContent }}""" keyFile = """{{ .KeyContent }}""" diff --git a/integration/fixtures/grpc/config_insecure.toml b/integration/fixtures/grpc/config_insecure.toml index ce4c7fb4b..053cc4b63 100644 --- a/integration/fixtures/grpc/config_insecure.toml +++ b/integration/fixtures/grpc/config_insecure.toml @@ -1,12 +1,12 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -insecureSkipVerify = true + insecureSkipVerify = true [entryPoints] [entryPoints.web-secure] @@ -15,7 +15,9 @@ insecureSkipVerify = true [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -24,11 +26,11 @@ insecureSkipVerify = true [http.routers.router1.tls] [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "https://127.0.0.1:{{ .GRPCServerPort }}" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = """{{ .CertContent }}""" keyFile = """{{ .KeyContent }}""" diff --git a/integration/fixtures/grpc/config_retry.toml b/integration/fixtures/grpc/config_retry.toml index f88706400..72f5b5e09 100644 --- a/integration/fixtures/grpc/config_retry.toml +++ b/integration/fixtures/grpc/config_retry.toml @@ -1,21 +1,23 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -rootCAs = [ """{{ .CertContent }}""" ] + rootCAs = [ """{{ .CertContent }}""" ] [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -26,16 +28,16 @@ rootCAs = [ """{{ .CertContent }}""" ] [http.middlewares] [http.middlewares.retryer.retry] - Attempts = 2 + attempts = 2 [http.services] - [http.services.service1.loadbalancer] - [http.services.service1.loadbalancer.responseForwarding] - flushInterval="1ms" - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [http.services.service1.loadBalancer.responseForwarding] + flushInterval = "1ms" + [[http.services.service1.loadBalancer.servers]] url = "https://127.0.0.1:{{ .GRPCServerPort }}" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = """{{ .CertContent }}""" keyFile = """{{ .KeyContent }}""" diff --git a/integration/fixtures/headers/basic.toml b/integration/fixtures/headers/basic.toml index 750c5375b..5ed0ab4ba 100644 --- a/integration/fixtures/headers/basic.toml +++ b/integration/fixtures/headers/basic.toml @@ -1,16 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] address = ":8000" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -18,6 +20,6 @@ level = "DEBUG" service = "service1" [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://172.17.0.2:80" diff --git a/integration/fixtures/headers/cors.toml b/integration/fixtures/headers/cors.toml index 91166e52c..7cc707cab 100644 --- a/integration/fixtures/headers/cors.toml +++ b/integration/fixtures/headers/cors.toml @@ -1,16 +1,18 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] address = ":8000" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -18,13 +20,13 @@ level = "DEBUG" service = "service1" [http.middlewares] - [http.middlewares.cors.Headers] - AccessControlAllowMethods= ["GET", "OPTIONS", "PUT"] - AccessControlAllowOrigin = "origin-list-or-null" - AccessControlMaxAge = 100 - AddVaryHeader = true + [http.middlewares.cors.headers] + accessControlAllowMethods= ["GET", "OPTIONS", "PUT"] + accessControlAllowOrigin = "origin-list-or-null" + accessControlMaxAge = 100 + addVaryHeader = true [http.services] - [http.services.service1.loadbalancer] - [[http.services.service1.loadbalancer.servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://172.17.0.2:80" diff --git a/integration/fixtures/healthcheck/multiple-entrypoints.toml b/integration/fixtures/healthcheck/multiple-entrypoints.toml index 42b11861c..12e543186 100644 --- a/integration/fixtures/healthcheck/multiple-entrypoints.toml +++ b/integration/fixtures/healthcheck/multiple-entrypoints.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.http1] @@ -14,20 +14,22 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] service = "service1" - Rule = "Host(`test.localhost`)" + rule = "Host(`test.localhost`)" [http.services] - [http.services.service1.loadbalancer] - [http.services.service1.loadbalancer.healthcheck] + [http.services.service1.loadBalancer] + [http.services.service1.loadBalancer.healthcheck] path = "/health" interval = "1s" timeout = "0.9s" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://{{.Server1}}:80" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://{{.Server2}}:80" diff --git a/integration/fixtures/healthcheck/port_overload.toml b/integration/fixtures/healthcheck/port_overload.toml index 8b17a4724..892e5b463 100644 --- a/integration/fixtures/healthcheck/port_overload.toml +++ b/integration/fixtures/healthcheck/port_overload.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -12,19 +12,21 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] service = "service1" - Rule = "Host(`test.localhost`)" + rule = "Host(`test.localhost`)" [http.services] - [http.services.service1.loadbalancer] - [http.services.service1.loadbalancer.healthcheck] + [http.services.service1.loadBalancer] + [http.services.service1.loadBalancer.healthcheck] path = "/health" port = 80 interval = "1s" timeout = "0.9s" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://{{.Server1}}:81" diff --git a/integration/fixtures/healthcheck/simple.toml b/integration/fixtures/healthcheck/simple.toml index 0e0cea877..0109337fc 100644 --- a/integration/fixtures/healthcheck/simple.toml +++ b/integration/fixtures/healthcheck/simple.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -12,20 +12,22 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] service = "service1" - Rule = "Host(`test.localhost`)" + rule = "Host(`test.localhost`)" [http.services] - [http.services.service1.loadbalancer] - [http.services.service1.loadbalancer.healthcheck] + [http.services.service1.loadBalancer] + [http.services.service1.loadBalancer.healthcheck] path = "/health" interval = "1s" timeout = "0.9s" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://{{.Server1}}:80" - [[http.services.service1.loadbalancer.servers]] + [[http.services.service1.loadBalancer.servers]] url = "http://{{.Server2}}:80" diff --git a/integration/fixtures/https/clientca/https_1ca1config.toml b/integration/fixtures/https/clientca/https_1ca1config.toml index 063b4f22d..ba62c4fd0 100644 --- a/integration/fixtures/https/clientca/https_1ca1config.toml +++ b/integration/fixtures/https/clientca/https_1ca1config.toml @@ -1,48 +1,50 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Host(`snitest.com`)" + service = "service1" + rule = "Host(`snitest.com`)" [http.routers.router1.tls] [http.routers.router2] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router2.tls] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9010" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9020" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9020" [[tls.certificates]] - certFile = "fixtures/https/snitest.com.cert" - keyFile = "fixtures/https/snitest.com.key" + certFile = "fixtures/https/snitest.com.cert" + keyFile = "fixtures/https/snitest.com.key" [[tls.certificates]] - certFile = "fixtures/https/snitest.org.cert" - keyFile = "fixtures/https/snitest.org.key" + certFile = "fixtures/https/snitest.org.cert" + keyFile = "fixtures/https/snitest.org.key" [tls.options] [tls.options.default.ClientCA] diff --git a/integration/fixtures/https/clientca/https_2ca1config.toml b/integration/fixtures/https/clientca/https_2ca1config.toml index e09d2c006..848b4ace9 100644 --- a/integration/fixtures/https/clientca/https_2ca1config.toml +++ b/integration/fixtures/https/clientca/https_2ca1config.toml @@ -1,49 +1,51 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Host(`snitest.com`)" + service = "service1" + rule = "Host(`snitest.com`)" [http.routers.router1.tls] [http.routers.router2] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router2.tls] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9010" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9020" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9020" [[tls.certificates]] - certFile = "fixtures/https/snitest.com.cert" - keyFile = "fixtures/https/snitest.com.key" + certFile = "fixtures/https/snitest.com.cert" + keyFile = "fixtures/https/snitest.com.key" [[tls.certificates]] certFile = "fixtures/https/snitest.org.cert" keyFile = "fixtures/https/snitest.org.key" [tls.options] - [tls.options.default.ClientCA] + [tls.options.default.clientCA] files = ["fixtures/https/clientca/ca1and2.crt"] \ No newline at end of file diff --git a/integration/fixtures/https/clientca/https_2ca2config.toml b/integration/fixtures/https/clientca/https_2ca2config.toml index 138ac2a18..6340cac13 100644 --- a/integration/fixtures/https/clientca/https_2ca2config.toml +++ b/integration/fixtures/https/clientca/https_2ca2config.toml @@ -1,39 +1,41 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Host(`snitest.com`)" + service = "service1" + rule = "Host(`snitest.com`)" [http.routers.router1.tls] [http.routers.router2] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router2.tls] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9010" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9020" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9020" [[tls.certificates]] certFile = "fixtures/https/snitest.com.cert" @@ -44,6 +46,6 @@ level = "DEBUG" keyFile = "fixtures/https/snitest.org.key" [tls.options] - [tls.options.default.ClientCA] + [tls.options.default.clientCA] files = ["fixtures/https/clientca/ca1.crt", "fixtures/https/clientca/ca2.crt"] optional = false diff --git a/integration/fixtures/https/dynamic_https.toml b/integration/fixtures/https/dynamic_https.toml index 65bfe163f..6ada7c2f5 100644 --- a/integration/fixtures/https/dynamic_https.toml +++ b/integration/fixtures/https/dynamic_https.toml @@ -11,30 +11,30 @@ [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] url = "http://127.0.0.1:9020" # bad certificates to validate the loop on the certificate appending [[tls.certificates]] - # bad content - certFile = """-----BEGIN CERTIFICATE----- + # bad content + certFile = """-----BEGIN CERTIFICATE----- MIIC/zCCAeegAwIBAgIJALAYHG/vGqWEMA0GCSqGSIb3DQEBBQUAMBYxFDASBgNV -----END CERTIFICATE-----""" - # bad content - keyFile = """-----BEGIN RSA PRIVATE KEY----- + # bad content + keyFile = """-----BEGIN RSA PRIVATE KEY----- wihZ13e3i5UQEYuoRcH1RUd1wyYoBSKuQnsT2WwVZ1wlXSYaELAbQgaI9NtfBA0G eRG3DaVpez4DQVupZDHMgxJUYqqKynUj6GD1YiaxGROj3TYCu6e7OxyhalhCllSu w/X5M802XqzLjeec5zHoZDfknnAkgR9MsxZYmZPFaDyL6GOKUB8= -----END RSA PRIVATE KEY-----""" [[tls.certificates]] - certFile = """-----BEGIN CERTIFICATE----- + certFile = """-----BEGIN CERTIFICATE----- MIIC/zCCAeegAwIBAgIJALAYHG/vGqWEMA0GCSqGSIb3DQEBBQUAMBYxFDASBgNV BAMMC3NuaXRlc3Qub3JnMB4XDTE1MTEyMzIyMDU0NFoXDTI1MTEyMDIyMDU0NFow FjEUMBIGA1UEAwwLc25pdGVzdC5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw @@ -53,7 +53,7 @@ FJTkElnxtELAGHoIwZ+bKprnexefpn9UW84VJvJ2crSR63vBvdTrgsrEGW6kQj1I k5fvuuXbIc979pQOoO03zG0S7Wpmpsw+9dQB9TOxGITOLfCZwEuIhnv+M9lLqCks 7H2A -----END CERTIFICATE-----""" - keyFile = """-----BEGIN RSA PRIVATE KEY----- + keyFile = """-----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEAvG9kL+vF57+MICehzbqcQAUlAOSl5r/YO6cMLBTEjiteaNqh hc8f8fZaCIuaTCGCMuElcCTa2FIu+9pwmDKkiFV5cHLfwhO9I9iW9oHiB7t4x2xV l67lm1tbRhlGM757DlM4jxN6y1mvzTmzWCy5VCiWsXx68Z6biqUFLF86C5duXCRF diff --git a/integration/fixtures/https/dynamic_https_sni.toml b/integration/fixtures/https/dynamic_https_sni.toml index c01ae8786..2a7ff45fa 100644 --- a/integration/fixtures/https/dynamic_https_sni.toml +++ b/integration/fixtures/https/dynamic_https_sni.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] @@ -15,6 +15,6 @@ level = "DEBUG" [api] [providers] - [providers.file] - fileName = "{{.DynamicConfFileName}}" - watch = true + [providers.file] + fileName = "{{.DynamicConfFileName}}" + watch = true diff --git a/integration/fixtures/https/dynamic_https_sni_default_cert.toml b/integration/fixtures/https/dynamic_https_sni_default_cert.toml index 50efab1f4..e45d40076 100644 --- a/integration/fixtures/https/dynamic_https_sni_default_cert.toml +++ b/integration/fixtures/https/dynamic_https_sni_default_cert.toml @@ -1,18 +1,20 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -27,8 +29,8 @@ level = "DEBUG" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:9010" [[tls.certificates]] @@ -40,6 +42,6 @@ level = "DEBUG" keyFile = "fixtures/https/www.snitest.com.key" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = "fixtures/https/snitest.com.cert" keyFile = "fixtures/https/snitest.com.key" diff --git a/integration/fixtures/https/https_redirect.toml b/integration/fixtures/https/https_redirect.toml index b072200b1..eed285020 100644 --- a/integration/fixtures/https/https_redirect.toml +++ b/integration/fixtures/https/https_redirect.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -17,6 +17,8 @@ level = "DEBUG" [providers] [providers.file] +## dynamic configuration ## + [http.routers] [http.routers.router1] entryPoints = [ "web" ] @@ -139,34 +141,34 @@ level = "DEBUG" [http.routers.router10TLS.tls] [http.middlewares] - [http.middlewares.api-strip.StripPrefix] - prefixes = ["/api"] - [http.middlewares.api-slash-strip.StripPrefix] - prefixes = ["/api/"] - [http.middlewares.foo-add-prefix.AddPrefix] - prefix = "/foo" - [http.middlewares.foo-slash-add-prefix.AddPrefix] - prefix = "/foo/" - [http.middlewares.id-strip-regex-prefix.StripPrefixRegex] - regex = ["/{id:[a-z]+}"] - [http.middlewares.id-slash-strip-regex-prefix.StripPrefixRegex] - regex = ["/{id:[a-z]+}/"] - [http.middlewares.api-regex-replace.ReplacePathRegex] - regex = "/api" - replacement = "/" - [http.middlewares.api-slash-regex-replace.ReplacePathRegex] - regex = "/api/" - replacement = "/" - [http.middlewares.api-replace-path.ReplacePath] - path = "/api" - [http.middlewares.api-slash-replace-path.ReplacePath] - path = "/api/" + [http.middlewares.api-strip.stripPrefix] + prefixes = ["/api"] + [http.middlewares.api-slash-strip.stripPrefix] + prefixes = ["/api/"] + [http.middlewares.foo-add-prefix.addPrefix] + prefix = "/foo" + [http.middlewares.foo-slash-add-prefix.addPrefix] + prefix = "/foo/" + [http.middlewares.id-strip-regex-prefix.stripPrefixRegex] + regex = ["/{id:[a-z]+}"] + [http.middlewares.id-slash-strip-regex-prefix.stripPrefixRegex] + regex = ["/{id:[a-z]+}/"] + [http.middlewares.api-regex-replace.replacePathRegex] + regex = "/api" + replacement = "/" + [http.middlewares.api-slash-regex-replace.replacePathRegex] + regex = "/api/" + replacement = "/" + [http.middlewares.api-replace-path.replacePath] + path = "/api" + [http.middlewares.api-slash-replace-path.replacePath] + path = "/api/" [http.middlewares.redirect-https.redirectScheme] - scheme = "https" - port = "8443" + scheme = "https" + port = "8443" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:80" diff --git a/integration/fixtures/https/https_sni.toml b/integration/fixtures/https/https_sni.toml index 3c184436c..561d5f3b5 100644 --- a/integration/fixtures/https/https_sni.toml +++ b/integration/fixtures/https/https_sni.toml @@ -1,40 +1,42 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Host(`snitest.com`)" + service = "service1" + rule = "Host(`snitest.com`)" [http.routers.router1.tls] [http.routers.router2] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router2.tls] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9010" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9020" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9020" [[tls.certificates]] certFile = "fixtures/https/snitest.com.cert" diff --git a/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml b/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml index 364d77816..28b22f45a 100644 --- a/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml +++ b/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] @@ -12,7 +12,9 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -27,8 +29,8 @@ level = "DEBUG" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:9010" [[tls.certificates]] @@ -36,6 +38,6 @@ level = "DEBUG" keyFile = "fixtures/https/uppercase_wildcard.www.snitest.com.key" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = "fixtures/https/wildcard.snitest.com.cert" keyFile = "fixtures/https/wildcard.snitest.com.key" diff --git a/integration/fixtures/https/https_sni_default_cert.toml b/integration/fixtures/https/https_sni_default_cert.toml index 50efab1f4..e45d40076 100644 --- a/integration/fixtures/https/https_sni_default_cert.toml +++ b/integration/fixtures/https/https_sni_default_cert.toml @@ -1,18 +1,20 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -27,8 +29,8 @@ level = "DEBUG" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:9010" [[tls.certificates]] @@ -40,6 +42,6 @@ level = "DEBUG" keyFile = "fixtures/https/www.snitest.com.key" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = "fixtures/https/snitest.com.cert" keyFile = "fixtures/https/snitest.com.key" diff --git a/integration/fixtures/https/https_sni_strict.toml b/integration/fixtures/https/https_sni_strict.toml index dce7c13a2..1f15bd6cc 100644 --- a/integration/fixtures/https/https_sni_strict.toml +++ b/integration/fixtures/https/https_sni_strict.toml @@ -12,7 +12,9 @@ [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -22,8 +24,8 @@ [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:9010" [tls.options] @@ -32,7 +34,7 @@ [tls.stores] [tls.stores.default] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = "fixtures/https/snitest.com.cert" keyFile = "fixtures/https/snitest.com.key" diff --git a/integration/fixtures/https/https_tls_options.toml b/integration/fixtures/https/https_tls_options.toml index aad21a2c4..50191c4c3 100644 --- a/integration/fixtures/https/https_tls_options.toml +++ b/integration/fixtures/https/https_tls_options.toml @@ -1,48 +1,50 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web-secure] - address = ":4443" + address = ":4443" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Host(`snitest.com`)" + service = "service1" + rule = "Host(`snitest.com`)" [http.routers.router1.tls] options = "foo" [http.routers.router2] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router2.tls] options = "bar" [http.routers.router3] - Service = "service2" - Rule = "Host(`snitest.org`)" + service = "service2" + rule = "Host(`snitest.org`)" [http.routers.router3.tls] options = "unknown" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9010" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://127.0.0.1:9020" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9020" [[tls.certificates]] certFile = "fixtures/https/snitest.com.cert" diff --git a/integration/fixtures/https/rootcas/https.toml b/integration/fixtures/https/rootcas/https.toml index ef89ac863..ae85cfaeb 100644 --- a/integration/fixtures/https/rootcas/https.toml +++ b/integration/fixtures/https/rootcas/https.toml @@ -1,13 +1,13 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -# Use certificate in net/internal/testcert.go -rootCAs = [ """ + # Use certificate in net/internal/testcert.go + rootCAs = [ """ -----BEGIN CERTIFICATE----- MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw @@ -26,21 +26,23 @@ fblo6RBxUQ== [entryPoints] [entryPoints.web] - address = ":8081" + address = ":8081" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/ping`)" + service = "service1" + rule = "Path(`/ping`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "{{ .BackendHost }}" + [[http.services.service1.loadBalancer.servers]] + url = "{{ .BackendHost }}" diff --git a/integration/fixtures/https/rootcas/https_with_file.toml b/integration/fixtures/https/rootcas/https_with_file.toml index efdd2fb6e..a37b8544c 100644 --- a/integration/fixtures/https/rootcas/https_with_file.toml +++ b/integration/fixtures/https/rootcas/https_with_file.toml @@ -1,31 +1,33 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -# Use certificate in net/internal/testcert.go -rootCAs = [ "fixtures/https/rootcas/local.crt"] + # Use certificate in net/internal/testcert.go + rootCAs = [ "fixtures/https/rootcas/local.crt"] [entryPoints] [entryPoints.web] - address = ":8081" + address = ":8081" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/ping`)" + service = "service1" + rule = "Path(`/ping`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "{{ .BackendHost }}" + [[http.services.service1.loadBalancer.servers]] + url = "{{ .BackendHost }}" diff --git a/integration/fixtures/k8s_crd.toml b/integration/fixtures/k8s_crd.toml index d34f6a03a..21bfa9855 100644 --- a/integration/fixtures/k8s_crd.toml +++ b/integration/fixtures/k8s_crd.toml @@ -1,18 +1,16 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" - -[entryPoints] - [entryPoints.web] - address = ":8000" - [entryPoints.footcp] - address = ":8093" - + level = "DEBUG" [api] -[Providers] - [Providers.KubernetesCRD] \ No newline at end of file +[entryPoints] + [entryPoints.footcp] + address = ":8093" + [entryPoints.web] + address = ":8000" + +[providers.kubernetesCRD] diff --git a/integration/fixtures/k8s_default.toml b/integration/fixtures/k8s_default.toml index 11a131af1..c6bc9b298 100644 --- a/integration/fixtures/k8s_default.toml +++ b/integration/fixtures/k8s_default.toml @@ -1,15 +1,14 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false - -[log] -level = "DEBUG" - -[entryPoints] - [entryPoints.web] - address = ":8000" + checkNewVersion = false + sendAnonymousUsage = false [api] -[Providers] - [Providers.Kubernetes] \ No newline at end of file +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web] + address = ":8000" + +[providers.kubernetes] diff --git a/integration/fixtures/log_rotation_config.toml b/integration/fixtures/log_rotation_config.toml index bc2e429ce..e96a0c7c0 100644 --- a/integration/fixtures/log_rotation_config.toml +++ b/integration/fixtures/log_rotation_config.toml @@ -1,37 +1,36 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -filePath = "traefik.log" -level = "ERROR" + filePath = "traefik.log" + level = "ERROR" [accessLog] -filePath = "access.log" + filePath = "access.log" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [entryPoints.api] - address = ":7888" + address = ":7888" [api] -entryPoint = "api" + entryPoint = "api" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## -################################################################ -# rules -################################################################ [http.routers] [http.routers.router1] Service = "service1" - Rule = "Path(`/test1`)" + rule = "Path(`/test1`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://127.0.0.1:8081" + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:8081" diff --git a/integration/fixtures/marathon/simple.toml b/integration/fixtures/marathon/simple.toml index 01a77d3b1..6ae3c66c0 100644 --- a/integration/fixtures/marathon/simple.toml +++ b/integration/fixtures/marathon/simple.toml @@ -1,21 +1,21 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" -[entryPoints.api] - address = ":9090" + address = ":8000" + [entryPoints.api] + address = ":9090" [api] entryPoint = "api" [providers] - [providers.marathon] - endpoint = "{{.MarathonURL}}" - watch = true - exposedByDefault = true + [providers.marathon] + endpoint = "{{.MarathonURL}}" + watch = true + exposedByDefault = true diff --git a/integration/fixtures/multiple_provider.toml b/integration/fixtures/multiple_provider.toml index 6e8cc4979..6703950f0 100644 --- a/integration/fixtures/multiple_provider.toml +++ b/integration/fixtures/multiple_provider.toml @@ -1,32 +1,31 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.docker] - endpoint = "unix:///var/run/docker.sock" - watch = true - exposedByDefault = false + [providers.docker] + watch = true + exposedByDefault = false - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router-1] - Service = "service-test" - Rule = "PathPrefix(`/file`)" + service = "service-test" + rule = "PathPrefix(`/file`)" [http.services] - [http.services.service-test] - [http.services.service-test.LoadBalancer] - - [[http.services.service-test.LoadBalancer.Servers]] - URL = "http://{{ .IP }}" + [http.services.service-test.loadBalancer] + [[http.services.service-test.loadBalancer.servers]] + url = "http://{{ .IP }}" diff --git a/integration/fixtures/multiprovider.toml b/integration/fixtures/multiprovider.toml index 3184a5a1f..4a2621455 100644 --- a/integration/fixtures/multiprovider.toml +++ b/integration/fixtures/multiprovider.toml @@ -1,27 +1,28 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [api] [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" -[Providers] - [Providers.Rest] +[providers] + [providers.rest] - [Providers.File] + [providers.file] + +## dynamic configuration ## [http.services] - [http.services.service] - [http.services.service.LoadBalancer] + [http.services.service.loadBalancer] + [[http.services.service.loadBalancer.servers]] + url = "{{.Server}}" - [[http.services.service.LoadBalancer.Servers]] - URL = "{{.Server}}" [http.middlewares] - [http.middlewares.customheader.Headers.CustomRequestHeaders] - X-Custom="CustomValue" + [http.middlewares.customheader.headers.customRequestHeaders] + X-Custom="CustomValue" diff --git a/integration/fixtures/proxy-protocol/with.toml b/integration/fixtures/proxy-protocol/with.toml index 5f853093d..d7a630a1f 100644 --- a/integration/fixtures/proxy-protocol/with.toml +++ b/integration/fixtures/proxy-protocol/with.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -14,16 +14,18 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/whoami`)" + service = "service1" + rule = "Path(`/whoami`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoamiIP}}" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoamiIP}}" diff --git a/integration/fixtures/proxy-protocol/without.toml b/integration/fixtures/proxy-protocol/without.toml index f4c12fcdd..edd4597b2 100644 --- a/integration/fixtures/proxy-protocol/without.toml +++ b/integration/fixtures/proxy-protocol/without.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -14,16 +14,18 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/whoami`)" + service = "service1" + rule = "Path(`/whoami`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoamiIP}}" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoamiIP}}" diff --git a/integration/fixtures/ratelimit/simple.toml b/integration/fixtures/ratelimit/simple.toml index cfd7a888c..ce04a31f1 100644 --- a/integration/fixtures/ratelimit/simple.toml +++ b/integration/fixtures/ratelimit/simple.toml @@ -1,45 +1,46 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [api] -entrypoint="api" + entrypoint="api" [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8081" - + address = ":8081" [entryPoints.api] - address = ":8080" + address = ":8080" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Middlewares = [ "ratelimit" ] - Rule = "Path(`/`)" + service = "service1" + middlewares = [ "ratelimit" ] + rule = "Path(`/`)" [http.middlewares] - [http.middlewares.ratelimit.RateLimit] + [http.middlewares.ratelimit.rateLimit] extractorfunc = "client.ip" - [http.middlewares.ratelimit.RateLimit.rateset.rateset1] - period = "60s" - average = 4 - burst = 5 - [http.middlewares.ratelimit.RateLimit.rateset.rateset2] - period = "3s" - average = 1 - burst = 2 + [http.middlewares.ratelimit.rateLimit.rateSet.rateset1] + period = "60s" + average = 4 + burst = 5 + [http.middlewares.ratelimit.rateLimit.rateSet.rateset2] + period = "3s" + average = 1 + burst = 2 [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.Server1}}:80" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.Server1}}:80" diff --git a/integration/fixtures/reqacceptgrace.toml b/integration/fixtures/reqacceptgrace.toml index 61069237d..ab5a9cedd 100644 --- a/integration/fixtures/reqacceptgrace.toml +++ b/integration/fixtures/reqacceptgrace.toml @@ -1,35 +1,36 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] + [entryPoints.web] - address = ":8000" - [entryPoints.web.transport.lifeCycle] - RequestAcceptGraceTimeout = "10s" + address = ":8000" + [entryPoints.web.transport.lifeCycle] + requestAcceptGraceTimeout = "10s" [entryPoints.traefik] - address = ":8001" -[entryPoints.traefik.transport.lifeCycle] - RequestAcceptGraceTimeout = "10s" + address = ":8001" + [entryPoints.traefik.transport.lifeCycle] + requestAcceptGraceTimeout = "10s" [ping] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router] - Service = "service" - Rule = "Path(`/service`)" + service = "service" + rule = "Path(`/service`)" [http.services] - [http.services.service] - [http.services.service.LoadBalancer] - - [[http.services.service.LoadBalancer.Servers]] - URL = "{{.Server}}" + [http.services.service.loadBalancer] + [[http.services.service.loadBalancer.servers]] + url = "{{.Server}}" diff --git a/integration/fixtures/rest/simple.toml b/integration/fixtures/rest/simple.toml index 0d3dbafcd..575c6e2e4 100644 --- a/integration/fixtures/rest/simple.toml +++ b/integration/fixtures/rest/simple.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] @@ -12,4 +12,4 @@ level = "DEBUG" [api] [providers] - [providers.rest] + [providers.rest] diff --git a/integration/fixtures/retry/simple.toml b/integration/fixtures/retry/simple.toml index 44f4a2577..30cb722d0 100644 --- a/integration/fixtures/retry/simple.toml +++ b/integration/fixtures/retry/simple.toml @@ -1,34 +1,36 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Middlewares = [ "retry" ] - Rule = "PathPrefix(`/`)" + service = "service1" + middlewares = [ "retry" ] + rule = "PathPrefix(`/`)" -[http.middlewares.retry.Retry] - Attempts = 3 +[http.middlewares.retry.retry] + attempts = 3 [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoamiEndpoint}}:8080" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoamiEndpoint}}:8080" - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoamiEndpoint}}:80" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoamiEndpoint}}:80" diff --git a/integration/fixtures/simple_auth.toml b/integration/fixtures/simple_auth.toml index 4796ca6b4..f17b5c88e 100644 --- a/integration/fixtures/simple_auth.toml +++ b/integration/fixtures/simple_auth.toml @@ -1,24 +1,24 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [entryPoints.traefik] - address = ":8001" + address = ":8001" [api] - middlewares = ["authentication@file"] + middlewares = ["authentication@file"] [ping] [providers.file] [http.middlewares] - [http.middlewares.authentication.basicauth] - users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] + [http.middlewares.authentication.basicAuth] + users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] diff --git a/integration/fixtures/simple_default.toml b/integration/fixtures/simple_default.toml index a97b07a01..47147bb82 100644 --- a/integration/fixtures/simple_default.toml +++ b/integration/fixtures/simple_default.toml @@ -1,7 +1,7 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" diff --git a/integration/fixtures/simple_hostresolver.toml b/integration/fixtures/simple_hostresolver.toml index 859edf47b..77627f89b 100644 --- a/integration/fixtures/simple_hostresolver.toml +++ b/integration/fixtures/simple_hostresolver.toml @@ -1,21 +1,21 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.docker] - exposedByDefault = false - defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" - watch = true + [providers.docker] + exposedByDefault = false + defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" + watch = true [hostResolver] -cnameFlattening = true + cnameFlattening = true diff --git a/integration/fixtures/simple_stats.toml b/integration/fixtures/simple_stats.toml index f2202d92c..bb9da6f3f 100644 --- a/integration/fixtures/simple_stats.toml +++ b/integration/fixtures/simple_stats.toml @@ -1,37 +1,36 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] -[providers] - [providers.file] +[providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - EntryPoints = ["web"] - Service = "service1" - Rule = "PathPrefix(`/whoami`)" + entryPoints = ["web"] + service = "service1" + rule = "PathPrefix(`/whoami`)" [http.routers.router2] - EntryPoints = ["traefik"] - Service = "service2" - Rule = "PathPrefix(`/whoami`)" + entryPoints = ["traefik"] + service = "service2" + rule = "PathPrefix(`/whoami`)" [http.services] - [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "{{ .Server1 }}" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "{{ .Server1 }}" - [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "{{ .Server2 }}" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "{{ .Server2 }}" diff --git a/integration/fixtures/simple_web.toml b/integration/fixtures/simple_web.toml index de39fbbdf..8751d9479 100644 --- a/integration/fixtures/simple_web.toml +++ b/integration/fixtures/simple_web.toml @@ -1,12 +1,12 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] diff --git a/integration/fixtures/simple_whitelist.toml b/integration/fixtures/simple_whitelist.toml index a6a456664..bef0e455d 100644 --- a/integration/fixtures/simple_whitelist.toml +++ b/integration/fixtures/simple_whitelist.toml @@ -1,17 +1,17 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" - [entryPoints.web.ForwardedHeaders] - insecure=true + address = ":8000" + [entryPoints.web.ForwardedHeaders] + insecure=true [api] [providers] - [providers.docker] + [providers.docker] diff --git a/integration/fixtures/tcp/catch-all-no-tls-with-https.toml b/integration/fixtures/tcp/catch-all-no-tls-with-https.toml index da1c0b62e..5f4c79900 100644 --- a/integration/fixtures/tcp/catch-all-no-tls-with-https.toml +++ b/integration/fixtures/tcp/catch-all-no-tls-with-https.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -13,28 +13,29 @@ level = "DEBUG" [providers.file] -[tcp] - [tcp.routers] - [tcp.routers.to-whoami-no-tls] - entryPoints = ["tcp"] - rule="HostSNI(`*`)" - service = "whoami-no-tls" +## dynamic configuration ## - [tcp.services] - [tcp.services.whoami-no-tls.loadbalancer] - [[tcp.services.whoami-no-tls.loadbalancer.servers]] - address = "localhost:8086" +[tcp] + [tcp.routers] + [tcp.routers.to-whoami-no-tls] + entryPoints = ["tcp"] + rule = "HostSNI(`*`)" + service = "whoami-no-tls" + + [tcp.services] + [tcp.services.whoami-no-tls.loadBalancer] + [[tcp.services.whoami-no-tls.loadBalancer.servers]] + address = "localhost:8086" [http] - [http.routers] - [http.routers.to-whoami] - entryPoints = ["tcp"] - rule="PathPrefix(`/`)" - service = "whoami" - [http.routers.to-whoami.tls] + [http.routers] + [http.routers.to-whoami] + entryPoints = ["tcp"] + rule="PathPrefix(`/`)" + service = "whoami" + [http.routers.to-whoami.tls] - - [http.services] - [http.services.whoami.loadbalancer] - [[http.services.whoami.loadbalancer.servers]] - url = "http://localhost:8085" + [http.services] + [http.services.whoami.loadBalancer] + [[http.services.whoami.loadBalancer.servers]] + url = "http://localhost:8085" diff --git a/integration/fixtures/tcp/catch-all-no-tls.toml b/integration/fixtures/tcp/catch-all-no-tls.toml index 6bd5fd5d0..efca7631d 100644 --- a/integration/fixtures/tcp/catch-all-no-tls.toml +++ b/integration/fixtures/tcp/catch-all-no-tls.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -13,14 +13,16 @@ level = "DEBUG" [providers.file] -[tcp] - [tcp.routers] - [tcp.routers.to-whoami-no-tls] - entryPoints = ["tcp"] - rule="HostSNI(`*`)" - service = "whoami-no-tls" +## dynamic configuration ## - [tcp.services] - [tcp.services.whoami-no-tls.loadbalancer] - [[tcp.services.whoami-no-tls.loadbalancer.servers]] - address = "localhost:8086" +[tcp] + [tcp.routers] + [tcp.routers.to-whoami-no-tls] + entryPoints = ["tcp"] + rule = "HostSNI(`*`)" + service = "whoami-no-tls" + + [tcp.services] + [tcp.services.whoami-no-tls.loadBalancer] + [[tcp.services.whoami-no-tls.loadBalancer.servers]] + address = "localhost:8086" diff --git a/integration/fixtures/tcp/mixed.toml b/integration/fixtures/tcp/mixed.toml index a94b7c640..9bca88eaf 100644 --- a/integration/fixtures/tcp/mixed.toml +++ b/integration/fixtures/tcp/mixed.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -13,56 +13,58 @@ level = "DEBUG" [providers.file] +## dynamic configuration ## + [http] - [http.routers] - [http.routers.my-router] - rule = "Path(`/test`)" - service = "whoami" - entrypoint=["tcp"] - + [http.routers] + [http.routers.my-router] + rule = "Path(`/test`)" + service = "whoami" + entrypoint=["tcp"] + [http.routers.my-https-router] - entryPoints=["tcp"] - rule = "Path(`/whoami/`)" - service = "whoami" - [http.routers.my-https-router.tls] + entryPoints=["tcp"] + rule = "Path(`/whoami/`)" + service = "whoami" + [http.routers.my-https-router.tls] - [http.services] - [http.services.whoami.loadbalancer] - [[http.services.whoami.loadbalancer.servers]] - url = "http://localhost:8085" + [http.services] + [http.services.whoami.loadBalancer] + [[http.services.whoami.loadBalancer.servers]] + url = "http://localhost:8085" [tcp] - [tcp.routers] - [tcp.routers.to-whoami-a] - rule = "HostSNI(`whoami-a.test`)" - service = "whoami-a" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-a.tls] - passthrough=true + [tcp.routers] + [tcp.routers.to-whoami-a] + rule = "HostSNI(`whoami-a.test`)" + service = "whoami-a" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-a.tls] + passthrough=true - [tcp.routers.to-whoami-b] - rule = "HostSNI(`whoami-b.test`)" - service = "whoami-b" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-b.tls] - passthrough=true + [tcp.routers.to-whoami-b] + rule = "HostSNI(`whoami-b.test`)" + service = "whoami-b" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-b.tls] + passthrough=true - [tcp.routers.to-whoami-no-cert] - rule = "HostSNI(`whoami-c.test`)" - service = "whoami-no-cert" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-no-cert.tls] + [tcp.routers.to-whoami-no-cert] + rule = "HostSNI(`whoami-c.test`)" + service = "whoami-no-cert" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-no-cert.tls] - [tcp.services.whoami-a.loadbalancer] - [[tcp.services.whoami-a.loadbalancer.servers]] - address = "localhost:8081" + [tcp.services.whoami-a.loadBalancer] + [[tcp.services.whoami-a.loadBalancer.servers]] + address = "localhost:8081" - [tcp.services.whoami-b.loadbalancer] - [[tcp.services.whoami-b.loadbalancer.servers]] - address = "localhost:8082" + [tcp.services.whoami-b.loadBalancer] + [[tcp.services.whoami-b.loadBalancer.servers]] + address = "localhost:8082" - [tcp.services.whoami-no-cert.loadbalancer] - [[tcp.services.whoami-no-cert.loadbalancer.servers]] - address = "localhost:8083" + [tcp.services.whoami-no-cert.loadBalancer] + [[tcp.services.whoami-no-cert.loadBalancer.servers]] + address = "localhost:8083" [[tls.certificates]] certFile = "fixtures/tcp/whoami-c.crt" diff --git a/integration/fixtures/tcp/multi-tls-options.toml b/integration/fixtures/tcp/multi-tls-options.toml index 5551a4088..517fdeddc 100644 --- a/integration/fixtures/tcp/multi-tls-options.toml +++ b/integration/fixtures/tcp/multi-tls-options.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -13,27 +13,29 @@ level = "DEBUG" [providers.file] +## dynamic configuration ## + [tcp] - [tcp.routers] - [tcp.routers.to-whoami-no-cert] - rule = "HostSNI(`whoami-c.test`)" - service = "whoami-no-cert" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-no-cert.tls] - options = "foo" + [tcp.routers] + [tcp.routers.to-whoami-no-cert] + rule = "HostSNI(`whoami-c.test`)" + service = "whoami-no-cert" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-no-cert.tls] + options = "foo" - [tcp.routers.to-whoami-sni-strict] - rule = "HostSNI(`whoami-d.test`)" - service = "whoami-no-cert" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-sni-strict.tls] - options = "bar" + [tcp.routers.to-whoami-sni-strict] + rule = "HostSNI(`whoami-d.test`)" + service = "whoami-no-cert" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-sni-strict.tls] + options = "bar" - [tcp.services.whoami-no-cert] - [tcp.services.whoami-no-cert.loadbalancer] - method = "wrr" - [[tcp.services.whoami-no-cert.loadbalancer.servers]] - address = "localhost:8083" + [tcp.services.whoami-no-cert] + [tcp.services.whoami-no-cert.loadBalancer] + method = "wrr" + [[tcp.services.whoami-no-cert.loadBalancer.servers]] + address = "localhost:8083" [tls.options] diff --git a/integration/fixtures/tcp/non-tls-fallback.toml b/integration/fixtures/tcp/non-tls-fallback.toml index 37ff13045..173086e1b 100644 --- a/integration/fixtures/tcp/non-tls-fallback.toml +++ b/integration/fixtures/tcp/non-tls-fallback.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -14,45 +14,45 @@ level = "DEBUG" [providers.file] [tcp] - [tcp.routers] - [tcp.routers.to-whoami-a] - rule = "HostSNI(`whoami-a.test`)" - service = "whoami-a" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-a.tls] - passthrough=true + [tcp.routers] + [tcp.routers.to-whoami-a] + rule = "HostSNI(`whoami-a.test`)" + service = "whoami-a" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-a.tls] + passthrough=true - [tcp.routers.to-whoami-b] - rule = "HostSNI(`whoami-b.test`)" - service = "whoami-b" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-b.tls] - passthrough=true + [tcp.routers.to-whoami-b] + rule = "HostSNI(`whoami-b.test`)" + service = "whoami-b" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-b.tls] + passthrough=true - [tcp.routers.to-whoami-no-cert] - rule = "HostSNI(`whoami-c.test`)" - service = "whoami-no-cert" - entryPoints = [ "tcp" ] - [tcp.routers.to-whoami-no-cert.tls] + [tcp.routers.to-whoami-no-cert] + rule = "HostSNI(`whoami-c.test`)" + service = "whoami-no-cert" + entryPoints = [ "tcp" ] + [tcp.routers.to-whoami-no-cert.tls] - [tcp.routers.to-whoami-no-tls] - entryPoints = ["tcp"] - rule="HostSNI(`*`)" - service = "whoami-no-tls" + [tcp.routers.to-whoami-no-tls] + entryPoints = ["tcp"] + rule="HostSNI(`*`)" + service = "whoami-no-tls" - [tcp.services] - [tcp.services.whoami-no-tls.loadbalancer] - [[tcp.services.whoami-no-tls.loadbalancer.servers]] - address = "localhost:8084" + [tcp.services] + [tcp.services.whoami-no-tls.loadBalancer] + [[tcp.services.whoami-no-tls.loadBalancer.servers]] + address = "localhost:8084" - [tcp.services.whoami-a.loadbalancer] - [[tcp.services.whoami-a.loadbalancer.servers]] - address = "localhost:8081" + [tcp.services.whoami-a.loadBalancer] + [[tcp.services.whoami-a.loadBalancer.servers]] + address = "localhost:8081" - [tcp.services.whoami-b.loadbalancer] - [[tcp.services.whoami-b.loadbalancer.servers]] - address = "localhost:8082" + [tcp.services.whoami-b.loadBalancer] + [[tcp.services.whoami-b.loadBalancer.servers]] + address = "localhost:8082" - [tcp.services.whoami-no-cert.loadbalancer] - [[tcp.services.whoami-no-cert.loadbalancer.servers]] - address = "localhost:8083" + [tcp.services.whoami-no-cert.loadBalancer] + [[tcp.services.whoami-no-cert.loadBalancer.servers]] + address = "localhost:8083" diff --git a/integration/fixtures/tcp/non-tls.toml b/integration/fixtures/tcp/non-tls.toml index 4cf36eade..c7ba8297f 100644 --- a/integration/fixtures/tcp/non-tls.toml +++ b/integration/fixtures/tcp/non-tls.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.tcp] @@ -13,14 +13,16 @@ level = "DEBUG" [providers.file] -[tcp] - [tcp.routers] - [tcp.routers.to-whoami-no-tls] - entryPoints = ["tcp"] - rule="HostSNI(`*`)" - service = "whoami-no-tls" +## dynamic configuration ## - [tcp.services] - [tcp.services.whoami-no-tls.loadbalancer] - [[tcp.services.whoami-no-tls.loadbalancer.servers]] - address = "localhost:8084" +[tcp] + [tcp.routers] + [tcp.routers.to-whoami-no-tls] + entryPoints = ["tcp"] + rule="HostSNI(`*`)" + service = "whoami-no-tls" + + [tcp.services] + [tcp.services.whoami-no-tls.loadBalancer] + [[tcp.services.whoami-no-tls.loadBalancer.servers]] + address = "localhost:8084" diff --git a/integration/fixtures/timeout/forwarding_timeouts.toml b/integration/fixtures/timeout/forwarding_timeouts.toml index 04d80e14f..5d123d18d 100644 --- a/integration/fixtures/timeout/forwarding_timeouts.toml +++ b/integration/fixtures/timeout/forwarding_timeouts.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport.forwardingTimeouts] dialTimeout = "300ms" @@ -19,24 +19,26 @@ level = "DEBUG" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/dialTimeout`)" + service = "service1" + rule = "Path(`/dialTimeout`)" [http.routers.router2] - Service = "service2" - Rule = "Path(`/responseHeaderTimeout`)" + service = "service2" + rule = "Path(`/responseHeaderTimeout`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://50.255.255.1" + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://50.255.255.1" [http.services.service2] - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://{{.TimeoutEndpoint}}:9000" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://{{.TimeoutEndpoint}}:9000" diff --git a/integration/fixtures/timeout/keepalive.toml b/integration/fixtures/timeout/keepalive.toml index c01dce754..d79e04786 100644 --- a/integration/fixtures/timeout/keepalive.toml +++ b/integration/fixtures/timeout/keepalive.toml @@ -1,31 +1,33 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport.forwardingTimeouts] idleConnTimeout = "{{ .IdleConnTimeout }}" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "keepalive" - Rule = "PathPrefix(`/keepalive`)" + service = "keepalive" + rule = "PathPrefix(`/keepalive`)" [http.services] [http.services.keepalive] - [http.services.keepalive.LoadBalancer] + [http.services.keepalive.loadBalancer] passHostHeader = true - [[http.services.keepalive.LoadBalancer.Servers]] - URL = "{{ .KeepAliveServer }}" - Weight = 1 + [[http.services.keepalive.loadBalancer.servers]] + url = "{{ .KeepAliveServer }}" + weight = 1 diff --git a/integration/fixtures/tlsclientheaders/simple.toml b/integration/fixtures/tlsclientheaders/simple.toml index 26c2cbe7b..90fed2166 100644 --- a/integration/fixtures/tlsclientheaders/simple.toml +++ b/integration/fixtures/tlsclientheaders/simple.toml @@ -16,17 +16,18 @@ [providers] [providers.docker] - endpoint = "unix:///var/run/docker.sock" watch = true [providers.file] +## dynamic configuration ## + [tls.options] - [tls.options.default.ClientCA] + [tls.options.default.clientCA] files = [ """{{ .RootCertContent }}""" ] optional = false [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = """{{ .ServerCertContent }}""" keyFile = """{{ .ServerKeyContent }}""" diff --git a/integration/fixtures/tracing/simple-jaeger.toml b/integration/fixtures/tracing/simple-jaeger.toml index 1a830f661..53435ad88 100644 --- a/integration/fixtures/tracing/simple-jaeger.toml +++ b/integration/fixtures/tracing/simple-jaeger.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [api] @@ -20,7 +20,9 @@ level = "DEBUG" localAgentHostPort = "{{.IP}}:6831" [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] @@ -38,36 +40,36 @@ level = "DEBUG" [http.middlewares] [http.middlewares.retry.retry] - attempts = 3 - [http.middlewares.basic-auth.BasicAuth] - users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] - [http.middlewares.ratelimit.RateLimit] - extractorfunc = "client.ip" - [http.middlewares.ratelimit.RateLimit.rateset.rateset1] - period = "60s" - average = 4 - burst = 5 - [http.middlewares.ratelimit.RateLimit.rateset.rateset2] - period = "3s" - average = 1 - burst = 2 + attempts = 3 + [http.middlewares.basic-auth.basicAuth] + users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] + [http.middlewares.ratelimit.rateLimit] + extractorfunc = "client.ip" + [http.middlewares.ratelimit.rateLimit.rateSet.rateset1] + period = "60s" + average = 4 + burst = 5 + [http.middlewares.ratelimit.rateLimit.rateSet.rateset2] + period = "3s" + average = 1 + burst = 2 [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" [http.services.service2] passHostHeader = true - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" [http.services.service3] passHostHeader = true - [http.services.service3.LoadBalancer] - [[http.services.service3.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [http.services.service3.loadBalancer] + [[http.services.service3.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" diff --git a/integration/fixtures/tracing/simple-zipkin.toml b/integration/fixtures/tracing/simple-zipkin.toml index e557fc122..b1f14bf37 100644 --- a/integration/fixtures/tracing/simple-zipkin.toml +++ b/integration/fixtures/tracing/simple-zipkin.toml @@ -1,9 +1,9 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [api] @@ -18,54 +18,55 @@ level = "DEBUG" debug = true [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Middlewares = ["retry", "ratelimit"] - Rule = "Path(`/ratelimit`)" + service = "service1" + middlewares = ["retry", "ratelimit"] + rule = "Path(`/ratelimit`)" [http.routers.router2] - Service = "service2" - Middlewares = ["retry"] - Rule = "Path(`/retry`)" + service = "service2" + middlewares = ["retry"] + rule = "Path(`/retry`)" [http.routers.router3] - Service = "service3" - Middlewares = ["retry", "basic-auth"] - Rule = "Path(`/auth`)" + service = "service3" + middlewares = ["retry", "basic-auth"] + rule = "Path(`/auth`)" [http.middlewares] [http.middlewares.retry.retry] - attempts = 3 - [http.middlewares.basic-auth.BasicAuth] - users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] - [http.middlewares.ratelimit.RateLimit] - extractorfunc = "client.ip" - [http.middlewares.ratelimit.RateLimit.rateset.rateset1] - period = "60s" - average = 4 - burst = 5 - [http.middlewares.ratelimit.RateLimit.rateset.rateset2] - period = "3s" - average = 1 - burst = 2 - + attempts = 3 + [http.middlewares.basic-auth.basicAuth] + users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"] + [http.middlewares.ratelimit.rateLimit] + extractorfunc = "client.ip" + [http.middlewares.ratelimit.rateLimit.rateSet.rateset1] + period = "60s" + average = 4 + burst = 5 + [http.middlewares.ratelimit.rateLimit.rateSet.rateset2] + period = "3s" + average = 1 + burst = 2 [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [[http.services.service1.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" [http.services.service2] passHostHeader = true - [http.services.service2.LoadBalancer] - [[http.services.service2.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" [http.services.service3] passHostHeader = true - [http.services.service3.LoadBalancer] - [[http.services.service3.LoadBalancer.Servers]] - URL = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" + [http.services.service3.loadBalancer] + [[http.services.service3.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" diff --git a/integration/fixtures/traefik_log_config.toml b/integration/fixtures/traefik_log_config.toml index d5bcf259b..e7b077c61 100644 --- a/integration/fixtures/traefik_log_config.toml +++ b/integration/fixtures/traefik_log_config.toml @@ -1,23 +1,23 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" -filePath = "traefik.log" + level = "DEBUG" + filePath = "traefik.log" [accessLog] filePath = "access.log" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] dashboard = false [providers] - [providers.docker] - exposedByDefault = false - defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" - watch = true + [providers.docker] + exposedByDefault = false + defaultRule = "Host(`{{ normalize .Name }}.docker.local`)" + watch = true diff --git a/integration/fixtures/websocket/config.toml b/integration/fixtures/websocket/config.toml index 5bd199180..066155d9b 100644 --- a/integration/fixtures/websocket/config.toml +++ b/integration/fixtures/websocket/config.toml @@ -1,27 +1,29 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [entryPoints] [entryPoints.web] - address = ":8000" + address = ":8000" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "PathPrefix(`/ws`)" + service = "service1" + rule = "PathPrefix(`/ws`)" [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] + [http.services.service1.loadBalancer] passHostHeader = true - [[http.services.service1.LoadBalancer.Servers]] - URL = "{{ .WebsocketServer }}" + [[http.services.service1.loadBalancer.servers]] + url = "{{ .WebsocketServer }}" diff --git a/integration/fixtures/websocket/config_https.toml b/integration/fixtures/websocket/config_https.toml index a1fa2f43a..f020fa71d 100644 --- a/integration/fixtures/websocket/config_https.toml +++ b/integration/fixtures/websocket/config_https.toml @@ -1,36 +1,38 @@ [global] -checkNewVersion = false -sendAnonymousUsage = false + checkNewVersion = false + sendAnonymousUsage = false [log] -level = "DEBUG" + level = "DEBUG" [serversTransport] -insecureSkipVerify=true + insecureSkipVerify=true [entryPoints] [entryPoints.wss] - address = ":8000" + address = ":8000" [api] [providers] - [providers.file] + [providers.file] + +## dynamic configuration ## [http.routers] [http.routers.router1] - Service = "service1" - Rule = "Path(`/echo`,`/ws`)" + service = "service1" + rule = "Path(`/echo`,`/ws`)" [http.routers.router1.tls] [http.services] [http.services.service1] - [http.services.service1.LoadBalancer] - PassHostHeader = true - [[http.services.service1.LoadBalancer.Servers]] - URL = "{{ .WebsocketServer }}" + [http.services.service1.loadBalancer] + passHostHeader = true + [[http.services.service1.loadBalancer.servers]] + url = "{{ .WebsocketServer }}" [tls.stores] - [tls.stores.default.DefaultCertificate] + [tls.stores.default.defaultCertificate] certFile = "resources/tls/local.cert" keyFile = "resources/tls/local.key" diff --git a/integration/testdata/rawdata-crd.json b/integration/testdata/rawdata-crd.json index 3e09587f5..c6c9e1b25 100644 --- a/integration/testdata/rawdata-crd.json +++ b/integration/testdata/rawdata-crd.json @@ -36,7 +36,7 @@ }, "services": { "default/test.crd-6b204d94623b3df4370c@kubernetescrd": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "url": "http://10.42.0.3:80" @@ -56,7 +56,7 @@ } }, "default/test2.crd-23c7f4c450289ee29016@kubernetescrd": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "url": "http://10.42.0.3:80" @@ -91,7 +91,7 @@ }, "tcpServices": { "default/test3.crd-673acf455cb2dab0b43a@kubernetescrd": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "10.42.0.4:8080" diff --git a/integration/testdata/rawdata-ingress.json b/integration/testdata/rawdata-ingress.json index de6c54952..c22fdf46e 100644 --- a/integration/testdata/rawdata-ingress.json +++ b/integration/testdata/rawdata-ingress.json @@ -1,14 +1,13 @@ { "routers": { "whoami-test/whoami@kubernetes": { - "entryPoints": null, "service": "default/whoami/http", "rule": "Host(`whoami.test`) \u0026\u0026 PathPrefix(`/whoami`)" } }, "services": { "default/whoami/http@kubernetes": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "url": "http://10.42.0.2:80" diff --git a/pkg/anonymize/anonymize_config_test.go b/pkg/anonymize/anonymize_config_test.go index 928d4254a..2f15468ad 100644 --- a/pkg/anonymize/anonymize_config_test.go +++ b/pkg/anonymize/anonymize_config_test.go @@ -199,7 +199,7 @@ func TestDo_globalConfiguration(t *testing.T) { EntryPoint: "MyEntryPoint", Middlewares: []string{"m1", "m2"}, }, - Datadog: &types.Datadog{ + DataDog: &types.DataDog{ Address: "localhost:8181", PushInterval: 12, }, diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go index 6794b977c..ce10158a2 100644 --- a/pkg/api/handler_test.go +++ b/pkg/api/handler_test.go @@ -895,7 +895,6 @@ func TestHandlerHTTP_API(t *testing.T) { assert.JSONEq(t, string(data), string(contents)) }) } - } func TestHandler_Configuration(t *testing.T) { diff --git a/pkg/api/testdata/getrawdata.json b/pkg/api/testdata/getrawdata.json index 736104e97..7e238245b 100644 --- a/pkg/api/testdata/getrawdata.json +++ b/pkg/api/testdata/getrawdata.json @@ -54,7 +54,7 @@ }, "services": { "foo-service@myprovider": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "url": "http://127.0.0.1" @@ -86,7 +86,7 @@ }, "tcpServices": { "tcpfoo-service@myprovider": { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "127.0.0.1" diff --git a/pkg/api/testdata/service-bar.json b/pkg/api/testdata/service-bar.json index a67023582..529e3382a 100644 --- a/pkg/api/testdata/service-bar.json +++ b/pkg/api/testdata/service-bar.json @@ -1,5 +1,5 @@ { - "loadbalancer": { + "loadBalancer": { "passHostHeader": false, "servers": [ { diff --git a/pkg/api/testdata/services-page2.json b/pkg/api/testdata/services-page2.json index 13e676ea9..2f5dce034 100644 --- a/pkg/api/testdata/services-page2.json +++ b/pkg/api/testdata/services-page2.json @@ -1,6 +1,6 @@ [ { - "loadbalancer": { + "loadBalancer": { "passHostHeader": false, "servers": [ { diff --git a/pkg/api/testdata/services.json b/pkg/api/testdata/services.json index ceb1fc381..9abd426f8 100644 --- a/pkg/api/testdata/services.json +++ b/pkg/api/testdata/services.json @@ -1,6 +1,6 @@ [ { - "loadbalancer": { + "loadBalancer": { "passHostHeader": false, "servers": [ { @@ -19,7 +19,7 @@ ] }, { - "loadbalancer": { + "loadBalancer": { "passHostHeader": false, "servers": [ { diff --git a/pkg/api/testdata/tcpservice-bar.json b/pkg/api/testdata/tcpservice-bar.json index 31f3f9405..114f0b74b 100644 --- a/pkg/api/testdata/tcpservice-bar.json +++ b/pkg/api/testdata/tcpservice-bar.json @@ -1,5 +1,5 @@ { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "127.0.0.1:2345" diff --git a/pkg/api/testdata/tcpservices-page2.json b/pkg/api/testdata/tcpservices-page2.json index 0a5bf6940..345151040 100644 --- a/pkg/api/testdata/tcpservices-page2.json +++ b/pkg/api/testdata/tcpservices-page2.json @@ -1,6 +1,6 @@ [ { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "127.0.0.2:2345" diff --git a/pkg/api/testdata/tcpservices.json b/pkg/api/testdata/tcpservices.json index e9820643c..4df6dc8b7 100644 --- a/pkg/api/testdata/tcpservices.json +++ b/pkg/api/testdata/tcpservices.json @@ -1,6 +1,6 @@ [ { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "127.0.0.1:2345" @@ -15,7 +15,7 @@ ] }, { - "loadbalancer": { + "loadBalancer": { "servers": [ { "address": "127.0.0.2:2345" diff --git a/pkg/config/dyn_config.go b/pkg/config/dyn_config.go index 032cff288..634fad4de 100644 --- a/pkg/config/dyn_config.go +++ b/pkg/config/dyn_config.go @@ -1,57 +1,98 @@ package config import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "os" "reflect" traefiktls "github.com/containous/traefik/pkg/tls" ) +// Message holds configuration information exchanged between parts of traefik. +type Message struct { + ProviderName string + Configuration *Configuration +} + +// Configurations is for currentConfigurations Map. +type Configurations map[string]*Configuration + +// Configuration is the root of the dynamic configuration +type Configuration struct { + HTTP *HTTPConfiguration `json:"http,omitempty" toml:"http,omitempty" yaml:"http,omitempty"` + TCP *TCPConfiguration `json:"tcp,omitempty" toml:"tcp,omitempty" yaml:"tcp,omitempty"` + TLS *TLSConfiguration `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"` +} + +// TLSConfiguration contains all the configuration parameters of a TLS connection. +type TLSConfiguration struct { + Certificates []*traefiktls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"` + Options map[string]traefiktls.Options `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + Stores map[string]traefiktls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"` +} + +// HTTPConfiguration contains all the HTTP configuration parameters. +type HTTPConfiguration struct { + Routers map[string]*Router `json:"routers,omitempty" toml:"routers,omitempty" yaml:"routers,omitempty"` + Middlewares map[string]*Middleware `json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty"` + Services map[string]*Service `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"` +} + +// TCPConfiguration contains all the TCP configuration parameters. +type TCPConfiguration struct { + Routers map[string]*TCPRouter `json:"routers,omitempty" toml:"routers,omitempty" yaml:"routers,omitempty"` + Services map[string]*TCPService `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"` +} + +// Service holds a service configuration (can only be of one type at the same time). +type Service struct { + LoadBalancer *LoadBalancerService `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"` +} + +// TCPService holds a tcp service configuration (can only be of one type at the same time). +type TCPService struct { + LoadBalancer *TCPLoadBalancerService `json:"loadBalancer,omitempty" toml:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"` +} + // Router holds the router configuration. type Router struct { - EntryPoints []string `json:"entryPoints"` - Middlewares []string `json:"middlewares,omitempty" toml:",omitempty"` - Service string `json:"service,omitempty" toml:",omitempty"` - Rule string `json:"rule,omitempty" toml:",omitempty"` - Priority int `json:"priority,omitempty" toml:"priority,omitzero"` - TLS *RouterTLSConfig `json:"tls,omitempty" toml:"tls,omitzero" label:"allowEmpty"` + EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"` + Middlewares []string `json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty"` + Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty"` + Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"` + Priority int `json:"priority,omitempty" toml:"priority,omitempty,omitzero" yaml:"priority,omitempty"` + TLS *RouterTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"` } // RouterTLSConfig holds the TLS configuration for a router type RouterTLSConfig struct { - Options string `json:"options,omitempty" toml:"options,omitzero"` + Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` } // TCPRouter holds the router configuration. type TCPRouter struct { - EntryPoints []string `json:"entryPoints"` - Service string `json:"service,omitempty" toml:",omitempty"` - Rule string `json:"rule,omitempty" toml:",omitempty"` - TLS *RouterTCPTLSConfig `json:"tls,omitempty" toml:"tls,omitzero" label:"allowEmpty"` + EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"` + Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty"` + Rule string `json:"rule,omitempty" toml:"rule,omitempty" yaml:"rule,omitempty"` + TLS *RouterTCPTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"` } // RouterTCPTLSConfig holds the TLS configuration for a router type RouterTCPTLSConfig struct { - Passthrough bool `json:"passthrough" toml:"passthrough,omitzero"` - Options string `json:"options,omitempty" toml:"options,omitzero"` + Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` + Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` } // LoadBalancerService holds the LoadBalancerService configuration. type LoadBalancerService struct { - Stickiness *Stickiness `json:"stickiness,omitempty" toml:",omitempty" label:"allowEmpty"` - Servers []Server `json:"servers,omitempty" toml:",omitempty" label-slice-as-struct:"server"` - HealthCheck *HealthCheck `json:"healthCheck,omitempty" toml:",omitempty"` - PassHostHeader bool `json:"passHostHeader" toml:",omitempty"` - ResponseForwarding *ResponseForwarding `json:"forwardingResponse,omitempty" toml:",omitempty"` + Stickiness *Stickiness `json:"stickiness,omitempty" toml:"stickiness,omitempty" yaml:"stickiness,omitempty" label:"allowEmpty"` + Servers []Server `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server"` + HealthCheck *HealthCheck `json:"healthCheck,omitempty" toml:"healthCheck,omitempty" yaml:"healthCheck,omitempty"` + PassHostHeader bool `json:"passHostHeader" toml:"passHostHeader" yaml:"passHostHeader"` + ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty" toml:"responseForwarding,omitempty" yaml:"responseForwarding,omitempty"` } // TCPLoadBalancerService holds the LoadBalancerService configuration. type TCPLoadBalancerService struct { - Servers []TCPServer `json:"servers,omitempty" toml:",omitempty" label-slice-as-struct:"server"` + Servers []TCPServer `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server" label-slice-as-struct:"server"` } // Mergeable tells if the given service is mergeable. @@ -95,27 +136,27 @@ func (l *LoadBalancerService) SetDefaults() { // ResponseForwarding holds configuration for the forward of the response. type ResponseForwarding struct { - FlushInterval string `json:"flushInterval,omitempty" toml:",omitempty"` + FlushInterval string `json:"flushInterval,omitempty" toml:"flushInterval,omitempty" yaml:"flushInterval,omitempty"` } // Stickiness holds the stickiness configuration. type Stickiness struct { - CookieName string `json:"cookieName,omitempty" toml:",omitempty"` - SecureCookie bool `json:"secureCookie,omitempty" toml:",omitempty"` - HTTPOnlyCookie bool `json:"httpOnlyCookie,omitempty" toml:",omitempty"` + CookieName string `json:"cookieName,omitempty" toml:"cookieName,omitempty" yaml:"cookieName,omitempty"` + SecureCookie bool `json:"secureCookie,omitempty" toml:"secureCookie,omitempty" yaml:"secureCookie,omitempty"` + HTTPOnlyCookie bool `json:"httpOnlyCookie,omitempty" toml:"httpOnlyCookie,omitempty" yaml:"httpOnlyCookie,omitempty"` } // Server holds the server configuration. type Server struct { - URL string `json:"url" label:"-"` - Scheme string `toml:"-" json:"-"` - Port string `toml:"-" json:"-"` + URL string `json:"url,omitempty" toml:"url,omitempty" yaml:"url,omitempty" label:"-"` + Scheme string `toml:"-" json:"-" yaml:"-"` + Port string `toml:"-" json:"-" yaml:"-"` } // TCPServer holds a TCP Server configuration type TCPServer struct { - Address string `json:"address" label:"-"` - Port string `toml:"-" json:"-"` + Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"` + Port string `toml:"-" json:"-" yaml:"-"` } // SetDefaults Default values for a Server. @@ -125,128 +166,13 @@ func (s *Server) SetDefaults() { // HealthCheck holds the HealthCheck configuration. type HealthCheck struct { - Scheme string `json:"scheme,omitempty" toml:",omitempty"` - Path string `json:"path,omitempty" toml:",omitempty"` - Port int `json:"port,omitempty" toml:",omitempty,omitzero"` + Scheme string `json:"scheme,omitempty" toml:"scheme,omitempty" yaml:"scheme,omitempty"` + Path string `json:"path,omitempty" toml:"path,omitempty" yaml:"path,omitempty"` + Port int `json:"port,omitempty" toml:"port,omitempty,omitzero" yaml:"port,omitempty"` // FIXME change string to types.Duration - Interval string `json:"interval,omitempty" toml:",omitempty"` + Interval string `json:"interval,omitempty" toml:"interval,omitempty" yaml:"interval,omitempty"` // FIXME change string to types.Duration - Timeout string `json:"timeout,omitempty" toml:",omitempty"` - Hostname string `json:"hostname,omitempty" toml:",omitempty"` - Headers map[string]string `json:"headers,omitempty" toml:",omitempty"` -} - -// CreateTLSConfig creates a TLS config from ClientTLS structures. -func (clientTLS *ClientTLS) CreateTLSConfig() (*tls.Config, error) { - if clientTLS == nil { - return nil, nil - } - - var err error - caPool := x509.NewCertPool() - clientAuth := tls.NoClientCert - if clientTLS.CA != "" { - var ca []byte - if _, errCA := os.Stat(clientTLS.CA); errCA == nil { - ca, err = ioutil.ReadFile(clientTLS.CA) - if err != nil { - return nil, fmt.Errorf("failed to read CA. %s", err) - } - } else { - ca = []byte(clientTLS.CA) - } - - if !caPool.AppendCertsFromPEM(ca) { - return nil, fmt.Errorf("failed to parse CA") - } - - if clientTLS.CAOptional { - clientAuth = tls.VerifyClientCertIfGiven - } else { - clientAuth = tls.RequireAndVerifyClientCert - } - } - - cert := tls.Certificate{} - _, errKeyIsFile := os.Stat(clientTLS.Key) - - if !clientTLS.InsecureSkipVerify && (len(clientTLS.Cert) == 0 || len(clientTLS.Key) == 0) { - return nil, fmt.Errorf("TLS Certificate or Key file must be set when TLS configuration is created") - } - - if len(clientTLS.Cert) > 0 && len(clientTLS.Key) > 0 { - if _, errCertIsFile := os.Stat(clientTLS.Cert); errCertIsFile == nil { - if errKeyIsFile == nil { - cert, err = tls.LoadX509KeyPair(clientTLS.Cert, clientTLS.Key) - if err != nil { - return nil, fmt.Errorf("failed to load TLS keypair: %v", err) - } - } else { - return nil, fmt.Errorf("tls cert is a file, but tls key is not") - } - } else { - if errKeyIsFile != nil { - cert, err = tls.X509KeyPair([]byte(clientTLS.Cert), []byte(clientTLS.Key)) - if err != nil { - return nil, fmt.Errorf("failed to load TLS keypair: %v", err) - - } - } else { - return nil, fmt.Errorf("TLS key is a file, but tls cert is not") - } - } - } - - return &tls.Config{ - Certificates: []tls.Certificate{cert}, - RootCAs: caPool, - InsecureSkipVerify: clientTLS.InsecureSkipVerify, - ClientAuth: clientAuth, - }, nil -} - -// Message holds configuration information exchanged between parts of traefik. -type Message struct { - ProviderName string - Configuration *Configuration -} - -// Configuration is the root of the dynamic configuration -type Configuration struct { - HTTP *HTTPConfiguration - TCP *TCPConfiguration - TLS *TLSConfiguration -} - -// TLSConfiguration contains all the configuration parameters of a TLS connection. -type TLSConfiguration struct { - Certificates []*traefiktls.CertAndStores `json:"-" label:"-" yaml:"certificates"` - Options map[string]traefiktls.Options - Stores map[string]traefiktls.Store -} - -// Configurations is for currentConfigurations Map. -type Configurations map[string]*Configuration - -// HTTPConfiguration contains all the HTTP configuration parameters. -type HTTPConfiguration struct { - Routers map[string]*Router `json:"routers,omitempty" toml:",omitempty"` - Middlewares map[string]*Middleware `json:"middlewares,omitempty" toml:",omitempty"` - Services map[string]*Service `json:"services,omitempty" toml:",omitempty"` -} - -// TCPConfiguration contains all the TCP configuration parameters. -type TCPConfiguration struct { - Routers map[string]*TCPRouter `json:"routers,omitempty" toml:",omitempty"` - Services map[string]*TCPService `json:"services,omitempty" toml:",omitempty"` -} - -// Service holds a service configuration (can only be of one type at the same time). -type Service struct { - LoadBalancer *LoadBalancerService `json:"loadbalancer,omitempty" toml:",omitempty,omitzero"` -} - -// TCPService holds a tcp service configuration (can only be of one type at the same time). -type TCPService struct { - LoadBalancer *TCPLoadBalancerService `json:"loadbalancer,omitempty" toml:",omitempty,omitzero"` + Timeout string `json:"timeout,omitempty" toml:"timeout,omitempty" yaml:"timeout,omitempty"` + Hostname string `json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"` + Headers map[string]string `json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty"` } diff --git a/pkg/config/file/file_node_test.go b/pkg/config/file/file_node_test.go index a8e1cb7a9..2a54fb47f 100644 --- a/pkg/config/file/file_node_test.go +++ b/pkg/config/file/file_node_test.go @@ -67,267 +67,235 @@ func Test_decodeFileToNode_Toml(t *testing.T) { expected := &parser.Node{ Name: "traefik", Children: []*parser.Node{ - {Name: "ACME", - Children: []*parser.Node{ - {Name: "ACMELogging", Value: "true"}, - {Name: "CAServer", Value: "foobar"}, - {Name: "DNSChallenge", Children: []*parser.Node{ - {Name: "DelayBeforeCheck", Value: "42"}, - {Name: "DisablePropagationCheck", Value: "true"}, - {Name: "Provider", Value: "foobar"}, - {Name: "Resolvers", Value: "foobar,foobar"}, - }}, - {Name: "Domains", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Main", Value: "foobar"}, - {Name: "SANs", Value: "foobar,foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Main", Value: "foobar"}, - {Name: "SANs", Value: "foobar,foobar"}, - }}, - }}, - {Name: "Email", Value: "foobar"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "HTTPChallenge", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}}}, - {Name: "KeyType", Value: "foobar"}, - {Name: "OnHostRule", Value: "true"}, - {Name: "Storage", Value: "foobar"}, - {Name: "TLSChallenge"}, - }, - }, - {Name: "API", Children: []*parser.Node{ - {Name: "Dashboard", Value: "true"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}, - {Name: "Statistics", Children: []*parser.Node{ - {Name: "RecentErrors", Value: "42"}}}}}, - {Name: "AccessLog", Children: []*parser.Node{ - {Name: "BufferingSize", Value: "42"}, - {Name: "Fields", Children: []*parser.Node{ - {Name: "DefaultMode", Value: "foobar"}, - {Name: "Headers", Children: []*parser.Node{ - {Name: "DefaultMode", Value: "foobar"}, - {Name: "Names", Children: []*parser.Node{ + {Name: "accessLog", Children: []*parser.Node{ + {Name: "bufferingSize", Value: "42"}, + {Name: "fields", Children: []*parser.Node{ + {Name: "defaultMode", Value: "foobar"}, + {Name: "headers", Children: []*parser.Node{ + {Name: "defaultMode", Value: "foobar"}, + {Name: "names", Children: []*parser.Node{ {Name: "name0", Value: "foobar"}, {Name: "name1", Value: "foobar"}}}}}, - {Name: "Names", Children: []*parser.Node{ + {Name: "names", Children: []*parser.Node{ {Name: "name0", Value: "foobar"}, {Name: "name1", Value: "foobar"}}}}}, - {Name: "FilePath", Value: "foobar"}, - {Name: "Filters", Children: []*parser.Node{ - {Name: "MinDuration", Value: "42"}, - {Name: "RetryAttempts", Value: "true"}, - {Name: "StatusCodes", Value: "foobar,foobar"}}}, - {Name: "Format", Value: "foobar"}}}, - {Name: "EntryPoints", Children: []*parser.Node{ + {Name: "filePath", Value: "foobar"}, + {Name: "filters", Children: []*parser.Node{ + {Name: "minDuration", Value: "42"}, + {Name: "retryAttempts", Value: "true"}, + {Name: "statusCodes", Value: "foobar,foobar"}}}, + {Name: "format", Value: "foobar"}}}, + {Name: "acme", + Children: []*parser.Node{ + {Name: "acmeLogging", Value: "true"}, + {Name: "caServer", Value: "foobar"}, + {Name: "dnsChallenge", Children: []*parser.Node{ + {Name: "delayBeforeCheck", Value: "42"}, + {Name: "disablePropagationCheck", Value: "true"}, + {Name: "provider", Value: "foobar"}, + {Name: "resolvers", Value: "foobar,foobar"}, + }}, + {Name: "domains", Children: []*parser.Node{ + {Name: "[0]", Children: []*parser.Node{ + {Name: "main", Value: "foobar"}, + {Name: "sans", Value: "foobar,foobar"}, + }}, + {Name: "[1]", Children: []*parser.Node{ + {Name: "main", Value: "foobar"}, + {Name: "sans", Value: "foobar,foobar"}, + }}, + }}, + {Name: "email", Value: "foobar"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "httpChallenge", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}, + {Name: "keyType", Value: "foobar"}, + {Name: "onHostRule", Value: "true"}, + {Name: "storage", Value: "foobar"}, + {Name: "tlsChallenge"}, + }, + }, + {Name: "api", Children: []*parser.Node{ + {Name: "dashboard", Value: "true"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}, + {Name: "statistics", Children: []*parser.Node{ + {Name: "recentErrors", Value: "42"}}}}}, + {Name: "entryPoints", Children: []*parser.Node{ {Name: "EntryPoint0", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "ForwardedHeaders", Children: []*parser.Node{ - {Name: "Insecure", Value: "true"}, - {Name: "TrustedIPs", Value: "foobar,foobar"}}}, - {Name: "ProxyProtocol", Children: []*parser.Node{ - {Name: "Insecure", Value: "true"}, - {Name: "TrustedIPs", Value: "foobar,foobar"}}}, - {Name: "Transport", Children: []*parser.Node{ - {Name: "LifeCycle", Children: []*parser.Node{ - {Name: "GraceTimeOut", Value: "42"}, - {Name: "RequestAcceptGraceTimeout", Value: "42"}}}, - {Name: "RespondingTimeouts", Children: []*parser.Node{ - {Name: "IdleTimeout", Value: "42"}, - {Name: "ReadTimeout", Value: "42"}, - {Name: "WriteTimeout", Value: "42"}}}}}}}}}, - {Name: "Global", Children: []*parser.Node{ - {Name: "CheckNewVersion", Value: "true"}, - {Name: "Debug", Value: "true"}, - {Name: "SendAnonymousUsage", Value: "true"}}}, - {Name: "HostResolver", Children: []*parser.Node{ - {Name: "CnameFlattening", Value: "true"}, - {Name: "ResolvConfig", Value: "foobar"}, - {Name: "ResolvDepth", Value: "42"}}}, - {Name: "Log", Children: []*parser.Node{ - {Name: "FilePath", Value: "foobar"}, - {Name: "Format", Value: "foobar"}, - {Name: "Level", Value: "foobar"}}}, - {Name: "Metrics", Children: []*parser.Node{ - {Name: "Datadog", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}}}, - {Name: "InfluxDB", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "Database", Value: "foobar"}, - {Name: "Password", Value: "foobar"}, - {Name: "Protocol", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}, - {Name: "RetentionPolicy", Value: "foobar"}, - {Name: "Username", Value: "foobar"}}}, - {Name: "Prometheus", Children: []*parser.Node{ - {Name: "Buckets", Value: "42,42"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}}}, - {Name: "StatsD", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}}}}}, - {Name: "Ping", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}}}, - {Name: "Providers", Children: []*parser.Node{ - {Name: "Docker", Children: []*parser.Node{ - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "Network", Value: "foobar"}, - {Name: "SwarmMode", Value: "true"}, - {Name: "SwarmModeRefreshSeconds", Value: "42"}, - {Name: "TLS", Children: []*parser.Node{ - {Name: "CA", Value: "foobar"}, - {Name: "CAOptional", Value: "true"}, - {Name: "Cert", Value: "foobar"}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "Key", Value: "foobar"}}}, - {Name: "UseBindPortIP", Value: "true"}, - {Name: "Watch", Value: "true"}}}, - {Name: "File", Children: []*parser.Node{ - {Name: "DebugLogGeneratedTemplate", Value: "true"}, - {Name: "Directory", Value: "foobar"}, - {Name: "Filename", Value: "foobar"}, - {Name: "TraefikFile", Value: "foobar"}, - {Name: "Watch", Value: "true"}}}, - {Name: "Kubernetes", Children: []*parser.Node{ - {Name: "CertAuthFilePath", Value: "foobar"}, - {Name: "DisablePassHostHeaders", Value: "true"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "IngressClass", Value: "foobar"}, - {Name: "IngressEndpoint", Children: []*parser.Node{ - {Name: "Hostname", Value: "foobar"}, - {Name: "IP", Value: "foobar"}, - {Name: "PublishedService", Value: "foobar"}}}, - {Name: "LabelSelector", Value: "foobar"}, - {Name: "Namespaces", Value: "foobar,foobar"}, - {Name: "Token", Value: "foobar"}}}, - {Name: "KubernetesCRD", + {Name: "address", Value: "foobar"}, + {Name: "forwardedHeaders", Children: []*parser.Node{ + {Name: "insecure", Value: "true"}, + {Name: "trustedIPs", Value: "foobar,foobar"}}}, + {Name: "proxyProtocol", Children: []*parser.Node{ + {Name: "insecure", Value: "true"}, + {Name: "trustedIPs", Value: "foobar,foobar"}}}, + {Name: "transport", Children: []*parser.Node{ + {Name: "lifeCycle", Children: []*parser.Node{ + {Name: "graceTimeOut", Value: "42"}, + {Name: "requestAcceptGraceTimeout", Value: "42"}}}, + {Name: "respondingTimeouts", Children: []*parser.Node{ + {Name: "idleTimeout", Value: "42"}, + {Name: "readTimeout", Value: "42"}, + {Name: "writeTimeout", Value: "42"}}}}}}}}}, + {Name: "global", Children: []*parser.Node{ + {Name: "checkNewVersion", Value: "true"}, + {Name: "sendAnonymousUsage", Value: "true"}}}, + {Name: "hostResolver", Children: []*parser.Node{ + {Name: "cnameFlattening", Value: "true"}, + {Name: "resolvConfig", Value: "foobar"}, + {Name: "resolvDepth", Value: "42"}}}, + {Name: "log", Children: []*parser.Node{ + {Name: "filePath", Value: "foobar"}, + {Name: "format", Value: "foobar"}, + {Name: "level", Value: "foobar"}}}, + {Name: "metrics", Children: []*parser.Node{ + {Name: "dataDog", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}}}, + {Name: "influxDB", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "database", Value: "foobar"}, + {Name: "password", Value: "foobar"}, + {Name: "protocol", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}, + {Name: "retentionPolicy", Value: "foobar"}, + {Name: "username", Value: "foobar"}}}, + {Name: "prometheus", Children: []*parser.Node{ + {Name: "buckets", Value: "42,42"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}}}, + {Name: "statsD", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}}}}}, + {Name: "ping", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}}}, + {Name: "providers", Children: []*parser.Node{ + {Name: "docker", Children: []*parser.Node{ + {Name: "constraints", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "network", Value: "foobar"}, + {Name: "swarmMode", Value: "true"}, + {Name: "swarmModeRefreshSeconds", Value: "42"}, + {Name: "tls", Children: []*parser.Node{ + {Name: "ca", Value: "foobar"}, + {Name: "caOptional", Value: "true"}, + {Name: "cert", Value: "foobar"}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "key", Value: "foobar"}}}, + {Name: "useBindPortIP", Value: "true"}, + {Name: "watch", Value: "true"}}}, + {Name: "file", Children: []*parser.Node{ + {Name: "debugLogGeneratedTemplate", Value: "true"}, + {Name: "directory", Value: "foobar"}, + {Name: "filename", Value: "foobar"}, + {Name: "traefikFile", Value: "foobar"}, + {Name: "watch", Value: "true"}}}, + {Name: "kubernetes", Children: []*parser.Node{ + {Name: "certAuthFilePath", Value: "foobar"}, + {Name: "disablePassHostHeaders", Value: "true"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "ingressClass", Value: "foobar"}, + {Name: "ingressEndpoint", Children: []*parser.Node{ + {Name: "hostname", Value: "foobar"}, + {Name: "ip", Value: "foobar"}, + {Name: "publishedService", Value: "foobar"}}}, + {Name: "labelSelector", Value: "foobar"}, + {Name: "namespaces", Value: "foobar,foobar"}, + {Name: "token", Value: "foobar"}}}, + {Name: "kubernetesCRD", Children: []*parser.Node{ - {Name: "CertAuthFilePath", Value: "foobar"}, - {Name: "DisablePassHostHeaders", Value: "true"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "IngressClass", Value: "foobar"}, - {Name: "LabelSelector", Value: "foobar"}, - {Name: "Namespaces", Value: "foobar,foobar"}, - {Name: "Token", Value: "foobar"}}}, - {Name: "Marathon", Children: []*parser.Node{ - {Name: "Basic", Children: []*parser.Node{ - {Name: "HTTPBasicAuthUser", Value: "foobar"}, - {Name: "HTTPBasicPassword", Value: "foobar"}}}, - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DCOSToken", Value: "foobar"}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "DialerTimeout", Value: "42"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "ForceTaskHostname", Value: "true"}, - {Name: "KeepAlive", Value: "42"}, - {Name: "RespectReadinessChecks", Value: "true"}, - {Name: "ResponseHeaderTimeout", Value: "42"}, - {Name: "TLS", Children: []*parser.Node{ - {Name: "CA", Value: "foobar"}, - {Name: "CAOptional", Value: "true"}, - {Name: "Cert", Value: "foobar"}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "Key", Value: "foobar"}}}, - {Name: "TLSHandshakeTimeout", Value: "42"}, - {Name: "Trace", Value: "true"}, - {Name: "Watch", Value: "true"}}}, - {Name: "ProvidersThrottleDuration", Value: "42"}, - {Name: "Rancher", Children: []*parser.Node{ - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "EnableServiceHealthFilter", Value: "true"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "IntervalPoll", Value: "true"}, - {Name: "Prefix", Value: "foobar"}, - {Name: "RefreshSeconds", Value: "42"}, - {Name: "Watch", Value: "true"}}}, - {Name: "Rest", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}}}}}, - {Name: "ServersTransport", Children: []*parser.Node{ - {Name: "ForwardingTimeouts", Children: []*parser.Node{ - {Name: "DialTimeout", Value: "42"}, - {Name: "ResponseHeaderTimeout", Value: "42"}}}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "MaxIdleConnsPerHost", Value: "42"}, - {Name: "RootCAs", Value: "foobar,foobar"}}}, - {Name: "Tracing", Children: []*parser.Node{ - {Name: "DataDog", Children: []*parser.Node{ - {Name: "BagagePrefixHeaderName", Value: "foobar"}, - {Name: "Debug", Value: "true"}, - {Name: "GlobalTag", Value: "foobar"}, - {Name: "LocalAgentHostPort", Value: "foobar"}, - {Name: "ParentIDHeaderName", Value: "foobar"}, - {Name: "PrioritySampling", Value: "true"}, - {Name: "SamplingPriorityHeaderName", Value: "foobar"}, - {Name: "TraceIDHeaderName", Value: "foobar"}}}, - {Name: "Haystack", Children: []*parser.Node{ - {Name: "GlobalTag", Value: "foobar"}, - {Name: "LocalAgentHost", Value: "foobar"}, - {Name: "LocalAgentPort", Value: "42"}, - {Name: "ParentIDHeaderName", Value: "foobar"}, - {Name: "SpanIDHeaderName", Value: "foobar"}, - {Name: "TraceIDHeaderName", Value: "foobar"}}}, - {Name: "Instana", Children: []*parser.Node{ - {Name: "LocalAgentHost", Value: "foobar"}, - {Name: "LocalAgentPort", Value: "42"}, - {Name: "LogLevel", Value: "foobar"}}}, - {Name: "Jaeger", Children: []*parser.Node{ - {Name: "Gen128Bit", Value: "true"}, - {Name: "LocalAgentHostPort", Value: "foobar"}, - {Name: "Propagation", Value: "foobar"}, - {Name: "SamplingParam", Value: "42"}, - {Name: "SamplingServerURL", Value: "foobar"}, - {Name: "SamplingType", Value: "foobar"}, - {Name: "TraceContextHeaderName", Value: "foobar"}}}, - {Name: "ServiceName", Value: "foobar"}, - {Name: "SpanNameLimit", Value: "42"}, - {Name: "Zipkin", Children: []*parser.Node{ - {Name: "Debug", Value: "true"}, - {Name: "HTTPEndpoint", Value: "foobar"}, - {Name: "ID128Bit", Value: "true"}, - {Name: "SameSpan", Value: "true"}, - {Name: "SampleRate", Value: "42"}}}}}}, + {Name: "certAuthFilePath", Value: "foobar"}, + {Name: "disablePassHostHeaders", Value: "true"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "ingressClass", Value: "foobar"}, + {Name: "labelSelector", Value: "foobar"}, + {Name: "namespaces", Value: "foobar,foobar"}, + {Name: "token", Value: "foobar"}}}, + {Name: "marathon", Children: []*parser.Node{ + {Name: "basic", Children: []*parser.Node{ + {Name: "httpBasicAuthUser", Value: "foobar"}, + {Name: "httpBasicPassword", Value: "foobar"}}}, + {Name: "constraints", Value: "foobar"}, + {Name: "dcosToken", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "dialerTimeout", Value: "42"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "forceTaskHostname", Value: "true"}, + {Name: "keepAlive", Value: "42"}, + {Name: "respectReadinessChecks", Value: "true"}, + {Name: "responseHeaderTimeout", Value: "42"}, + {Name: "tls", Children: []*parser.Node{ + {Name: "ca", Value: "foobar"}, + {Name: "caOptional", Value: "true"}, + {Name: "cert", Value: "foobar"}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "key", Value: "foobar"}}}, + {Name: "tlsHandshakeTimeout", Value: "42"}, + {Name: "trace", Value: "true"}, + {Name: "watch", Value: "true"}}}, + {Name: "providersThrottleDuration", Value: "42"}, + {Name: "rancher", Children: []*parser.Node{ + {Name: "constraints", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "enableServiceHealthFilter", Value: "true"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "intervalPoll", Value: "true"}, + {Name: "prefix", Value: "foobar"}, + {Name: "refreshSeconds", Value: "42"}, + {Name: "watch", Value: "true"}}}, + {Name: "rest", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}}}, + {Name: "serversTransport", Children: []*parser.Node{ + {Name: "forwardingTimeouts", Children: []*parser.Node{ + {Name: "dialTimeout", Value: "42"}, + {Name: "idleConnTimeout", Value: "42"}, + {Name: "responseHeaderTimeout", Value: "42"}}}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "maxIdleConnsPerHost", Value: "42"}, + {Name: "rootCAs", Value: "foobar,foobar"}}}, + {Name: "tracing", Children: []*parser.Node{ + {Name: "dataDog", Children: []*parser.Node{ + {Name: "bagagePrefixHeaderName", Value: "foobar"}, + {Name: "debug", Value: "true"}, + {Name: "globalTag", Value: "foobar"}, + {Name: "localAgentHostPort", Value: "foobar"}, + {Name: "parentIDHeaderName", Value: "foobar"}, + {Name: "prioritySampling", Value: "true"}, + {Name: "samplingPriorityHeaderName", Value: "foobar"}, + {Name: "traceIDHeaderName", Value: "foobar"}}}, + {Name: "haystack", Children: []*parser.Node{ + {Name: "globalTag", Value: "foobar"}, + {Name: "localAgentHost", Value: "foobar"}, + {Name: "localAgentPort", Value: "42"}, + {Name: "parentIDHeaderName", Value: "foobar"}, + {Name: "spanIDHeaderName", Value: "foobar"}, + {Name: "traceIDHeaderName", Value: "foobar"}}}, + {Name: "instana", Children: []*parser.Node{ + {Name: "localAgentHost", Value: "foobar"}, + {Name: "localAgentPort", Value: "42"}, + {Name: "logLevel", Value: "foobar"}}}, + {Name: "jaeger", Children: []*parser.Node{ + {Name: "gen128Bit", Value: "true"}, + {Name: "localAgentHostPort", Value: "foobar"}, + {Name: "propagation", Value: "foobar"}, + {Name: "samplingParam", Value: "42"}, + {Name: "samplingServerURL", Value: "foobar"}, + {Name: "samplingType", Value: "foobar"}, + {Name: "traceContextHeaderName", Value: "foobar"}}}, + {Name: "serviceName", Value: "foobar"}, + {Name: "spanNameLimit", Value: "42"}, + {Name: "zipkin", Children: []*parser.Node{ + {Name: "debug", Value: "true"}, + {Name: "httpEndpoint", Value: "foobar"}, + {Name: "id128Bit", Value: "true"}, + {Name: "sameSpan", Value: "true"}, + {Name: "sampleRate", Value: "42"}}}}}, + }, } assert.Equal(t, expected, node) @@ -342,267 +310,235 @@ func Test_decodeFileToNode_Yaml(t *testing.T) { expected := &parser.Node{ Name: "traefik", Children: []*parser.Node{ - {Name: "ACME", - Children: []*parser.Node{ - {Name: "ACMELogging", Value: "true"}, - {Name: "CAServer", Value: "foobar"}, - {Name: "DNSChallenge", Children: []*parser.Node{ - {Name: "DelayBeforeCheck", Value: "42"}, - {Name: "DisablePropagationCheck", Value: "true"}, - {Name: "Provider", Value: "foobar"}, - {Name: "Resolvers", Value: "foobar,foobar"}, - }}, - {Name: "Domains", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Main", Value: "foobar"}, - {Name: "SANs", Value: "foobar,foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Main", Value: "foobar"}, - {Name: "SANs", Value: "foobar,foobar"}, - }}, - }}, - {Name: "Email", Value: "foobar"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "HTTPChallenge", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}}}, - {Name: "KeyType", Value: "foobar"}, - {Name: "OnHostRule", Value: "true"}, - {Name: "Storage", Value: "foobar"}, - {Name: "TLSChallenge"}, - }, - }, - {Name: "API", Children: []*parser.Node{ - {Name: "Dashboard", Value: "true"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}, - {Name: "Statistics", Children: []*parser.Node{ - {Name: "RecentErrors", Value: "42"}}}}}, - {Name: "AccessLog", Children: []*parser.Node{ - {Name: "BufferingSize", Value: "42"}, - {Name: "Fields", Children: []*parser.Node{ - {Name: "DefaultMode", Value: "foobar"}, - {Name: "Headers", Children: []*parser.Node{ - {Name: "DefaultMode", Value: "foobar"}, - {Name: "Names", Children: []*parser.Node{ + {Name: "accessLog", Children: []*parser.Node{ + {Name: "bufferingSize", Value: "42"}, + {Name: "fields", Children: []*parser.Node{ + {Name: "defaultMode", Value: "foobar"}, + {Name: "headers", Children: []*parser.Node{ + {Name: "defaultMode", Value: "foobar"}, + {Name: "names", Children: []*parser.Node{ {Name: "name0", Value: "foobar"}, {Name: "name1", Value: "foobar"}}}}}, - {Name: "Names", Children: []*parser.Node{ + {Name: "names", Children: []*parser.Node{ {Name: "name0", Value: "foobar"}, {Name: "name1", Value: "foobar"}}}}}, - {Name: "FilePath", Value: "foobar"}, - {Name: "Filters", Children: []*parser.Node{ - {Name: "MinDuration", Value: "42"}, - {Name: "RetryAttempts", Value: "true"}, - {Name: "StatusCodes", Value: "foobar,foobar"}}}, - {Name: "Format", Value: "foobar"}}}, - {Name: "EntryPoints", Children: []*parser.Node{ + {Name: "filePath", Value: "foobar"}, + {Name: "filters", Children: []*parser.Node{ + {Name: "minDuration", Value: "42"}, + {Name: "retryAttempts", Value: "true"}, + {Name: "statusCodes", Value: "foobar,foobar"}}}, + {Name: "format", Value: "foobar"}}}, + {Name: "acme", + Children: []*parser.Node{ + {Name: "acmeLogging", Value: "true"}, + {Name: "caServer", Value: "foobar"}, + {Name: "dnsChallenge", Children: []*parser.Node{ + {Name: "delayBeforeCheck", Value: "42"}, + {Name: "disablePropagationCheck", Value: "true"}, + {Name: "provider", Value: "foobar"}, + {Name: "resolvers", Value: "foobar,foobar"}, + }}, + {Name: "domains", Children: []*parser.Node{ + {Name: "[0]", Children: []*parser.Node{ + {Name: "main", Value: "foobar"}, + {Name: "sans", Value: "foobar,foobar"}, + }}, + {Name: "[1]", Children: []*parser.Node{ + {Name: "main", Value: "foobar"}, + {Name: "sans", Value: "foobar,foobar"}, + }}, + }}, + {Name: "email", Value: "foobar"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "httpChallenge", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}, + {Name: "keyType", Value: "foobar"}, + {Name: "onHostRule", Value: "true"}, + {Name: "storage", Value: "foobar"}, + {Name: "tlsChallenge"}, + }, + }, + {Name: "api", Children: []*parser.Node{ + {Name: "dashboard", Value: "true"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}, + {Name: "statistics", Children: []*parser.Node{ + {Name: "recentErrors", Value: "42"}}}}}, + {Name: "entryPoints", Children: []*parser.Node{ {Name: "EntryPoint0", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "ForwardedHeaders", Children: []*parser.Node{ - {Name: "Insecure", Value: "true"}, - {Name: "TrustedIPs", Value: "foobar,foobar"}}}, - {Name: "ProxyProtocol", Children: []*parser.Node{ - {Name: "Insecure", Value: "true"}, - {Name: "TrustedIPs", Value: "foobar,foobar"}}}, - {Name: "Transport", Children: []*parser.Node{ - {Name: "LifeCycle", Children: []*parser.Node{ - {Name: "GraceTimeOut", Value: "42"}, - {Name: "RequestAcceptGraceTimeout", Value: "42"}}}, - {Name: "RespondingTimeouts", Children: []*parser.Node{ - {Name: "IdleTimeout", Value: "42"}, - {Name: "ReadTimeout", Value: "42"}, - {Name: "WriteTimeout", Value: "42"}}}}}}}}}, - {Name: "Global", Children: []*parser.Node{ - {Name: "CheckNewVersion", Value: "true"}, - {Name: "Debug", Value: "true"}, - {Name: "SendAnonymousUsage", Value: "true"}}}, - {Name: "HostResolver", Children: []*parser.Node{ - {Name: "CnameFlattening", Value: "true"}, - {Name: "ResolvConfig", Value: "foobar"}, - {Name: "ResolvDepth", Value: "42"}}}, - {Name: "Log", Children: []*parser.Node{ - {Name: "FilePath", Value: "foobar"}, - {Name: "Format", Value: "foobar"}, - {Name: "Level", Value: "foobar"}}}, - {Name: "Metrics", Children: []*parser.Node{ - {Name: "Datadog", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}}}, - {Name: "InfluxDB", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "Database", Value: "foobar"}, - {Name: "Password", Value: "foobar"}, - {Name: "Protocol", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}, - {Name: "RetentionPolicy", Value: "foobar"}, - {Name: "Username", Value: "foobar"}}}, - {Name: "Prometheus", Children: []*parser.Node{ - {Name: "Buckets", Value: "42,42"}, - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}}}, - {Name: "StatsD", Children: []*parser.Node{ - {Name: "Address", Value: "foobar"}, - {Name: "PushInterval", Value: "10s"}}}}}, - {Name: "Ping", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}, - {Name: "Middlewares", Value: "foobar,foobar"}}}, - {Name: "Providers", Children: []*parser.Node{ - {Name: "Docker", Children: []*parser.Node{ - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "Network", Value: "foobar"}, - {Name: "SwarmMode", Value: "true"}, - {Name: "SwarmModeRefreshSeconds", Value: "42"}, - {Name: "TLS", Children: []*parser.Node{ - {Name: "CA", Value: "foobar"}, - {Name: "CAOptional", Value: "true"}, - {Name: "Cert", Value: "foobar"}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "Key", Value: "foobar"}}}, - {Name: "UseBindPortIP", Value: "true"}, - {Name: "Watch", Value: "true"}}}, - {Name: "File", Children: []*parser.Node{ - {Name: "DebugLogGeneratedTemplate", Value: "true"}, - {Name: "Directory", Value: "foobar"}, - {Name: "Filename", Value: "foobar"}, - {Name: "TraefikFile", Value: "foobar"}, - {Name: "Watch", Value: "true"}}}, - {Name: "Kubernetes", Children: []*parser.Node{ - {Name: "CertAuthFilePath", Value: "foobar"}, - {Name: "DisablePassHostHeaders", Value: "true"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "IngressClass", Value: "foobar"}, - {Name: "IngressEndpoint", Children: []*parser.Node{ - {Name: "Hostname", Value: "foobar"}, - {Name: "IP", Value: "foobar"}, - {Name: "PublishedService", Value: "foobar"}}}, - {Name: "LabelSelector", Value: "foobar"}, - {Name: "Namespaces", Value: "foobar,foobar"}, - {Name: "Token", Value: "foobar"}}}, - {Name: "KubernetesCRD", + {Name: "address", Value: "foobar"}, + {Name: "forwardedHeaders", Children: []*parser.Node{ + {Name: "insecure", Value: "true"}, + {Name: "trustedIPs", Value: "foobar,foobar"}}}, + {Name: "proxyProtocol", Children: []*parser.Node{ + {Name: "insecure", Value: "true"}, + {Name: "trustedIPs", Value: "foobar,foobar"}}}, + {Name: "transport", Children: []*parser.Node{ + {Name: "lifeCycle", Children: []*parser.Node{ + {Name: "graceTimeOut", Value: "42"}, + {Name: "requestAcceptGraceTimeout", Value: "42"}}}, + {Name: "respondingTimeouts", Children: []*parser.Node{ + {Name: "idleTimeout", Value: "42"}, + {Name: "readTimeout", Value: "42"}, + {Name: "writeTimeout", Value: "42"}}}}}}}}}, + {Name: "global", Children: []*parser.Node{ + {Name: "checkNewVersion", Value: "true"}, + {Name: "sendAnonymousUsage", Value: "true"}}}, + {Name: "hostResolver", Children: []*parser.Node{ + {Name: "cnameFlattening", Value: "true"}, + {Name: "resolvConfig", Value: "foobar"}, + {Name: "resolvDepth", Value: "42"}}}, + {Name: "log", Children: []*parser.Node{ + {Name: "filePath", Value: "foobar"}, + {Name: "format", Value: "foobar"}, + {Name: "level", Value: "foobar"}}}, + {Name: "metrics", Children: []*parser.Node{ + {Name: "dataDog", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}}}, + {Name: "influxDB", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "database", Value: "foobar"}, + {Name: "password", Value: "foobar"}, + {Name: "protocol", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}, + {Name: "retentionPolicy", Value: "foobar"}, + {Name: "username", Value: "foobar"}}}, + {Name: "prometheus", Children: []*parser.Node{ + {Name: "buckets", Value: "42,42"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}}}, + {Name: "statsD", Children: []*parser.Node{ + {Name: "address", Value: "foobar"}, + {Name: "pushInterval", Value: "10s"}}}}}, + {Name: "ping", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}, + {Name: "middlewares", Value: "foobar,foobar"}}}, + {Name: "providers", Children: []*parser.Node{ + {Name: "docker", Children: []*parser.Node{ + {Name: "constraints", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "network", Value: "foobar"}, + {Name: "swarmMode", Value: "true"}, + {Name: "swarmModeRefreshSeconds", Value: "42"}, + {Name: "tls", Children: []*parser.Node{ + {Name: "ca", Value: "foobar"}, + {Name: "caOptional", Value: "true"}, + {Name: "cert", Value: "foobar"}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "key", Value: "foobar"}}}, + {Name: "useBindPortIP", Value: "true"}, + {Name: "watch", Value: "true"}}}, + {Name: "file", Children: []*parser.Node{ + {Name: "debugLogGeneratedTemplate", Value: "true"}, + {Name: "directory", Value: "foobar"}, + {Name: "filename", Value: "foobar"}, + {Name: "traefikFile", Value: "foobar"}, + {Name: "watch", Value: "true"}}}, + {Name: "kubernetes", Children: []*parser.Node{ + {Name: "certAuthFilePath", Value: "foobar"}, + {Name: "disablePassHostHeaders", Value: "true"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "ingressClass", Value: "foobar"}, + {Name: "ingressEndpoint", Children: []*parser.Node{ + {Name: "hostname", Value: "foobar"}, + {Name: "ip", Value: "foobar"}, + {Name: "publishedService", Value: "foobar"}}}, + {Name: "labelSelector", Value: "foobar"}, + {Name: "namespaces", Value: "foobar,foobar"}, + {Name: "token", Value: "foobar"}}}, + {Name: "kubernetesCRD", Children: []*parser.Node{ - {Name: "CertAuthFilePath", Value: "foobar"}, - {Name: "DisablePassHostHeaders", Value: "true"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "IngressClass", Value: "foobar"}, - {Name: "LabelSelector", Value: "foobar"}, - {Name: "Namespaces", Value: "foobar,foobar"}, - {Name: "Token", Value: "foobar"}}}, - {Name: "Marathon", Children: []*parser.Node{ - {Name: "Basic", Children: []*parser.Node{ - {Name: "HTTPBasicAuthUser", Value: "foobar"}, - {Name: "HTTPBasicPassword", Value: "foobar"}}}, - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DCOSToken", Value: "foobar"}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "DialerTimeout", Value: "42"}, - {Name: "Endpoint", Value: "foobar"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "ForceTaskHostname", Value: "true"}, - {Name: "KeepAlive", Value: "42"}, - {Name: "RespectReadinessChecks", Value: "true"}, - {Name: "ResponseHeaderTimeout", Value: "42"}, - {Name: "TLS", Children: []*parser.Node{ - {Name: "CA", Value: "foobar"}, - {Name: "CAOptional", Value: "true"}, - {Name: "Cert", Value: "foobar"}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "Key", Value: "foobar"}}}, - {Name: "TLSHandshakeTimeout", Value: "42"}, - {Name: "Trace", Value: "true"}, - {Name: "Watch", Value: "true"}}}, - {Name: "ProvidersThrottleDuration", Value: "42"}, - {Name: "Rancher", Children: []*parser.Node{ - {Name: "Constraints", Children: []*parser.Node{ - {Name: "[0]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - {Name: "[1]", Children: []*parser.Node{ - {Name: "Key", Value: "foobar"}, - {Name: "MustMatch", Value: "true"}, - {Name: "Value", Value: "foobar"}, - }}, - }}, - {Name: "DefaultRule", Value: "foobar"}, - {Name: "EnableServiceHealthFilter", Value: "true"}, - {Name: "ExposedByDefault", Value: "true"}, - {Name: "IntervalPoll", Value: "true"}, - {Name: "Prefix", Value: "foobar"}, - {Name: "RefreshSeconds", Value: "42"}, - {Name: "Watch", Value: "true"}}}, - {Name: "Rest", Children: []*parser.Node{ - {Name: "EntryPoint", Value: "foobar"}}}}}, - {Name: "ServersTransport", Children: []*parser.Node{ - {Name: "ForwardingTimeouts", Children: []*parser.Node{ - {Name: "DialTimeout", Value: "42"}, - {Name: "ResponseHeaderTimeout", Value: "42"}}}, - {Name: "InsecureSkipVerify", Value: "true"}, - {Name: "MaxIdleConnsPerHost", Value: "42"}, - {Name: "RootCAs", Value: "foobar,foobar"}}}, - {Name: "Tracing", Children: []*parser.Node{ - {Name: "DataDog", Children: []*parser.Node{ - {Name: "BagagePrefixHeaderName", Value: "foobar"}, - {Name: "Debug", Value: "true"}, - {Name: "GlobalTag", Value: "foobar"}, - {Name: "LocalAgentHostPort", Value: "foobar"}, - {Name: "ParentIDHeaderName", Value: "foobar"}, - {Name: "PrioritySampling", Value: "true"}, - {Name: "SamplingPriorityHeaderName", Value: "foobar"}, - {Name: "TraceIDHeaderName", Value: "foobar"}}}, - {Name: "Haystack", Children: []*parser.Node{ - {Name: "GlobalTag", Value: "foobar"}, - {Name: "LocalAgentHost", Value: "foobar"}, - {Name: "LocalAgentPort", Value: "42"}, - {Name: "ParentIDHeaderName", Value: "foobar"}, - {Name: "SpanIDHeaderName", Value: "foobar"}, - {Name: "TraceIDHeaderName", Value: "foobar"}}}, - {Name: "Instana", Children: []*parser.Node{ - {Name: "LocalAgentHost", Value: "foobar"}, - {Name: "LocalAgentPort", Value: "42"}, - {Name: "LogLevel", Value: "foobar"}}}, - {Name: "Jaeger", Children: []*parser.Node{ - {Name: "Gen128Bit", Value: "true"}, - {Name: "LocalAgentHostPort", Value: "foobar"}, - {Name: "Propagation", Value: "foobar"}, - {Name: "SamplingParam", Value: "42"}, - {Name: "SamplingServerURL", Value: "foobar"}, - {Name: "SamplingType", Value: "foobar"}, - {Name: "TraceContextHeaderName", Value: "foobar"}}}, - {Name: "ServiceName", Value: "foobar"}, - {Name: "SpanNameLimit", Value: "42"}, - {Name: "Zipkin", Children: []*parser.Node{ - {Name: "Debug", Value: "true"}, - {Name: "HTTPEndpoint", Value: "foobar"}, - {Name: "ID128Bit", Value: "true"}, - {Name: "SameSpan", Value: "true"}, - {Name: "SampleRate", Value: "42"}}}}}}, + {Name: "certAuthFilePath", Value: "foobar"}, + {Name: "disablePassHostHeaders", Value: "true"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "ingressClass", Value: "foobar"}, + {Name: "labelSelector", Value: "foobar"}, + {Name: "namespaces", Value: "foobar,foobar"}, + {Name: "token", Value: "foobar"}}}, + {Name: "marathon", Children: []*parser.Node{ + {Name: "basic", Children: []*parser.Node{ + {Name: "httpBasicAuthUser", Value: "foobar"}, + {Name: "httpBasicPassword", Value: "foobar"}}}, + {Name: "constraints", Value: "foobar"}, + {Name: "dcosToken", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "dialerTimeout", Value: "42"}, + {Name: "endpoint", Value: "foobar"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "forceTaskHostname", Value: "true"}, + {Name: "keepAlive", Value: "42"}, + {Name: "respectReadinessChecks", Value: "true"}, + {Name: "responseHeaderTimeout", Value: "42"}, + {Name: "tls", Children: []*parser.Node{ + {Name: "ca", Value: "foobar"}, + {Name: "caOptional", Value: "true"}, + {Name: "cert", Value: "foobar"}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "key", Value: "foobar"}}}, + {Name: "tlsHandshakeTimeout", Value: "42"}, + {Name: "trace", Value: "true"}, + {Name: "watch", Value: "true"}}}, + {Name: "providersThrottleDuration", Value: "42"}, + {Name: "rancher", Children: []*parser.Node{ + {Name: "constraints", Value: "foobar"}, + {Name: "defaultRule", Value: "foobar"}, + {Name: "enableServiceHealthFilter", Value: "true"}, + {Name: "exposedByDefault", Value: "true"}, + {Name: "intervalPoll", Value: "true"}, + {Name: "prefix", Value: "foobar"}, + {Name: "refreshSeconds", Value: "42"}, + {Name: "watch", Value: "true"}}}, + {Name: "rest", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}}}, + {Name: "serversTransport", Children: []*parser.Node{ + {Name: "forwardingTimeouts", Children: []*parser.Node{ + {Name: "dialTimeout", Value: "42"}, + {Name: "idleConnTimeout", Value: "42"}, + {Name: "responseHeaderTimeout", Value: "42"}}}, + {Name: "insecureSkipVerify", Value: "true"}, + {Name: "maxIdleConnsPerHost", Value: "42"}, + {Name: "rootCAs", Value: "foobar,foobar"}}}, + {Name: "tracing", Children: []*parser.Node{ + {Name: "dataDog", Children: []*parser.Node{ + {Name: "bagagePrefixHeaderName", Value: "foobar"}, + {Name: "debug", Value: "true"}, + {Name: "globalTag", Value: "foobar"}, + {Name: "localAgentHostPort", Value: "foobar"}, + {Name: "parentIDHeaderName", Value: "foobar"}, + {Name: "prioritySampling", Value: "true"}, + {Name: "samplingPriorityHeaderName", Value: "foobar"}, + {Name: "traceIDHeaderName", Value: "foobar"}}}, + {Name: "haystack", Children: []*parser.Node{ + {Name: "globalTag", Value: "foobar"}, + {Name: "localAgentHost", Value: "foobar"}, + {Name: "localAgentPort", Value: "42"}, + {Name: "parentIDHeaderName", Value: "foobar"}, + {Name: "spanIDHeaderName", Value: "foobar"}, + {Name: "traceIDHeaderName", Value: "foobar"}}}, + {Name: "instana", Children: []*parser.Node{ + {Name: "localAgentHost", Value: "foobar"}, + {Name: "localAgentPort", Value: "42"}, + {Name: "logLevel", Value: "foobar"}}}, + {Name: "jaeger", Children: []*parser.Node{ + {Name: "gen128Bit", Value: "true"}, + {Name: "localAgentHostPort", Value: "foobar"}, + {Name: "propagation", Value: "foobar"}, + {Name: "samplingParam", Value: "42"}, + {Name: "samplingServerURL", Value: "foobar"}, + {Name: "samplingType", Value: "foobar"}, + {Name: "traceContextHeaderName", Value: "foobar"}}}, + {Name: "serviceName", Value: "foobar"}, + {Name: "spanNameLimit", Value: "42"}, + {Name: "zipkin", Children: []*parser.Node{ + {Name: "debug", Value: "true"}, + {Name: "httpEndpoint", Value: "foobar"}, + {Name: "id128Bit", Value: "true"}, + {Name: "sameSpan", Value: "true"}, + {Name: "sampleRate", Value: "42"}}}}}, + }, } assert.Equal(t, expected, node) diff --git a/pkg/config/file/fixtures/sample.toml b/pkg/config/file/fixtures/sample.toml index 4cd6436ab..8db3b5093 100644 --- a/pkg/config/file/fixtures/sample.toml +++ b/pkg/config/file/fixtures/sample.toml @@ -1,543 +1,481 @@ -[Global] - Debug = true - CheckNewVersion = true - SendAnonymousUsage = true +[global] + checkNewVersion = true + sendAnonymousUsage = true -[ServersTransport] - InsecureSkipVerify = true - RootCAs = ["foobar", "foobar"] - MaxIdleConnsPerHost = 42 - [ServersTransport.ForwardingTimeouts] - DialTimeout = 42 - ResponseHeaderTimeout = 42 +[serversTransport] + insecureSkipVerify = true + rootCAs = ["foobar", "foobar"] + maxIdleConnsPerHost = 42 + [serversTransport.forwardingTimeouts] + dialTimeout = 42 + responseHeaderTimeout = 42 + idleConnTimeout = 42 -[EntryPoints] +[entryPoints] + [entryPoints.EntryPoint0] + address = "foobar" + [entryPoints.EntryPoint0.transport] + [entryPoints.EntryPoint0.transport.lifeCycle] + requestAcceptGraceTimeout = 42 + graceTimeOut = 42 + [entryPoints.EntryPoint0.transport.respondingTimeouts] + readTimeout = 42 + writeTimeout = 42 + idleTimeout = 42 + [entryPoints.EntryPoint0.proxyProtocol] + insecure = true + trustedIPs = ["foobar", "foobar"] + [entryPoints.EntryPoint0.forwardedHeaders] + insecure = true + trustedIPs = ["foobar", "foobar"] - [EntryPoints.EntryPoint0] - Address = "foobar" - [EntryPoints.EntryPoint0.Transport] - [EntryPoints.EntryPoint0.Transport.LifeCycle] - RequestAcceptGraceTimeout = 42 - GraceTimeOut = 42 - [EntryPoints.EntryPoint0.Transport.RespondingTimeouts] - ReadTimeout = 42 - WriteTimeout = 42 - IdleTimeout = 42 - [EntryPoints.EntryPoint0.ProxyProtocol] - Insecure = true - TrustedIPs = ["foobar", "foobar"] - [EntryPoints.EntryPoint0.ForwardedHeaders] - Insecure = true - TrustedIPs = ["foobar", "foobar"] +[providers] + providersThrottleDuration = 42 + [providers.docker] + constraints = "foobar" + watch = true + endpoint = "foobar" + defaultRule = "foobar" + exposedByDefault = true + useBindPortIP = true + swarmMode = true + network = "foobar" + swarmModeRefreshSeconds = 42 + [providers.docker.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [providers.file] + directory = "foobar" + watch = true + filename = "foobar" + debugLogGeneratedTemplate = true + traefikFile = "foobar" + [providers.marathon] + constraints = "foobar" + trace = true + watch = true + endpoint = "foobar" + defaultRule = "foobar" + exposedByDefault = true + dcosToken = "foobar" + dialerTimeout = 42 + responseHeaderTimeout = 42 + tlsHandshakeTimeout = 42 + keepAlive = 42 + forceTaskHostname = true + respectReadinessChecks = true + [providers.marathon.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [providers.marathon.basic] + httpBasicAuthUser = "foobar" + httpBasicPassword = "foobar" + [providers.kubernetes] + endpoint = "foobar" + token = "foobar" + certAuthFilePath = "foobar" + disablePassHostHeaders = true + namespaces = ["foobar", "foobar"] + labelSelector = "foobar" + ingressClass = "foobar" + [providers.kubernetes.ingressEndpoint] + ip = "foobar" + hostname = "foobar" + publishedService = "foobar" + [providers.kubernetesCRD] + endpoint = "foobar" + token = "foobar" + certAuthFilePath = "foobar" + disablePassHostHeaders = true + namespaces = ["foobar", "foobar"] + labelSelector = "foobar" + ingressClass = "foobar" + [providers.rest] + entryPoint = "foobar" + [providers.rancher] + constraints = "foobar" + watch = true + defaultRule = "foobar" + exposedByDefault = true + enableServiceHealthFilter = true + refreshSeconds = 42 + intervalPoll = true + prefix = "foobar" -[Providers] - ProvidersThrottleDuration = 42 +[api] + entryPoint = "foobar" + dashboard = true + middlewares = ["foobar", "foobar"] + [api.statistics] + recentErrors = 42 - [Providers.Docker] - Watch = true - Endpoint = "foobar" - DefaultRule = "foobar" - ExposedByDefault = true - UseBindPortIP = true - SwarmMode = true - Network = "foobar" - SwarmModeRefreshSeconds = 42 +[metrics] + [metrics.prometheus] + buckets = [42.0, 42.0] + entryPoint = "foobar" + middlewares = ["foobar", "foobar"] + [metrics.dataDog] + address = "foobar" + pushInterval = "10s" + [metrics.statsD] + address = "foobar" + pushInterval = "10s" + [metrics.influxDB] + address = "foobar" + protocol = "foobar" + pushInterval = "10s" + database = "foobar" + retentionPolicy = "foobar" + username = "foobar" + password = "foobar" - [[Providers.Docker.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" +[ping] + entryPoint = "foobar" + middlewares = ["foobar", "foobar"] - [[Providers.Docker.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" +[log] + level = "foobar" + filePath = "foobar" + format = "foobar" - [Providers.Docker.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true - - [Providers.File] - Directory = "foobar" - Watch = true - Filename = "foobar" - DebugLogGeneratedTemplate = true - TraefikFile = "foobar" - - [Providers.Marathon] - Trace = true - Watch = true - Endpoint = "foobar" - DefaultRule = "foobar" - ExposedByDefault = true - DCOSToken = "foobar" - DialerTimeout = 42 - ResponseHeaderTimeout = 42 - TLSHandshakeTimeout = 42 - KeepAlive = 42 - ForceTaskHostname = true - RespectReadinessChecks = true - - [[Providers.Marathon.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" - - [[Providers.Marathon.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" - - [Providers.Marathon.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true - [Providers.Marathon.Basic] - HTTPBasicAuthUser = "foobar" - HTTPBasicPassword = "foobar" - - [Providers.Kubernetes] - Endpoint = "foobar" - Token = "foobar" - CertAuthFilePath = "foobar" - DisablePassHostHeaders = true - Namespaces = ["foobar", "foobar"] - LabelSelector = "foobar" - IngressClass = "foobar" - [Providers.Kubernetes.IngressEndpoint] - IP = "foobar" - Hostname = "foobar" - PublishedService = "foobar" - - [Providers.KubernetesCRD] - Endpoint = "foobar" - Token = "foobar" - CertAuthFilePath = "foobar" - DisablePassHostHeaders = true - Namespaces = ["foobar", "foobar"] - LabelSelector = "foobar" - IngressClass = "foobar" - - [Providers.Rest] - EntryPoint = "foobar" - - [Providers.Rancher] - Watch = true - DefaultRule = "foobar" - ExposedByDefault = true - EnableServiceHealthFilter = true - RefreshSeconds = 42 - IntervalPoll = true - Prefix = "foobar" - - [[Providers.Rancher.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" - - [[Providers.Rancher.Constraints]] - Key = "foobar" - MustMatch = true - Value = "foobar" - -[API] - EntryPoint = "foobar" - Dashboard = true - Middlewares = ["foobar", "foobar"] - [API.Statistics] - RecentErrors = 42 - -[Metrics] - - [Metrics.Prometheus] - Buckets = [42.0, 42.0] - EntryPoint = "foobar" - Middlewares = ["foobar", "foobar"] - - [Metrics.Datadog] - Address = "foobar" - PushInterval = "10s" - - [Metrics.StatsD] - Address = "foobar" - PushInterval = "10s" - - [Metrics.InfluxDB] - Address = "foobar" - Protocol = "foobar" - PushInterval = "10s" - Database = "foobar" - RetentionPolicy = "foobar" - Username = "foobar" - Password = "foobar" - -[Ping] - EntryPoint = "foobar" - Middlewares = ["foobar", "foobar"] - -[Log] - Level = "foobar" - FilePath = "foobar" - Format = "foobar" - -[AccessLog] - FilePath = "foobar" - Format = "foobar" - BufferingSize = 42 - [AccessLog.Filters] - StatusCodes = ["foobar", "foobar"] - RetryAttempts = true - MinDuration = 42 - [AccessLog.Fields] - DefaultMode = "foobar" - [AccessLog.Fields.Names] +[accessLog] + filePath = "foobar" + format = "foobar" + bufferingSize = 42 + [accessLog.filters] + statusCodes = ["foobar", "foobar"] + retryAttempts = true + minDuration = 42 + [accessLog.fields] + defaultMode = "foobar" + [accessLog.fields.names] name0 = "foobar" name1 = "foobar" - [AccessLog.Fields.Headers] - DefaultMode = "foobar" - [AccessLog.Fields.Headers.Names] + [accessLog.fields.headers] + defaultMode = "foobar" + [accessLog.fields.headers.names] name0 = "foobar" name1 = "foobar" -[Tracing] - ServiceName = "foobar" - SpanNameLimit = 42 +[tracing] + serviceName = "foobar" + spanNameLimit = 42 + [tracing.jaeger] + samplingServerURL = "foobar" + samplingType = "foobar" + samplingParam = 42.0 + localAgentHostPort = "foobar" + gen128Bit = true + propagation = "foobar" + traceContextHeaderName = "foobar" + [tracing.zipkin] + httpEndpoint = "foobar" + sameSpan = true + id128Bit = true + debug = true + sampleRate = 42.0 + [tracing.dataDog] + localAgentHostPort = "foobar" + globalTag = "foobar" + debug = true + prioritySampling = true + traceIDHeaderName = "foobar" + parentIDHeaderName = "foobar" + samplingPriorityHeaderName = "foobar" + bagagePrefixHeaderName = "foobar" + [tracing.instana] + localAgentHost = "foobar" + localAgentPort = 42 + logLevel = "foobar" + [tracing.haystack] + localAgentHost = "foobar" + localAgentPort = 42 + globalTag = "foobar" + traceIDHeaderName = "foobar" + parentIDHeaderName = "foobar" + spanIDHeaderName = "foobar" - [Tracing.Jaeger] - SamplingServerURL = "foobar" - SamplingType = "foobar" - SamplingParam = 42.0 - LocalAgentHostPort = "foobar" - Gen128Bit = true - Propagation = "foobar" - TraceContextHeaderName = "foobar" +[hostResolver] + cnameFlattening = true + resolvConfig = "foobar" + resolvDepth = 42 - [Tracing.Zipkin] - HTTPEndpoint = "foobar" - SameSpan = true - ID128Bit = true - Debug = true - SampleRate = 42.0 +[acme] + email = "foobar" + acmeLogging = true + caServer = "foobar" + storage = "foobar" + entryPoint = "foobar" + keyType = "foobar" + onHostRule = true + [acme.dnsChallenge] + provider = "foobar" + delayBeforeCheck = 42 + resolvers = ["foobar", "foobar"] + disablePropagationCheck = true + [acme.httpChallenge] + entryPoint = "foobar" + [acme.tlsChallenge] - [Tracing.DataDog] - LocalAgentHostPort = "foobar" - GlobalTag = "foobar" - Debug = true - PrioritySampling = true - TraceIDHeaderName = "foobar" - ParentIDHeaderName = "foobar" - SamplingPriorityHeaderName = "foobar" - BagagePrefixHeaderName = "foobar" + [[acme.domains]] + main = "foobar" + sans = ["foobar", "foobar"] - [Tracing.Instana] - LocalAgentHost = "foobar" - LocalAgentPort = 42 - LogLevel = "foobar" + [[acme.domains]] + main = "foobar" + sans = ["foobar", "foobar"] - [Tracing.Haystack] - GlobalTag = "foobar" - LocalAgentHost = "foobar" - LocalAgentPort = 42 - ParentIDHeaderName = "foobar" - SpanIDHeaderName = "foobar" - TraceIDHeaderName = "foobar" +## Dynamic configuration -[HostResolver] - CnameFlattening = true - ResolvConfig = "foobar" - ResolvDepth = 42 - -[ACME] - Email = "foobar" - ACMELogging = true - CAServer = "foobar" - Storage = "foobar" - EntryPoint = "foobar" - KeyType = "foobar" - OnHostRule = true - - [ACME.DNSChallenge] - Provider = "foobar" - DelayBeforeCheck = 42 - Resolvers = ["foobar", "foobar"] - DisablePropagationCheck = true - - [ACME.HTTPChallenge] - EntryPoint = "foobar" - - [ACME.TLSChallenge] - - [[ACME.Domains]] - Main = "foobar" - SANs = ["foobar", "foobar"] - - [[ACME.Domains]] - Main = "foobar" - SANs = ["foobar", "foobar"] - -#### Dynamic configuration - -[HTTP] - - [HTTP.Routers] - - [HTTP.Routers.Router0] - EntryPoints = ["foobar", "foobar"] - Middlewares = ["foobar", "foobar"] - Service = "foobar" - Rule = "foobar" +[http] + [http.routers] + [http.routers.Router0] + entryPoints = ["foobar", "foobar"] + middlewares = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" priority = 42 - [HTTP.Routers.Router0.tls] - - [HTTP.Middlewares] - - [HTTP.Middlewares.Middleware0.AddPrefix] - Prefix = "foobar" - - [HTTP.Middlewares.Middleware1.StripPrefix] - Prefixes = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware2.StripPrefixRegex] - Regex = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware3.ReplacePath] - Path = "foobar" - - [HTTP.Middlewares.Middleware4.ReplacePathRegex] - Regex = "foobar" - Replacement = "foobar" - - [HTTP.Middlewares.Middleware5.Chain] - Middlewares = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware6.IPWhiteList] - SourceRange = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware7.IPWhiteList.IPStrategy] - Depth = 42 - ExcludedIPs = ["foobar", "foobar"] - - [HTTP.Middlewares.Middleware8.Headers] - AccessControlAllowCredentials = true - AccessControlAllowHeaders = ["foobar", "foobar"] - AccessControlAllowMethods = ["foobar", "foobar"] - AccessControlAllowOrigin = "foobar" - AccessControlExposeHeaders = ["foobar", "foobar"] - AccessControlMaxAge = 42 - AddVaryHeader = true - AllowedHosts = ["foobar", "foobar"] - HostsProxyHeaders = ["foobar", "foobar"] - SSLRedirect = true - SSLTemporaryRedirect = true - SSLHost = "foobar" - SSLForceHost = true - STSSeconds = 42 - STSIncludeSubdomains = true - STSPreload = true - ForceSTSHeader = true - FrameDeny = true - CustomFrameOptionsValue = "foobar" - ContentTypeNosniff = true - BrowserXSSFilter = true - CustomBrowserXSSValue = "foobar" - ContentSecurityPolicy = "foobar" - PublicKey = "foobar" - ReferrerPolicy = "foobar" - IsDevelopment = true - [HTTP.Middlewares.Middleware8.Headers.CustomRequestHeaders] + [http.routers.Router0.tls] + [http.middlewares] + [http.middlewares.Middleware0] + [http.middlewares.Middleware0.addPrefix] + prefix = "foobar" + [http.middlewares.Middleware1] + [http.middlewares.Middleware1.stripPrefix] + prefixes = ["foobar", "foobar"] + [http.middlewares.Middleware10] + [http.middlewares.Middleware10.rateLimit] + extractorFunc = "foobar" + [http.middlewares.Middleware10.rateLimit.rateSet] + [http.middlewares.Middleware10.rateLimit.rateSet.Rate0] + period = 42000000000 + average = 42 + burst = 42 + [http.middlewares.Middleware10.rateLimit.rateSet.Rate1] + period = 42000000000 + average = 42 + burst = 42 + [http.middlewares.Middleware11] + [http.middlewares.Middleware11.redirectRegex] + regex = "foobar" + replacement = "foobar" + permanent = true + [http.middlewares.Middleware12] + [http.middlewares.Middleware12.redirectScheme] + scheme = "foobar" + port = "foobar" + permanent = true + [http.middlewares.Middleware13] + [http.middlewares.Middleware13.basicAuth] + users = ["foobar", "foobar"] + usersFile = "foobar" + realm = "foobar" + removeHeader = true + headerField = "foobar" + [http.middlewares.Middleware14] + [http.middlewares.Middleware14.digestAuth] + users = ["foobar", "foobar"] + usersFile = "foobar" + removeHeader = true + realm = "foobar" + headerField = "foobar" + [http.middlewares.Middleware15] + [http.middlewares.Middleware15.forwardAuth] + address = "foobar" + trustForwardHeader = true + authResponseHeaders = ["foobar", "foobar"] + [http.middlewares.Middleware15.forwardAuth.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [http.middlewares.Middleware16] + [http.middlewares.Middleware16.maxConn] + amount = 42 + extractorFunc = "foobar" + [http.middlewares.Middleware17] + [http.middlewares.Middleware17.buffering] + maxRequestBodyBytes = 42 + memRequestBodyBytes = 42 + maxResponseBodyBytes = 42 + memResponseBodyBytes = 42 + retryExpression = "foobar" + [http.middlewares.Middleware18] + [http.middlewares.Middleware18.circuitBreaker] + expression = "foobar" + [http.middlewares.Middleware19] + [http.middlewares.Middleware19.compress] + [http.middlewares.Middleware2] + [http.middlewares.Middleware2.stripPrefixRegex] + regex = ["foobar", "foobar"] + [http.middlewares.Middleware20] + [http.middlewares.Middleware20.passTLSClientCert] + pem = true + [http.middlewares.Middleware20.passTLSClientCert.info] + notAfter = true + notBefore = true + sans = true + [http.middlewares.Middleware20.passTLSClientCert.info.subject] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware20.passTLSClientCert.info.issuer] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware21] + [http.middlewares.Middleware21.retry] + regex = 0 + [http.middlewares.Middleware3] + [http.middlewares.Middleware3.replacePath] + path = "foobar" + [http.middlewares.Middleware4] + [http.middlewares.Middleware4.replacePathRegex] + regex = "foobar" + replacement = "foobar" + [http.middlewares.Middleware5] + [http.middlewares.Middleware5.chain] + middlewares = ["foobar", "foobar"] + [http.middlewares.Middleware6] + [http.middlewares.Middleware6.ipWhiteList] + sourceRange = ["foobar", "foobar"] + [http.middlewares.Middleware7] + [http.middlewares.Middleware7.ipWhiteList] + [http.middlewares.Middleware7.ipWhiteList.ipStrategy] + depth = 42 + excludedIPs = ["foobar", "foobar"] + [http.middlewares.Middleware8] + [http.middlewares.Middleware8.headers] + accessControlAllowCredentials = true + accessControlAllowHeaders = ["foobar", "foobar"] + accessControlAllowMethods = ["foobar", "foobar"] + accessControlAllowOrigin = "foobar" + accessControlExposeHeaders = ["foobar", "foobar"] + accessControlMaxAge = 42 + addVaryHeader = true + allowedHosts = ["foobar", "foobar"] + hostsProxyHeaders = ["foobar", "foobar"] + sslRedirect = true + sslTemporaryRedirect = true + sslHost = "foobar" + sslForceHost = true + stsSeconds = 42 + stsIncludeSubdomains = true + stsPreload = true + forceSTSHeader = true + frameDeny = true + customFrameOptionsValue = "foobar" + contentTypeNosniff = true + browserXssFilter = true + customBrowserXSSValue = "foobar" + contentSecurityPolicy = "foobar" + publicKey = "foobar" + referrerPolicy = "foobar" + isDevelopment = true + [http.middlewares.Middleware8.headers.customRequestHeaders] name0 = "foobar" name1 = "foobar" - [HTTP.Middlewares.Middleware8.Headers.CustomResponseHeaders] + [http.middlewares.Middleware8.headers.customResponseHeaders] name0 = "foobar" name1 = "foobar" - [HTTP.Middlewares.Middleware8.Headers.SSLProxyHeaders] + [http.middlewares.Middleware8.headers.sslProxyHeaders] name0 = "foobar" name1 = "foobar" + [http.middlewares.Middleware9] + [http.middlewares.Middleware9.errors] + status = ["foobar", "foobar"] + service = "foobar" + query = "foobar" + [http.services] + [http.services.Service0] + [http.services.Service0.loadBalancer] + passHostHeader = true + [http.services.Service0.loadBalancer.stickiness] + cookieName = "foobar" - [HTTP.Middlewares.Middleware9.Errors] - Status = ["foobar", "foobar"] - Service = "foobar" - Query = "foobar" + [[http.services.Service0.loadBalancer.servers]] + url = "foobar" - [HTTP.Middlewares.Middleware10.RateLimit] - ExtractorFunc = "foobar" - [HTTP.Middlewares.Middleware10.RateLimit.RateSet] - [HTTP.Middlewares.Middleware10.RateLimit.RateSet.Rate0] - Period = 42 - Average = 42 - Burst = 42 - [HTTP.Middlewares.Middleware10.RateLimit.RateSet.Rate1] - Period = 42 - Average = 42 - Burst = 42 - - [HTTP.Middlewares.Middleware11.RedirectRegex] - Regex = "foobar" - Replacement = "foobar" - Permanent = true - - [HTTP.Middlewares.Middleware12.RedirectScheme] - Scheme = "foobar" - Port = "foobar" - Permanent = true - - [HTTP.Middlewares.Middleware13.BasicAuth] - Users = ["foobar", "foobar"] - UsersFile = "foobar" - Realm = "foobar" - RemoveHeader = true - HeaderField = "foobar" - - [HTTP.Middlewares.Middleware14.DigestAuth] - Users = ["foobar", "foobar"] - UsersFile = "foobar" - RemoveHeader = true - Realm = "foobar" - HeaderField = "foobar" - - [HTTP.Middlewares.Middleware15.ForwardAuth] - Address = "foobar" - TrustForwardHeader = true - AuthResponseHeaders = ["foobar", "foobar"] - [HTTP.Middlewares.Middleware15.ForwardAuth.TLS] - CA = "foobar" - CAOptional = true - Cert = "foobar" - Key = "foobar" - InsecureSkipVerify = true - - [HTTP.Middlewares.Middleware16.MaxConn] - Amount = 42 - ExtractorFunc = "foobar" - - [HTTP.Middlewares.Middleware17.Buffering] - MaxRequestBodyBytes = 42 - MemRequestBodyBytes = 42 - MaxResponseBodyBytes = 42 - MemResponseBodyBytes = 42 - RetryExpression = "foobar" - - [HTTP.Middlewares.Middleware18.CircuitBreaker] - Expression = "foobar" - - [HTTP.Middlewares.Middleware19.Compress] - - [HTTP.Middlewares.Middleware20.PassTLSClientCert] - PEM = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info] - NotAfter = true - NotBefore = true - Sans = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info.Subject] - Country = true - Province = true - Locality = true - Organization = true - CommonName = true - SerialNumber = true - DomainComponent = true - [HTTP.Middlewares.Middleware20.PassTLSClientCert.Info.Issuer] - Country = true - Province = true - Locality = true - Organization = true - CommonName = true - SerialNumber = true - DomainComponent = true - - [HTTP.Middlewares.Middleware21.Retry] - Attempts = 42 - - [HTTP.Services] - [HTTP.Services.Service0] - [HTTP.Services.Service0.LoadBalancer] - Method = "foobar" - PassHostHeader = true - - [[HTTP.Services.Service0.LoadBalancer.Servers]] - URL = "foobar" - - [HTTP.Services.Service0.LoadBalancer.Stickiness] - CookieName = "foobar" - - [[HTTP.Services.Service0.LoadBalancer.Servers]] - URL = "foobar" - - [HTTP.Services.Service0.LoadBalancer.HealthCheck] - Scheme = "foobar" - Path = "foobar" - Port = 42 - Interval = "foobar" - Timeout = "foobar" - Hostname = "foobar" - [HTTP.Services.Service0.LoadBalancer.HealthCheck.Headers] + [[http.services.Service0.loadBalancer.servers]] + url = "foobar" + [http.services.Service0.loadBalancer.healthCheck] + scheme = "foobar" + path = "foobar" + port = 42 + interval = "foobar" + timeout = "foobar" + hostname = "foobar" + [http.services.Service0.loadBalancer.healthCheck.headers] name0 = "foobar" name1 = "foobar" - [HTTP.Services.Service0.LoadBalancer.ResponseForwarding] - FlushInterval = "foobar" + [http.services.Service0.loadBalancer.responseForwarding] + flushInterval = "foobar" -[TCP] - - [TCP.Routers] - - [TCP.Routers.TCPRouter0] - EntryPoints = ["foobar", "foobar"] - Service = "foobar" - Rule = "foobar" - [TCP.Routers.TCPRouter0.tls] +[tcp] + [tcp.routers] + [tcp.routers.TCPRouter0] + entryPoints = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" + [tcp.routers.TCPRouter0.tls] passthrough = true + [tcp.services] + [tcp.services.TCPService0] + [tcp.services.TCPService0.loadBalancer] - [TCP.Services] + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" - [TCP.Services.TCPService0] - [TCP.Services.TCPService0.LoadBalancer] - Method = "foobar" + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" - [[TCP.Services.TCPService0.LoadBalancer.Servers]] - Address = "foobar" +[tls] - [[TCP.Services.TCPService0.LoadBalancer.Servers]] - Address = "foobar" + [[tls.Certificates]] + certFile = "foobar" + keyFile = "foobar" + stores = ["foobar", "foobar"] -[[TLS.Certificates]] - Stores = ["foobar", "foobar"] - CertFile = "foobar" - KeyFile = "foobar" - -[[TLS.Certificates]] - Stores = ["foobar", "foobar"] - CertFile = "foobar" - KeyFile = "foobar" - -[TLS.Options] - - [TLS.Options.TLS0] - MinVersion = "foobar" - CipherSuites = ["foobar", "foobar"] - SniStrict = true - [TLS.Options.TLS0.ClientCA] - Files = ["foobar", "foobar"] - Optional = true - [TLS.Options.TLS1] - MinVersion = "foobar" - CipherSuites = ["foobar", "foobar"] - SniStrict = true - [TLS.Options.TLS1.ClientCA] - Files = ["foobar", "foobar"] - Optional = true - -[TLS.Stores] - - [TLS.Stores.Store0] - [TLS.Stores.Store0.DefaultCertificate] - CertFile = "foobar" - KeyFile = "foobar" - [TLS.Stores.Store1] - [TLS.Stores.Store1.DefaultCertificate] - CertFile = "foobar" - KeyFile = "foobar" + [[tls.Certificates]] + certFile = "foobar" + keyFile = "foobar" + stores = ["foobar", "foobar"] + [tls.options] + [tls.options.TLS0] + minVersion = "foobar" + cipherSuites = ["foobar", "foobar"] + sniStrict = true + [tls.options.TLS0.clientCA] + files = ["foobar", "foobar"] + optional = true + [tls.options.TLS1] + minVersion = "foobar" + cipherSuites = ["foobar", "foobar"] + sniStrict = true + [tls.options.TLS1.clientCA] + files = ["foobar", "foobar"] + optional = true + [tls.stores] + [tls.stores.Store0] + [tls.stores.Store0.defaultCertificate] + certFile = "foobar" + keyFile = "foobar" + [tls.stores.Store1] + [tls.stores.Store1.defaultCertificate] + certFile = "foobar" + keyFile = "foobar" \ No newline at end of file diff --git a/pkg/config/file/fixtures/sample.yml b/pkg/config/file/fixtures/sample.yml index 23724c162..40c269d72 100644 --- a/pkg/config/file/fixtures/sample.yml +++ b/pkg/config/file/fixtures/sample.yml @@ -1,262 +1,244 @@ -Global: - Debug: true - CheckNewVersion: true - SendAnonymousUsage: true -ServersTransport: - InsecureSkipVerify: true - RootCAs: +global: + checkNewVersion: true + sendAnonymousUsage: true +serversTransport: + insecureSkipVerify: true + rootCAs: - foobar - foobar - MaxIdleConnsPerHost: 42 - ForwardingTimeouts: - DialTimeout: 42 - ResponseHeaderTimeout: 42 -EntryPoints: + maxIdleConnsPerHost: 42 + forwardingTimeouts: + dialTimeout: 42 + responseHeaderTimeout: 42 + idleConnTimeout: 42 +entryPoints: EntryPoint0: - Address: foobar - Transport: - LifeCycle: - RequestAcceptGraceTimeout: 42 - GraceTimeOut: 42 - RespondingTimeouts: - ReadTimeout: 42 - WriteTimeout: 42 - IdleTimeout: 42 - ProxyProtocol: - Insecure: true - TrustedIPs: + address: foobar + transport: + lifeCycle: + requestAcceptGraceTimeout: 42 + graceTimeOut: 42 + respondingTimeouts: + readTimeout: 42 + writeTimeout: 42 + idleTimeout: 42 + proxyProtocol: + insecure: true + trustedIPs: - foobar - foobar - ForwardedHeaders: - Insecure: true - TrustedIPs: + forwardedHeaders: + insecure: true + trustedIPs: - foobar - foobar -Providers: - ProvidersThrottleDuration: 42 - Docker: - Watch: true - Endpoint: foobar - DefaultRule: foobar - ExposedByDefault: true - UseBindPortIP: true - SwarmMode: true - Network: foobar - SwarmModeRefreshSeconds: 42 - Constraints: - - Key: foobar - MustMatch: true - Value: foobar - - Key: foobar - MustMatch: true - Value: foobar - TLS: - CA: foobar - CAOptional: true - Cert: foobar - Key: foobar - InsecureSkipVerify: true - File: - Directory: foobar - Watch: true - Filename: foobar - DebugLogGeneratedTemplate: true - TraefikFile: foobar - Marathon: - Trace: true - Watch: true - Endpoint: foobar - DefaultRule: foobar - ExposedByDefault: true - DCOSToken: foobar - DialerTimeout: 42 - ResponseHeaderTimeout: 42 - TLSHandshakeTimeout: 42 - KeepAlive: 42 - ForceTaskHostname: true - RespectReadinessChecks: true - Constraints: - - Key: foobar - MustMatch: true - Value: foobar - - Key: foobar - MustMatch: true - Value: foobar - TLS: - CA: foobar - CAOptional: true - Cert: foobar - Key: foobar - InsecureSkipVerify: true - Basic: - HTTPBasicAuthUser: foobar - HTTPBasicPassword: foobar - Kubernetes: - Endpoint: foobar - Token: foobar - CertAuthFilePath: foobar - DisablePassHostHeaders: true - Namespaces: +providers: + providersThrottleDuration: 42 + docker: + constraints: foobar + watch: true + endpoint: foobar + defaultRule: foobar + tls: + ca: foobar + caOptional: true + cert: foobar + key: foobar + insecureSkipVerify: true + exposedByDefault: true + useBindPortIP: true + swarmMode: true + network: foobar + swarmModeRefreshSeconds: 42 + file: + directory: foobar + watch: true + filename: foobar + debugLogGeneratedTemplate: true + traefikFile: foobar + marathon: + constraints: foobar + trace: true + watch: true + endpoint: foobar + defaultRule: foobar + exposedByDefault: true + dcosToken: foobar + tls: + ca: foobar + caOptional: true + cert: foobar + key: foobar + insecureSkipVerify: true + dialerTimeout: 42 + responseHeaderTimeout: 42 + tlsHandshakeTimeout: 42 + keepAlive: 42 + forceTaskHostname: true + basic: + httpBasicAuthUser: foobar + httpBasicPassword: foobar + respectReadinessChecks: true + kubernetes: + endpoint: foobar + token: foobar + certAuthFilePath: foobar + disablePassHostHeaders: true + namespaces: - foobar - foobar - LabelSelector: foobar - IngressClass: foobar - IngressEndpoint: - IP: foobar - Hostname: foobar - PublishedService: foobar - KubernetesCRD: - Endpoint: foobar - Token: foobar - CertAuthFilePath: foobar - DisablePassHostHeaders: true - Namespaces: + labelSelector: foobar + ingressClass: foobar + ingressEndpoint: + ip: foobar + hostname: foobar + publishedService: foobar + kubernetesCRD: + endpoint: foobar + token: foobar + certAuthFilePath: foobar + disablePassHostHeaders: true + namespaces: - foobar - foobar - LabelSelector: foobar - IngressClass: foobar - Rest: - EntryPoint: foobar - Rancher: - Watch: true - DefaultRule: foobar - ExposedByDefault: true - EnableServiceHealthFilter: true - RefreshSeconds: 42 - IntervalPoll: true - Prefix: foobar - Constraints: - - Key: foobar - MustMatch: true - Value: foobar - - Key: foobar - MustMatch: true - Value: foobar -API: - EntryPoint: foobar - Dashboard: true - Middlewares: + labelSelector: foobar + ingressClass: foobar + rest: + entryPoint: foobar + rancher: + constraints: foobar + watch: true + defaultRule: foobar + exposedByDefault: true + enableServiceHealthFilter: true + refreshSeconds: 42 + intervalPoll: true + prefix: foobar +api: + entryPoint: foobar + dashboard: true + statistics: + recentErrors: 42 + middlewares: - foobar - foobar - Statistics: - RecentErrors: 42 -Metrics: - Prometheus: - Buckets: +metrics: + prometheus: + buckets: - 42 - 42 - EntryPoint: foobar - Middlewares: + entryPoint: foobar + middlewares: - foobar - foobar - Datadog: - Address: foobar - PushInterval: 10s - StatsD: - Address: foobar - PushInterval: 10s - InfluxDB: - Address: foobar - Protocol: foobar - PushInterval: 10s - Database: foobar - RetentionPolicy: foobar - Username: foobar - Password: foobar -Ping: - EntryPoint: foobar - Middlewares: + dataDog: + address: foobar + pushInterval: 10s + statsD: + address: foobar + pushInterval: 10s + influxDB: + address: foobar + protocol: foobar + pushInterval: 10s + database: foobar + retentionPolicy: foobar + username: foobar + password: foobar +ping: + entryPoint: foobar + middlewares: - foobar - foobar -Log: - Level: foobar - FilePath: foobar - Format: foobar -AccessLog: - FilePath: foobar - Format: foobar - BufferingSize: 42 - Filters: - StatusCodes: +log: + level: foobar + filePath: foobar + format: foobar +accessLog: + filePath: foobar + format: foobar + filters: + statusCodes: - foobar - foobar - RetryAttempts: true - MinDuration: 42 - Fields: - DefaultMode: foobar - Names: + retryAttempts: true + minDuration: 42 + fields: + defaultMode: foobar + names: name0: foobar name1: foobar - Headers: - DefaultMode: foobar - Names: + headers: + defaultMode: foobar + names: name0: foobar name1: foobar -Tracing: - ServiceName: foobar - SpanNameLimit: 42 - Jaeger: - SamplingServerURL: foobar - SamplingType: foobar - SamplingParam: 42 - LocalAgentHostPort: foobar - Gen128Bit: true - Propagation: foobar - TraceContextHeaderName: foobar - Zipkin: - HTTPEndpoint: foobar - SameSpan: true - ID128Bit: true - Debug: true - SampleRate: 42 - DataDog: - LocalAgentHostPort: foobar - GlobalTag: foobar - Debug: true - PrioritySampling: true - TraceIDHeaderName: foobar - ParentIDHeaderName: foobar - SamplingPriorityHeaderName: foobar - BagagePrefixHeaderName: foobar - Instana: - LocalAgentHost: foobar - LocalAgentPort: 42 - LogLevel: foobar - Haystack: - GlobalTag: foobar - LocalAgentHost: foobar - LocalAgentPort: 42 - ParentIDHeaderName: foobar - TraceIDHeaderName: foobar - SpanIDHeaderName: foobar -HostResolver: - CnameFlattening: true - ResolvConfig: foobar - ResolvDepth: 42 -ACME: - Email: foobar - ACMELogging: true - CAServer: foobar - Storage: foobar - EntryPoint: foobar - KeyType: foobar - OnHostRule: true - DNSChallenge: - Provider: foobar - DelayBeforeCheck: 42 - Resolvers: + bufferingSize: 42 +tracing: + serviceName: foobar + spanNameLimit: 42 + jaeger: + samplingServerURL: foobar + samplingType: foobar + samplingParam: 42 + localAgentHostPort: foobar + gen128Bit: true + propagation: foobar + traceContextHeaderName: foobar + zipkin: + httpEndpoint: foobar + sameSpan: true + id128Bit: true + debug: true + sampleRate: 42 + dataDog: + localAgentHostPort: foobar + globalTag: foobar + debug: true + prioritySampling: true + traceIDHeaderName: foobar + parentIDHeaderName: foobar + samplingPriorityHeaderName: foobar + bagagePrefixHeaderName: foobar + instana: + localAgentHost: foobar + localAgentPort: 42 + logLevel: foobar + haystack: + localAgentHost: foobar + localAgentPort: 42 + globalTag: foobar + traceIDHeaderName: foobar + parentIDHeaderName: foobar + spanIDHeaderName: foobar +hostResolver: + cnameFlattening: true + resolvConfig: foobar + resolvDepth: 42 +acme: + email: foobar + acmeLogging: true + caServer: foobar + storage: foobar + entryPoint: foobar + keyType: foobar + onHostRule: true + dnsChallenge: + provider: foobar + delayBeforeCheck: 42 + resolvers: - foobar - foobar - DisablePropagationCheck: true - HTTPChallenge: - EntryPoint: foobar - TLSChallenge: {} - Domains: - - Main: foobar - SANs: + disablePropagationCheck: true + httpChallenge: + entryPoint: foobar + tlsChallenge: {} + domains: + - main: foobar + sans: - foobar - foobar - - Main: foobar - SANs: + - main: foobar + sans: - foobar - foobar diff --git a/pkg/config/middlewares.go b/pkg/config/middlewares.go index 05c36513a..8b8ee3599 100644 --- a/pkg/config/middlewares.go +++ b/pkg/config/middlewares.go @@ -1,6 +1,12 @@ package config import ( + "crypto/tls" + "crypto/x509" + "fmt" + "io/ioutil" + "os" + "github.com/containous/traefik/pkg/ip" "github.com/containous/traefik/pkg/types" ) @@ -9,79 +15,79 @@ import ( // Middleware holds the Middleware configuration. type Middleware struct { - AddPrefix *AddPrefix `json:"addPrefix,omitempty" yaml:"addPrefix,omitempty"` - StripPrefix *StripPrefix `json:"stripPrefix,omitempty" yaml:"stripPrefix,omitempty"` - StripPrefixRegex *StripPrefixRegex `json:"stripPrefixRegex,omitempty" yaml:"stripPrefixRegex,omitempty"` - ReplacePath *ReplacePath `json:"replacePath,omitempty" yaml:"replacePath,omitempty"` - ReplacePathRegex *ReplacePathRegex `json:"replacePathRegex,omitempty" yaml:"replacePathRegex,omitempty"` - Chain *Chain `json:"chain,omitempty" yaml:"chain,omitempty"` - IPWhiteList *IPWhiteList `json:"ipWhiteList,omitempty" yaml:"ipWhiteList,omitempty"` - Headers *Headers `json:"headers,omitempty" yaml:"headers,omitempty"` - Errors *ErrorPage `json:"errors,omitempty" yaml:"errors,omitempty"` - RateLimit *RateLimit `json:"rateLimit,omitempty" yaml:"rateLimit,omitempty"` - RedirectRegex *RedirectRegex `json:"redirectRegex,omitempty" yaml:"redirectRegex,omitempty"` - RedirectScheme *RedirectScheme `json:"redirectScheme,omitempty" yaml:"redirectScheme,omitempty"` - BasicAuth *BasicAuth `json:"basicAuth,omitempty" yaml:"basicAuth,omitempty"` - DigestAuth *DigestAuth `json:"digestAuth,omitempty" yaml:"digestAuth,omitempty"` - ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty" yaml:"forwardAuth,omitempty"` - MaxConn *MaxConn `json:"maxConn,omitempty" yaml:"maxConn,omitempty"` - Buffering *Buffering `json:"buffering,omitempty" yaml:"buffering,omitempty"` - CircuitBreaker *CircuitBreaker `json:"circuitBreaker,omitempty" yaml:"circuitBreaker,omitempty"` - Compress *Compress `json:"compress,omitempty" label:"allowEmpty" yaml:"compress,omitempty" label:"allowEmpty"` - PassTLSClientCert *PassTLSClientCert `json:"passTLSClientCert,omitempty" yaml:"passTLSClientCert,omitempty"` - Retry *Retry `json:"retry,omitempty" yaml:"retry,omitempty"` + AddPrefix *AddPrefix `json:"addPrefix,omitempty" toml:"addPrefix,omitempty" yaml:"addPrefix,omitempty"` + StripPrefix *StripPrefix `json:"stripPrefix,omitempty" toml:"stripPrefix,omitempty" yaml:"stripPrefix,omitempty"` + StripPrefixRegex *StripPrefixRegex `json:"stripPrefixRegex,omitempty" toml:"stripPrefixRegex,omitempty" yaml:"stripPrefixRegex,omitempty"` + ReplacePath *ReplacePath `json:"replacePath,omitempty" toml:"replacePath,omitempty" yaml:"replacePath,omitempty"` + ReplacePathRegex *ReplacePathRegex `json:"replacePathRegex,omitempty" toml:"replacePathRegex,omitempty" yaml:"replacePathRegex,omitempty"` + Chain *Chain `json:"chain,omitempty" toml:"chain,omitempty" yaml:"chain,omitempty"` + IPWhiteList *IPWhiteList `json:"ipWhiteList,omitempty" toml:"ipWhiteList,omitempty" yaml:"ipWhiteList,omitempty"` + Headers *Headers `json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty"` + Errors *ErrorPage `json:"errors,omitempty" toml:"errors,omitempty" yaml:"errors,omitempty"` + RateLimit *RateLimit `json:"rateLimit,omitempty" toml:"rateLimit,omitempty" yaml:"rateLimit,omitempty"` + RedirectRegex *RedirectRegex `json:"redirectRegex,omitempty" toml:"redirectRegex,omitempty" yaml:"redirectRegex,omitempty"` + RedirectScheme *RedirectScheme `json:"redirectScheme,omitempty" toml:"redirectScheme,omitempty" yaml:"redirectScheme,omitempty"` + BasicAuth *BasicAuth `json:"basicAuth,omitempty" toml:"basicAuth,omitempty" yaml:"basicAuth,omitempty"` + DigestAuth *DigestAuth `json:"digestAuth,omitempty" toml:"digestAuth,omitempty" yaml:"digestAuth,omitempty"` + ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty" toml:"forwardAuth,omitempty" yaml:"forwardAuth,omitempty"` + MaxConn *MaxConn `json:"maxConn,omitempty" toml:"maxConn,omitempty" yaml:"maxConn,omitempty"` + Buffering *Buffering `json:"buffering,omitempty" toml:"buffering,omitempty" yaml:"buffering,omitempty"` + CircuitBreaker *CircuitBreaker `json:"circuitBreaker,omitempty" toml:"circuitBreaker,omitempty" yaml:"circuitBreaker,omitempty"` + Compress *Compress `json:"compress,omitempty" toml:"compress,omitempty" yaml:"compress,omitempty" label:"allowEmpty"` + PassTLSClientCert *PassTLSClientCert `json:"passTLSClientCert,omitempty" toml:"passTLSClientCert,omitempty" yaml:"passTLSClientCert,omitempty"` + Retry *Retry `json:"retry,omitempty" toml:"retry,omitempty" yaml:"retry,omitempty"` } // +k8s:deepcopy-gen=true // AddPrefix holds the AddPrefix configuration. type AddPrefix struct { - Prefix string `json:"prefix,omitempty"` + Prefix string `json:"prefix,omitempty" toml:"prefix,omitempty" yaml:"prefix,omitempty"` } // +k8s:deepcopy-gen=true // Auth holds the authentication configuration (BASIC, DIGEST, users). type Auth struct { - Basic *BasicAuth `json:"basic,omitempty" export:"true"` - Digest *DigestAuth `json:"digest,omitempty" export:"true"` - Forward *ForwardAuth `json:"forward,omitempty" export:"true"` + Basic *BasicAuth `json:"basic,omitempty" toml:"basic,omitempty" yaml:"basic,omitempty" export:"true"` + Digest *DigestAuth `json:"digest,omitempty" toml:"digest,omitempty" yaml:"digest,omitempty" export:"true"` + Forward *ForwardAuth `json:"forward,omitempty" toml:"forward,omitempty" yaml:"forward,omitempty" export:"true"` } // +k8s:deepcopy-gen=true // BasicAuth holds the HTTP basic authentication configuration. type BasicAuth struct { - Users Users `json:"users,omitempty"` - UsersFile string `json:"usersFile,omitempty"` - Realm string `json:"realm,omitempty"` - RemoveHeader bool `json:"removeHeader,omitempty"` - HeaderField string `json:"headerField,omitempty" export:"true"` + Users Users `json:"users,omitempty" toml:"users,omitempty" yaml:"users,omitempty"` + UsersFile string `json:"usersFile,omitempty" toml:"usersFile,omitempty" yaml:"usersFile,omitempty"` + Realm string `json:"realm,omitempty" toml:"realm,omitempty" yaml:"realm,omitempty"` + RemoveHeader bool `json:"removeHeader,omitempty" toml:"removeHeader,omitempty" yaml:"removeHeader,omitempty"` + HeaderField string `json:"headerField,omitempty" toml:"headerField,omitempty" yaml:"headerField,omitempty" export:"true"` } // +k8s:deepcopy-gen=true // Buffering holds the request/response buffering configuration. type Buffering struct { - MaxRequestBodyBytes int64 `json:"maxRequestBodyBytes,omitempty"` - MemRequestBodyBytes int64 `json:"memRequestBodyBytes,omitempty"` - MaxResponseBodyBytes int64 `json:"maxResponseBodyBytes,omitempty"` - MemResponseBodyBytes int64 `json:"memResponseBodyBytes,omitempty"` - RetryExpression string `json:"retryExpression,omitempty"` + MaxRequestBodyBytes int64 `json:"maxRequestBodyBytes,omitempty" toml:"maxRequestBodyBytes,omitempty" yaml:"maxRequestBodyBytes,omitempty"` + MemRequestBodyBytes int64 `json:"memRequestBodyBytes,omitempty" toml:"memRequestBodyBytes,omitempty" yaml:"memRequestBodyBytes,omitempty"` + MaxResponseBodyBytes int64 `json:"maxResponseBodyBytes,omitempty" toml:"maxResponseBodyBytes,omitempty" yaml:"maxResponseBodyBytes,omitempty"` + MemResponseBodyBytes int64 `json:"memResponseBodyBytes,omitempty" toml:"memResponseBodyBytes,omitempty" yaml:"memResponseBodyBytes,omitempty"` + RetryExpression string `json:"retryExpression,omitempty" toml:"retryExpression,omitempty" yaml:"retryExpression,omitempty"` } // +k8s:deepcopy-gen=true // Chain holds a chain of middlewares type Chain struct { - Middlewares []string `json:"middlewares"` + Middlewares []string `json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty"` } // +k8s:deepcopy-gen=true // CircuitBreaker holds the circuit breaker configuration. type CircuitBreaker struct { - Expression string `json:"expression,omitempty"` + Expression string `json:"expression,omitempty" toml:"expression,omitempty" yaml:"expression,omitempty"` } // +k8s:deepcopy-gen=true @@ -93,74 +99,74 @@ type Compress struct{} // DigestAuth holds the Digest HTTP authentication configuration. type DigestAuth struct { - Users Users `json:"users,omitempty"` - UsersFile string `json:"usersFile,omitempty"` - RemoveHeader bool `json:"removeHeader,omitempty"` - Realm string `json:"realm,omitempty" mapstructure:","` - HeaderField string `json:"headerField,omitempty" export:"true"` + Users Users `json:"users,omitempty" toml:"users,omitempty" yaml:"users,omitempty"` + UsersFile string `json:"usersFile,omitempty" toml:"usersFile,omitempty" yaml:"usersFile,omitempty"` + RemoveHeader bool `json:"removeHeader,omitempty" toml:"removeHeader,omitempty" yaml:"removeHeader,omitempty"` + Realm string `json:"realm,omitempty" toml:"realm,omitempty" yaml:"realm,omitempty"` + HeaderField string `json:"headerField,omitempty" toml:"headerField,omitempty" yaml:"headerField,omitempty" export:"true"` } // +k8s:deepcopy-gen=true // ErrorPage holds the custom error page configuration. type ErrorPage struct { - Status []string `json:"status,omitempty"` - Service string `json:"service,omitempty"` - Query string `json:"query,omitempty"` + Status []string `json:"status,omitempty" toml:"status,omitempty" yaml:"status,omitempty"` + Service string `json:"service,omitempty" toml:"service,omitempty" yaml:"service,omitempty"` + Query string `json:"query,omitempty" toml:"query,omitempty" yaml:"query,omitempty"` } // +k8s:deepcopy-gen=true // ForwardAuth holds the http forward authentication configuration. type ForwardAuth struct { - Address string `description:"Authentication server address" json:"address,omitempty"` - TLS *ClientTLS `description:"Enable TLS support" json:"tls,omitempty" export:"true"` - TrustForwardHeader bool `description:"Trust X-Forwarded-* headers" json:"trustForwardHeader,omitempty" export:"true"` - AuthResponseHeaders []string `description:"Headers to be forwarded from auth response" json:"authResponseHeaders,omitempty"` + Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` + TLS *ClientTLS `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"` + TrustForwardHeader bool `json:"trustForwardHeader,omitempty" toml:"trustForwardHeader,omitempty" yaml:"trustForwardHeader,omitempty" export:"true"` + AuthResponseHeaders []string `json:"authResponseHeaders,omitempty" toml:"authResponseHeaders,omitempty" yaml:"authResponseHeaders,omitempty"` } // +k8s:deepcopy-gen=true // Headers holds the custom header configuration. type Headers struct { - CustomRequestHeaders map[string]string `json:"customRequestHeaders,omitempty"` - CustomResponseHeaders map[string]string `json:"customResponseHeaders,omitempty"` + CustomRequestHeaders map[string]string `json:"customRequestHeaders,omitempty" toml:"customRequestHeaders,omitempty" yaml:"customRequestHeaders,omitempty"` + CustomResponseHeaders map[string]string `json:"customResponseHeaders,omitempty" toml:"customResponseHeaders,omitempty" yaml:"customResponseHeaders,omitempty"` // AccessControlAllowCredentials is only valid if true. false is ignored. - AccessControlAllowCredentials bool `json:"AccessControlAllowCredentials,omitempty"` + AccessControlAllowCredentials bool `json:"accessControlAllowCredentials,omitempty" toml:"accessControlAllowCredentials,omitempty" yaml:"accessControlAllowCredentials,omitempty"` // AccessControlAllowHeaders must be used in response to a preflight request with Access-Control-Request-Headers set. - AccessControlAllowHeaders []string `json:"AccessControlAllowHeaders,omitempty"` + AccessControlAllowHeaders []string `json:"accessControlAllowHeaders,omitempty" toml:"accessControlAllowHeaders,omitempty" yaml:"accessControlAllowHeaders,omitempty"` // AccessControlAllowMethods must be used in response to a preflight request with Access-Control-Request-Method set. - AccessControlAllowMethods []string `json:"AccessControlAllowMethods,omitempty"` + AccessControlAllowMethods []string `json:"accessControlAllowMethods,omitempty" toml:"accessControlAllowMethods,omitempty" yaml:"accessControlAllowMethods,omitempty"` // AccessControlAllowOrigin Can be "origin-list-or-null" or "*". From (https://www.w3.org/TR/cors/#access-control-allow-origin-response-header) - AccessControlAllowOrigin string `json:"AccessControlAllowOrigin,omitempty"` + AccessControlAllowOrigin string `json:"accessControlAllowOrigin,omitempty" toml:"accessControlAllowOrigin,omitempty" yaml:"accessControlAllowOrigin,omitempty"` // AccessControlExposeHeaders sets valid headers for the response. - AccessControlExposeHeaders []string `json:"AccessControlExposeHeaders,omitempty"` + AccessControlExposeHeaders []string `json:"accessControlExposeHeaders,omitempty" toml:"accessControlExposeHeaders,omitempty" yaml:"accessControlExposeHeaders,omitempty"` // AccessControlMaxAge sets the time that a preflight request may be cached. - AccessControlMaxAge int64 `json:"AccessControlMaxAge,omitempty"` + AccessControlMaxAge int64 `json:"accessControlMaxAge,omitempty" toml:"accessControlMaxAge,omitempty" yaml:"accessControlMaxAge,omitempty"` // AddVaryHeader controls if the Vary header is automatically added/updated when the AccessControlAllowOrigin is set. - AddVaryHeader bool `json:"AddVaryHeader,omitempty"` + AddVaryHeader bool `json:"addVaryHeader,omitempty" toml:"addVaryHeader,omitempty" yaml:"addVaryHeader,omitempty"` - AllowedHosts []string `json:"allowedHosts,omitempty"` - HostsProxyHeaders []string `json:"hostsProxyHeaders,omitempty"` - SSLRedirect bool `json:"sslRedirect,omitempty"` - SSLTemporaryRedirect bool `json:"sslTemporaryRedirect,omitempty"` - SSLHost string `json:"sslHost,omitempty"` - SSLProxyHeaders map[string]string `json:"sslProxyHeaders,omitempty"` - SSLForceHost bool `json:"sslForceHost,omitempty"` - STSSeconds int64 `json:"stsSeconds,omitempty"` - STSIncludeSubdomains bool `json:"stsIncludeSubdomains,omitempty"` - STSPreload bool `json:"stsPreload,omitempty"` - ForceSTSHeader bool `json:"forceSTSHeader,omitempty"` - FrameDeny bool `json:"frameDeny,omitempty"` - CustomFrameOptionsValue string `json:"customFrameOptionsValue,omitempty"` - ContentTypeNosniff bool `json:"contentTypeNosniff,omitempty"` - BrowserXSSFilter bool `json:"browserXssFilter,omitempty"` - CustomBrowserXSSValue string `json:"customBrowserXSSValue,omitempty"` - ContentSecurityPolicy string `json:"contentSecurityPolicy,omitempty"` - PublicKey string `json:"publicKey,omitempty"` - ReferrerPolicy string `json:"referrerPolicy,omitempty"` - IsDevelopment bool `json:"isDevelopment,omitempty"` + AllowedHosts []string `json:"allowedHosts,omitempty" toml:"allowedHosts,omitempty" yaml:"allowedHosts,omitempty"` + HostsProxyHeaders []string `json:"hostsProxyHeaders,omitempty" toml:"hostsProxyHeaders,omitempty" yaml:"hostsProxyHeaders,omitempty"` + SSLRedirect bool `json:"sslRedirect,omitempty" toml:"sslRedirect,omitempty" yaml:"sslRedirect,omitempty"` + SSLTemporaryRedirect bool `json:"sslTemporaryRedirect,omitempty" toml:"sslTemporaryRedirect,omitempty" yaml:"sslTemporaryRedirect,omitempty"` + SSLHost string `json:"sslHost,omitempty" toml:"sslHost,omitempty" yaml:"sslHost,omitempty"` + SSLProxyHeaders map[string]string `json:"sslProxyHeaders,omitempty" toml:"sslProxyHeaders,omitempty" yaml:"sslProxyHeaders,omitempty"` + SSLForceHost bool `json:"sslForceHost,omitempty" toml:"sslForceHost,omitempty" yaml:"sslForceHost,omitempty"` + STSSeconds int64 `json:"stsSeconds,omitempty" toml:"stsSeconds,omitempty" yaml:"stsSeconds,omitempty"` + STSIncludeSubdomains bool `json:"stsIncludeSubdomains,omitempty" toml:"stsIncludeSubdomains,omitempty" yaml:"stsIncludeSubdomains,omitempty"` + STSPreload bool `json:"stsPreload,omitempty" toml:"stsPreload,omitempty" yaml:"stsPreload,omitempty"` + ForceSTSHeader bool `json:"forceSTSHeader,omitempty" toml:"forceSTSHeader,omitempty" yaml:"forceSTSHeader,omitempty"` + FrameDeny bool `json:"frameDeny,omitempty" toml:"frameDeny,omitempty" yaml:"frameDeny,omitempty"` + CustomFrameOptionsValue string `json:"customFrameOptionsValue,omitempty" toml:"customFrameOptionsValue,omitempty" yaml:"customFrameOptionsValue,omitempty"` + ContentTypeNosniff bool `json:"contentTypeNosniff,omitempty" toml:"contentTypeNosniff,omitempty" yaml:"contentTypeNosniff,omitempty"` + BrowserXSSFilter bool `json:"browserXssFilter,omitempty" toml:"browserXssFilter,omitempty" yaml:"browserXssFilter,omitempty"` + CustomBrowserXSSValue string `json:"customBrowserXSSValue,omitempty" toml:"customBrowserXSSValue,omitempty" yaml:"customBrowserXSSValue,omitempty"` + ContentSecurityPolicy string `json:"contentSecurityPolicy,omitempty" toml:"contentSecurityPolicy,omitempty" yaml:"contentSecurityPolicy,omitempty"` + PublicKey string `json:"publicKey,omitempty" toml:"publicKey,omitempty" yaml:"publicKey,omitempty"` + ReferrerPolicy string `json:"referrerPolicy,omitempty" toml:"referrerPolicy,omitempty" yaml:"referrerPolicy,omitempty"` + IsDevelopment bool `json:"isDevelopment,omitempty" toml:"isDevelopment,omitempty" yaml:"isDevelopment,omitempty"` } // HasCustomHeadersDefined checks to see if any of the custom header elements have been set @@ -208,8 +214,8 @@ func (h *Headers) HasSecureHeadersDefined() bool { // IPStrategy holds the ip strategy configuration. type IPStrategy struct { - Depth int `json:"depth,omitempty" export:"true"` - ExcludedIPs []string `json:"excludedIPs,omitempty"` + Depth int `json:"depth,omitempty" toml:"depth,omitempty" yaml:"depth,omitempty" export:"true"` + ExcludedIPs []string `json:"excludedIPs,omitempty" toml:"excludedIPs,omitempty" yaml:"excludedIPs,omitempty"` } // Get an IP selection strategy @@ -244,16 +250,16 @@ func (s *IPStrategy) Get() (ip.Strategy, error) { // IPWhiteList holds the ip white list configuration. type IPWhiteList struct { - SourceRange []string `json:"sourceRange,omitempty"` - IPStrategy *IPStrategy `json:"ipStrategy,omitempty" label:"allowEmpty"` + SourceRange []string `json:"sourceRange,omitempty" toml:"sourceRange,omitempty" yaml:"sourceRange,omitempty"` + IPStrategy *IPStrategy `json:"ipStrategy,omitempty" toml:"ipStrategy,omitempty" yaml:"ipStrategy,omitempty" label:"allowEmpty"` } // +k8s:deepcopy-gen=true // MaxConn holds maximum connection configuration. type MaxConn struct { - Amount int64 `json:"amount,omitempty"` - ExtractorFunc string `json:"extractorFunc,omitempty"` + Amount int64 `json:"amount,omitempty" toml:"amount,omitempty" yaml:"amount,omitempty"` + ExtractorFunc string `json:"extractorFunc,omitempty" toml:"extractorFunc,omitempty" yaml:"extractorFunc,omitempty"` } // SetDefaults Default values for a MaxConn. @@ -265,26 +271,26 @@ func (m *MaxConn) SetDefaults() { // PassTLSClientCert holds the TLS client cert headers configuration. type PassTLSClientCert struct { - PEM bool `description:"Enable header with escaped client pem" json:"pem"` - Info *TLSClientCertificateInfo `description:"Enable header with configured client cert info" json:"info,omitempty"` + PEM bool `json:"pem,omitempty" toml:"pem,omitempty" yaml:"pem,omitempty"` + Info *TLSClientCertificateInfo `json:"info,omitempty" toml:"info,omitempty" yaml:"info,omitempty"` } // +k8s:deepcopy-gen=true // Rate holds the rate limiting configuration for a specific time period. type Rate struct { - Period types.Duration `json:"period,omitempty"` - Average int64 `json:"average,omitempty"` - Burst int64 `json:"burst,omitempty"` + Period types.Duration `json:"period,omitempty" toml:"period,omitempty" yaml:"period,omitempty"` + Average int64 `json:"average,omitempty" toml:"average,omitempty" yaml:"average,omitempty"` + Burst int64 `json:"burst,omitempty" toml:"burst,omitempty" yaml:"burst,omitempty"` } // +k8s:deepcopy-gen=true // RateLimit holds the rate limiting configuration for a given frontend. type RateLimit struct { - RateSet map[string]*Rate `json:"rateset,omitempty"` + RateSet map[string]*Rate `json:"rateSet,omitempty" toml:"rateSet,omitempty" yaml:"rateSet,omitempty"` // FIXME replace by ipStrategy see oxy and replace - ExtractorFunc string `json:"extractorFunc,omitempty"` + ExtractorFunc string `json:"extractorFunc,omitempty" toml:"extractorFunc,omitempty" yaml:"extractorFunc,omitempty"` } // SetDefaults Default values for a MaxConn. @@ -296,65 +302,65 @@ func (r *RateLimit) SetDefaults() { // RedirectRegex holds the redirection configuration. type RedirectRegex struct { - Regex string `json:"regex,omitempty"` - Replacement string `json:"replacement,omitempty"` - Permanent bool `json:"permanent,omitempty"` + Regex string `json:"regex,omitempty" toml:"regex,omitempty" yaml:"regex,omitempty"` + Replacement string `json:"replacement,omitempty" toml:"replacement,omitempty" yaml:"replacement,omitempty"` + Permanent bool `json:"permanent,omitempty" toml:"permanent,omitempty" yaml:"permanent,omitempty"` } // +k8s:deepcopy-gen=true // RedirectScheme holds the scheme redirection configuration. type RedirectScheme struct { - Scheme string `json:"scheme,omitempty"` - Port string `json:"port,omitempty"` - Permanent bool `json:"permanent,omitempty"` + Scheme string `json:"scheme,omitempty" toml:"scheme,omitempty" yaml:"scheme,omitempty"` + Port string `json:"port,omitempty" toml:"port,omitempty" yaml:"port,omitempty"` + Permanent bool `json:"permanent,omitempty" toml:"permanent,omitempty" yaml:"permanent,omitempty"` } // +k8s:deepcopy-gen=true // ReplacePath holds the ReplacePath configuration. type ReplacePath struct { - Path string `json:"path,omitempty"` + Path string `json:"path,omitempty" toml:"path,omitempty" yaml:"path,omitempty"` } // +k8s:deepcopy-gen=true // ReplacePathRegex holds the ReplacePathRegex configuration. type ReplacePathRegex struct { - Regex string `json:"regex,omitempty"` - Replacement string `json:"replacement,omitempty"` + Regex string `json:"regex,omitempty" toml:"regex,omitempty" yaml:"regex,omitempty"` + Replacement string `json:"replacement,omitempty" toml:"replacement,omitempty" yaml:"replacement,omitempty"` } // +k8s:deepcopy-gen=true // Retry holds the retry configuration. type Retry struct { - Attempts int `description:"Number of attempts" export:"true"` + Attempts int `json:"attempts,omitempty" toml:"attempts,omitempty" yaml:"attempts,omitempty" export:"true"` } // +k8s:deepcopy-gen=true // StripPrefix holds the StripPrefix configuration. type StripPrefix struct { - Prefixes []string `json:"prefixes,omitempty"` + Prefixes []string `json:"prefixes,omitempty" toml:"prefixes,omitempty" yaml:"prefixes,omitempty"` } // +k8s:deepcopy-gen=true // StripPrefixRegex holds the StripPrefixRegex configuration. type StripPrefixRegex struct { - Regex []string `json:"regex,omitempty"` + Regex []string `json:"regex,omitempty" toml:"regex,omitempty" yaml:"regex,omitempty"` } // +k8s:deepcopy-gen=true // TLSClientCertificateInfo holds the client TLS certificate info configuration. type TLSClientCertificateInfo struct { - NotAfter bool `description:"Add NotAfter info in header" json:"notAfter"` - NotBefore bool `description:"Add NotBefore info in header" json:"notBefore"` - Sans bool `description:"Add Sans info in header" json:"sans"` - Subject *TLSCLientCertificateDNInfo `description:"Add Subject info in header" json:"subject,omitempty"` - Issuer *TLSCLientCertificateDNInfo `description:"Add Issuer info in header" json:"issuer,omitempty"` + NotAfter bool `json:"notAfter,omitempty" toml:"notAfter,omitempty" yaml:"notAfter,omitempty"` + NotBefore bool `json:"notBefore,omitempty" toml:"notBefore,omitempty" yaml:"notBefore,omitempty"` + Sans bool `json:"sans,omitempty" toml:"sans,omitempty" yaml:"sans,omitempty"` + Subject *TLSCLientCertificateDNInfo `json:"subject,omitempty" toml:"subject,omitempty" yaml:"subject,omitempty"` + Issuer *TLSCLientCertificateDNInfo `json:"issuer,omitempty" toml:"issuer,omitempty" yaml:"issuer,omitempty"` } // +k8s:deepcopy-gen=true @@ -362,13 +368,13 @@ type TLSClientCertificateInfo struct { // TLSCLientCertificateDNInfo holds the client TLS certificate distinguished name info configuration // cf https://tools.ietf.org/html/rfc3739 type TLSCLientCertificateDNInfo struct { - Country bool `description:"Add Country info in header" json:"country"` - Province bool `description:"Add Province info in header" json:"province"` - Locality bool `description:"Add Locality info in header" json:"locality"` - Organization bool `description:"Add Organization info in header" json:"organization"` - CommonName bool `description:"Add CommonName info in header" json:"commonName"` - SerialNumber bool `description:"Add SerialNumber info in header" json:"serialNumber"` - DomainComponent bool `description:"Add Domain Component info in header" json:"domainComponent"` + Country bool `json:"country,omitempty" toml:"country,omitempty" yaml:"country,omitempty"` + Province bool `json:"province,omitempty" toml:"province,omitempty" yaml:"province,omitempty"` + Locality bool `json:"locality,omitempty" toml:"locality,omitempty" yaml:"locality,omitempty"` + Organization bool `json:"organization,omitempty" toml:"organization,omitempty" yaml:"organization,omitempty"` + CommonName bool `json:"commonName,omitempty" toml:"commonName,omitempty" yaml:"commonName,omitempty"` + SerialNumber bool `json:"serialNumber,omitempty" toml:"serialNumber,omitempty" yaml:"serialNumber,omitempty"` + DomainComponent bool `json:"domainComponent,omitempty" toml:"domainComponent,omitempty" yaml:"domainComponent,omitempty"` } // +k8s:deepcopy-gen=true @@ -381,9 +387,78 @@ type Users []string // ClientTLS holds the TLS specific configurations as client // CA, Cert and Key can be either path or file contents. type ClientTLS struct { - CA string `description:"TLS CA" json:"ca,omitempty"` - CAOptional bool `description:"TLS CA.Optional" json:"caOptional,omitempty"` - Cert string `description:"TLS cert" json:"cert,omitempty"` - Key string `description:"TLS key" json:"key,omitempty"` - InsecureSkipVerify bool `description:"TLS insecure skip verify" json:"insecureSkipVerify,omitempty"` + CA string `json:"ca,omitempty" toml:"ca,omitempty" yaml:"ca,omitempty"` + CAOptional bool `json:"caOptional,omitempty" toml:"caOptional,omitempty" yaml:"caOptional,omitempty"` + Cert string `json:"cert,omitempty" toml:"cert,omitempty" yaml:"cert,omitempty"` + Key string `json:"key,omitempty" toml:"key,omitempty" yaml:"key,omitempty"` + InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" toml:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` +} + +// CreateTLSConfig creates a TLS config from ClientTLS structures. +func (clientTLS *ClientTLS) CreateTLSConfig() (*tls.Config, error) { + if clientTLS == nil { + return nil, nil + } + + var err error + caPool := x509.NewCertPool() + clientAuth := tls.NoClientCert + if clientTLS.CA != "" { + var ca []byte + if _, errCA := os.Stat(clientTLS.CA); errCA == nil { + ca, err = ioutil.ReadFile(clientTLS.CA) + if err != nil { + return nil, fmt.Errorf("failed to read CA. %s", err) + } + } else { + ca = []byte(clientTLS.CA) + } + + if !caPool.AppendCertsFromPEM(ca) { + return nil, fmt.Errorf("failed to parse CA") + } + + if clientTLS.CAOptional { + clientAuth = tls.VerifyClientCertIfGiven + } else { + clientAuth = tls.RequireAndVerifyClientCert + } + } + + cert := tls.Certificate{} + _, errKeyIsFile := os.Stat(clientTLS.Key) + + if !clientTLS.InsecureSkipVerify && (len(clientTLS.Cert) == 0 || len(clientTLS.Key) == 0) { + return nil, fmt.Errorf("TLS Certificate or Key file must be set when TLS configuration is created") + } + + if len(clientTLS.Cert) > 0 && len(clientTLS.Key) > 0 { + if _, errCertIsFile := os.Stat(clientTLS.Cert); errCertIsFile == nil { + if errKeyIsFile == nil { + cert, err = tls.LoadX509KeyPair(clientTLS.Cert, clientTLS.Key) + if err != nil { + return nil, fmt.Errorf("failed to load TLS keypair: %v", err) + } + } else { + return nil, fmt.Errorf("tls cert is a file, but tls key is not") + } + } else { + if errKeyIsFile != nil { + cert, err = tls.X509KeyPair([]byte(clientTLS.Cert), []byte(clientTLS.Key)) + if err != nil { + return nil, fmt.Errorf("failed to load TLS keypair: %v", err) + + } + } else { + return nil, fmt.Errorf("TLS key is a file, but tls cert is not") + } + } + } + + return &tls.Config{ + Certificates: []tls.Certificate{cert}, + RootCAs: caPool, + InsecureSkipVerify: clientTLS.InsecureSkipVerify, + ClientAuth: clientAuth, + }, nil } diff --git a/pkg/config/static/entrypoints.go b/pkg/config/static/entrypoints.go index 3cfaac2dd..544bb8386 100644 --- a/pkg/config/static/entrypoints.go +++ b/pkg/config/static/entrypoints.go @@ -2,10 +2,10 @@ package static // EntryPoint holds the entry point configuration. type EntryPoint struct { - Address string `description:"Entry point address."` - Transport *EntryPointsTransport `description:"Configures communication between clients and Traefik."` - ProxyProtocol *ProxyProtocol `description:"Proxy-Protocol configuration." label:"allowEmpty"` - ForwardedHeaders *ForwardedHeaders `description:"Trust client forwarding headers."` + Address string `description:"Entry point address." json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` + Transport *EntryPointsTransport `description:"Configures communication between clients and Traefik." json:"transport,omitempty" toml:"transport,omitempty" yaml:"transport,omitempty"` + ProxyProtocol *ProxyProtocol `description:"Proxy-Protocol configuration." json:"proxyProtocol,omitempty" toml:"proxyProtocol,omitempty" yaml:"proxyProtocol,omitempty" label:"allowEmpty"` + ForwardedHeaders *ForwardedHeaders `description:"Trust client forwarding headers." json:"forwardedHeaders,omitempty" toml:"forwardedHeaders,omitempty" yaml:"forwardedHeaders,omitempty"` } // SetDefaults sets the default values. @@ -17,14 +17,14 @@ func (e *EntryPoint) SetDefaults() { // ForwardedHeaders Trust client forwarding headers. type ForwardedHeaders struct { - Insecure bool `description:"Trust all forwarded headers." export:"true"` - TrustedIPs []string `description:"Trust only forwarded headers from selected IPs."` + Insecure bool `description:"Trust all forwarded headers." json:"insecure,omitempty" toml:"insecure,omitempty" yaml:"insecure,omitempty" export:"true"` + TrustedIPs []string `description:"Trust only forwarded headers from selected IPs." json:"trustedIPs,omitempty" toml:"trustedIPs,omitempty" yaml:"trustedIPs,omitempty"` } // ProxyProtocol contains Proxy-Protocol configuration. type ProxyProtocol struct { - Insecure bool `description:"Trust all." export:"true"` - TrustedIPs []string `description:"Trust only selected IPs."` + Insecure bool `description:"Trust all." json:"insecure,omitempty" toml:"insecure,omitempty" yaml:"insecure,omitempty" export:"true"` + TrustedIPs []string `description:"Trust only selected IPs." json:"trustedIPs,omitempty" toml:"trustedIPs,omitempty" yaml:"trustedIPs,omitempty"` } // EntryPoints holds the HTTP entry point list. @@ -32,8 +32,8 @@ type EntryPoints map[string]*EntryPoint // EntryPointsTransport configures communication between clients and Traefik. type EntryPointsTransport struct { - LifeCycle *LifeCycle `description:"Timeouts influencing the server life cycle." export:"true"` - RespondingTimeouts *RespondingTimeouts `description:"Timeouts for incoming requests to the Traefik instance." export:"true"` + LifeCycle *LifeCycle `description:"Timeouts influencing the server life cycle." json:"lifeCycle,omitempty" toml:"lifeCycle,omitempty" yaml:"lifeCycle,omitempty" export:"true" export:"true"` + RespondingTimeouts *RespondingTimeouts `description:"Timeouts for incoming requests to the Traefik instance." json:"respondingTimeouts,omitempty" toml:"respondingTimeouts,omitempty" yaml:"respondingTimeouts,omitempty" export:"true" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index d149ef37b..d34931506 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -43,48 +43,47 @@ const ( // Configuration is the static configuration type Configuration struct { - Global *Global `description:"Global configuration options" export:"true"` + Global *Global `description:"Global configuration options" json:"global,omitempty" toml:"global,omitempty" yaml:"global,omitempty" export:"true"` - ServersTransport *ServersTransport `description:"Servers default transport." export:"true"` - EntryPoints EntryPoints `description:"Entry points definition." export:"true"` - Providers *Providers `description:"Providers configuration." export:"true"` + ServersTransport *ServersTransport `description:"Servers default transport." json:"serversTransport,omitempty" toml:"serversTransport,omitempty" yaml:"serversTransport,omitempty" export:"true"` + EntryPoints EntryPoints `description:"Entry points definition." json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty" export:"true"` + Providers *Providers `description:"Providers configuration." json:"providers,omitempty" toml:"providers,omitempty" yaml:"providers,omitempty" export:"true"` - API *API `description:"Enable api/dashboard." export:"true" label:"allowEmpty"` - Metrics *types.Metrics `description:"Enable a metrics exporter." export:"true"` - Ping *ping.Handler `description:"Enable ping." export:"true" label:"allowEmpty"` - // Rest *rest.Provider `description:"Enable Rest backend with default settings" export:"true"` + API *API `description:"Enable api/dashboard." json:"api,omitempty" toml:"api,omitempty" yaml:"api,omitempty" label:"allowEmpty" export:"true"` + Metrics *types.Metrics `description:"Enable a metrics exporter." json:"metrics,omitempty" toml:"metrics,omitempty" yaml:"metrics,omitempty" export:"true"` + Ping *ping.Handler `description:"Enable ping." json:"ping,omitempty" toml:"ping,omitempty" yaml:"ping,omitempty" label:"allowEmpty" export:"true"` - Log *types.TraefikLog `description:"Traefik log settings." export:"true" label:"allowEmpty"` - AccessLog *types.AccessLog `description:"Access log settings." export:"true" label:"allowEmpty"` - Tracing *Tracing `description:"OpenTracing configuration." export:"true" label:"allowEmpty"` + Log *types.TraefikLog `description:"Traefik log settings." json:"log,omitempty" toml:"log,omitempty" yaml:"log,omitempty" label:"allowEmpty" export:"true"` + AccessLog *types.AccessLog `description:"Access log settings." json:"accessLog,omitempty" toml:"accessLog,omitempty" yaml:"accessLog,omitempty" label:"allowEmpty" export:"true"` + Tracing *Tracing `description:"OpenTracing configuration." json:"tracing,omitempty" toml:"tracing,omitempty" yaml:"tracing,omitempty" label:"allowEmpty" export:"true"` - HostResolver *types.HostResolverConfig `description:"Enable CNAME Flattening." export:"true" label:"allowEmpty"` + HostResolver *types.HostResolverConfig `description:"Enable CNAME Flattening." json:"hostResolver,omitempty" toml:"hostResolver,omitempty" yaml:"hostResolver,omitempty" label:"allowEmpty" export:"true"` - ACME *acmeprovider.Configuration `description:"Enable ACME (Let's Encrypt): automatic SSL." export:"true"` + ACME *acmeprovider.Configuration `description:"Enable ACME (Let's Encrypt): automatic SSL." json:"acme,omitempty" toml:"acme,omitempty" yaml:"acme,omitempty" export:"true"` } // Global holds the global configuration. type Global struct { - CheckNewVersion bool `description:"Periodically check if a new version has been released." export:"true"` - SendAnonymousUsage *bool `description:"Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default." export:"true"` + CheckNewVersion bool `description:"Periodically check if a new version has been released." json:"checkNewVersion,omitempty" toml:"checkNewVersion,omitempty" yaml:"checkNewVersion,omitempty" label:"allowEmpty" export:"true"` + SendAnonymousUsage *bool `description:"Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default." json:"sendAnonymousUsage,omitempty" toml:"sendAnonymousUsage,omitempty" yaml:"sendAnonymousUsage,omitempty" label:"allowEmpty" export:"true"` } // ServersTransport options to configure communication between Traefik and the servers type ServersTransport struct { - InsecureSkipVerify bool `description:"Disable SSL certificate verification." export:"true"` - RootCAs []tls.FileOrContent `description:"Add cert file for self-signed certificate."` - MaxIdleConnsPerHost int `description:"If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used" export:"true"` - ForwardingTimeouts *ForwardingTimeouts `description:"Timeouts for requests forwarded to the backend servers." export:"true"` + InsecureSkipVerify bool `description:"Disable SSL certificate verification." json:"insecureSkipVerify,omitempty" toml:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty" export:"true"` + RootCAs []tls.FileOrContent `description:"Add cert file for self-signed certificate." json:"rootCAs,omitempty" toml:"rootCAs,omitempty" yaml:"rootCAs,omitempty"` + MaxIdleConnsPerHost int `description:"If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used" json:"maxIdleConnsPerHost,omitempty" toml:"maxIdleConnsPerHost,omitempty" yaml:"maxIdleConnsPerHost,omitempty" export:"true"` + ForwardingTimeouts *ForwardingTimeouts `description:"Timeouts for requests forwarded to the backend servers." json:"forwardingTimeouts,omitempty" toml:"forwardingTimeouts,omitempty" yaml:"forwardingTimeouts,omitempty" export:"true"` } // API holds the API configuration type API struct { - EntryPoint string `description:"The entry point that the API handler will be bound to." export:"true"` - Dashboard bool `description:"Activate dashboard." export:"true"` - Debug bool `description:"Enable additional endpoints for debugging and profiling." export:"true"` - Statistics *types.Statistics `description:"Enable more detailed statistics." export:"true" label:"allowEmpty"` - Middlewares []string `description:"Middleware list." export:"true"` - DashboardAssets *assetfs.AssetFS `json:"-" label:"-"` + EntryPoint string `description:"The entry point that the API handler will be bound to." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` + Dashboard bool `description:"Activate dashboard." json:"dashboard,omitempty" toml:"dashboard,omitempty" yaml:"dashboard,omitempty" export:"true"` + Debug bool `description:"Enable additional endpoints for debugging and profiling." json:"debug,omitempty" toml:"debug,omitempty" yaml:"debug,omitempty" export:"true"` + Statistics *types.Statistics `description:"Enable more detailed statistics." json:"statistics,omitempty" toml:"statistics,omitempty" yaml:"statistics,omitempty" export:"true" label:"allowEmpty"` + Middlewares []string `description:"Middleware list." json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty" export:"true"` + DashboardAssets *assetfs.AssetFS `json:"-" toml:"-" yaml:"-" label:"-"` } // SetDefaults sets the default values. @@ -95,9 +94,9 @@ func (a *API) SetDefaults() { // RespondingTimeouts contains timeout configurations for incoming requests to the Traefik instance. type RespondingTimeouts struct { - ReadTimeout types.Duration `description:"ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set." export:"true"` - WriteTimeout types.Duration `description:"WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set." export:"true"` - IdleTimeout types.Duration `description:"IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set." export:"true"` + ReadTimeout types.Duration `description:"ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set." json:"readTimeout,omitempty" toml:"readTimeout,omitempty" yaml:"readTimeout,omitempty" export:"true"` + WriteTimeout types.Duration `description:"WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set." json:"writeTimeout,omitempty" toml:"writeTimeout,omitempty" yaml:"writeTimeout,omitempty" export:"true"` + IdleTimeout types.Duration `description:"IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set." json:"idleTimeout,omitempty" toml:"idleTimeout,omitempty" yaml:"idleTimeout,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -107,9 +106,9 @@ func (a *RespondingTimeouts) SetDefaults() { // ForwardingTimeouts contains timeout configurations for forwarding requests to the backend servers. type ForwardingTimeouts struct { - DialTimeout types.Duration `description:"The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists." export:"true"` - ResponseHeaderTimeout types.Duration `description:"The amount of time to wait for a server's response headers after fully writing the request (including its body, if any). If zero, no timeout exists." export:"true"` - IdleConnTimeout types.Duration `description:"The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself" export:"true"` + DialTimeout types.Duration `description:"The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists." json:"dialTimeout,omitempty" toml:"dialTimeout,omitempty" yaml:"dialTimeout,omitempty" export:"true"` + ResponseHeaderTimeout types.Duration `description:"The amount of time to wait for a server's response headers after fully writing the request (including its body, if any). If zero, no timeout exists." json:"responseHeaderTimeout,omitempty" toml:"responseHeaderTimeout,omitempty" yaml:"responseHeaderTimeout,omitempty" export:"true"` + IdleConnTimeout types.Duration `description:"The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself" json:"idleConnTimeout,omitempty" toml:"idleConnTimeout,omitempty" yaml:"idleConnTimeout,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -120,8 +119,8 @@ func (f *ForwardingTimeouts) SetDefaults() { // LifeCycle contains configurations relevant to the lifecycle (such as the shutdown phase) of Traefik. type LifeCycle struct { - RequestAcceptGraceTimeout types.Duration `description:"Duration to keep accepting requests before Traefik initiates the graceful shutdown procedure."` - GraceTimeOut types.Duration `description:"Duration to give active requests a chance to finish before Traefik stops."` + RequestAcceptGraceTimeout types.Duration `description:"Duration to keep accepting requests before Traefik initiates the graceful shutdown procedure." json:"requestAcceptGraceTimeout,omitempty" toml:"requestAcceptGraceTimeout,omitempty" yaml:"requestAcceptGraceTimeout,omitempty" export:"true"` + GraceTimeOut types.Duration `description:"Duration to give active requests a chance to finish before Traefik stops." json:"graceTimeOut,omitempty" toml:"graceTimeOut,omitempty" yaml:"graceTimeOut,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -131,13 +130,13 @@ func (a *LifeCycle) SetDefaults() { // Tracing holds the tracing configuration. type Tracing struct { - ServiceName string `description:"Set the name for this service." export:"true"` - SpanNameLimit int `description:"Set the maximum character limit for Span names (default 0 = no limit)." export:"true"` - Jaeger *jaeger.Config `description:"Settings for jaeger." label:"allowEmpty"` - Zipkin *zipkin.Config `description:"Settings for zipkin." label:"allowEmpty"` - DataDog *datadog.Config `description:"Settings for DataDog." label:"allowEmpty"` - Instana *instana.Config `description:"Settings for Instana." label:"allowEmpty"` - Haystack *haystack.Config `description:"Settings for Haystack." label:"allowEmpty"` + ServiceName string `description:"Set the name for this service." json:"serviceName,omitempty" toml:"serviceName,omitempty" yaml:"serviceName,omitempty" export:"true"` + SpanNameLimit int `description:"Set the maximum character limit for Span names (default 0 = no limit)." json:"spanNameLimit,omitempty" toml:"spanNameLimit,omitempty" yaml:"spanNameLimit,omitempty" export:"true"` + Jaeger *jaeger.Config `description:"Settings for Jaeger." json:"jaeger,omitempty" toml:"jaeger,omitempty" yaml:"jaeger,omitempty" export:"true" label:"allowEmpty"` + Zipkin *zipkin.Config `description:"Settings for Zipkin." json:"zipkin,omitempty" toml:"zipkin,omitempty" yaml:"zipkin,omitempty" export:"true" label:"allowEmpty"` + DataDog *datadog.Config `description:"Settings for DataDog." json:"dataDog,omitempty" toml:"dataDog,omitempty" yaml:"dataDog,omitempty" export:"true" label:"allowEmpty"` + Instana *instana.Config `description:"Settings for Instana." json:"instana,omitempty" toml:"instana,omitempty" yaml:"instana,omitempty" export:"true" label:"allowEmpty"` + Haystack *haystack.Config `description:"Settings for Haystack." json:"haystack,omitempty" toml:"haystack,omitempty" yaml:"haystack,omitempty" export:"true" label:"allowEmpty"` } // SetDefaults sets the default values. @@ -148,14 +147,14 @@ func (t *Tracing) SetDefaults() { // Providers contains providers configuration type Providers struct { - ProvidersThrottleDuration types.Duration `description:"Backends throttle duration: minimum duration between 2 events from providers before applying a new configuration. It avoids unnecessary reloads if multiples events are sent in a short amount of time." export:"true"` - Docker *docker.Provider `description:"Enable Docker backend with default settings." export:"true" label:"allowEmpty"` - File *file.Provider `description:"Enable File backend with default settings." export:"true" label:"allowEmpty"` - Marathon *marathon.Provider `description:"Enable Marathon backend with default settings." export:"true" label:"allowEmpty"` - Kubernetes *ingress.Provider `description:"Enable Kubernetes backend with default settings." export:"true" label:"allowEmpty"` - KubernetesCRD *crd.Provider `description:"Enable Kubernetes backend with default settings." export:"true" label:"allowEmpty"` - Rest *rest.Provider `description:"Enable Rest backend with default settings." export:"true" label:"allowEmpty"` - Rancher *rancher.Provider `description:"Enable Rancher backend with default settings." export:"true" label:"allowEmpty"` + ProvidersThrottleDuration types.Duration `description:"Backends throttle duration: minimum duration between 2 events from providers before applying a new configuration. It avoids unnecessary reloads if multiples events are sent in a short amount of time." json:"providersThrottleDuration,omitempty" toml:"providersThrottleDuration,omitempty" yaml:"providersThrottleDuration,omitempty" export:"true"` + Docker *docker.Provider `description:"Enable Docker backend with default settings." json:"docker,omitempty" toml:"docker,omitempty" yaml:"docker,omitempty" export:"true" label:"allowEmpty"` + File *file.Provider `description:"Enable File backend with default settings." json:"file,omitempty" toml:"file,omitempty" yaml:"file,omitempty" export:"true" label:"allowEmpty"` + Marathon *marathon.Provider `description:"Enable Marathon backend with default settings." json:"marathon,omitempty" toml:"marathon,omitempty" yaml:"marathon,omitempty" export:"true" label:"allowEmpty"` + Kubernetes *ingress.Provider `description:"Enable Kubernetes backend with default settings." json:"kubernetes,omitempty" toml:"kubernetes,omitempty" yaml:"kubernetes,omitempty" export:"true" label:"allowEmpty"` + KubernetesCRD *crd.Provider `description:"Enable Kubernetes backend with default settings." json:"kubernetesCRD,omitempty" toml:"kubernetesCRD,omitempty" yaml:"kubernetesCRD,omitempty" export:"true" label:"allowEmpty"` + Rest *rest.Provider `description:"Enable Rest backend with default settings." json:"rest,omitempty" toml:"rest,omitempty" yaml:"rest,omitempty" export:"true" label:"allowEmpty"` + Rancher *rancher.Provider `description:"Enable Rancher backend with default settings." json:"rancher,omitempty" toml:"rancher,omitempty" yaml:"rancher,omitempty" export:"true" label:"allowEmpty"` } // SetEffectiveConfiguration adds missing configuration parameters derived from existing ones. diff --git a/pkg/metrics/datadog.go b/pkg/metrics/datadog.go index e2118cead..5e3567059 100644 --- a/pkg/metrics/datadog.go +++ b/pkg/metrics/datadog.go @@ -35,7 +35,7 @@ const ( ) // RegisterDatadog registers the metrics pusher if this didn't happen yet and creates a datadog Registry instance. -func RegisterDatadog(ctx context.Context, config *types.Datadog) Registry { +func RegisterDatadog(ctx context.Context, config *types.DataDog) Registry { if datadogTicker == nil { datadogTicker = initDatadogClient(ctx, config) } @@ -59,7 +59,7 @@ func RegisterDatadog(ctx context.Context, config *types.Datadog) Registry { return registry } -func initDatadogClient(ctx context.Context, config *types.Datadog) *time.Ticker { +func initDatadogClient(ctx context.Context, config *types.DataDog) *time.Ticker { address := config.Address if len(address) == 0 { address = "localhost:8125" diff --git a/pkg/metrics/datadog_test.go b/pkg/metrics/datadog_test.go index e45976c13..c8618c01b 100644 --- a/pkg/metrics/datadog_test.go +++ b/pkg/metrics/datadog_test.go @@ -16,7 +16,7 @@ func TestDatadog(t *testing.T) { // This is needed to make sure that UDP Listener listens for data a bit longer, otherwise it will quit after a millisecond udp.Timeout = 5 * time.Second - datadogRegistry := RegisterDatadog(context.Background(), &types.Datadog{Address: ":18125", PushInterval: types.Duration(time.Second)}) + datadogRegistry := RegisterDatadog(context.Background(), &types.DataDog{Address: ":18125", PushInterval: types.Duration(time.Second)}) defer StopDatadog() if !datadogRegistry.IsEnabled() { diff --git a/pkg/ping/ping.go b/pkg/ping/ping.go index 0daf65499..50e7b4708 100644 --- a/pkg/ping/ping.go +++ b/pkg/ping/ping.go @@ -10,8 +10,8 @@ import ( // Handler expose ping routes. type Handler struct { - EntryPoint string `description:"Ping entryPoint." export:"true"` - Middlewares []string `description:"Middleware list." export:"true"` + EntryPoint string `description:"Ping entryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` + Middlewares []string `description:"Middleware list." json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty" export:"true"` terminating bool } diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index 39e2ba072..75b6ff03b 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -38,17 +38,17 @@ var ( // Configuration holds ACME configuration provided by users type Configuration struct { - Email string `description:"Email address used for registration."` - ACMELogging bool `description:"Enable debug logging of ACME actions."` - CAServer string `description:"CA server to use."` - Storage string `description:"Storage to use."` - EntryPoint string `description:"EntryPoint to use."` - KeyType string `description:"KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'."` - OnHostRule bool `description:"Enable certificate generation on router Host rules."` - DNSChallenge *DNSChallenge `description:"Activate DNS-01 Challenge." label:"allowEmpty"` - HTTPChallenge *HTTPChallenge `description:"Activate HTTP-01 Challenge." label:"allowEmpty"` - TLSChallenge *TLSChallenge `description:"Activate TLS-ALPN-01 Challenge." label:"allowEmpty"` - Domains []types.Domain `description:"The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge."` + Email string `description:"Email address used for registration." json:"email,omitempty" toml:"email,omitempty" yaml:"email,omitempty"` + ACMELogging bool `description:"Enable debug logging of ACME actions." json:"acmeLogging,omitempty" toml:"acmeLogging,omitempty" yaml:"acmeLogging,omitempty"` + CAServer string `description:"CA server to use." json:"caServer,omitempty" toml:"caServer,omitempty" yaml:"caServer,omitempty"` + Storage string `description:"Storage to use." json:"storage,omitempty" toml:"storage,omitempty" yaml:"storage,omitempty"` + EntryPoint string `description:"EntryPoint to use." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty"` + KeyType string `description:"KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'." json:"keyType,omitempty" toml:"keyType,omitempty" yaml:"keyType,omitempty"` + OnHostRule bool `description:"Enable certificate generation on router Host rules." json:"onHostRule,omitempty" toml:"onHostRule,omitempty" yaml:"onHostRule,omitempty"` + DNSChallenge *DNSChallenge `description:"Activate DNS-01 Challenge." json:"dnsChallenge,omitempty" toml:"dnsChallenge,omitempty" yaml:"dnsChallenge,omitempty" label:"allowEmpty"` + HTTPChallenge *HTTPChallenge `description:"Activate HTTP-01 Challenge." json:"httpChallenge,omitempty" toml:"httpChallenge,omitempty" yaml:"httpChallenge,omitempty" label:"allowEmpty"` + TLSChallenge *TLSChallenge `description:"Activate TLS-ALPN-01 Challenge." json:"tlsChallenge,omitempty" toml:"tlsChallenge,omitempty" yaml:"tlsChallenge,omitempty" label:"allowEmpty"` + Domains []types.Domain `description:"The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge." json:"domains,omitempty" toml:"domains,omitempty" yaml:"domains,omitempty"` } // SetDefaults sets the default values. @@ -60,22 +60,22 @@ func (a *Configuration) SetDefaults() { // Certificate is a struct which contains all data needed from an ACME certificate type Certificate struct { - Domain types.Domain - Certificate []byte - Key []byte + Domain types.Domain `json:"domain,omitempty" toml:"domain,omitempty" yaml:"domain,omitempty"` + Certificate []byte `json:"certificate,omitempty" toml:"certificate,omitempty" yaml:"certificate,omitempty"` + Key []byte `json:"key,omitempty" toml:"key,omitempty" yaml:"key,omitempty"` } // DNSChallenge contains DNS challenge Configuration type DNSChallenge struct { - Provider string `description:"Use a DNS-01 based challenge provider rather than HTTPS."` - DelayBeforeCheck types.Duration `description:"Assume DNS propagates after a delay in seconds rather than finding and querying nameservers."` - Resolvers []string `description:"Use following DNS servers to resolve the FQDN authority."` - DisablePropagationCheck bool `description:"Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended]"` + Provider string `description:"Use a DNS-01 based challenge provider rather than HTTPS." json:"provider,omitempty" toml:"provider,omitempty" yaml:"provider,omitempty"` + DelayBeforeCheck types.Duration `description:"Assume DNS propagates after a delay in seconds rather than finding and querying nameservers." json:"delayBeforeCheck,omitempty" toml:"delayBeforeCheck,omitempty" yaml:"delayBeforeCheck,omitempty"` + Resolvers []string `description:"Use following DNS servers to resolve the FQDN authority." json:"resolvers,omitempty" toml:"resolvers,omitempty" yaml:"resolvers,omitempty"` + DisablePropagationCheck bool `description:"Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended]" json:"disablePropagationCheck,omitempty" toml:"disablePropagationCheck,omitempty" yaml:"disablePropagationCheck,omitempty"` } // HTTPChallenge contains HTTP challenge Configuration type HTTPChallenge struct { - EntryPoint string `description:"HTTP challenge EntryPoint"` + EntryPoint string `description:"HTTP challenge EntryPoint" json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty"` } // TLSChallenge contains TLS challenge Configuration @@ -84,7 +84,7 @@ type TLSChallenge struct{} // Provider holds configurations of the provider. type Provider struct { *Configuration - Store Store + Store Store `json:"store,omitempty" toml:"store,omitempty" yaml:"store,omitempty"` certificates []*Certificate account *Account client *lego.Client diff --git a/pkg/provider/docker/docker.go b/pkg/provider/docker/docker.go index 3e4507647..7eaa48818 100644 --- a/pkg/provider/docker/docker.go +++ b/pkg/provider/docker/docker.go @@ -45,16 +45,16 @@ var _ provider.Provider = (*Provider)(nil) // Provider holds configurations of the provider. type Provider struct { - Constraints string `description:"Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container." export:"true"` - Watch bool `description:"Watch provider." export:"true"` - Endpoint string `description:"Docker server endpoint. Can be a tcp or a unix socket endpoint."` - DefaultRule string `description:"Default rule."` - TLS *types.ClientTLS `description:"Enable Docker TLS support." export:"true"` - ExposedByDefault bool `description:"Expose containers by default." export:"true"` - UseBindPortIP bool `description:"Use the ip address from the bound port, rather than from the inner network." export:"true"` - SwarmMode bool `description:"Use Docker on Swarm Mode." export:"true"` - Network string `description:"Default Docker network used." export:"true"` - SwarmModeRefreshSeconds types.Duration `description:"Polling interval for swarm mode." export:"true"` + Constraints string `description:"Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container." json:"constraints,omitempty" toml:"constraints,omitempty" yaml:"constraints,omitempty" export:"true"` + Watch bool `description:"Watch provider." json:"watch,omitempty" toml:"watch,omitempty" yaml:"watch,omitempty" export:"true"` + Endpoint string `description:"Docker server endpoint. Can be a tcp or a unix socket endpoint." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpoint,omitempty"` + DefaultRule string `description:"Default rule." json:"defaultRule,omitempty" toml:"defaultRule,omitempty" yaml:"defaultRule,omitempty"` + TLS *types.ClientTLS `description:"Enable Docker TLS support." json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" export:"true"` + ExposedByDefault bool `description:"Expose containers by default." json:"exposedByDefault,omitempty" toml:"exposedByDefault,omitempty" yaml:"exposedByDefault,omitempty" export:"true"` + UseBindPortIP bool `description:"Use the ip address from the bound port, rather than from the inner network." json:"useBindPortIP,omitempty" toml:"useBindPortIP,omitempty" yaml:"useBindPortIP,omitempty" export:"true"` + SwarmMode bool `description:"Use Docker on Swarm Mode." json:"swarmMode,omitempty" toml:"swarmMode,omitempty" yaml:"swarmMode,omitempty" export:"true"` + Network string `description:"Default Docker network used." json:"network,omitempty" toml:"network,omitempty" yaml:"network,omitempty" export:"true"` + SwarmModeRefreshSeconds types.Duration `description:"Polling interval for swarm mode." json:"swarmModeRefreshSeconds,omitempty" toml:"swarmModeRefreshSeconds,omitempty" yaml:"swarmModeRefreshSeconds,omitempty" export:"true"` defaultRuleTpl *template.Template } diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index cceb93fbb..2d64b0375 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -28,11 +28,11 @@ var _ provider.Provider = (*Provider)(nil) // Provider holds configurations of the provider. type Provider struct { - Directory string `description:"Load configuration from one or more .toml files in a directory." export:"true"` - Watch bool `description:"Watch provider." export:"true"` - Filename string `description:"Override default configuration template. For advanced users :)" export:"true"` - DebugLogGeneratedTemplate bool `description:"Enable debug logging of generated configuration template." export:"true"` - TraefikFile string `description:"-"` + Directory string `description:"Load configuration from one or more .toml files in a directory." json:"directory,omitempty" toml:"directory,omitempty" yaml:"directory,omitempty" export:"true"` + Watch bool `description:"Watch provider." json:"watch,omitempty" toml:"watch,omitempty" yaml:"watch,omitempty" export:"true"` + Filename string `description:"Override default configuration template. For advanced users :)" json:"filename,omitempty" toml:"filename,omitempty" yaml:"filename,omitempty" export:"true"` + DebugLogGeneratedTemplate bool `description:"Enable debug logging of generated configuration template." json:"debugLogGeneratedTemplate,omitempty" toml:"debugLogGeneratedTemplate,omitempty" yaml:"debugLogGeneratedTemplate,omitempty" export:"true"` + TraefikFile string `description:"-" json:"traefikFile,omitempty" toml:"traefikFile,omitempty" yaml:"traefikFile,omitempty"` } // SetDefaults sets the default values. diff --git a/pkg/provider/file/fixtures/toml/dir01_file01.toml b/pkg/provider/file/fixtures/toml/dir01_file01.toml index 64f84722a..a695df25f 100644 --- a/pkg/provider/file/fixtures/toml/dir01_file01.toml +++ b/pkg/provider/file/fixtures/toml/dir01_file01.toml @@ -1,7 +1,7 @@ [http.routers] -[http.routers."router1"] - service = "application-1" + [http.routers."router1"] + service = "application-1" -[http.routers."router2"] - service = "application-2" + [http.routers."router2"] + service = "application-2" diff --git a/pkg/provider/file/fixtures/toml/dir01_file02.toml b/pkg/provider/file/fixtures/toml/dir01_file02.toml index 6eb6d31d5..3fed5e860 100644 --- a/pkg/provider/file/fixtures/toml/dir01_file02.toml +++ b/pkg/provider/file/fixtures/toml/dir01_file02.toml @@ -1,13 +1,13 @@ [http.services] -[http.services.application-1.loadbalancer] - [[http.services.application-1.loadbalancer.servers]] - url = "http://172.17.0.1:80" +[http.services.application-1.loadBalancer] + [[http.services.application-1.loadBalancer.servers]] + url = "http://172.17.0.1:80" -[http.services.application-2.loadbalancer] - [[http.services.application-2.loadbalancer.servers]] - url = "http://172.17.0.2:80" +[http.services.application-2.loadBalancer] + [[http.services.application-2.loadBalancer.servers]] + url = "http://172.17.0.2:80" -[http.services.application-3.loadbalancer] - [[http.services.application-3.loadbalancer.servers]] - url = "http://172.17.0.3:80" +[http.services.application-3.loadBalancer] + [[http.services.application-3.loadBalancer.servers]] + url = "http://172.17.0.3:80" diff --git a/pkg/provider/file/fixtures/toml/dir01_file03.toml b/pkg/provider/file/fixtures/toml/dir01_file03.toml index 7d5a35e0d..6cfb2635c 100644 --- a/pkg/provider/file/fixtures/toml/dir01_file03.toml +++ b/pkg/provider/file/fixtures/toml/dir01_file03.toml @@ -1,17 +1,17 @@ -[TLS] +[tls] -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest1.com.cert" - KeyFile = "integration/fixtures/https/snitest1.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest1.com.cert" + keyFile = "integration/fixtures/https/snitest1.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest2.com.cert" - KeyFile = "integration/fixtures/https/snitest2.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest2.com.cert" + keyFile = "integration/fixtures/https/snitest2.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest3.com.cert" - KeyFile = "integration/fixtures/https/snitest3.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest3.com.cert" + keyFile = "integration/fixtures/https/snitest3.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest4.com.cert" - KeyFile = "integration/fixtures/https/snitest4.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest4.com.cert" + keyFile = "integration/fixtures/https/snitest4.com.key" diff --git a/pkg/provider/file/fixtures/toml/simple_file_01.toml b/pkg/provider/file/fixtures/toml/simple_file_01.toml index 287597951..bb3df5d87 100644 --- a/pkg/provider/file/fixtures/toml/simple_file_01.toml +++ b/pkg/provider/file/fixtures/toml/simple_file_01.toml @@ -1,57 +1,58 @@ [http.routers] -[http.routers."router1"] - service = "application-1" - -[http.routers."router2"] - service = "application-2" - -[http.routers."router3"] - service = "application-3" + [http.routers."router1"] + service = "application-1" + + [http.routers."router2"] + service = "application-2" + + [http.routers."router3"] + service = "application-3" + [http.services] -[http.services.application-1.loadbalancer] - [[http.services.application-1.loadbalancer.servers]] - url = "http://172.17.0.1:80" + [http.services.application-1.loadBalancer] + [[http.services.application-1.loadBalancer.servers]] + url = "http://172.17.0.1:80" -[http.services.application-2.loadbalancer] - [[http.services.application-2.loadbalancer.servers]] - url = "http://172.17.0.2:80" + [http.services.application-2.loadBalancer] + [[http.services.application-2.loadBalancer.servers]] + url = "http://172.17.0.2:80" -[http.services.application-3.loadbalancer] - [[http.services.application-3.loadbalancer.servers]] - url = "http://172.17.0.3:80" + [http.services.application-3.loadBalancer] + [[http.services.application-3.loadBalancer.servers]] + url = "http://172.17.0.3:80" -[http.services.application-4.loadbalancer] - [[http.services.application-4.loadbalancer.servers]] - url = "http://172.17.0.4:80" + [http.services.application-4.loadBalancer] + [[http.services.application-4.loadBalancer.servers]] + url = "http://172.17.0.4:80" -[http.services.application-5.loadbalancer] - [[http.services.application-5.loadbalancer.servers]] - url = "http://172.17.0.5:80" + [http.services.application-5.loadBalancer] + [[http.services.application-5.loadBalancer.servers]] + url = "http://172.17.0.5:80" -[http.services.application-6.loadbalancer] - [[http.services.application-6.loadbalancer.servers]] - url = "http://172.17.0.6:80" + [http.services.application-6.loadBalancer] + [[http.services.application-6.loadBalancer.servers]] + url = "http://172.17.0.6:80" -[TLS] +[tls] -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest1.com.cert" - KeyFile = "integration/fixtures/https/snitest1.com.key" + [[tls.certificates]] + certFile = "integration/fixtures/https/snitest1.com.cert" + keyFile = "integration/fixtures/https/snitest1.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest2.com.cert" - KeyFile = "integration/fixtures/https/snitest2.com.key" + [[tls.certificates]] + certFile = "integration/fixtures/https/snitest2.com.cert" + keyFile = "integration/fixtures/https/snitest2.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest3.com.cert" - KeyFile = "integration/fixtures/https/snitest3.com.key" + [[tls.certificates]] + certFile = "integration/fixtures/https/snitest3.com.cert" + keyFile = "integration/fixtures/https/snitest3.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest4.com.cert" - KeyFile = "integration/fixtures/https/snitest4.com.key" + [[tls.certificates]] + certFile = "integration/fixtures/https/snitest4.com.cert" + keyFile = "integration/fixtures/https/snitest4.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest5.com.cert" - KeyFile = "integration/fixtures/https/snitest5.com.key" + [[tls.certificates]] + certFile = "integration/fixtures/https/snitest5.com.cert" + keyFile = "integration/fixtures/https/snitest5.com.key" diff --git a/pkg/provider/file/fixtures/toml/simple_file_02.toml b/pkg/provider/file/fixtures/toml/simple_file_02.toml index 2b4feb4a4..947d3d64d 100644 --- a/pkg/provider/file/fixtures/toml/simple_file_02.toml +++ b/pkg/provider/file/fixtures/toml/simple_file_02.toml @@ -1,64 +1,65 @@ [http.routers] -[http.routers."router1"] - service = "application-1" + [http.routers."router1"] + service = "application-1" -[http.routers."router2"] - service = "application-2" + [http.routers."router2"] + service = "application-2" -[http.routers."router3"] - service = "application-3" + [http.routers."router3"] + service = "application-3" + + [http.routers."router4"] + service = "application-4" -[http.routers."router4"] - service = "application-4" [http.services] -[http.services.application-1.loadbalancer] - [[http.services.application-1.loadbalancer.servers]] - url = "http://172.17.0.1:80" + [http.services.application-1.loadBalancer] + [[http.services.application-1.loadBalancer.servers]] + url = "http://172.17.0.1:80" -[http.services.application-2.loadbalancer] - [[http.services.application-2.loadbalancer.servers]] - url = "http://172.17.0.2:80" + [http.services.application-2.loadBalancer] + [[http.services.application-2.loadBalancer.servers]] + url = "http://172.17.0.2:80" -[http.services.application-3.loadbalancer] - [[http.services.application-3.loadbalancer.servers]] - url = "http://172.17.0.3:80" + [http.services.application-3.loadBalancer] + [[http.services.application-3.loadBalancer.servers]] + url = "http://172.17.0.3:80" -[http.services.application-4.loadbalancer] - [[http.services.application-4.loadbalancer.servers]] - url = "http://172.17.0.4:80" + [http.services.application-4.loadBalancer] + [[http.services.application-4.loadBalancer.servers]] + url = "http://172.17.0.4:80" -[http.services.application-5.loadbalancer] - [[http.services.application-5.loadbalancer.servers]] - url = "http://172.17.0.5:80" + [http.services.application-5.loadBalancer] + [[http.services.application-5.loadBalancer.servers]] + url = "http://172.17.0.5:80" -[http.services.application-6.loadbalancer] - [[http.services.application-6.loadbalancer.servers]] - url = "http://172.17.0.6:80" + [http.services.application-6.loadBalancer] + [[http.services.application-6.loadBalancer.servers]] + url = "http://172.17.0.6:80" -[http.services.application-7.loadbalancer] - [[http.services.application-7.loadbalancer.servers]] - url = "http://172.17.0.7:80" + [http.services.application-7.loadBalancer] + [[http.services.application-7.loadBalancer.servers]] + url = "http://172.17.0.7:80" -[http.services.application-8.loadbalancer] - [[http.services.application-8.loadbalancer.servers]] - url = "http://172.17.0.8:80" + [http.services.application-8.loadBalancer] + [[http.services.application-8.loadBalancer.servers]] + url = "http://172.17.0.8:80" -[TLS] +[tls] -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest1.com.cert" - KeyFile = "integration/fixtures/https/snitest1.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest1.com.cert" + keyFile = "integration/fixtures/https/snitest1.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest2.com.cert" - KeyFile = "integration/fixtures/https/snitest2.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest2.com.cert" + keyFile = "integration/fixtures/https/snitest2.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest3.com.cert" - KeyFile = "integration/fixtures/https/snitest3.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest3.com.cert" + keyFile = "integration/fixtures/https/snitest3.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest4.com.cert" - KeyFile = "integration/fixtures/https/snitest4.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest4.com.cert" + keyFile = "integration/fixtures/https/snitest4.com.key" diff --git a/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml b/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml index dcc1c678d..023ca4109 100644 --- a/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml +++ b/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml @@ -1,40 +1,44 @@ [providers.file] +## dynamic configuration ## + [http.routers] -[http.routers."router1"] - service = "application-1" + [http.routers."router1"] + service = "application-1" + + [http.routers."router2"] + service = "application-2" + -[http.routers."router2"] - service = "application-2" [http.services] -[http.services.application-1.loadbalancer] - [[http.services.application-1.loadbalancer.servers]] - url = "http://172.17.0.1:80" + [http.services.application-1.loadBalancer] + [[http.services.application-1.loadBalancer.servers]] + url = "http://172.17.0.1:80" -[http.services.application-2.loadbalancer] - [[http.services.application-2.loadbalancer.servers]] - url = "http://172.17.0.2:80" + [http.services.application-2.loadBalancer] + [[http.services.application-2.loadBalancer.servers]] + url = "http://172.17.0.2:80" -[http.services.application-3.loadbalancer] - [[http.services.application-3.loadbalancer.servers]] - url = "http://172.17.0.3:80" + [http.services.application-3.loadBalancer] + [[http.services.application-3.loadBalancer.servers]] + url = "http://172.17.0.3:80" -[TLS] +[tls] -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest1.com.cert" - KeyFile = "integration/fixtures/https/snitest1.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest1.com.cert" + keyFile = "integration/fixtures/https/snitest1.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest2.com.cert" - KeyFile = "integration/fixtures/https/snitest2.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest2.com.cert" + keyFile = "integration/fixtures/https/snitest2.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest3.com.cert" - KeyFile = "integration/fixtures/https/snitest3.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest3.com.cert" + keyFile = "integration/fixtures/https/snitest3.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest4.com.cert" - KeyFile = "integration/fixtures/https/snitest4.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest4.com.cert" + keyFile = "integration/fixtures/https/snitest4.com.key" diff --git a/pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml b/pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml index c07e8601c..c99dc5610 100644 --- a/pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml +++ b/pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml @@ -2,41 +2,44 @@ temp="{{ getTag \"test\" }}" [providers.file] +## dynamic configuration ## + [http.routers] - + [http.routers."router1"] - service = "application-1" + service = "application-1" [http.routers."router2"] - service = "application-2" + service = "application-2" + [http.services] -[http.services.application-1.loadbalancer] - [[http.services.application-1.loadbalancer.servers]] - url = "http://172.17.0.1:80" + [http.services.application-1.loadBalancer] + [[http.services.application-1.loadBalancer.servers]] + url = "http://172.17.0.1:80" + + [http.services.application-2.loadBalancer] + [[http.services.application-2.loadBalancer.servers]] + url = "http://172.17.0.2:80" + + [http.services.application-3.loadBalancer] + [[http.services.application-3.loadBalancer.servers]] + url = "http://172.17.0.3:80" -[http.services.application-2.loadbalancer] - [[http.services.application-2.loadbalancer.servers]] - url = "http://172.17.0.2:80" +[tls] -[http.services.application-3.loadbalancer] - [[http.services.application-3.loadbalancer.servers]] - url = "http://172.17.0.3:80" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest1.com.cert" + keyFile = "integration/fixtures/https/snitest1.com.key" -[TLS] +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest2.com.cert" + keyFile = "integration/fixtures/https/snitest2.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest1.com.cert" - KeyFile = "integration/fixtures/https/snitest1.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest3.com.cert" + keyFile = "integration/fixtures/https/snitest3.com.key" -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest2.com.cert" - KeyFile = "integration/fixtures/https/snitest2.com.key" - -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest3.com.cert" - KeyFile = "integration/fixtures/https/snitest3.com.key" - -[[TLS.Certificates]] - CertFile = "integration/fixtures/https/snitest4.com.cert" - KeyFile = "integration/fixtures/https/snitest4.com.key" +[[tls.certificates]] + certFile = "integration/fixtures/https/snitest4.com.cert" + keyFile = "integration/fixtures/https/snitest4.com.key" diff --git a/pkg/provider/file/fixtures/yaml/dir01_file02.yml b/pkg/provider/file/fixtures/yaml/dir01_file02.yml index 65f706ff0..39fff3e75 100644 --- a/pkg/provider/file/fixtures/yaml/dir01_file02.yml +++ b/pkg/provider/file/fixtures/yaml/dir01_file02.yml @@ -1,14 +1,14 @@ http: services: application-1: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.1:80' application-2: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.2:80' application-3: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.3:80' diff --git a/pkg/provider/file/fixtures/yaml/dir01_file03.yml b/pkg/provider/file/fixtures/yaml/dir01_file03.yml index 3bd36db08..bcf46ba67 100644 --- a/pkg/provider/file/fixtures/yaml/dir01_file03.yml +++ b/pkg/provider/file/fixtures/yaml/dir01_file03.yml @@ -1,10 +1,10 @@ tls: certificates: - - certfile: integration/fixtures/https/snitest1.com.cert - keyfile: integration/fixtures/https/snitest1.com.key - - certfile: integration/fixtures/https/snitest2.com.cert - keyfile: integration/fixtures/https/snitest2.com.key - - certfile: integration/fixtures/https/snitest3.com.cert - keyfile: integration/fixtures/https/snitest3.com.key - - certfile: integration/fixtures/https/snitest4.com.cert - keyfile: integration/fixtures/https/snitest4.com.key + - certFile: integration/fixtures/https/snitest1.com.cert + keyFile: integration/fixtures/https/snitest1.com.key + - certFile: integration/fixtures/https/snitest2.com.cert + keyFile: integration/fixtures/https/snitest2.com.key + - certFile: integration/fixtures/https/snitest3.com.cert + keyFile: integration/fixtures/https/snitest3.com.key + - certFile: integration/fixtures/https/snitest4.com.cert + keyFile: integration/fixtures/https/snitest4.com.key diff --git a/pkg/provider/file/fixtures/yaml/simple_file_01.yml b/pkg/provider/file/fixtures/yaml/simple_file_01.yml index e1cd1cb5b..286565ff6 100644 --- a/pkg/provider/file/fixtures/yaml/simple_file_01.yml +++ b/pkg/provider/file/fixtures/yaml/simple_file_01.yml @@ -8,39 +8,39 @@ http: service: application-3 services: application-1: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.1:80' application-2: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.2:80' application-3: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.3:80' application-4: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.4:80' application-5: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.5:80' application-6: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.6:80' tls: certificates: - - certfile: integration/fixtures/https/snitest1.com.cert - keyfile: integration/fixtures/https/snitest1.com.key - - certfile: integration/fixtures/https/snitest2.com.cert - keyfile: integration/fixtures/https/snitest2.com.key - - certfile: integration/fixtures/https/snitest3.com.cert - keyfile: integration/fixtures/https/snitest3.com.key - - certfile: integration/fixtures/https/snitest4.com.cert - keyfile: integration/fixtures/https/snitest4.com.key - - certfile: integration/fixtures/https/snitest5.com.cert - keyfile: integration/fixtures/https/snitest5.com.key + - certFile: integration/fixtures/https/snitest1.com.cert + keyFile: integration/fixtures/https/snitest1.com.key + - certFile: integration/fixtures/https/snitest2.com.cert + keyFile: integration/fixtures/https/snitest2.com.key + - certFile: integration/fixtures/https/snitest3.com.cert + keyFile: integration/fixtures/https/snitest3.com.key + - certFile: integration/fixtures/https/snitest4.com.cert + keyFile: integration/fixtures/https/snitest4.com.key + - certFile: integration/fixtures/https/snitest5.com.cert + keyFile: integration/fixtures/https/snitest5.com.key diff --git a/pkg/provider/file/fixtures/yaml/simple_file_02.yml b/pkg/provider/file/fixtures/yaml/simple_file_02.yml index 6066f9a57..db147efd4 100644 --- a/pkg/provider/file/fixtures/yaml/simple_file_02.yml +++ b/pkg/provider/file/fixtures/yaml/simple_file_02.yml @@ -10,45 +10,44 @@ http: service: application-4 services: application-1: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.1:80' application-2: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.2:80' application-3: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.3:80' application-4: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.4:80' application-5: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.5:80' application-6: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.6:80' application-7: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.7:80' application-8: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.8:80' - tls: certificates: - - certfile: integration/fixtures/https/snitest1.com.cert - keyfile: integration/fixtures/https/snitest1.com.key - - certfile: integration/fixtures/https/snitest2.com.cert - keyfile: integration/fixtures/https/snitest2.com.key - - certfile: integration/fixtures/https/snitest3.com.cert - keyfile: integration/fixtures/https/snitest3.com.key - - certfile: integration/fixtures/https/snitest4.com.cert - keyfile: integration/fixtures/https/snitest4.com.key \ No newline at end of file + - certFile: integration/fixtures/https/snitest1.com.cert + keyFile: integration/fixtures/https/snitest1.com.key + - certFile: integration/fixtures/https/snitest2.com.cert + keyFile: integration/fixtures/https/snitest2.com.key + - certFile: integration/fixtures/https/snitest3.com.cert + keyFile: integration/fixtures/https/snitest3.com.key + - certFile: integration/fixtures/https/snitest4.com.cert + keyFile: integration/fixtures/https/snitest4.com.key diff --git a/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml b/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml index 4d6f87160..1d9979eb9 100644 --- a/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml +++ b/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml @@ -8,25 +8,25 @@ http: service: application-2 services: application-1: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.1:80' application-2: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.2:80' application-3: - loadbalancer: + loadBalancer: servers: - url: 'http://172.17.0.3:80' tls: certificates: - - certfile: integration/fixtures/https/snitest1.com.cert - keyfile: integration/fixtures/https/snitest1.com.key - - certfile: integration/fixtures/https/snitest2.com.cert - keyfile: integration/fixtures/https/snitest2.com.key - - certfile: integration/fixtures/https/snitest3.com.cert - keyfile: integration/fixtures/https/snitest3.com.key - - certfile: integration/fixtures/https/snitest4.com.cert - keyfile: integration/fixtures/https/snitest4.com.key \ No newline at end of file + - certFile: integration/fixtures/https/snitest1.com.cert + keyFile: integration/fixtures/https/snitest1.com.key + - certFile: integration/fixtures/https/snitest2.com.cert + keyFile: integration/fixtures/https/snitest2.com.key + - certFile: integration/fixtures/https/snitest3.com.cert + keyFile: integration/fixtures/https/snitest3.com.key + - certFile: integration/fixtures/https/snitest4.com.cert + keyFile: integration/fixtures/https/snitest4.com.key diff --git a/pkg/provider/file/fixtures/yaml/template_in_directory_file02.yml b/pkg/provider/file/fixtures/yaml/template_in_directory_file02.yml index 8c2d94c03..36cf2e202 100644 --- a/pkg/provider/file/fixtures/yaml/template_in_directory_file02.yml +++ b/pkg/provider/file/fixtures/yaml/template_in_directory_file02.yml @@ -2,7 +2,7 @@ http: services: {{ range $i, $e := until 20 }} application-{{ $e }}: - loadbalancer: + loadBalancer: servers: - url: 'http://127.0.0.1' {{ end }} diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 07c3e7610..8a4c277e1 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -31,13 +31,13 @@ const ( // Provider holds configurations of the provider. type Provider struct { - Endpoint string `description:"Kubernetes server endpoint (required for external cluster client)."` - Token string `description:"Kubernetes bearer token (not needed for in-cluster client)."` - CertAuthFilePath string `description:"Kubernetes certificate authority file path (not needed for in-cluster client)."` - DisablePassHostHeaders bool `description:"Kubernetes disable PassHost Headers." export:"true"` - Namespaces []string `description:"Kubernetes namespaces." export:"true"` - LabelSelector string `description:"Kubernetes label selector to use." export:"true"` - IngressClass string `description:"Value of kubernetes.io/ingress.class annotation to watch for." export:"true"` + Endpoint string `description:"Kubernetes server endpoint (required for external cluster client)." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpoint,omitempty"` + Token string `description:"Kubernetes bearer token (not needed for in-cluster client)." json:"token,omitempty" toml:"token,omitempty" yaml:"token,omitempty"` + CertAuthFilePath string `description:"Kubernetes certificate authority file path (not needed for in-cluster client)." json:"certAuthFilePath,omitempty" toml:"certAuthFilePath,omitempty" yaml:"certAuthFilePath,omitempty"` + DisablePassHostHeaders bool `description:"Kubernetes disable PassHost Headers." json:"disablePassHostHeaders,omitempty" toml:"disablePassHostHeaders,omitempty" yaml:"disablePassHostHeaders,omitempty" export:"true"` + Namespaces []string `description:"Kubernetes namespaces." json:"namespaces,omitempty" toml:"namespaces,omitempty" yaml:"namespaces,omitempty" export:"true"` + LabelSelector string `description:"Kubernetes label selector to use." json:"labelSelector,omitempty" toml:"labelSelector,omitempty" yaml:"labelSelector,omitempty" export:"true"` + IngressClass string `description:"Value of kubernetes.io/ingress.class annotation to watch for." json:"ingressClass,omitempty" toml:"ingressClass,omitempty" yaml:"ingressClass,omitempty" export:"true"` lastConfiguration safe.Safe } diff --git a/pkg/provider/kubernetes/ingress/kubernetes.go b/pkg/provider/kubernetes/ingress/kubernetes.go index 7f4b24c08..16bfc30d1 100644 --- a/pkg/provider/kubernetes/ingress/kubernetes.go +++ b/pkg/provider/kubernetes/ingress/kubernetes.go @@ -32,22 +32,22 @@ const ( // Provider holds configurations of the provider. type Provider struct { - Endpoint string `description:"Kubernetes server endpoint (required for external cluster client)."` - Token string `description:"Kubernetes bearer token (not needed for in-cluster client)."` - CertAuthFilePath string `description:"Kubernetes certificate authority file path (not needed for in-cluster client)."` - DisablePassHostHeaders bool `description:"Kubernetes disable PassHost Headers." export:"true"` - Namespaces []string `description:"Kubernetes namespaces." export:"true"` - LabelSelector string `description:"Kubernetes Ingress label selector to use." export:"true"` - IngressClass string `description:"Value of kubernetes.io/ingress.class annotation to watch for." export:"true"` - IngressEndpoint *EndpointIngress `description:"Kubernetes Ingress Endpoint."` + Endpoint string `description:"Kubernetes server endpoint (required for external cluster client)." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpoint,omitempty"` + Token string `description:"Kubernetes bearer token (not needed for in-cluster client)." json:"token,omitempty" toml:"token,omitempty" yaml:"token,omitempty"` + CertAuthFilePath string `description:"Kubernetes certificate authority file path (not needed for in-cluster client)." json:"certAuthFilePath,omitempty" toml:"certAuthFilePath,omitempty" yaml:"certAuthFilePath,omitempty"` + DisablePassHostHeaders bool `description:"Kubernetes disable PassHost Headers." json:"disablePassHostHeaders,omitempty" toml:"disablePassHostHeaders,omitempty" yaml:"disablePassHostHeaders,omitempty" export:"true"` + Namespaces []string `description:"Kubernetes namespaces." json:"namespaces,omitempty" toml:"namespaces,omitempty" yaml:"namespaces,omitempty" export:"true"` + LabelSelector string `description:"Kubernetes Ingress label selector to use." json:"labelSelector,omitempty" toml:"labelSelector,omitempty" yaml:"labelSelector,omitempty" export:"true"` + IngressClass string `description:"Value of kubernetes.io/ingress.class annotation to watch for." json:"ingressClass,omitempty" toml:"ingressClass,omitempty" yaml:"ingressClass,omitempty" export:"true"` + IngressEndpoint *EndpointIngress `description:"Kubernetes Ingress Endpoint." json:"ingressEndpoint,omitempty" toml:"ingressEndpoint,omitempty" yaml:"ingressEndpoint,omitempty"` lastConfiguration safe.Safe } // EndpointIngress holds the endpoint information for the Kubernetes provider type EndpointIngress struct { - IP string `description:"IP used for Kubernetes Ingress endpoints."` - Hostname string `description:"Hostname used for Kubernetes Ingress endpoints."` - PublishedService string `description:"Published Kubernetes Service to copy status from."` + IP string `description:"IP used for Kubernetes Ingress endpoints." json:"ip,omitempty" toml:"ip,omitempty" yaml:"ip,omitempty"` + Hostname string `description:"Hostname used for Kubernetes Ingress endpoints." json:"hostname,omitempty" toml:"hostname,omitempty" yaml:"hostname,omitempty"` + PublishedService string `description:"Published Kubernetes Service to copy status from." json:"publishedService,omitempty" toml:"publishedService,omitempty" yaml:"publishedService,omitempty"` } func (p *Provider) newK8sClient(ctx context.Context, ingressLabelSelector string) (*clientWrapper, error) { diff --git a/pkg/provider/marathon/marathon.go b/pkg/provider/marathon/marathon.go index 5fb64ccd7..b08d7f425 100644 --- a/pkg/provider/marathon/marathon.go +++ b/pkg/provider/marathon/marathon.go @@ -45,21 +45,21 @@ var _ provider.Provider = (*Provider)(nil) // Provider holds configuration of the provider. type Provider struct { - Constraints string `description:"Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application." export:"true"` - Trace bool `description:"Display additional provider logs." export:"true"` - Watch bool `description:"Watch provider." export:"true"` - Endpoint string `description:"Marathon server endpoint. You can also specify multiple endpoint for Marathon." export:"true"` - DefaultRule string `description:"Default rule."` - ExposedByDefault bool `description:"Expose Marathon apps by default." export:"true"` - DCOSToken string `description:"DCOSToken for DCOS environment, This will override the Authorization header." export:"true"` - TLS *types.ClientTLS `description:"Enable TLS support." export:"true"` - DialerTimeout types.Duration `description:"Set a dialer timeout for Marathon." export:"true"` - ResponseHeaderTimeout types.Duration `description:"Set a response header timeout for Marathon." export:"true"` - TLSHandshakeTimeout types.Duration `description:"Set a TLS handshake timeout for Marathon." export:"true"` - KeepAlive types.Duration `description:"Set a TCP Keep Alive time." export:"true"` - ForceTaskHostname bool `description:"Force to use the task's hostname." export:"true"` - Basic *Basic `description:"Enable basic authentication." export:"true"` - RespectReadinessChecks bool `description:"Filter out tasks with non-successful readiness checks during deployments." export:"true"` + Constraints string `description:"Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application." json:"constraints,omitempty" toml:"constraints,omitempty" yaml:"constraints,omitempty" export:"true"` + Trace bool `description:"Display additional provider logs." json:"trace,omitempty" toml:"trace,omitempty" yaml:"trace,omitempty" export:"true"` + Watch bool `description:"Watch provider." json:"watch,omitempty" toml:"watch,omitempty" yaml:"watch,omitempty" export:"true"` + Endpoint string `description:"Marathon server endpoint. You can also specify multiple endpoint for Marathon." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpoint,omitempty" export:"true"` + DefaultRule string `description:"Default rule." json:"defaultRule,omitempty" toml:"defaultRule,omitempty" yaml:"defaultRule,omitempty"` + ExposedByDefault bool `description:"Expose Marathon apps by default." json:"exposedByDefault,omitempty" toml:"exposedByDefault,omitempty" yaml:"exposedByDefault,omitempty" export:"true"` + DCOSToken string `description:"DCOSToken for DCOS environment, This will override the Authorization header." json:"dcosToken,omitempty" toml:"dcosToken,omitempty" yaml:"dcosToken,omitempty" export:"true"` + TLS *types.ClientTLS `description:"Enable TLS support." json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" export:"true"` + DialerTimeout types.Duration `description:"Set a dialer timeout for Marathon." json:"dialerTimeout,omitempty" toml:"dialerTimeout,omitempty" yaml:"dialerTimeout,omitempty" export:"true"` + ResponseHeaderTimeout types.Duration `description:"Set a response header timeout for Marathon." json:"responseHeaderTimeout,omitempty" toml:"responseHeaderTimeout,omitempty" yaml:"responseHeaderTimeout,omitempty" export:"true"` + TLSHandshakeTimeout types.Duration `description:"Set a TLS handshake timeout for Marathon." json:"tlsHandshakeTimeout,omitempty" toml:"tlsHandshakeTimeout,omitempty" yaml:"tlsHandshakeTimeout,omitempty" export:"true"` + KeepAlive types.Duration `description:"Set a TCP Keep Alive time." json:"keepAlive,omitempty" toml:"keepAlive,omitempty" yaml:"keepAlive,omitempty" export:"true"` + ForceTaskHostname bool `description:"Force to use the task's hostname." json:"forceTaskHostname,omitempty" toml:"forceTaskHostname,omitempty" yaml:"forceTaskHostname,omitempty" export:"true"` + Basic *Basic `description:"Enable basic authentication." json:"basic,omitempty" toml:"basic,omitempty" yaml:"basic,omitempty" export:"true"` + RespectReadinessChecks bool `description:"Filter out tasks with non-successful readiness checks during deployments." json:"respectReadinessChecks,omitempty" toml:"respectReadinessChecks,omitempty" yaml:"respectReadinessChecks,omitempty" export:"true"` readyChecker *readinessChecker marathonClient marathon.Marathon defaultRuleTpl *template.Template @@ -79,8 +79,8 @@ func (p *Provider) SetDefaults() { // Basic holds basic authentication specific configurations type Basic struct { - HTTPBasicAuthUser string `description:"Basic authentication User."` - HTTPBasicPassword string `description:"Basic authentication Password."` + HTTPBasicAuthUser string `description:"Basic authentication User." json:"httpBasicAuthUser,omitempty" toml:"httpBasicAuthUser,omitempty" yaml:"httpBasicAuthUser,omitempty"` + HTTPBasicPassword string `description:"Basic authentication Password." json:"httpBasicPassword,omitempty" toml:"httpBasicPassword,omitempty" yaml:"httpBasicPassword,omitempty"` } // Init the provider diff --git a/pkg/provider/rancher/config_test.go b/pkg/provider/rancher/config_test.go index 0adff55f1..3cdf36f6e 100644 --- a/pkg/provider/rancher/config_test.go +++ b/pkg/provider/rancher/config_test.go @@ -496,7 +496,6 @@ func Test_buildConfiguration(t *testing.T) { }, }, expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ "foo": { diff --git a/pkg/provider/rancher/rancher.go b/pkg/provider/rancher/rancher.go index 76a3f9028..9d12ac6bc 100644 --- a/pkg/provider/rancher/rancher.go +++ b/pkg/provider/rancher/rancher.go @@ -40,14 +40,14 @@ var _ provider.Provider = (*Provider)(nil) // Provider holds configurations of the provider. type Provider struct { - Constraints string `description:"Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container." export:"true"` - Watch bool `description:"Watch provider." export:"true"` - DefaultRule string `description:"Default rule."` - ExposedByDefault bool `description:"Expose containers by default." export:"true"` - EnableServiceHealthFilter bool `description:"Filter services with unhealthy states and inactive states." export:"true"` - RefreshSeconds int `description:"Defines the polling interval in seconds." export:"true"` - IntervalPoll bool `description:"Poll the Rancher metadata service every 'rancher.refreshseconds' (less accurate)."` - Prefix string `description:"Prefix used for accessing the Rancher metadata service."` + Constraints string `description:"Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container." json:"constraints,omitempty" toml:"constraints,omitempty" yaml:"constraints,omitempty" export:"true"` + Watch bool `description:"Watch provider." json:"watch,omitempty" toml:"watch,omitempty" yaml:"watch,omitempty" export:"true"` + DefaultRule string `description:"Default rule." json:"defaultRule,omitempty" toml:"defaultRule,omitempty" yaml:"defaultRule,omitempty"` + ExposedByDefault bool `description:"Expose containers by default." json:"exposedByDefault,omitempty" toml:"exposedByDefault,omitempty" yaml:"exposedByDefault,omitempty" export:"true"` + EnableServiceHealthFilter bool `description:"Filter services with unhealthy states and inactive states." json:"enableServiceHealthFilter,omitempty" toml:"enableServiceHealthFilter,omitempty" yaml:"enableServiceHealthFilter,omitempty" export:"true"` + RefreshSeconds int `description:"Defines the polling interval in seconds." json:"refreshSeconds,omitempty" toml:"refreshSeconds,omitempty" yaml:"refreshSeconds,omitempty" export:"true"` + IntervalPoll bool `description:"Poll the Rancher metadata service every 'rancher.refreshseconds' (less accurate)." json:"intervalPoll,omitempty" toml:"intervalPoll,omitempty" yaml:"intervalPoll,omitempty"` + Prefix string `description:"Prefix used for accessing the Rancher metadata service." json:"prefix,omitempty" toml:"prefix,omitempty" yaml:"prefix,omitempty"` defaultRuleTpl *template.Template } diff --git a/pkg/provider/rest/rest.go b/pkg/provider/rest/rest.go index 02aa10c5f..b7cc8e065 100644 --- a/pkg/provider/rest/rest.go +++ b/pkg/provider/rest/rest.go @@ -19,7 +19,7 @@ var _ provider.Provider = (*Provider)(nil) // Provider is a provider.Provider implementation that provides a Rest API. type Provider struct { configurationChan chan<- config.Message - EntryPoint string `description:"EntryPoint." export:"true"` + EntryPoint string `description:"EntryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/server/server.go b/pkg/server/server.go index 093ee6e21..c84f1c84a 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -306,11 +306,11 @@ func registerMetricClients(metricsConfig *types.Metrics) metrics.Registry { } } - if metricsConfig.Datadog != nil { + if metricsConfig.DataDog != nil { ctx := log.With(context.Background(), log.Str(log.MetricsProviderName, "datadog")) - registries = append(registries, metrics.RegisterDatadog(ctx, metricsConfig.Datadog)) + registries = append(registries, metrics.RegisterDatadog(ctx, metricsConfig.DataDog)) log.FromContext(ctx).Debugf("Configured DataDog metrics: pushing to %s once every %s", - metricsConfig.Datadog.Address, metricsConfig.Datadog.PushInterval) + metricsConfig.DataDog.Address, metricsConfig.DataDog.PushInterval) } if metricsConfig.StatsD != nil { diff --git a/pkg/tls/certificate.go b/pkg/tls/certificate.go index 08d0d80a6..4b59fee49 100644 --- a/pkg/tls/certificate.go +++ b/pkg/tls/certificate.go @@ -57,8 +57,8 @@ var ( // Certificate holds a SSL cert/key pair // Certs and Key could be either a file path, or the file content itself type Certificate struct { - CertFile FileOrContent - KeyFile FileOrContent + CertFile FileOrContent `json:"certFile,omitempty" toml:"certFile,omitempty" yaml:"certFile,omitempty"` + KeyFile FileOrContent `json:"keyFile,omitempty" toml:"keyFile,omitempty" yaml:"keyFile,omitempty"` } // Certificates defines traefik certificates type diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go index e509e4b10..8b855fcba 100644 --- a/pkg/tls/tls.go +++ b/pkg/tls/tls.go @@ -5,25 +5,25 @@ const certificateHeader = "-----BEGIN CERTIFICATE-----\n" // ClientCA defines traefik CA files for a entryPoint // and it indicates if they are mandatory or have just to be analyzed if provided. type ClientCA struct { - Files []FileOrContent - Optional bool + Files []FileOrContent `json:"files,omitempty" toml:"files,omitempty" yaml:"files,omitempty"` + Optional bool `json:"optional,omitempty" toml:"optional,omitempty" yaml:"optional,omitempty"` } // Options configures TLS for an entry point type Options struct { - MinVersion string `export:"true"` - CipherSuites []string - ClientCA ClientCA - SniStrict bool `export:"true"` + MinVersion string `json:"minVersion,omitempty" toml:"minVersion,omitempty" yaml:"minVersion,omitempty" export:"true"` + CipherSuites []string `json:"cipherSuites,omitempty" toml:"cipherSuites,omitempty" yaml:"cipherSuites,omitempty"` + ClientCA ClientCA `json:"clientCA,omitempty" toml:"clientCA,omitempty" yaml:"clientCA,omitempty"` + SniStrict bool `json:"sniStrict,omitempty" toml:"sniStrict,omitempty" yaml:"sniStrict,omitempty" export:"true"` } // Store holds the options for a given Store type Store struct { - DefaultCertificate *Certificate + DefaultCertificate *Certificate `json:"defaultCertificate,omitempty" toml:"defaultCertificate,omitempty" yaml:"defaultCertificate,omitempty"` } // CertAndStores allows mapping a TLS certificate to a list of entry points. type CertAndStores struct { Certificate `yaml:",inline"` - Stores []string + Stores []string `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"` } diff --git a/pkg/tracing/datadog/datadog.go b/pkg/tracing/datadog/datadog.go index 70af78cdd..466df2ca9 100644 --- a/pkg/tracing/datadog/datadog.go +++ b/pkg/tracing/datadog/datadog.go @@ -15,14 +15,14 @@ const Name = "datadog" // Config provides configuration settings for a datadog tracer type Config struct { - LocalAgentHostPort string `description:"Set datadog-agent's host:port that the reporter will used." export:"false"` - GlobalTag string `description:"Key:Value tag to be set on all the spans." export:"true"` - Debug bool `description:"Enable DataDog debug." export:"true"` - PrioritySampling bool `description:"Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled."` - TraceIDHeaderName string `description:"Specifies the header name that will be used to store the trace ID." export:"true"` - ParentIDHeaderName string `description:"Specifies the header name that will be used to store the parent ID." export:"true"` - SamplingPriorityHeaderName string `description:"Specifies the header name that will be used to store the sampling priority." export:"true"` - BagagePrefixHeaderName string `description:"Specifies the header name prefix that will be used to store baggage items in a map." export:"true"` + LocalAgentHostPort string `description:"Set datadog-agent's host:port that the reporter will used." json:"localAgentHostPort,omitempty" toml:"localAgentHostPort,omitempty" yaml:"localAgentHostPort,omitempty"` + GlobalTag string `description:"Key:Value tag to be set on all the spans." json:"globalTag,omitempty" toml:"globalTag,omitempty" yaml:"globalTag,omitempty" export:"true"` + Debug bool `description:"Enable DataDog debug." json:"debug,omitempty" toml:"debug,omitempty" yaml:"debug,omitempty" export:"true"` + PrioritySampling bool `description:"Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled." json:"prioritySampling,omitempty" toml:"prioritySampling,omitempty" yaml:"prioritySampling,omitempty"` + TraceIDHeaderName string `description:"Specifies the header name that will be used to store the trace ID." json:"traceIDHeaderName,omitempty" toml:"traceIDHeaderName,omitempty" yaml:"traceIDHeaderName,omitempty" export:"true"` + ParentIDHeaderName string `description:"Specifies the header name that will be used to store the parent ID." json:"parentIDHeaderName,omitempty" toml:"parentIDHeaderName,omitempty" yaml:"parentIDHeaderName,omitempty" export:"true"` + SamplingPriorityHeaderName string `description:"Specifies the header name that will be used to store the sampling priority." json:"samplingPriorityHeaderName,omitempty" toml:"samplingPriorityHeaderName,omitempty" yaml:"samplingPriorityHeaderName,omitempty" export:"true"` + BagagePrefixHeaderName string `description:"Specifies the header name prefix that will be used to store baggage items in a map." json:"bagagePrefixHeaderName,omitempty" toml:"bagagePrefixHeaderName,omitempty" yaml:"bagagePrefixHeaderName,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/tracing/haystack/haystack.go b/pkg/tracing/haystack/haystack.go index 58a65be02..19038fff9 100644 --- a/pkg/tracing/haystack/haystack.go +++ b/pkg/tracing/haystack/haystack.go @@ -15,13 +15,13 @@ const Name = "haystack" // Config provides configuration settings for a haystack tracer type Config struct { - LocalAgentHost string `description:"Set haystack-agent's host that the reporter will used." export:"false"` - LocalAgentPort int `description:"Set haystack-agent's port that the reporter will used." export:"false"` - GlobalTag string `description:"Key:Value tag to be set on all the spans." export:"true"` - TraceIDHeaderName string `description:"Specifies the header name that will be used to store the trace ID." export:"true"` - ParentIDHeaderName string `description:"Specifies the header name that will be used to store the parent ID." export:"true"` - SpanIDHeaderName string `description:"Specifies the header name that will be used to store the span ID." export:"true"` - BaggagePrefixHeaderName string `description:"Specifies the header name prefix that will be used to store baggage items in a map." export:"true"` + LocalAgentHost string `description:"Set haystack-agent's host that the reporter will used." json:"localAgentHost,omitempty" toml:"localAgentHost,omitempty" yaml:"localAgentHost,omitempty"` + LocalAgentPort int `description:"Set haystack-agent's port that the reporter will used." json:"localAgentPort,omitempty" toml:"localAgentPort,omitempty" yaml:"localAgentPort,omitempty"` + GlobalTag string `description:"Key:Value tag to be set on all the spans." json:"globalTag,omitempty" toml:"globalTag,omitempty" yaml:"globalTag,omitempty" export:"true"` + TraceIDHeaderName string `description:"Specifies the header name that will be used to store the trace ID." json:"traceIDHeaderName,omitempty" toml:"traceIDHeaderName,omitempty" yaml:"traceIDHeaderName,omitempty" export:"true"` + ParentIDHeaderName string `description:"Specifies the header name that will be used to store the parent ID." json:"parentIDHeaderName,omitempty" toml:"parentIDHeaderName,omitempty" yaml:"parentIDHeaderName,omitempty" export:"true"` + SpanIDHeaderName string `description:"Specifies the header name that will be used to store the span ID." json:"spanIDHeaderName,omitempty" toml:"spanIDHeaderName,omitempty" yaml:"spanIDHeaderName,omitempty" export:"true"` + BaggagePrefixHeaderName string `description:"Specifies the header name prefix that will be used to store baggage items in a map." json:"baggagePrefixHeaderName,omitempty" toml:"baggagePrefixHeaderName,omitempty" yaml:"baggagePrefixHeaderName,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/tracing/instana/instana.go b/pkg/tracing/instana/instana.go index da66ea916..34df22f16 100644 --- a/pkg/tracing/instana/instana.go +++ b/pkg/tracing/instana/instana.go @@ -13,9 +13,9 @@ const Name = "instana" // Config provides configuration settings for a instana tracer type Config struct { - LocalAgentHost string `description:"Set instana-agent's host that the reporter will used." export:"false"` - LocalAgentPort int `description:"Set instana-agent's port that the reporter will used." export:"false"` - LogLevel string `description:"Set instana-agent's log level. ('error','warn','info','debug')" export:"false"` + LocalAgentHost string `description:"Set instana-agent's host that the reporter will used." json:"localAgentHost,omitempty" toml:"localAgentHost,omitempty" yaml:"localAgentHost,omitempty"` + LocalAgentPort int `description:"Set instana-agent's port that the reporter will used." json:"localAgentPort,omitempty" toml:"localAgentPort,omitempty" yaml:"localAgentPort,omitempty"` + LogLevel string `description:"Set instana-agent's log level. ('error','warn','info','debug')" json:"logLevel,omitempty" toml:"logLevel,omitempty" yaml:"logLevel,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/tracing/jaeger/jaeger.go b/pkg/tracing/jaeger/jaeger.go index 1aaf61ba5..458c7444a 100644 --- a/pkg/tracing/jaeger/jaeger.go +++ b/pkg/tracing/jaeger/jaeger.go @@ -18,13 +18,13 @@ const Name = "jaeger" // Config provides configuration settings for a jaeger tracer type Config struct { - SamplingServerURL string `description:"Set the sampling server url." export:"false"` - SamplingType string `description:"Set the sampling type." export:"true"` - SamplingParam float64 `description:"Set the sampling parameter." export:"true"` - LocalAgentHostPort string `description:"Set jaeger-agent's host:port that the reporter will used." export:"false"` - Gen128Bit bool `description:"Generate 128 bit span IDs." export:"true"` - Propagation string `description:"Which propgation format to use (jaeger/b3)." export:"true"` - TraceContextHeaderName string `description:"Set the header to use for the trace-id." export:"true"` + SamplingServerURL string `description:"Set the sampling server url." json:"samplingServerURL,omitempty" toml:"samplingServerURL,omitempty" yaml:"samplingServerURL,omitempty"` + SamplingType string `description:"Set the sampling type." json:"samplingType,omitempty" toml:"samplingType,omitempty" yaml:"samplingType,omitempty" export:"true"` + SamplingParam float64 `description:"Set the sampling parameter." json:"samplingParam,omitempty" toml:"samplingParam,omitempty" yaml:"samplingParam,omitempty" export:"true"` + LocalAgentHostPort string `description:"Set jaeger-agent's host:port that the reporter will used." json:"localAgentHostPort,omitempty" toml:"localAgentHostPort,omitempty" yaml:"localAgentHostPort,omitempty"` + Gen128Bit bool `description:"Generate 128 bit span IDs." json:"gen128Bit,omitempty" toml:"gen128Bit,omitempty" yaml:"gen128Bit,omitempty" export:"true"` + Propagation string `description:"Which propgation format to use (jaeger/b3)." json:"propagation,omitempty" toml:"propagation,omitempty" yaml:"propagation,omitempty" export:"true"` + TraceContextHeaderName string `description:"Set the header to use for the trace-id." json:"traceContextHeaderName,omitempty" toml:"traceContextHeaderName,omitempty" yaml:"traceContextHeaderName,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/tracing/zipkin/zipkin.go b/pkg/tracing/zipkin/zipkin.go index e2bc34c0f..3d246be9f 100644 --- a/pkg/tracing/zipkin/zipkin.go +++ b/pkg/tracing/zipkin/zipkin.go @@ -14,11 +14,11 @@ const Name = "zipkin" // Config provides configuration settings for a zipkin tracer. type Config struct { - HTTPEndpoint string `description:"HTTP Endpoint to report traces to." export:"false"` - SameSpan bool `description:"Use Zipkin SameSpan RPC style traces." export:"true"` - ID128Bit bool `description:"Use Zipkin 128 bit root span IDs." export:"true"` - Debug bool `description:"Enable Zipkin debug." export:"true"` - SampleRate float64 `description:"The rate between 0.0 and 1.0 of requests to trace." export:"true"` + HTTPEndpoint string `description:"HTTP Endpoint to report traces to." json:"httpEndpoint,omitempty" toml:"httpEndpoint,omitempty" yaml:"httpEndpoint,omitempty"` + SameSpan bool `description:"Use Zipkin SameSpan RPC style traces." json:"sameSpan,omitempty" toml:"sameSpan,omitempty" yaml:"sameSpan,omitempty" export:"true"` + ID128Bit bool `description:"Use Zipkin 128 bit root span IDs." json:"id128Bit,omitempty" toml:"id128Bit,omitempty" yaml:"id128Bit,omitempty" export:"true"` + Debug bool `description:"Enable Zipkin debug." json:"debug,omitempty" toml:"debug,omitempty" yaml:"debug,omitempty" export:"true"` + SampleRate float64 `description:"The rate between 0.0 and 1.0 of requests to trace." json:"sampleRate,omitempty" toml:"sampleRate,omitempty" yaml:"sampleRate,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/types/domains.go b/pkg/types/domains.go index 70b3a3904..0ebda7f59 100644 --- a/pkg/types/domains.go +++ b/pkg/types/domains.go @@ -7,8 +7,8 @@ import ( // Domain holds a domain name with SANs. type Domain struct { - Main string `description:"Default subject name."` - SANs []string `description:"Subject alternative names."` + Main string `description:"Default subject name." json:"main,omitempty" toml:"main,omitempty" yaml:"main,omitempty"` + SANs []string `description:"Subject alternative names." json:"sans,omitempty" toml:"sans,omitempty" yaml:"sans,omitempty"` } // ToStrArray convert a domain into an array of strings. diff --git a/pkg/types/host_resolver.go b/pkg/types/host_resolver.go index 0e5ad3b18..081fb7b34 100644 --- a/pkg/types/host_resolver.go +++ b/pkg/types/host_resolver.go @@ -2,9 +2,9 @@ package types // HostResolverConfig contain configuration for CNAME Flattening. type HostResolverConfig struct { - CnameFlattening bool `description:"A flag to enable/disable CNAME flattening" export:"true"` - ResolvConfig string `description:"resolv.conf used for DNS resolving" export:"true"` - ResolvDepth int `description:"The maximal depth of DNS recursive resolving" export:"true"` + CnameFlattening bool `description:"A flag to enable/disable CNAME flattening" json:"cnameFlattening,omitempty" toml:"cnameFlattening,omitempty" yaml:"cnameFlattening,omitempty" export:"true"` + ResolvConfig string `description:"resolv.conf used for DNS resolving" json:"resolvConfig,omitempty" toml:"resolvConfig,omitempty" yaml:"resolvConfig,omitempty" export:"true"` + ResolvDepth int `description:"The maximal depth of DNS recursive resolving" json:"resolvDepth,omitempty" toml:"resolvDepth,omitempty" yaml:"resolvDepth,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/types/logs.go b/pkg/types/logs.go index 716decf01..7c9f82906 100644 --- a/pkg/types/logs.go +++ b/pkg/types/logs.go @@ -19,9 +19,9 @@ const ( // TraefikLog holds the configuration settings for the traefik logger. type TraefikLog struct { - Level string `description:"Log level set to traefik logs." export:"true"` - FilePath string `json:"file,omitempty" description:"Traefik log file path. Stdout is used when omitted or empty."` - Format string `json:"format,omitempty" description:"Traefik log format: json | common"` + Level string `description:"Log level set to traefik logs." json:"level,omitempty" toml:"level,omitempty" yaml:"level,omitempty" export:"true"` + FilePath string `description:"Traefik log file path. Stdout is used when omitted or empty." json:"filePath,omitempty" toml:"filePath,omitempty" yaml:"filePath,omitempty"` + Format string `description:"Traefik log format: json | common" json:"format,omitempty" toml:"format,omitempty" yaml:"format,omitempty"` } // SetDefaults sets the default values. @@ -32,11 +32,11 @@ func (l *TraefikLog) SetDefaults() { // AccessLog holds the configuration settings for the access logger (middlewares/accesslog). type AccessLog struct { - FilePath string `json:"file,omitempty" description:"Access log file path. Stdout is used when omitted or empty." export:"true"` - Format string `json:"format,omitempty" description:"Access log format: json | common" export:"true"` - Filters *AccessLogFilters `json:"filters,omitempty" description:"Access log filters, used to keep only specific access logs." export:"true"` - Fields *AccessLogFields `json:"fields,omitempty" description:"AccessLogFields." export:"true"` - BufferingSize int64 `json:"bufferingSize,omitempty" description:"Number of access log lines to process in a buffered way." export:"true"` + FilePath string `description:"Access log file path. Stdout is used when omitted or empty." json:"filePath,omitempty" toml:"filePath,omitempty" yaml:"filePath,omitempty" export:"true"` + Format string `description:"Access log format: json | common" json:"format,omitempty" toml:"format,omitempty" yaml:"format,omitempty" export:"true"` + Filters *AccessLogFilters `description:"Access log filters, used to keep only specific access logs." json:"filters,omitempty" toml:"filters,omitempty" yaml:"filters,omitempty" export:"true"` + Fields *AccessLogFields `description:"AccessLogFields." json:"fields,omitempty" toml:"fields,omitempty" yaml:"fields,omitempty" export:"true"` + BufferingSize int64 `description:"Number of access log lines to process in a buffered way." json:"bufferingSize,omitempty" toml:"bufferingSize,omitempty" yaml:"bufferingSize,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -50,22 +50,22 @@ func (l *AccessLog) SetDefaults() { // AccessLogFilters holds filters configuration type AccessLogFilters struct { - StatusCodes []string `json:"statusCodes,omitempty" description:"Keep access logs with status codes in the specified range." export:"true"` - RetryAttempts bool `json:"retryAttempts,omitempty" description:"Keep access logs when at least one retry happened." export:"true"` - MinDuration Duration `json:"duration,omitempty" description:"Keep access logs when request took longer than the specified duration." export:"true"` + StatusCodes []string `description:"Keep access logs with status codes in the specified range." json:"statusCodes,omitempty" toml:"statusCodes,omitempty" yaml:"statusCodes,omitempty" export:"true"` + RetryAttempts bool `description:"Keep access logs when at least one retry happened." json:"retryAttempts,omitempty" toml:"retryAttempts,omitempty" yaml:"retryAttempts,omitempty" export:"true"` + MinDuration Duration `description:"Keep access logs when request took longer than the specified duration." json:"minDuration,omitempty" toml:"minDuration,omitempty" yaml:"minDuration,omitempty" export:"true"` } // FieldHeaders holds configuration for access log headers type FieldHeaders struct { - DefaultMode string `json:"defaultMode,omitempty" description:"Default mode for fields: keep | drop | redact" export:"true"` - Names map[string]string `json:"names,omitempty" description:"Override mode for headers" export:"true"` + DefaultMode string `description:"Default mode for fields: keep | drop | redact" json:"defaultMode,omitempty" toml:"defaultMode,omitempty" yaml:"defaultMode,omitempty" export:"true"` + Names map[string]string `description:"Override mode for headers" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"` } // AccessLogFields holds configuration for access log fields type AccessLogFields struct { - DefaultMode string `json:"defaultMode,omitempty" description:"Default mode for fields: keep | drop" export:"true"` - Names map[string]string `json:"names,omitempty" description:"Override mode for fields" export:"true"` - Headers *FieldHeaders `json:"headers,omitempty" description:"Headers to keep, drop or redact" export:"true"` + DefaultMode string `description:"Default mode for fields: keep | drop" json:"defaultMode,omitempty" toml:"defaultMode,omitempty" yaml:"defaultMode,omitempty" export:"true"` + Names map[string]string `json:"names,omitempty" description:"Override mode for fields" json:"names,omitempty" toml:"names,omitempty" yaml:"names,omitempty" export:"true"` + Headers *FieldHeaders `description:"Headers to keep, drop or redact" json:"headers,omitempty" toml:"headers,omitempty" yaml:"headers,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/types/metrics.go b/pkg/types/metrics.go index 9a1a763b2..2d148ce93 100644 --- a/pkg/types/metrics.go +++ b/pkg/types/metrics.go @@ -6,17 +6,17 @@ import ( // Metrics provides options to expose and send Traefik metrics to different third party monitoring systems type Metrics struct { - Prometheus *Prometheus `description:"Prometheus metrics exporter type." export:"true" label:"allowEmpty"` - Datadog *Datadog `description:"DataDog metrics exporter type." export:"true" label:"allowEmpty"` - StatsD *Statsd `description:"StatsD metrics exporter type." export:"true" label:"allowEmpty"` - InfluxDB *InfluxDB `description:"InfluxDB metrics exporter type." label:"allowEmpty"` + Prometheus *Prometheus `description:"Prometheus metrics exporter type." json:"prometheus,omitempty" toml:"prometheus,omitempty" yaml:"prometheus,omitempty" export:"true" label:"allowEmpty"` + DataDog *DataDog `description:"DataDog metrics exporter type." json:"dataDog,omitempty" toml:"dataDog,omitempty" yaml:"dataDog,omitempty" export:"true" label:"allowEmpty"` + StatsD *Statsd `description:"StatsD metrics exporter type." json:"statsD,omitempty" toml:"statsD,omitempty" yaml:"statsD,omitempty" export:"true" label:"allowEmpty"` + InfluxDB *InfluxDB `description:"InfluxDB metrics exporter type." json:"influxDB,omitempty" toml:"influxDB,omitempty" yaml:"influxDB,omitempty" label:"allowEmpty"` } // Prometheus can contain specific configuration used by the Prometheus Metrics exporter type Prometheus struct { - Buckets []float64 `description:"Buckets for latency metrics." export:"true"` - EntryPoint string `description:"EntryPoint." export:"true"` - Middlewares []string `description:"Middlewares." export:"true"` + Buckets []float64 `description:"Buckets for latency metrics." json:"buckets,omitempty" toml:"buckets,omitempty" yaml:"buckets,omitempty" export:"true"` + EntryPoint string `description:"EntryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` + Middlewares []string `description:"Middlewares." json:"middlewares,omitempty" toml:"middlewares,omitempty" yaml:"middlewares,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -25,22 +25,22 @@ func (p *Prometheus) SetDefaults() { p.EntryPoint = "traefik" } -// Datadog contains address and metrics pushing interval configuration -type Datadog struct { - Address string `description:"DataDog's address."` - PushInterval Duration `description:"DataDog push interval." export:"true"` +// DataDog contains address and metrics pushing interval configuration +type DataDog struct { + Address string `description:"DataDog's address." json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` + PushInterval Duration `description:"DataDog push interval." json:"pushInterval,omitempty" toml:"pushInterval,omitempty" yaml:"pushInterval,omitempty" export:"true"` } // SetDefaults sets the default values. -func (d *Datadog) SetDefaults() { +func (d *DataDog) SetDefaults() { d.Address = "localhost:8125" d.PushInterval = Duration(10 * time.Second) } // Statsd contains address and metrics pushing interval configuration type Statsd struct { - Address string `description:"StatsD address."` - PushInterval Duration `description:"StatsD push interval." export:"true"` + Address string `description:"StatsD address." json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` + PushInterval Duration `description:"StatsD push interval." json:"pushInterval,omitempty" toml:"pushInterval,omitempty" yaml:"pushInterval,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -51,13 +51,13 @@ func (s *Statsd) SetDefaults() { // InfluxDB contains address, login and metrics pushing interval configuration type InfluxDB struct { - Address string `description:"InfluxDB address."` - Protocol string `description:"InfluxDB address protocol (udp or http)."` - PushInterval Duration `description:"InfluxDB push interval." export:"true"` - Database string `description:"InfluxDB database used when protocol is http." export:"true"` - RetentionPolicy string `description:"InfluxDB retention policy used when protocol is http." export:"true"` - Username string `description:"InfluxDB username (only with http)." export:"true"` - Password string `description:"InfluxDB password (only with http)." export:"true"` + Address string `description:"InfluxDB address." json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty"` + Protocol string `description:"InfluxDB address protocol (udp or http)." json:"protocol,omitempty" toml:"protocol,omitempty" yaml:"protocol,omitempty"` + PushInterval Duration `description:"InfluxDB push interval." json:"pushInterval,omitempty" toml:"pushInterval,omitempty" yaml:"pushInterval,omitempty" export:"true"` + Database string `description:"InfluxDB database used when protocol is http." json:"database,omitempty" toml:"database,omitempty" yaml:"database,omitempty" export:"true"` + RetentionPolicy string `description:"InfluxDB retention policy used when protocol is http." json:"retentionPolicy,omitempty" toml:"retentionPolicy,omitempty" yaml:"retentionPolicy,omitempty" export:"true"` + Username string `description:"InfluxDB username (only with http)." json:"username,omitempty" toml:"username,omitempty" yaml:"username,omitempty" export:"true"` + Password string `description:"InfluxDB password (only with http)." json:"password,omitempty" toml:"password,omitempty" yaml:"password,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -69,7 +69,7 @@ func (i *InfluxDB) SetDefaults() { // Statistics provides options for monitoring request and response stats type Statistics struct { - RecentErrors int `description:"Number of recent errors logged." export:"true"` + RecentErrors int `description:"Number of recent errors logged." json:"recentErrors,omitempty" toml:"recentErrors,omitempty" yaml:"recentErrors,omitempty" export:"true"` } // SetDefaults sets the default values. diff --git a/pkg/types/tls.go b/pkg/types/tls.go index 4f1c66ff7..492225003 100644 --- a/pkg/types/tls.go +++ b/pkg/types/tls.go @@ -14,11 +14,11 @@ import ( // ClientTLS holds TLS specific configurations as client // CA, Cert and Key can be either path or file contents type ClientTLS struct { - CA string `description:"TLS CA" json:"ca,omitempty"` - CAOptional bool `description:"TLS CA.Optional" json:"caOptional,omitempty"` - Cert string `description:"TLS cert" json:"cert,omitempty"` - Key string `description:"TLS key" json:"key,omitempty"` - InsecureSkipVerify bool `description:"TLS insecure skip verify" json:"insecureSkipVerify,omitempty"` + CA string `description:"TLS CA" json:"ca,omitempty" toml:"ca,omitempty" yaml:"ca,omitempty"` + CAOptional bool `description:"TLS CA.Optional" json:"caOptional,omitempty" toml:"caOptional,omitempty" yaml:"caOptional,omitempty"` + Cert string `description:"TLS cert" json:"cert,omitempty" toml:"cert,omitempty" yaml:"cert,omitempty"` + Key string `description:"TLS key" json:"key,omitempty" toml:"key,omitempty" yaml:"key,omitempty"` + InsecureSkipVerify bool `description:"TLS insecure skip verify" json:"insecureSkipVerify,omitempty" toml:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` } // CreateTLSConfig creates a TLS config from ClientTLS structures diff --git a/traefik.sample.toml b/traefik.sample.toml index 1bff7753d..57c90e9ac 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -21,8 +21,8 @@ # Optional # Default: [entryPoints] - [entryPoints.web] - address = ":80" + [entryPoints.web] + address = ":80" ################################################################ # Traefik logs configuration