From 9db91433663f43265a6426d2f9ad9b8c4d6c623f Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 2 Jul 2019 17:36:04 +0200 Subject: [PATCH 01/49] Improve providers documentation. --- docs/content/https/acme.md | 32 ++- docs/content/providers/docker.md | 228 ++++++++++++++--- docs/content/providers/kubernetes-crd.md | 130 ++++++---- docs/content/providers/marathon.md | 302 ++++++++++++++++++++--- docs/content/providers/rancher.md | 174 +++++++++++-- docs/content/providers/rancher.txt | 20 ++ docs/content/providers/rancher.yml | 21 ++ docs/content/routing/entrypoints.md | 14 +- docs/content/routing/overview.md | 20 +- 9 files changed, 784 insertions(+), 157 deletions(-) create mode 100644 docs/content/providers/rancher.txt create mode 100644 docs/content/providers/rancher.yml diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index e75d26e00..724b5375d 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -17,7 +17,7 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom [entryPoints.web] address = ":80" - [entryPoints.http-tls] + [entryPoints.web-secure] address = ":443" # every router with TLS enabled will now be able to use ACME for its certificates @@ -36,7 +36,7 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom web: address: ":80" - http-tls: + web-secure: address: ":443" # every router with TLS enabled will now be able to use ACME for its certificates @@ -54,10 +54,7 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom ```toml tab="TOML" [entryPoints] - [entryPoints.web] - address = ":80" - - [entryPoints.http-tls] + [entryPoints.web-secure] address = ":443" [acme] @@ -73,10 +70,7 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom ```yaml tab="YAML" entryPoints: - web: - address: ":80" - - http-tls: + web-secure: address: ":443" acme: @@ -144,17 +138,31 @@ when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reac ??? example "Using an EntryPoint Called http for the `httpChallenge`" ```toml tab="TOML" + [entryPoints] + [entryPoints.web] + address = ":80" + + [entryPoints.web-secure] + address = ":443" + [acme] # ... [acme.httpChallenge] - entryPoint = "http" + entryPoint = "web" ``` ```yaml tab="YAML" + entryPoints: + web: + address: ":80" + + web-secure: + address: ":443" + acme: # ... httpChallenge: - entryPoint: http + entryPoint: web ``` !!! note diff --git a/docs/content/providers/docker.md b/docs/content/providers/docker.md index fb25b14ea..e532496ff 100644 --- a/docs/content/providers/docker.md +++ b/docs/content/providers/docker.md @@ -15,10 +15,18 @@ Attach labels to your containers and let Traefik do the rest! ??? example "Configuring Docker & Deploying / Exposing Services" Enabling the docker provider - - ```toml + + ```toml tab="File (TOML)" [providers.docker] - endpoint = "unix:///var/run/docker.sock" + ``` + + ```yaml tab="File (YAML)" + providers: + docker: {} + ``` + + ```bash tab="CLI" + --providers.docker ``` Attaching labels to containers (in your docker compose file) @@ -36,13 +44,28 @@ Attach labels to your containers and let Traefik do the rest! Enabling the docker provider (Swarm Mode) - ```toml + ```toml tab="File (TOML)" [providers.docker] - # swarm classic (1.12-) - # endpoint = "tcp://127.0.0.1:2375" - # docker swarm mode (1.12+) - endpoint = "tcp://127.0.0.1:2377" - swarmMode = true + # swarm classic (1.12-) + # endpoint = "tcp://127.0.0.1:2375" + # docker swarm mode (1.12+) + endpoint = "tcp://127.0.0.1:2377" + swarmMode = true + ``` + + ```yaml tab="File (YAML)" + providers: + docker: + # swarm classic (1.12-) + # endpoint = "tcp://127.0.0.1:2375" + # docker swarm mode (1.12+) + endpoint: "tcp://127.0.0.1:2375" + swarmMode: true + ``` + + ```bash tab="CLI" + --providers.docker.endpoint="tcp://127.0.0.1:2375" + --providers.docker.swarmMode ``` Attach labels to services (not to containers) while in Swarm mode (in your docker compose file) @@ -67,6 +90,23 @@ Attach labels to your containers and let Traefik do the rest! ### `endpoint` +_Required, Default="unix:///var/run/docker.sock"_ + +```toml tab="File (TOML)" +[providers.docker] + endpoint = "unix:///var/run/docker.sock" +``` + +```yaml tab="File (YAML)" +providers: + docker: + endpoint: "unix:///var/run/docker.sock" +``` + +```bash tab="CLI" +--providers.docker.endpoint="unix:///var/run/docker.sock" +``` + Traefik requires access to the docker socket to get its dynamic configuration. ??? warning "Security Notes" @@ -94,14 +134,10 @@ Traefik requires access to the docker socket to get its dynamic configuration. It allows different implementation levels of the [AAA (Authentication, Authorization, Accounting) concepts](https://en.wikipedia.org/wiki/AAA_(computer_security)), depending on your security assessment: - Authentication with Client Certificates as described in ["Protect the Docker daemon socket."](https://docs.docker.com/engine/security/https/) - - Authorization with the [Docker Authorization Plugin Mechanism](https://docs.docker.com/engine/extend/plugins_authorization/) - - Accounting at networking level, by exposing the socket only inside a Docker private network, only available for Traefik. - - Accounting at container level, by exposing the socket on a another container than Traefik's. With Swarm mode, it allows scheduling of Traefik on worker nodes, with only the "socket exposer" container on the manager nodes. - - Accounting at kernel level, by enforcing kernel calls with mechanisms like [SELinux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux), to only allows an identified set of actions for Traefik's process (or the "socket exposer" process). ??? tip "Additional Resources" @@ -133,19 +169,48 @@ Traefik requires access to the docker socket to get its dynamic configuration. We specify the docker.sock in traefik's configuration file. - ```toml + ```toml tab="File (TOML)" + [providers.docker] + endpoint = "unix:///var/run/docker.sock" + # ... + ``` + + ```yaml tab="File (YAML)" + providers: + docker: + endpoint: "unix:///var/run/docker.sock" + # ... + ``` + + ```bash tab="CLI" + --providers.docker.endpoint="unix:///var/run/docker.sock" # ... - [providers] - [providers.docker] - endpoint = "unix:///var/run/docker.sock" ``` -### `usebindportip` +### `useBindPortIP` _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.docker] + useBindPortIP = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + useBindPortIP: true + # ... +``` + +```bash tab="CLI" +--providers.docker.useBindPortIP=true +# ... +``` + Traefik routes requests to the IP/Port of the matching container. -When setting `usebindportip=true`, you tell Traefik to use the IP/Port attached to the container's _binding_ instead of its inner network IP/Port. +When setting `useBindPortIP=true`, you tell Traefik to use the IP/Port attached to the container's _binding_ instead of its inner network IP/Port. When used in conjunction with the `traefik.http.services.XXX.loadbalancer.server.port` label (that tells Traefik to route requests to a specific port), Traefik tries to find a binding on port `traefik.http.services.XXX.loadbalancer.server.port`. @@ -171,12 +236,50 @@ but still uses the `traefik.http.services.XXX.loadbalancer.server.port` that is _Optional, Default=true_ +```toml tab="File (TOML)" +[providers.docker] + exposedByDefault = false + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + exposedByDefault: false + # ... +``` + +```bash tab="CLI" +--providers.docker.exposedByDefault=false +# ... +``` + Expose containers by default through Traefik. If set to false, containers that don't have a `traefik.enable=true` label will be ignored from the resulting routing configuration. +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + ### `network` -_Optional_ +_Optional, Default=empty_ + +```toml tab="File (TOML)" +[providers.docker] + network = "test" + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + network: test + # ... +``` + +```bash tab="CLI" +--providers.docker.network=test +# ... +``` Defines a default docker network to use for connections to all containers. @@ -186,39 +289,100 @@ This option can be overridden on a container basis with the `traefik.docker.netw _Optional, Default=```Host(`{{ normalize .Name }}`)```_ +```toml tab="File (TOML)" +[providers.docker] + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + defaultRule: "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```bash tab="CLI" +--providers.docker.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" +# ... +``` + For a given container if no routing rule was defined by a label, it is defined by this defaultRule instead. It must be a valid [Go template](https://golang.org/pkg/text/template/), augmented with the [sprig template functions](http://masterminds.github.io/sprig/). The container 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.docker] - defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" - # ... -``` - -```txt tab="CLI" ---providers.docker ---providers.docker.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -``` - ### `swarmMode` _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.docker] + swarmMode = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + swarmMode: true + # ... +``` + +```bash tab="CLI" +--providers.docker.swarmMode +# ... +``` + Activates the Swarm Mode. ### `swarmModeRefreshSeconds` _Optional, Default=15_ +```toml tab="File (TOML)" +[providers.docker] + swarmModeRefreshSeconds = "30s" + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + swarmModeRefreshSeconds: "30s" + # ... +``` + +```bash tab="CLI" +--providers.docker.swarmModeRefreshSeconds=30s +# ... +``` + Defines the polling interval (in seconds) in Swarm Mode. ### `constraints` _Optional, Default=""_ +```toml tab="File (TOML)" +[providers.docker] + constraints = "Label(`a.label.name`, `foo`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + docker: + constraints: "Label(`a.label.name`, `foo`)" + # ... +``` + +```bash tab="CLI" +--providers.docker.constraints="Label(`a.label.name`, `foo`)" +# ... +``` + Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. That is to say, if none of the container's labels match the expression, no route for the container is created. If the expression is empty, all detected containers are included. @@ -257,6 +421,8 @@ The expression syntax is based on the `Label("key", "value")`, and `LabelRegexp( constraints = "LabelRegexp(`a.label.name`, `a.+`)" ``` +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + ## Routing Configuration Options ### General diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index b0f35ae94..cf6c0b79c 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -19,6 +19,23 @@ we ended up writing a [Custom Resource Definition](https://kubernetes.io/docs/co _Optional, Default=empty_ +```toml tab="File (TOML)" +[providers.kubernetesCRD] + endpoint = "http://localhost:8080" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + endpoint = "http://localhost:8080" + # ... +``` + +```bash tab="CLI" +--providers.kubernetescrd.endpoint="http://localhost:8080" +``` + The Kubernetes server endpoint as URL. When deployed into Kubernetes, Traefik will read the environment variables `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` or `KUBECONFIG` to construct the endpoint. @@ -32,109 +49,130 @@ When the environment variables are not found, Traefik will try to connect to the 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] - endpoint = "http://localhost:8080" - # ... -``` - -```txt tab="CLI" ---providers.kubernetescrd ---providers.kubernetescrd.endpoint="http://localhost:8080" -``` - ### `token` _Optional, Default=empty_ -Bearer token used for the Kubernetes client configuration. - -```toml tab="File" +```toml tab="File (TOML)" [providers.kubernetesCRD] token = "mytoken" # ... ``` -```txt tab="CLI" ---providers.kubernetescrd +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + token = "mytoken" + # ... +``` + +```bash tab="CLI" --providers.kubernetescrd.token="mytoken" ``` +Bearer token used for the Kubernetes client configuration. + ### `certAuthFilePath` _Optional, Default=empty_ -Path to the certificate authority file. -Used for the Kubernetes client configuration. - -```toml tab="File" +```toml tab="File (TOML)" [providers.kubernetesCRD] certAuthFilePath = "/my/ca.crt" # ... ``` -```txt tab="CLI" ---providers.kubernetescrd +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + certAuthFilePath: "/my/ca.crt" + # ... +``` + +```bash tab="CLI" --providers.kubernetescrd.certauthfilepath="/my/ca.crt" ``` +Path to the certificate authority file. +Used for the Kubernetes client configuration. + ### `namespaces` _Optional, Default: all namespaces (empty array)_ -Array of namespaces to watch. - -```toml tab="File" +```toml tab="File (TOML)" [providers.kubernetesCRD] namespaces = ["default", "production"] # ... ``` -```txt tab="CLI" ---providers.kubernetescrd +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + namespaces: + - "default" + - "production" + # ... +``` + +```bash tab="CLI" --providers.kubernetescrd.namespaces="default,production" ``` +Array of namespaces to watch. + ### `labelselector` _Optional,Default: empty (process all Ingresses)_ +```toml tab="File (TOML)" +[providers.kubernetesCRD] + labelselector = "A and not B" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + labelselector: "A and not B" + # ... +``` + +```bash tab="CLI" +--providers.kubernetescrd.labelselector="A and not B" +``` + By default, Traefik processes all Ingress objects in the configured namespaces. 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] - labelselector = "A and not B" - # ... -``` - -```txt tab="CLI" ---providers.kubernetescrd ---providers.kubernetescrd.labelselector="A and not B" -``` - ### `ingressClass` _Optional, Default: empty_ -Value of `kubernetes.io/ingress.class` annotation that identifies Ingress objects to be processed. - -If the parameter is non-empty, only Ingresses containing an annotation with the same value are processed. -Otherwise, Ingresses missing the annotation, having an empty value, or the value `traefik` are processed. - -```toml tab="File" +```toml tab="File (TOML)" [providers.kubernetesCRD] ingressClass = "traefik-internal" # ... ``` -```txt tab="CLI" ---providers.kubernetescrd +```yaml tab="File (YAML)" +providers: + kubernetesCRD: + ingressClass: "traefik-internal" + # ... +``` + +```bash tab="CLI" --providers.kubernetescrd.ingressclass="traefik-internal" ``` +Value of `kubernetes.io/ingress.class` annotation that identifies Ingress objects to be processed. + +If the parameter is non-empty, only Ingresses containing an annotation with the same value are processed. +Otherwise, Ingresses missing the annotation, having an empty value, or the value `traefik` are processed. + ## Resource Configuration If you're in a hurry, maybe you'd rather go through the [dynamic](../reference/dynamic-configuration/kubernetes-crd.md) configuration reference. diff --git a/docs/content/providers/marathon.md b/docs/content/providers/marathon.md index d37e3ed78..b2c851541 100644 --- a/docs/content/providers/marathon.md +++ b/docs/content/providers/marathon.md @@ -11,14 +11,17 @@ See also [Marathon user guide](../user-guides/marathon.md). Enabling the marathon provider - ```toml tab="File" + ```toml tab="File (TOML)" [providers.marathon] - endpoint = "http://127.0.0.1:8080" ``` - ```txt tab="CLI" + ```yaml tab="File (YAML)" + providers: + marathon: {} + ``` + + ```bash tab="CLI" --providers.marathon - --providers.marathon.endpoint="http://127.0.0.1:8080" ``` Attaching labels to marathon applications @@ -55,43 +58,74 @@ See also [Marathon user guide](../user-guides/marathon.md). _Optional_ -Enables Marathon basic authentication. - -```toml tab="File" +```toml tab="File (TOML)" [providers.marathon.basic] httpBasicAuthUser = "foo" httpBasicPassword = "bar" ``` -```txt tab="CLI" ---providers.marathon +```yaml tab="File (YAML)" +providers: + marathon: + basic: + httpBasicAuthUser: foo + httpBasicPassword: bar +``` + +```bash tab="CLI" --providers.marathon.basic.httpbasicauthuser="foo" --providers.marathon.basic.httpbasicpassword="bar" ``` +Enables Marathon basic authentication. + ### `dcosToken` _Optional_ -DCOSToken for DCOS environment. - -If set, it overrides the Authorization header. - -```toml tab="File" +```toml tab="File (TOML)" [providers.marathon] dcosToken = "xxxxxx" # ... ``` -```txt tab="CLI" ---providers.marathon +```toml tab="File (YAML)" +providers: + marathon: + dcosToken: "xxxxxx" + # ... +``` + +```bash tab="CLI" --providers.marathon.dcosToken="xxxxxx" ``` +DCOSToken for DCOS environment. + +If set, it overrides the Authorization header. + ### `defaultRule` _Optional, Default=```Host(`{{ normalize .Name }}`)```_ +```toml tab="File (TOML)" +[providers.marathon] + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + defaultRule: "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```bash tab="CLI" +--providers.marathon.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" +# ... +``` + For a given application if no routing rule was defined by a label, it is defined by this defaultRule instead. It must be a valid [Go template](https://golang.org/pkg/text/template/), @@ -100,21 +134,27 @@ augmented with the [sprig template functions](http://masterminds.github.io/sprig The app ID can be accessed as the Name identifier, and the template has access to all the labels defined on this Marathon application. -```toml tab="File" -[providers.marathon] - defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" - # ... -``` - -```txt tab="CLI" ---providers.marathon ---providers.marathon.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -``` - ### `dialerTimeout` _Optional, Default=5s_ +```toml tab="File (TOML)" +[providers.marathon] + dialerTimeout = "10s" + # ... +``` + +```toml tab="File (YAML)" +providers: + marathon: + dialerTimeout: "10s" + # ... +``` + +```bash tab="CLI" +--providers.marathon.dialerTimeout=10s +``` + Overrides DialerTimeout. Amount of time the Marathon provider should wait before timing out, @@ -127,33 +167,77 @@ or directly as a number of seconds. _Optional, Default=http://127.0.0.1:8080_ -Marathon server endpoint. - -You can optionally specify multiple endpoints: - -```toml tab="File" +```toml tab="File (TOML)" [providers.marathon] endpoint = "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080" # ... ``` -```txt tab="CLI" ---providers.marathon +```toml tab="File (YAML)" +providers: + marathon: + endpoint: "http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080" + # ... +``` + +```bash tab="CLI" --providers.marathon.endpoint="http://10.241.1.71:8080,10.241.1.72:8080,10.241.1.73:8080" ``` +Marathon server endpoint. + +You can optionally specify multiple endpoints: + ### `exposedByDefault` _Optional, Default=true_ +```toml tab="File (TOML)" +[providers.marathon] + exposedByDefault = false + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + exposedByDefault: false + # ... +``` + +```bash tab="CLI" +--providers.marathon.exposedByDefault=false +# ... +``` + Exposes Marathon applications by default through Traefik. If set to false, applications that don't have a `traefik.enable=true` label will be ignored from the resulting routing configuration. +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + ### `constraints` _Optional, Default=""_ +```toml tab="File (TOML)" +[providers.marathon] + constraints = "Label(`a.label.name`, `foo`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + constraints: "Label(`a.label.name`, `foo`)" + # ... +``` + +```bash tab="CLI" +--providers.marathon.constraints="Label(`a.label.name`, `foo`)" +# ... +``` + Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application. That is to say, if none of the application's labels match the expression, no route for the application is created. In addition, the expression also matched against the application's constraints, such as described in [Marathon constraints](https://mesosphere.github.io/marathon/docs/constraints.html). @@ -204,10 +288,30 @@ In addition, to match against marathon constraints, the function `MarathonConstr constraints = "MarathonConstraint(`A:B:C`) && Label(`a.label.name`, `value`)" ``` +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + ### `forceTaskHostname` _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.marathon] + forceTaskHostname = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + forceTaskHostname: true + # ... +``` + +```bash tab="CLI" +--providers.marathon.forceTaskHostname=true +# ... +``` + By default, a task's IP address (as returned by the Marathon API) is used as backend server if an IP-per-task configuration can be found; otherwise, the name of the host running the task is used. The latter behavior can be enforced by enabling this switch. @@ -216,6 +320,24 @@ The latter behavior can be enforced by enabling this switch. _Optional, Default=10s_ +```toml tab="File (TOML)" +[providers.marathon] + keepAlive = "30s" + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + keepAlive: "30s" + # ... +``` + +```bash tab="CLI" +--providers.marathon.keepAlive=30s +# ... +``` + Set the TCP Keep Alive interval for the Marathon HTTP Client. Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration), or directly as a number of seconds. @@ -224,6 +346,24 @@ or directly as a number of seconds. _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.marathon] + respectReadinessChecks = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + respectReadinessChecks: true + # ... +``` + +```bash tab="CLI" +--providers.marathon.respectReadinessChecks=true +# ... +``` + Applications may define readiness checks which are probed by Marathon during deployments periodically, and these check results are exposed via the API. Enabling respectReadinessChecks causes Traefik to filter out tasks whose readiness checks have not succeeded. Note that the checks are only valid at deployment times. @@ -234,6 +374,24 @@ See the Marathon guide for details. _Optional, Default=60s_ +```toml tab="File (TOML)" +[providers.marathon] + responseHeaderTimeout = "66s" + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + responseHeaderTimeout: "66s" + # ... +``` + +```bash tab="CLI" +--providers.marathon.responseHeaderTimeout="66s" +# ... +``` + Overrides ResponseHeaderTimeout. Amount of time the Marathon provider should wait before timing out, when waiting for the first response header from a Marathon master. @@ -244,9 +402,7 @@ Can be provided in a format supported by [time.ParseDuration](https://golang.org _Optional_ -TLS client configuration. [tls/#Config](https://golang.org/pkg/crypto/tls/#Config). - -```toml tab="File" +```toml tab="File (TOML)" [providers.marathon.tls] ca = "/etc/ssl/ca.crt" cert = "/etc/ssl/marathon.cert" @@ -254,19 +410,49 @@ TLS client configuration. [tls/#Config](https://golang.org/pkg/crypto/tls/#Confi insecureSkipVerify = true ``` -```txt tab="CLI" ---providers.marathon.tls +```yaml tab="File (YAML)" +providers: + marathon + tls: + ca: "/etc/ssl/ca.crt" + cert: "/etc/ssl/marathon.cert" + key: "/etc/ssl/marathon.key" + insecureSkipVerify: true +``` + +```bash tab="CLI" --providers.marathon.tls.ca="/etc/ssl/ca.crt" --providers.marathon.tls.cert="/etc/ssl/marathon.cert" --providers.marathon.tls.key="/etc/ssl/marathon.key" --providers.marathon.tls.insecureskipverify=true ``` -### `TLSHandshakeTimeout` +TLS client configuration. [tls/#Config](https://golang.org/pkg/crypto/tls/#Config). + +### `tlsHandshakeTimeout` _Optional, Default=5s_ +```toml tab="File (TOML)" +[providers.marathon] + responseHeaderTimeout = "10s" + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + responseHeaderTimeout: "10s" + # ... +``` + +```bash tab="CLI" +--providers.marathon.responseHeaderTimeout="10s" +# ... +``` + Overrides TLSHandshakeTimeout. + Amount of time the Marathon provider should wait before timing out, when waiting for the TLS handshake to complete. Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration), @@ -276,12 +462,48 @@ or directly as a number of seconds. _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.marathon] + trace = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + trace: true + # ... +``` + +```bash tab="CLI" +--providers.marathon.trace=true +# ... +``` + Displays additional provider logs (if available). ### `watch` _Optional, Default=true_ +```toml tab="File (TOML)" +[providers.marathon] + watch = false + # ... +``` + +```yaml tab="File (YAML)" +providers: + marathon: + watch: false + # ... +``` + +```bash tab="CLI" +--providers.marathon.watch=false +# ... +``` + Enables watching for Marathon changes. ## Routing Configuration Options diff --git a/docs/content/providers/rancher.md b/docs/content/providers/rancher.md index a5662f31f..ea74e39bd 100644 --- a/docs/content/providers/rancher.md +++ b/docs/content/providers/rancher.md @@ -18,9 +18,18 @@ Attach labels to your services and let Traefik do the rest! Enabling the rancher provider - ```toml + ```toml tab="File (TOML)" [providers.rancher] ``` + + ```yaml tab="File (YAML)" + providers: + rancher: {} + ``` + + ```bash tab="CLI" + --providers.rancher + ``` Attaching labels to services @@ -34,21 +43,67 @@ Attach labels to your services and let Traefik do the rest! ??? tip "Browse the Reference" If you're in a hurry, maybe you'd rather go through the configuration reference: - ```toml + ```toml tab="File (TOML)" --8<-- "content/providers/rancher.toml" ``` + + ```yaml tab="File (YAML)" + --8<-- "content/providers/rancher.yml" + ``` + + ```bash tab="CLI" + --8<-- "content/providers/rancher.txt" + ``` -### `ExposedByDefault` +### `exposedByDefault` _Optional, Default=true_ +```toml tab="File (TOML)" +[providers.rancher] + exposedByDefault = false + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + exposedByDefault: false + # ... +``` + +```bash tab="CLI" +--providers.rancher.exposedByDefault=false +# ... +``` + Expose Rancher services by default in Traefik. If set to false, services that don't have a `traefik.enable=true` label will be ignored from the resulting routing configuration. -### `DefaultRule` +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + +### `defaultRule` _Optional, Default=```Host(`{{ normalize .Name }}`)```_ +```toml tab="File (TOML)" +[providers.rancher] + defaultRule = "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + defaultRule: "Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" + # ... +``` + +```bash tab="CLI" +--providers.rancher.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" +# ... +``` + The default host rule for all services. For a given container if no routing rule was defined by a label, it is defined by this defaultRule instead. @@ -57,48 +112,127 @@ augmented with the [sprig template functions](http://masterminds.github.io/sprig 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\"}}`)" - # ... -``` - -```txt tab="CLI" ---providers.rancher ---providers.rancher.defaultRule="Host(`{{ .Name }}.{{ index .Labels \"customLabel\"}}`)" -``` - This option can be overridden on a container basis with the `traefik.http.routers.Router1.rule` label. -### `EnableServiceHealthFilter` +### `enableServiceHealthFilter` _Optional, Default=true_ +```toml tab="File (TOML)" +[providers.rancher] + enableServiceHealthFilter = false + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + enableServiceHealthFilter: false + # ... +``` + +```bash tab="CLI" +--providers.rancher.enableServiceHealthFilter=false +# ... +``` + Filter services with unhealthy states and inactive states. -### `RefreshSeconds` +### `refreshSeconds` _Optional, Default=15_ +```toml tab="File (TOML)" +[providers.rancher] + refreshSeconds = 30 + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + refreshSeconds: 30 + # ... +``` + +```bash tab="CLI" +--providers.rancher.refreshSeconds=30 +# ... +``` + Defines the polling interval (in seconds). -### `IntervalPoll` +### `intervalPoll` _Optional, Default=false_ +```toml tab="File (TOML)" +[providers.rancher] + intervalPoll = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + intervalPoll: true + # ... +``` + +```bash tab="CLI" +--providers.rancher.intervalPoll=true +# ... +``` + Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate than the default long polling technique which will provide near instantaneous updates to Traefik. -### `Prefix` +### `prefix` _Optional, Default=/latest_ +```toml tab="File (TOML)" +[providers.rancher] + prefix = "/test" + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + prefix: "/test" + # ... +``` + +```bash tab="CLI" +--providers.rancher.prefix="/test" +# ... +``` + Prefix used for accessing the Rancher metadata service ### `constraints` _Optional, Default=""_ +```toml tab="File (TOML)" +[providers.rancher] + constraints = "Label(`a.label.name`, `foo`)" + # ... +``` + +```yaml tab="File (YAML)" +providers: + rancher: + constraints: "Label(`a.label.name`, `foo`)" + # ... +``` + +```bash tab="CLI" +--providers.rancher.constraints="Label(`a.label.name`, `foo`)" +# ... +``` + Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. That is to say, if none of the container's labels match the expression, no route for the container is created. If the expression is empty, all detected containers are included. @@ -137,6 +271,8 @@ The expression syntax is based on the `Label("key", "value")`, and `LabelRegexp( constraints = "LabelRegexp(`a.label.name`, `a.+`)" ``` +See also [Restrict the Scope of Service Discovery](./overview.md#restrict-the-scope-of-service-discovery). + ## Routing Configuration Options ### General diff --git a/docs/content/providers/rancher.txt b/docs/content/providers/rancher.txt new file mode 100644 index 000000000..daf9db4ce --- /dev/null +++ b/docs/content/providers/rancher.txt @@ -0,0 +1,20 @@ +# Enable Rancher Provider. +--providers.rancher + +# Expose Rancher services by default in Traefik. +--providers.rancher.exposedByDefault=true + +# Enable watch Rancher changes. +--providers.rancher.watch=true + +# Filter services with unhealthy states and inactive states. +--providers.rancher.enableServiceHealthFilter=true + +# Defines the polling interval (in seconds). +--providers.rancher.refreshSeconds=true + +# Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate +--providers.rancher.intervalPoll=false + +# Prefix used for accessing the Rancher metadata service +--providers.rancher.prefix="/latest" diff --git a/docs/content/providers/rancher.yml b/docs/content/providers/rancher.yml new file mode 100644 index 000000000..9db978da2 --- /dev/null +++ b/docs/content/providers/rancher.yml @@ -0,0 +1,21 @@ +# Enable Rancher Provider. +providers: + rancher: + + # Expose Rancher services by default in Traefik. + exposedByDefault: true + + # Enable watch Rancher changes. + watch: true + + # Filter services with unhealthy states and inactive states. + enableServiceHealthFilter: true + + # Defines the polling interval (in seconds). + refreshSeconds: true + + # Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate + intervalPoll: false + + # Prefix used for accessing the Rancher metadata service + prefix: "/latest" diff --git a/docs/content/routing/entrypoints.md b/docs/content/routing/entrypoints.md index 78534aa9b..d13a6d77e 100644 --- a/docs/content/routing/entrypoints.md +++ b/docs/content/routing/entrypoints.md @@ -24,7 +24,7 @@ They define the port which will receive the requests (whether HTTP or TCP). address: ":80" ``` - ```ini tab="CLI" + ```bash tab="CLI" --entryPoints.web.address=:80 ``` @@ -50,7 +50,7 @@ They define the port which will receive the requests (whether HTTP or TCP). address: ":443" ``` - ```ini tab="CLI" + ```bash tab="CLI" --entryPoints.web.address=:80 --entryPoints.web-secure.address=:443 ``` @@ -113,7 +113,7 @@ entryPoints: - "foobar" ``` -```ini tab="CLI" +```bash tab="CLI" --entryPoints.EntryPoint0.address=:8888 --entryPoints.EntryPoint0.transport.lifeCycle.requestAcceptGraceTimeout=42 --entryPoints.EntryPoint0.transport.lifeCycle.graceTimeOut=42 @@ -151,7 +151,7 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- - "192.168.1.7" ``` - ```ini tab="CLI" + ```bash tab="CLI" --entryPoints.web.address=:80 --entryPoints.web.proxyProtocol.trustedIPs=127.0.0.1/32,192.168.1.7 ``` @@ -180,7 +180,7 @@ Traefik supports [ProxyProtocol](https://www.haproxy.org/download/1.8/doc/proxy- insecure: true ``` - ```ini tab="CLI" + ```bash tab="CLI" --entryPoints.web.address=:80 --entryPoints.web.proxyProtocol.insecure ``` @@ -215,7 +215,7 @@ You can configure Traefik to trust the forwarded headers information (`X-Forward - "192.168.1.7" ``` - ```ini tab="CLI" + ```bash tab="CLI" --entryPoints.web.address=:80 --entryPoints.web.forwardedHeaders.trustedIPs=127.0.0.1/32,192.168.1.7 ``` @@ -239,7 +239,7 @@ You can configure Traefik to trust the forwarded headers information (`X-Forward insecure: true ``` - ```ini tab="CLI" + ```bash 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 39247cda6..d7bd5978e 100644 --- a/docs/content/routing/overview.md +++ b/docs/content/routing/overview.md @@ -26,7 +26,7 @@ In the process, Traefik will make sure that the user is authenticated (using the Static configuration: -```toml tab="TOML" +```toml tab="File (TOML)" [entryPoints] [entryPoints.web] # Listen on port 8081 for incoming requests @@ -37,7 +37,7 @@ Static configuration: [providers.file] ``` -```yaml tab="YAML" +```yaml tab="File (YAML)" entryPoints: web: # Listen on port 8081 for incoming requests @@ -48,6 +48,14 @@ providers: file: {} ``` +```bash tab="CLI" +# Listen on port 8081 for incoming requests +--entryPoints.web.address=:8081 + +# Enable the file provider to define routers / middlewares / services in a file +--providers.file +``` + Dynamic configuration: ```toml tab="TOML" @@ -137,6 +145,14 @@ http: file: {} ``` + ```bash tab="CLI" + # Listen on port 8081 for incoming requests + --entryPoints.web.address=":8081" + + # Enable the file provider to define routers / middlewares / services in a file + --providers.file + ``` + Dynamic configuration: ```toml tab="TOML" From 39aae4167e0b488ae56ad0d3ec1e1d6812ad7dcc Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 3 Jul 2019 19:22:05 +0200 Subject: [PATCH 02/49] TLSOptions: handle conflict: same host name, different TLS options Co-authored-by: Julien Salleyron --- docs/content/routing/routers/index.md | 42 +++++++++++- docs/content/user-guides/crd-acme/01-crd.yml | 23 +++++++ .../fixtures/https/https_tls_options.toml | 18 +++++ integration/https_test.go | 66 +++++++++++++++++++ pkg/server/router/tcp/router.go | 51 ++++++++++++-- pkg/tcp/router.go | 1 - 6 files changed, 193 insertions(+), 8 deletions(-) diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 811783f04..5a3d09987 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -327,9 +327,15 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted #### `Options` -The `Options` field enables fine-grained control of the TLS parameters. +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. +!!! note "Server Name Association" + + Even though one might get the impression that a TLS options reference is mapped to a router, or a router rule, one should realize that it is actually mapped only to the host name found in the `Host` part of the rule. Of course, there could also be several `Host` parts in a rule, in which case the TLS options reference would be mapped to as many host names. + + Another thing to keep in mind is: the TLS option is picked from the mapping mentioned above and based on the server name provided during the TLS handshake, and it all happens before routing actually occurs. + ??? example "Configuring the TLS options" ```toml tab="TOML" @@ -369,6 +375,40 @@ It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied - TLS_RSA_WITH_AES_256_GCM_SHA384 ``` +!!! important "Conflicting TLS Options" + + Since a TLS options reference is mapped to a host name, if a configuration introduces a situation where the same host name (from a `Host` rule) gets matched with two TLS options references, a conflict occurs, such as in the example below: + + ```toml tab="TOML" + [http.routers] + [http.routers.routerfoo] + rule = "Host(`snitest.com`) && Path(`/foo`)" + [http.routers.routerfoo.tls] + options="foo" + + [http.routers] + [http.routers.routerbar] + rule = "Host(`snitest.com`) && Path(`/bar`)" + [http.routers.routerbar.tls] + options="bar" + ``` + + ```yaml tab="YAML" + http: + routers: + routerfoo: + rule: "Host(`snitest.com`) && Path(`/foo`)" + tls: + options: foo + + routerbar: + rule: "Host(`snitest.com`) && Path(`/bar`)" + tls: + options: bar + ``` + + If that happens, both mappings are discarded, and the host name (`snitest.com` in this case) for these routers gets associated with the default TLS options instead. + ## Configuring TCP Routers ### General diff --git a/docs/content/user-guides/crd-acme/01-crd.yml b/docs/content/user-guides/crd-acme/01-crd.yml index 8914ccac1..9aef075b4 100644 --- a/docs/content/user-guides/crd-acme/01-crd.yml +++ b/docs/content/user-guides/crd-acme/01-crd.yml @@ -42,6 +42,21 @@ spec: singular: middleware scope: Namespaced +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: tlsoptions.traefik.containo.us + +spec: + group: traefik.containo.us + version: v1alpha1 + names: + kind: TLSOption + plural: tlsoptions + singular: tlsoption + scope: Namespaced + --- kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1beta1 @@ -97,6 +112,14 @@ rules: - get - list - watch + - apiGroups: + - traefik.containo.us + resources: + - tlsoptions + verbs: + - get + - list + - watch --- kind: ClusterRoleBinding diff --git a/integration/fixtures/https/https_tls_options.toml b/integration/fixtures/https/https_tls_options.toml index 50191c4c3..10bf6cadf 100644 --- a/integration/fixtures/https/https_tls_options.toml +++ b/integration/fixtures/https/https_tls_options.toml @@ -35,6 +35,18 @@ [http.routers.router3.tls] options = "unknown" + [http.routers.router4] + service = "service1" + rule = "Host(`snitest.net`)" + [http.routers.router4.tls] + options = "foo" + + [http.routers.router5] + service = "service1" + rule = "Host(`snitest.net`)" + [http.routers.router5.tls] + options = "baz" + [http.services] [http.services.service1] [http.services.service1.loadBalancer] @@ -59,5 +71,11 @@ [tls.options.foo] minversion = "VersionTLS11" + [tls.options.baz] + minversion = "VersionTLS11" + [tls.options.bar] minversion = "VersionTLS12" + + [tls.options.default] + minversion = "VersionTLS12" diff --git a/integration/https_test.go b/integration/https_test.go index cdbc58489..a226c54ce 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -195,6 +195,72 @@ func (s *HTTPSSuite) TestWithTLSOptions(c *check.C) { c.Assert(err, checker.IsNil) } +// TestWithConflictingTLSOptions checks that routers with same SNI but different TLS options get fallbacked to the default TLS options. +func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) { + cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_tls_options.toml")) + defer display(c) + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + // wait for Traefik + err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains("Host(`snitest.net`)")) + c.Assert(err, checker.IsNil) + + backend1 := startTestServer("9010", http.StatusNoContent) + backend2 := startTestServer("9020", http.StatusResetContent) + defer backend1.Close() + defer backend2.Close() + + err = try.GetRequest(backend1.URL, 1*time.Second, try.StatusCodeIs(http.StatusNoContent)) + c.Assert(err, checker.IsNil) + err = try.GetRequest(backend2.URL, 1*time.Second, try.StatusCodeIs(http.StatusResetContent)) + c.Assert(err, checker.IsNil) + + tr4 := &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + MaxVersion: tls.VersionTLS11, + ServerName: "snitest.net", + }, + } + + trDefault := &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + MaxVersion: tls.VersionTLS12, + ServerName: "snitest.net", + }, + } + + // With valid TLS options and request + req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443/", nil) + c.Assert(err, checker.IsNil) + req.Host = trDefault.TLSClientConfig.ServerName + req.Header.Set("Host", trDefault.TLSClientConfig.ServerName) + req.Header.Set("Accept", "*/*") + + err = try.RequestWithTransport(req, 30*time.Second, trDefault, try.StatusCodeIs(http.StatusNoContent)) + c.Assert(err, checker.IsNil) + + // With a bad TLS version + req, err = http.NewRequest(http.MethodGet, "https://127.0.0.1:4443/", nil) + c.Assert(err, checker.IsNil) + req.Host = tr4.TLSClientConfig.ServerName + req.Header.Set("Host", tr4.TLSClientConfig.ServerName) + req.Header.Set("Accept", "*/*") + client := http.Client{ + Transport: tr4, + } + _, err = client.Do(req) + c.Assert(err, checker.NotNil) + c.Assert(err.Error(), checker.Contains, "protocol version not supported") + + // with unknown tls option + err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains(fmt.Sprintf("found different TLS options for routers on the same host %v, so using the default TLS option instead", tr4.TLSClientConfig.ServerName))) + c.Assert(err, checker.IsNil) +} + // TestWithSNIStrictNotMatchedRequest involves a client sending a SNI hostname of // "snitest.org", which does not match the CN of 'snitest.com.crt'. The test // verifies that traefik closes the connection. diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index 9ea4995f7..26ed3d096 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -2,6 +2,7 @@ package tcp import ( "context" + "crypto/tls" "fmt" "net/http" @@ -11,7 +12,7 @@ import ( "github.com/containous/traefik/pkg/server/internal" tcpservice "github.com/containous/traefik/pkg/server/service/tcp" "github.com/containous/traefik/pkg/tcp" - "github.com/containous/traefik/pkg/tls" + traefiktls "github.com/containous/traefik/pkg/tls" ) // NewManager Creates a new Manager @@ -19,7 +20,7 @@ func NewManager(conf *config.RuntimeConfiguration, serviceManager *tcpservice.Manager, httpHandlers map[string]http.Handler, httpsHandlers map[string]http.Handler, - tlsManager *tls.Manager, + tlsManager *traefiktls.Manager, ) *Manager { return &Manager{ serviceManager: serviceManager, @@ -35,7 +36,7 @@ type Manager struct { serviceManager *tcpservice.Manager httpHandlers map[string]http.Handler httpsHandlers map[string]http.Handler - tlsManager *tls.Manager + tlsManager *traefiktls.Manager conf *config.RuntimeConfiguration } @@ -90,6 +91,12 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string router.HTTPSHandler(handlerHTTPS, defaultTLSConf) + type nameAndConfig struct { + routerName string // just so we have it as additional information when logging + TLSConfig *tls.Config + } + // Keyed by domain, then by options reference. + tlsOptionsForHostSNI := map[string]map[string]nameAndConfig{} for routerHTTPName, routerHTTPConfig := range configsHTTP { if len(routerHTTPConfig.TLS.Options) == 0 || routerHTTPConfig.TLS.Options == defaultTLSConfigName { continue @@ -107,7 +114,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string } if len(domains) == 0 { - logger.Warnf("The 'default' TLS options will be applied instead of %q as no domain has been found in the rule", routerHTTPConfig.TLS.Options) + logger.Warnf("No domain found in rule %v, the TLS options applied for this router will depend on the hostSNI of each request", routerHTTPConfig.Rule) } for _, domain := range domains { @@ -123,12 +130,44 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string logger.Debug(err) continue } - - router.AddRouteHTTPTLS(domain, tlsConf) + if tlsOptionsForHostSNI[domain] == nil { + tlsOptionsForHostSNI[domain] = make(map[string]nameAndConfig) + } + tlsOptionsForHostSNI[domain][routerHTTPConfig.TLS.Options] = nameAndConfig{ + routerName: routerHTTPName, + TLSConfig: tlsConf, + } } } } + logger := log.FromContext(ctx) + for hostSNI, tlsConfigs := range tlsOptionsForHostSNI { + if len(tlsConfigs) == 1 { + var optionsName string + var config *tls.Config + for k, v := range tlsConfigs { + optionsName = k + config = v.TLSConfig + break + } + logger.Debugf("Adding route for %s with TLS options %s", hostSNI, optionsName) + router.AddRouteHTTPTLS(hostSNI, config) + } else { + routers := make([]string, 0, len(tlsConfigs)) + for _, v := range tlsConfigs { + // TODO: properly deal with critical errors VS non-critical errors + if configsHTTP[v.routerName].Err != "" { + configsHTTP[v.routerName].Err += "\n" + } + configsHTTP[v.routerName].Err += fmt.Sprintf("found different TLS options for routers on the same host %v, so using the default TLS option instead", hostSNI) + routers = append(routers, v.routerName) + } + logger.Warnf("Found different TLS options for routers on the same host %v, so using the default TLS options instead for these routers: %#v", hostSNI, routers) + router.AddRouteHTTPTLS(hostSNI, defaultTLSConf) + } + } + for routerName, routerConfig := range configs { ctxRouter := log.With(internal.AddProviderInContext(ctx, routerName), log.Str(log.RouterName, routerName)) logger := log.FromContext(ctxRouter) diff --git a/pkg/tcp/router.go b/pkg/tcp/router.go index aeb98171e..dd7eb5020 100644 --- a/pkg/tcp/router.go +++ b/pkg/tcp/router.go @@ -90,7 +90,6 @@ func (r *Router) AddRouteHTTPTLS(sniHost string, config *tls.Config) { if r.hostHTTPTLSConfig == nil { r.hostHTTPTLSConfig = map[string]*tls.Config{} } - log.Debugf("adding route %s with minversion %d", sniHost, config.MinVersion) r.hostHTTPTLSConfig[sniHost] = config } From c39aa5e857cc30d7b37cbb8752d029d947c3d113 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 5 Jul 2019 17:24:04 +0200 Subject: [PATCH 03/49] Add scheme to IngressRoute. --- .../dynamic-configuration/kubernetes-crd.yml | 6 + integration/fixtures/k8s/03-ingressroute.yml | 2 +- integration/fixtures/k8s/04-ingressroute.yml | 2 +- integration/testdata/rawdata-crd.json | 18 +- .../kubernetes/crd/fixtures/services.yml | 31 +++ .../kubernetes/crd/fixtures/simple.yml | 2 +- .../kubernetes/crd/fixtures/tcp/simple.yml | 2 +- .../crd/fixtures/tcp/with_bad_host_rule.yml | 2 +- .../crd/fixtures/tcp/with_bad_tls_options.yml | 2 +- .../crd/fixtures/tcp/with_no_rule_value.yml | 2 +- .../kubernetes/crd/fixtures/tcp/with_tls.yml | 2 +- .../crd/fixtures/tcp/with_tls_acme.yml | 2 +- .../crd/fixtures/tcp/with_tls_options.yml | 2 +- ...ith_tls_options_and_specific_namespace.yml | 2 +- .../crd/fixtures/tcp/with_tls_passthrough.yml | 2 +- .../crd/fixtures/tcp/with_two_rules.yml | 2 +- .../crd/fixtures/tcp/with_two_services.yml | 2 +- .../fixtures/tcp/with_unknown_tls_options.yml | 2 +- .../with_unknown_tls_options_namespace.yml | 2 +- .../crd/fixtures/with_bad_host_rule.yml | 2 +- .../crd/fixtures/with_bad_tls_options.yml | 2 +- .../crd/fixtures/with_https_default.yml | 2 +- .../crd/fixtures/with_https_scheme.yml | 18 ++ .../crd/fixtures/with_middleware.yml | 2 +- .../with_middleware_crossprovider.yml | 2 +- .../crd/fixtures/with_no_rule_value.yml | 2 +- .../kubernetes/crd/fixtures/with_tls.yml | 2 +- .../kubernetes/crd/fixtures/with_tls_acme.yml | 2 +- .../crd/fixtures/with_tls_options.yml | 2 +- ...ith_tls_options_and_specific_namespace.yml | 2 +- .../crd/fixtures/with_two_rules.yml | 2 +- .../crd/fixtures/with_two_services.yml | 2 +- .../crd/fixtures/with_unknown_tls_options.yml | 2 +- .../with_unknown_tls_options_namespace.yml | 2 +- .../crd/fixtures/with_wrong_rule_kind.yml | 2 +- pkg/provider/kubernetes/crd/kubernetes.go | 11 +- .../kubernetes/crd/kubernetes_test.go | 193 +++++++++++------- .../crd/traefik/v1alpha1/ingressroute.go | 1 + 38 files changed, 220 insertions(+), 120 deletions(-) create mode 100644 pkg/provider/kubernetes/crd/fixtures/with_https_scheme.yml diff --git a/docs/content/reference/dynamic-configuration/kubernetes-crd.yml b/docs/content/reference/dynamic-configuration/kubernetes-crd.yml index bb016b6d7..f7254e785 100644 --- a/docs/content/reference/dynamic-configuration/kubernetes-crd.yml +++ b/docs/content/reference/dynamic-configuration/kubernetes-crd.yml @@ -97,6 +97,12 @@ spec: middlewares: - name: stripprefix - name: addprefix + - match: PathPrefix(`/misc`) + services: + - name: s3 + port: 8443 + # scheme allow to override the scheme for the service. (ex: https or h2c) + scheme: https # use an empty tls object for TLS with Let's Encrypt tls: secretName: supersecret diff --git a/integration/fixtures/k8s/03-ingressroute.yml b/integration/fixtures/k8s/03-ingressroute.yml index fc4a9230f..03f458333 100644 --- a/integration/fixtures/k8s/03-ingressroute.yml +++ b/integration/fixtures/k8s/03-ingressroute.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/integration/fixtures/k8s/04-ingressroute.yml b/integration/fixtures/k8s/04-ingressroute.yml index 276bff98c..596073206 100644 --- a/integration/fixtures/k8s/04-ingressroute.yml +++ b/integration/fixtures/k8s/04-ingressroute.yml @@ -13,7 +13,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test2.crd + name: test2.route namespace: default spec: diff --git a/integration/testdata/rawdata-crd.json b/integration/testdata/rawdata-crd.json index c6c9e1b25..1851ddd5e 100644 --- a/integration/testdata/rawdata-crd.json +++ b/integration/testdata/rawdata-crd.json @@ -1,24 +1,24 @@ { "routers": { - "default/test.crd-6b204d94623b3df4370c@kubernetescrd": { + "default/test.route-6b204d94623b3df4370c@kubernetescrd": { "entryPoints": [ "web" ], - "service": "default/test.crd-6b204d94623b3df4370c", + "service": "default/test.route-6b204d94623b3df4370c", "rule": "Host(`foo.com`) \u0026\u0026 PathPrefix(`/bar`)", "priority": 12, "tls": { "options": "default/mytlsoption" } }, - "default/test2.crd-23c7f4c450289ee29016@kubernetescrd": { + "default/test2.route-23c7f4c450289ee29016@kubernetescrd": { "entryPoints": [ "web" ], "middlewares": [ "default/stripprefix" ], - "service": "default/test2.crd-23c7f4c450289ee29016", + "service": "default/test2.route-23c7f4c450289ee29016", "rule": "Host(`foo.com`) \u0026\u0026 PathPrefix(`/tobestripped`)" } }, @@ -30,12 +30,12 @@ ] }, "usedBy": [ - "default/test2.crd-23c7f4c450289ee29016@kubernetescrd" + "default/test2.route-23c7f4c450289ee29016@kubernetescrd" ] } }, "services": { - "default/test.crd-6b204d94623b3df4370c@kubernetescrd": { + "default/test.route-6b204d94623b3df4370c@kubernetescrd": { "loadBalancer": { "servers": [ { @@ -48,14 +48,14 @@ "passHostHeader": true }, "usedBy": [ - "default/test.crd-6b204d94623b3df4370c@kubernetescrd" + "default/test.route-6b204d94623b3df4370c@kubernetescrd" ], "serverStatus": { "http://10.42.0.3:80": "UP", "http://10.42.0.5:80": "UP" } }, - "default/test2.crd-23c7f4c450289ee29016@kubernetescrd": { + "default/test2.route-23c7f4c450289ee29016@kubernetescrd": { "loadBalancer": { "servers": [ { @@ -68,7 +68,7 @@ "passHostHeader": true }, "usedBy": [ - "default/test2.crd-23c7f4c450289ee29016@kubernetescrd" + "default/test2.route-23c7f4c450289ee29016@kubernetescrd" ], "serverStatus": { "http://10.42.0.3:80": "UP", diff --git a/pkg/provider/kubernetes/crd/fixtures/services.yml b/pkg/provider/kubernetes/crd/fixtures/services.yml index 2a8ad6edd..1c89a9c00 100644 --- a/pkg/provider/kubernetes/crd/fixtures/services.yml +++ b/pkg/provider/kubernetes/crd/fixtures/services.yml @@ -86,3 +86,34 @@ subsets: ports: - name: web-secure port: 443 + +--- +apiVersion: v1 +kind: Service +metadata: + name: whoami3 + namespace: default + +spec: + ports: + - name: web-secure2 + port: 8443 + scheme: https + selector: + app: containous + task: whoami3 + +--- +kind: Endpoints +apiVersion: v1 +metadata: + name: whoami3 + namespace: default + +subsets: + - addresses: + - ip: 10.10.0.7 + - ip: 10.10.0.8 + ports: + - name: web-secure2 + port: 8443 diff --git a/pkg/provider/kubernetes/crd/fixtures/simple.yml b/pkg/provider/kubernetes/crd/fixtures/simple.yml index 92cfb153c..15e20535c 100644 --- a/pkg/provider/kubernetes/crd/fixtures/simple.yml +++ b/pkg/provider/kubernetes/crd/fixtures/simple.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/simple.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/simple.yml index db1e0ca87..141cf6cb4 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/simple.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/simple.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_host_rule.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_host_rule.yml index b525c0619..084da9bf7 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_host_rule.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_host_rule.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml index 81c08b434..27915bb20 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml @@ -52,7 +52,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_no_rule_value.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_no_rule_value.yml index 8a51c2e6f..e78a0bfec 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_no_rule_value.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_no_rule_value.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls.yml index 33237f2bc..17548e2b3 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls.yml @@ -12,7 +12,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_acme.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_acme.yml index 43fcf5938..f7e334513 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_acme.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_acme.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml index 8666918bc..5788e2f6b 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml @@ -51,7 +51,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml index 49c1b4bb5..4c5ba7844 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml @@ -51,7 +51,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_passthrough.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_passthrough.yml index 5c440a4a4..5cfac32f5 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_passthrough.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_passthrough.yml @@ -12,7 +12,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_rules.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_rules.yml index f07c7b25f..dd068d0c3 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_rules.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_rules.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_services.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_services.yml index 0cbdfa513..bc846568e 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_services.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_two_services.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml index d42471762..6c8e2491e 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml @@ -12,7 +12,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml index 743ab8072..bd444c505 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml @@ -12,7 +12,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRouteTCP metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_bad_host_rule.yml b/pkg/provider/kubernetes/crd/fixtures/with_bad_host_rule.yml index d18c4f157..2a722c8f6 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_bad_host_rule.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_bad_host_rule.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml index a1db6f972..0a51178ca 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml @@ -41,7 +41,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_https_default.yml b/pkg/provider/kubernetes/crd/fixtures/with_https_default.yml index 233d66d3a..c022a6cde 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_https_default.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_https_default.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_https_scheme.yml b/pkg/provider/kubernetes/crd/fixtures/with_https_scheme.yml new file mode 100644 index 000000000..4a9bb8b46 --- /dev/null +++ b/pkg/provider/kubernetes/crd/fixtures/with_https_scheme.yml @@ -0,0 +1,18 @@ +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: test.route + namespace: default + +spec: + entryPoints: + - foo + + routes: + - match: Host(`foo.com`) && PathPrefix(`/bar`) + kind: Rule + priority: 12 + services: + - name: whoami3 + port: 8443 + scheme: https diff --git a/pkg/provider/kubernetes/crd/fixtures/with_middleware.yml b/pkg/provider/kubernetes/crd/fixtures/with_middleware.yml index 448ee5bdf..3a7cd97eb 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_middleware.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_middleware.yml @@ -24,7 +24,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test2.crd + name: test2.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_middleware_crossprovider.yml b/pkg/provider/kubernetes/crd/fixtures/with_middleware_crossprovider.yml index 799953da8..915000329 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_middleware_crossprovider.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_middleware_crossprovider.yml @@ -24,7 +24,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test2.crd + name: test2.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_no_rule_value.yml b/pkg/provider/kubernetes/crd/fixtures/with_no_rule_value.yml index be1bfb92c..35a2df6d3 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_no_rule_value.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_no_rule_value.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls.yml index dc95f9770..8f78a318d 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls.yml @@ -12,7 +12,7 @@ data: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls_acme.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls_acme.yml index 3b289e1bc..170c7a94d 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls_acme.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls_acme.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml index 10839d487..5d9bd31a7 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml @@ -40,7 +40,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml index c378a82f3..2fd7aa390 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml @@ -40,7 +40,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_two_rules.yml b/pkg/provider/kubernetes/crd/fixtures/with_two_rules.yml index a6e4fd021..f307b797d 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_two_rules.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_two_rules.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_two_services.yml b/pkg/provider/kubernetes/crd/fixtures/with_two_services.yml index 2495702c8..8a6a17e24 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_two_services.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_two_services.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml index d39f40468..1ef9d2344 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml @@ -11,7 +11,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml index 7b2b3111a..022b88c98 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml @@ -11,7 +11,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/fixtures/with_wrong_rule_kind.yml b/pkg/provider/kubernetes/crd/fixtures/with_wrong_rule_kind.yml index 31b06e1ce..6c649295a 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_wrong_rule_kind.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_wrong_rule_kind.yml @@ -1,7 +1,7 @@ apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: test.crd + name: test.route namespace: default spec: diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 8a4c277e1..94144a8b8 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -278,8 +278,15 @@ func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]confi } protocol := "http" - if port == 443 || strings.HasPrefix(portSpec.Name, "https") { - protocol = "https" + switch svc.Scheme { + case "http", "https", "h2c": + protocol = svc.Scheme + case "": + if port == 443 || strings.HasPrefix(portSpec.Name, "https") { + protocol = "https" + } + default: + return nil, fmt.Errorf("invalid scheme %q specified", svc.Scheme) } for _, addr := range subset.Addresses { diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index 8e48e71d3..c88ffcb0d 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -45,14 +45,14 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -77,19 +77,19 @@ func TestLoadIngressRouteTCPs(t *testing.T) { expected: &config.Configuration{ TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", }, - "default/test.crd-f44ce589164e656d231c": { + "default/test.route-f44ce589164e656d231c": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-f44ce589164e656d231c", + Service: "default/test.route-f44ce589164e656d231c", Rule: "HostSNI(`bar.com`)", }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -103,7 +103,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - "default/test.crd-f44ce589164e656d231c": { + "default/test.route-f44ce589164e656d231c": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -133,14 +133,14 @@ func TestLoadIngressRouteTCPs(t *testing.T) { expected: &config.Configuration{ TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -236,15 +236,15 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{}, }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -273,9 +273,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { expected: &config.Configuration{ TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Passthrough: true, @@ -283,7 +283,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -332,9 +332,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Options: "default/foo", @@ -342,7 +342,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -390,9 +390,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Options: "myns/foo", @@ -400,7 +400,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -447,9 +447,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Options: "default/foo", @@ -457,7 +457,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -493,9 +493,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Options: "default/unknown", @@ -503,7 +503,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -539,9 +539,9 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{ Options: "unknown/foo", @@ -549,7 +549,7 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -578,15 +578,15 @@ func TestLoadIngressRouteTCPs(t *testing.T) { expected: &config.Configuration{ TCP: &config.TCPConfiguration{ Routers: map[string]*config.TCPRouter{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-fdd3e9338e47a45efefc", + Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", TLS: &config.RouterTCPTLSConfig{}, }, }, Services: map[string]*config.TCPService{ - "default/test.crd-fdd3e9338e47a45efefc": { + "default/test.route-fdd3e9338e47a45efefc": { LoadBalancer: &config.TCPLoadBalancerService{ Servers: []config.TCPServer{ { @@ -661,16 +661,16 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, }, }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -698,9 +698,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test2.crd-23c7f4c450289ee29016": { + "default/test2.route-23c7f4c450289ee29016": { EntryPoints: []string{"web"}, - Service: "default/test2.crd-23c7f4c450289ee29016", + Service: "default/test2.route-23c7f4c450289ee29016", Rule: "Host(`foo.com`) && PathPrefix(`/tobestripped`)", Priority: 12, Middlewares: []string{"default/stripprefix", "foo/addprefix"}, @@ -719,7 +719,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, Services: map[string]*config.Service{ - "default/test2.crd-23c7f4c450289ee29016": { + "default/test2.route-23c7f4c450289ee29016": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -748,9 +748,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test2.crd-23c7f4c450289ee29016": { + "default/test2.route-23c7f4c450289ee29016": { EntryPoints: []string{"web"}, - Service: "default/test2.crd-23c7f4c450289ee29016", + Service: "default/test2.route-23c7f4c450289ee29016", Rule: "Host(`foo.com`) && PathPrefix(`/tobestripped`)", Priority: 12, Middlewares: []string{"default/stripprefix", "foo/addprefix", "basicauth@file", "redirect@file"}, @@ -769,7 +769,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, Services: map[string]*config.Service{ - "default/test2.crd-23c7f4c450289ee29016": { + "default/test2.route-23c7f4c450289ee29016": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -796,22 +796,22 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Priority: 14, }, - "default/test.crd-77c62dfe9517144aeeaa": { + "default/test.route-77c62dfe9517144aeeaa": { EntryPoints: []string{"web"}, - Service: "default/test.crd-77c62dfe9517144aeeaa", + Service: "default/test.route-77c62dfe9517144aeeaa", Rule: "Host(`foo.com`) && PathPrefix(`/foo`)", Priority: 12, }, }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -824,7 +824,7 @@ func TestLoadIngressRoutes(t *testing.T) { PassHostHeader: true, }, }, - "default/test.crd-77c62dfe9517144aeeaa": { + "default/test.route-77c62dfe9517144aeeaa": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -853,16 +853,16 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-77c62dfe9517144aeeaa": { + "default/test.route-77c62dfe9517144aeeaa": { EntryPoints: []string{"web"}, - Service: "default/test.crd-77c62dfe9517144aeeaa", + Service: "default/test.route-77c62dfe9517144aeeaa", Rule: "Host(`foo.com`) && PathPrefix(`/foo`)", Priority: 12, }, }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-77c62dfe9517144aeeaa": { + "default/test.route-77c62dfe9517144aeeaa": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -970,9 +970,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{}, @@ -980,7 +980,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1026,9 +1026,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{ @@ -1038,7 +1038,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1084,9 +1084,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{ @@ -1096,7 +1096,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1141,9 +1141,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{ @@ -1153,7 +1153,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1187,9 +1187,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{ @@ -1199,7 +1199,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1233,9 +1233,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{ @@ -1245,7 +1245,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1273,9 +1273,9 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, TLS: &config.RouterTLSConfig{}, @@ -1283,7 +1283,7 @@ func TestLoadIngressRoutes(t *testing.T) { }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1311,16 +1311,16 @@ func TestLoadIngressRoutes(t *testing.T) { }, HTTP: &config.HTTPConfiguration{ Routers: map[string]*config.Router{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"foo"}, - Service: "default/test.crd-6b204d94623b3df4370c", + Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, }, }, Middlewares: map[string]*config.Middleware{}, Services: map[string]*config.Service{ - "default/test.crd-6b204d94623b3df4370c": { + "default/test.route-6b204d94623b3df4370c": { LoadBalancer: &config.LoadBalancerService{ Servers: []config.Server{ { @@ -1337,6 +1337,43 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, + { + desc: "Simple Ingress Route, explicit https scheme", + paths: []string{"services.yml", "with_https_scheme.yml"}, + expected: &config.Configuration{ + TLS: &config.TLSConfiguration{}, + TCP: &config.TCPConfiguration{ + Routers: map[string]*config.TCPRouter{}, + Services: map[string]*config.TCPService{}, + }, + HTTP: &config.HTTPConfiguration{ + Routers: map[string]*config.Router{ + "default/test.route-6b204d94623b3df4370c": { + EntryPoints: []string{"foo"}, + Service: "default/test.route-6b204d94623b3df4370c", + Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", + Priority: 12, + }, + }, + Middlewares: map[string]*config.Middleware{}, + Services: map[string]*config.Service{ + "default/test.route-6b204d94623b3df4370c": { + LoadBalancer: &config.LoadBalancerService{ + Servers: []config.Server{ + { + URL: "https://10.10.0.7:8443", + }, + { + URL: "https://10.10.0.8:8443", + }, + }, + PassHostHeader: true, + }, + }, + }, + }, + }, + }, { desc: "port selected by name (TODO)", }, diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go index 26f534ad8..2fb9be90a 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go @@ -45,6 +45,7 @@ type TLSOptionRef struct { type Service struct { Name string `json:"name"` Port int32 `json:"port"` + Scheme string `json:"scheme,omitempty"` HealthCheck *HealthCheck `json:"healthCheck,omitempty"` Strategy string `json:"strategy,omitempty"` } From 0ee5d3d83f9316d3b1a49fcc5f7c32e24ab43706 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 8 Jul 2019 11:00:04 +0200 Subject: [PATCH 04/49] Automatic generation of the doc for the CLI flags and env vars. --- .../reference/dynamic-configuration/file.toml | 336 +++++----- .../reference/dynamic-configuration/file.yaml | 386 ++++++----- .../dynamic-configuration/labels.yml | 317 ++++----- .../reference/static-configuration/cli-ref.md | 589 +++++++++++++++++ .../reference/static-configuration/cli.md | 5 +- .../reference/static-configuration/cli.txt | 609 ------------------ .../reference/static-configuration/env-ref.md | 589 +++++++++++++++++ .../reference/static-configuration/env.md | 589 +---------------- .../reference/static-configuration/file.toml | 3 +- .../reference/static-configuration/file.yaml | 101 +-- generate.go | 1 + internal/gendoc.go | 83 +++ pkg/config/parser/tags.go | 1 + pkg/provider/file/file.go | 2 +- pkg/types/duration.go | 16 +- 15 files changed, 1898 insertions(+), 1729 deletions(-) create mode 100644 docs/content/reference/static-configuration/cli-ref.md delete mode 100644 docs/content/reference/static-configuration/cli.txt create mode 100644 docs/content/reference/static-configuration/env-ref.md create mode 100644 internal/gendoc.go diff --git a/docs/content/reference/dynamic-configuration/file.toml b/docs/content/reference/dynamic-configuration/file.toml index 8dab9ba61..9c378e0ef 100644 --- a/docs/content/reference/dynamic-configuration/file.toml +++ b/docs/content/reference/dynamic-configuration/file.toml @@ -7,126 +7,117 @@ rule = "foobar" priority = 42 [http.routers.Router0.tls] - options = "TLS0" + options = "foobar" + [http.routers.Router1] + entryPoints = ["foobar", "foobar"] + middlewares = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" + priority = 42 + [http.routers.Router1.tls] + options = "foobar" + [http.services] + [http.services.Service0] + [http.services.Service0.loadBalancer] + passHostHeader = true + [http.services.Service0.loadBalancer.stickiness] + cookieName = "foobar" + secureCookie = true + httpOnlyCookie = true + + [[http.services.Service0.loadBalancer.servers]] + url = "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] + name0 = "foobar" + name1 = "foobar" + [http.services.Service0.loadBalancer.responseForwarding] + flushInterval = "foobar" + [http.services.Service1] + [http.services.Service1.loadBalancer] + passHostHeader = true + [http.services.Service1.loadBalancer.stickiness] + cookieName = "foobar" + secureCookie = true + httpOnlyCookie = true + + [[http.services.Service1.loadBalancer.servers]] + url = "foobar" + + [[http.services.Service1.loadBalancer.servers]] + url = "foobar" + [http.services.Service1.loadBalancer.healthCheck] + scheme = "foobar" + path = "foobar" + port = 42 + interval = "foobar" + timeout = "foobar" + hostname = "foobar" + [http.services.Service1.loadBalancer.healthCheck.headers] + name0 = "foobar" + name1 = "foobar" + [http.services.Service1.loadBalancer.responseForwarding] + flushInterval = "foobar" [http.middlewares] - [http.middlewares.Middleware0] - [http.middlewares.Middleware0.addPrefix] + [http.middlewares.Middleware00] + [http.middlewares.Middleware00.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] + [http.middlewares.Middleware01] + [http.middlewares.Middleware01.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] + [http.middlewares.Middleware02] + [http.middlewares.Middleware02.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] + [http.middlewares.Middleware03] + [http.middlewares.Middleware03.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] + [http.middlewares.Middleware04] + [http.middlewares.Middleware04.circuitBreaker] + expression = "foobar" + [http.middlewares.Middleware05] + [http.middlewares.Middleware05.compress] + [http.middlewares.Middleware06] + [http.middlewares.Middleware06.digestAuth] + users = ["foobar", "foobar"] + usersFile = "foobar" + removeHeader = true + realm = "foobar" + headerField = "foobar" + [http.middlewares.Middleware07] + [http.middlewares.Middleware07.errors] + status = ["foobar", "foobar"] + service = "foobar" + query = "foobar" + [http.middlewares.Middleware08] + [http.middlewares.Middleware08.forwardAuth] + address = "foobar" + trustForwardHeader = true + authResponseHeaders = ["foobar", "foobar"] + [http.middlewares.Middleware08.forwardAuth.tls] + ca = "foobar" + caOptional = true + cert = "foobar" + key = "foobar" + insecureSkipVerify = true + [http.middlewares.Middleware09] + [http.middlewares.Middleware09.headers] accessControlAllowCredentials = true accessControlAllowHeaders = ["foobar", "foobar"] accessControlAllowMethods = ["foobar", "foobar"] @@ -153,44 +144,86 @@ publicKey = "foobar" referrerPolicy = "foobar" isDevelopment = true - [http.middlewares.Middleware8.headers.customRequestHeaders] + [http.middlewares.Middleware09.headers.customRequestHeaders] name0 = "foobar" name1 = "foobar" - [http.middlewares.Middleware8.headers.customResponseHeaders] + [http.middlewares.Middleware09.headers.customResponseHeaders] name0 = "foobar" name1 = "foobar" - [http.middlewares.Middleware8.headers.sslProxyHeaders] + [http.middlewares.Middleware09.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.services.Service0.loadBalancer.servers]] - url = "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] - name0 = "foobar" - name1 = "foobar" - [http.services.Service0.loadBalancer.responseForwarding] - flushInterval = "foobar" + [http.middlewares.Middleware10] + [http.middlewares.Middleware10.ipWhiteList] + sourceRange = ["foobar", "foobar"] + [http.middlewares.Middleware10.ipWhiteList.ipStrategy] + depth = 42 + excludedIPs = ["foobar", "foobar"] + [http.middlewares.Middleware11] + [http.middlewares.Middleware11.maxConn] + amount = 42 + extractorFunc = "foobar" + [http.middlewares.Middleware12] + [http.middlewares.Middleware12.passTLSClientCert] + pem = true + [http.middlewares.Middleware12.passTLSClientCert.info] + notAfter = true + notBefore = true + sans = true + [http.middlewares.Middleware12.passTLSClientCert.info.subject] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware12.passTLSClientCert.info.issuer] + country = true + province = true + locality = true + organization = true + commonName = true + serialNumber = true + domainComponent = true + [http.middlewares.Middleware13] + [http.middlewares.Middleware13.rateLimit] + extractorFunc = "foobar" + [http.middlewares.Middleware13.rateLimit.rateSet] + [http.middlewares.Middleware13.rateLimit.rateSet.Rate0] + period = "42ns" + average = 42 + burst = 42 + [http.middlewares.Middleware13.rateLimit.rateSet.Rate1] + period = "42ns" + average = 42 + burst = 42 + [http.middlewares.Middleware14] + [http.middlewares.Middleware14.redirectRegex] + regex = "foobar" + replacement = "foobar" + permanent = true + [http.middlewares.Middleware15] + [http.middlewares.Middleware15.redirectScheme] + scheme = "foobar" + port = "foobar" + permanent = true + [http.middlewares.Middleware16] + [http.middlewares.Middleware16.replacePath] + path = "foobar" + [http.middlewares.Middleware17] + [http.middlewares.Middleware17.replacePathRegex] + regex = "foobar" + replacement = "foobar" + [http.middlewares.Middleware18] + [http.middlewares.Middleware18.retry] + attempts = 42 + [http.middlewares.Middleware19] + [http.middlewares.Middleware19.stripPrefix] + prefixes = ["foobar", "foobar"] + [http.middlewares.Middleware20] + [http.middlewares.Middleware20.stripPrefixRegex] + regex = ["foobar", "foobar"] [tcp] [tcp.routers] @@ -200,7 +233,14 @@ rule = "foobar" [tcp.routers.TCPRouter0.tls] passthrough = true - options = "TLS1" + options = "foobar" + [tcp.routers.TCPRouter1] + entryPoints = ["foobar", "foobar"] + service = "foobar" + rule = "foobar" + [tcp.routers.TCPRouter1.tls] + passthrough = true + options = "foobar" [tcp.services] [tcp.services.TCPService0] [tcp.services.TCPService0.loadBalancer] @@ -210,6 +250,14 @@ [[tcp.services.TCPService0.loadBalancer.servers]] address = "foobar" + [tcp.services.TCPService1] + [tcp.services.TCPService1.loadBalancer] + + [[tcp.services.TCPService1.loadBalancer.servers]] + address = "foobar" + + [[tcp.services.TCPService1.loadBalancer.servers]] + address = "foobar" [tls] @@ -223,18 +271,18 @@ keyFile = "foobar" stores = ["foobar", "foobar"] [tls.options] - [tls.options.TLS0] + [tls.options.Options0] minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.TLS0.clientCA] + [tls.options.Options0.clientCA] files = ["foobar", "foobar"] optional = true - [tls.options.TLS1] + [tls.options.Options1] minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.TLS1.clientCA] + [tls.options.Options1.clientCA] files = ["foobar", "foobar"] optional = true [tls.stores] diff --git a/docs/content/reference/dynamic-configuration/file.yaml b/docs/content/reference/dynamic-configuration/file.yaml index 1e72d988a..0ea19a867 100644 --- a/docs/content/reference/dynamic-configuration/file.yaml +++ b/docs/content/reference/dynamic-configuration/file.yaml @@ -2,54 +2,133 @@ http: routers: Router0: entryPoints: - - foobar - - foobar + - foobar + - foobar middlewares: - - foobar - - foobar + - foobar + - foobar service: foobar rule: foobar priority: 42 - tls: {} + tls: + options: foobar + Router1: + entryPoints: + - foobar + - foobar + middlewares: + - foobar + - foobar + service: foobar + rule: foobar + priority: 42 + tls: + options: foobar + services: + Service0: + loadBalancer: + stickiness: + cookieName: foobar + secureCookie: true + httpOnlyCookie: true + servers: + - url: foobar + - url: foobar + healthCheck: + scheme: foobar + path: foobar + port: 42 + interval: foobar + timeout: foobar + hostname: foobar + headers: + name0: foobar + name1: foobar + passHostHeader: true + responseForwarding: + flushInterval: foobar + Service1: + loadBalancer: + stickiness: + cookieName: foobar + secureCookie: true + httpOnlyCookie: true + servers: + - url: foobar + - url: foobar + healthCheck: + scheme: foobar + path: foobar + port: 42 + interval: foobar + timeout: foobar + hostname: foobar + headers: + name0: foobar + name1: foobar + passHostHeader: true + responseForwarding: + flushInterval: foobar middlewares: - Middleware0: + Middleware00: addPrefix: prefix: foobar - Middleware1: - stripPrefix: - prefixes: - - foobar - - foobar - Middleware2: - stripPrefixRegex: - regex: - - foobar - - foobar - Middleware3: - replacePath: - path: foobar - Middleware4: - replacePathRegex: - regex: foobar - replacement: foobar - Middleware5: + Middleware01: + basicAuth: + users: + - foobar + - foobar + usersFile: foobar + realm: foobar + removeHeader: true + headerField: foobar + Middleware02: + buffering: + maxRequestBodyBytes: 42 + memRequestBodyBytes: 42 + maxResponseBodyBytes: 42 + memResponseBodyBytes: 42 + retryExpression: foobar + Middleware03: chain: middlewares: - - foobar - - foobar - Middleware6: - ipWhiteList: - sourceRange: - - foobar - - foobar - Middleware7: - ipWhiteList: - ipStrategy: - depth: 42 - excludedIPs: - - foobar - - foobar - Middleware8: + - foobar + - foobar + Middleware04: + circuitBreaker: + expression: foobar + Middleware05: + compress: {} + Middleware06: + digestAuth: + users: + - foobar + - foobar + usersFile: foobar + removeHeader: true + realm: foobar + headerField: foobar + Middleware07: + errors: + status: + - foobar + - foobar + service: foobar + query: foobar + Middleware08: + forwardAuth: + address: foobar + tls: + ca: foobar + caOptional: true + cert: foobar + key: foobar + insecureSkipVerify: true + trustForwardHeader: true + authResponseHeaders: + - foobar + - foobar + Middleware09: headers: customRequestHeaders: name0: foobar @@ -59,23 +138,23 @@ http: name1: foobar accessControlAllowCredentials: true accessControlAllowHeaders: - - foobar - - foobar + - foobar + - foobar accessControlAllowMethods: - - foobar - - foobar + - foobar + - foobar accessControlAllowOrigin: foobar accessControlExposeHeaders: - - foobar - - foobar + - foobar + - foobar accessControlMaxAge: 42 addVaryHeader: true allowedHosts: - - foobar - - foobar + - foobar + - foobar hostsProxyHeaders: - - foobar - - foobar + - foobar + - foobar sslRedirect: true sslTemporaryRedirect: true sslHost: foobar @@ -96,83 +175,21 @@ http: publicKey: foobar referrerPolicy: foobar isDevelopment: true - Middleware9: - errors: - status: - - foobar - - foobar - service: foobar - query: foobar Middleware10: - rateLimit: - rateSet: - Rate0: - period: 42000000000 - average: 42 - burst: 42 - Rate1: - period: 42000000000 - average: 42 - burst: 42 - extractorFunc: foobar + ipWhiteList: + sourceRange: + - foobar + - foobar + ipStrategy: + depth: 42 + excludedIPs: + - foobar + - foobar Middleware11: - redirectRegex: - regex: foobar - replacement: foobar - permanent: true - Middleware12: - redirectScheme: - scheme: foobar - port: foobar - permanent: true - Middleware13: - basicAuth: - users: - - foobar - - foobar - usersFile: foobar - realm: foobar - removeHeader: true - headerField: foobar - Middleware14: - digestAuth: - users: - - foobar - - foobar - usersFile: foobar - removeHeader: true - realm: foobar - headerField: foobar - Middleware15: - forwardAuth: - address: foobar - tls: - ca: foobar - caOptional: true - cert: foobar - key: foobar - insecureSkipVerify: true - trustForwardHeader: true - authResponseHeaders: - - foobar - - foobar - Middleware16: maxConn: amount: 42 extractorFunc: foobar - Middleware17: - buffering: - maxRequestBodyBytes: 42 - memRequestBodyBytes: 42 - maxResponseBodyBytes: 42 - memResponseBodyBytes: 42 - retryExpression: foobar - Middleware18: - circuitBreaker: - expression: foobar - Middleware19: - compress: {} - Middleware20: + Middleware12: passTLSClientCert: pem: true info: @@ -195,79 +212,112 @@ http: commonName: true serialNumber: true domainComponent: true - Middleware21: + Middleware13: + rateLimit: + rateSet: + Rate0: + period: 42ns + average: 42 + burst: 42 + Rate1: + period: 42ns + average: 42 + burst: 42 + extractorFunc: foobar + Middleware14: + redirectRegex: + regex: foobar + replacement: foobar + permanent: true + Middleware15: + redirectScheme: + scheme: foobar + port: foobar + permanent: true + Middleware16: + replacePath: + path: foobar + Middleware17: + replacePathRegex: + regex: foobar + replacement: foobar + Middleware18: retry: - attemps: 42 - services: - Service0: - loadBalancer: - stickiness: - cookieName: foobar - servers: - - url: foobar - - url: foobar - healthCheck: - scheme: foobar - path: foobar - port: 42 - interval: foobar - timeout: foobar - hostname: foobar - headers: - name0: foobar - name1: foobar - passHostHeader: true - responseForwarding: - flushInterval: foobar + attempts: 42 + Middleware19: + stripPrefix: + prefixes: + - foobar + - foobar + Middleware20: + stripPrefixRegex: + regex: + - foobar + - foobar tcp: routers: TCPRouter0: entryPoints: - - foobar - - foobar + - foobar + - foobar service: foobar rule: foobar tls: passthrough: true + options: foobar + TCPRouter1: + entryPoints: + - foobar + - foobar + service: foobar + rule: foobar + tls: + passthrough: true + options: foobar services: TCPService0: loadBalancer: servers: - - address: foobar - - address: foobar + - address: foobar + - address: foobar + TCPService1: + loadBalancer: + servers: + - address: foobar + - address: foobar tls: certificates: - - certFile: foobar - keyFile: foobar - stores: - - foobar - - foobar - - certFile: foobar - keyFile: foobar - stores: - - foobar - - foobar + - certFile: foobar + keyFile: foobar + stores: + - foobar + - foobar + - certFile: foobar + keyFile: foobar + stores: + - foobar + - foobar options: - TLS0: + Options0: minVersion: foobar cipherSuites: - - foobar - - foobar + - foobar + - foobar clientCA: files: - - foobar - - foobar + - foobar + - foobar optional: true sniStrict: true - TLS1: + Options1: minVersion: foobar cipherSuites: - - foobar - - foobar + - foobar + - foobar clientCA: files: - - foobar - - foobar + - foobar + - foobar optional: true sniStrict: true stores: diff --git a/docs/content/reference/dynamic-configuration/labels.yml b/docs/content/reference/dynamic-configuration/labels.yml index a1b557cfb..3cd3e4767 100644 --- a/docs/content/reference/dynamic-configuration/labels.yml +++ b/docs/content/reference/dynamic-configuration/labels.yml @@ -1,154 +1,165 @@ 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.middleware00.addprefix.prefix=foobar" +- "traefik.http.middlewares.middleware01.basicauth.headerfield=foobar" +- "traefik.http.middlewares.middleware01.basicauth.realm=foobar" +- "traefik.http.middlewares.middleware01.basicauth.removeheader=true" +- "traefik.http.middlewares.middleware01.basicauth.users=foobar, foobar" +- "traefik.http.middlewares.middleware01.basicauth.usersfile=foobar" +- "traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.memrequestbodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.memresponsebodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.retryexpression=foobar" +- "traefik.http.middlewares.middleware03.chain.middlewares=foobar, foobar" +- "traefik.http.middlewares.middleware04.circuitbreaker.expression=foobar" +- "traefik.http.middlewares.middleware05.compress=true" +- "traefik.http.middlewares.middleware06.digestauth.headerfield=foobar" +- "traefik.http.middlewares.middleware06.digestauth.realm=foobar" +- "traefik.http.middlewares.middleware06.digestauth.removeheader=true" +- "traefik.http.middlewares.middleware06.digestauth.users=foobar, foobar" +- "traefik.http.middlewares.middleware06.digestauth.usersfile=foobar" +- "traefik.http.middlewares.middleware07.errors.query=foobar" +- "traefik.http.middlewares.middleware07.errors.service=foobar" +- "traefik.http.middlewares.middleware07.errors.status=foobar, foobar" +- "traefik.http.middlewares.middleware08.forwardauth.address=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.authresponseheaders=foobar, foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.ca=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.caoptional=true" +- "traefik.http.middlewares.middleware08.forwardauth.tls.cert=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify=true" +- "traefik.http.middlewares.middleware08.forwardauth.tls.key=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.trustforwardheader=true" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials=true" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin=foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolmaxage=42" +- "traefik.http.middlewares.middleware09.headers.addvaryheader=true" +- "traefik.http.middlewares.middleware09.headers.allowedhosts=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.browserxssfilter=true" +- "traefik.http.middlewares.middleware09.headers.contentsecuritypolicy=foobar" +- "traefik.http.middlewares.middleware09.headers.contenttypenosniff=true" +- "traefik.http.middlewares.middleware09.headers.custombrowserxssvalue=foobar" +- "traefik.http.middlewares.middleware09.headers.customframeoptionsvalue=foobar" +- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.forcestsheader=true" +- "traefik.http.middlewares.middleware09.headers.framedeny=true" +- "traefik.http.middlewares.middleware09.headers.hostsproxyheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.isdevelopment=true" +- "traefik.http.middlewares.middleware09.headers.publickey=foobar" +- "traefik.http.middlewares.middleware09.headers.referrerpolicy=foobar" +- "traefik.http.middlewares.middleware09.headers.sslforcehost=true" +- "traefik.http.middlewares.middleware09.headers.sslhost=foobar" +- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.sslredirect=true" +- "traefik.http.middlewares.middleware09.headers.ssltemporaryredirect=true" +- "traefik.http.middlewares.middleware09.headers.stsincludesubdomains=true" +- "traefik.http.middlewares.middleware09.headers.stspreload=true" +- "traefik.http.middlewares.middleware09.headers.stsseconds=42" +- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth=42" +- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips=foobar, foobar" +- "traefik.http.middlewares.middleware10.ipwhitelist.sourcerange=foobar, foobar" +- "traefik.http.middlewares.middleware11.maxconn.amount=42" +- "traefik.http.middlewares.middleware11.maxconn.extractorfunc=foobar" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.sans=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" +- "traefik.http.middlewares.middleware13.ratelimit.extractorfunc=foobar" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.average=42" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.burst=42" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.period=42" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.average=42" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.burst=42" +- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.period=42" +- "traefik.http.middlewares.middleware14.redirectregex.permanent=true" +- "traefik.http.middlewares.middleware14.redirectregex.regex=foobar" +- "traefik.http.middlewares.middleware14.redirectregex.replacement=foobar" +- "traefik.http.middlewares.middleware15.redirectscheme.permanent=true" +- "traefik.http.middlewares.middleware15.redirectscheme.port=foobar" +- "traefik.http.middlewares.middleware15.redirectscheme.scheme=foobar" +- "traefik.http.middlewares.middleware16.replacepath.path=foobar" +- "traefik.http.middlewares.middleware17.replacepathregex.regex=foobar" +- "traefik.http.middlewares.middleware17.replacepathregex.replacement=foobar" +- "traefik.http.middlewares.middleware18.retry.attempts=42" +- "traefik.http.middlewares.middleware19.stripprefix.prefixes=foobar, foobar" +- "traefik.http.middlewares.middleware20.stripprefixregex.regex=foobar, foobar" +- "traefik.http.routers.router0.entrypoints=foobar, foobar" +- "traefik.http.routers.router0.middlewares=foobar, foobar" +- "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=foobar" +- "traefik.http.routers.router1.entrypoints=foobar, foobar" +- "traefik.http.routers.router1.middlewares=foobar, foobar" +- "traefik.http.routers.router1.priority=42" +- "traefik.http.routers.router1.rule=foobar" +- "traefik.http.routers.router1.service=foobar" +- "traefik.http.routers.router1.tls=true" +- "traefik.http.routers.router1.tls.options=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.stickiness=true" +- "traefik.http.services.service0.loadbalancer.stickiness.cookiename=foobar" +- "traefik.http.services.service0.loadbalancer.stickiness.httponlycookie=true" +- "traefik.http.services.service0.loadbalancer.stickiness.securecookie=true" +- "traefik.http.services.service0.loadbalancer.server.port=foobar" +- "traefik.http.services.service0.loadbalancer.server.scheme=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.stickiness=true" +- "traefik.http.services.service1.loadbalancer.stickiness.cookiename=foobar" +- "traefik.http.services.service1.loadbalancer.stickiness.httponlycookie=true" +- "traefik.http.services.service1.loadbalancer.stickiness.securecookie=true" +- "traefik.http.services.service1.loadbalancer.server.port=foobar" +- "traefik.http.services.service1.loadbalancer.server.scheme=foobar" +- "traefik.tcp.routers.tcprouter0.entrypoints=foobar, foobar" +- "traefik.tcp.routers.tcprouter0.rule=foobar" +- "traefik.tcp.routers.tcprouter0.service=foobar" +- "traefik.tcp.routers.tcprouter0.tls=true" +- "traefik.tcp.routers.tcprouter0.tls.options=foobar" +- "traefik.tcp.routers.tcprouter0.tls.passthrough=true" +- "traefik.tcp.routers.tcprouter1.entrypoints=foobar, foobar" +- "traefik.tcp.routers.tcprouter1.rule=foobar" +- "traefik.tcp.routers.tcprouter1.service=foobar" +- "traefik.tcp.routers.tcprouter1.tls=true" +- "traefik.tcp.routers.tcprouter1.tls.options=foobar" +- "traefik.tcp.routers.tcprouter1.tls.passthrough=true" +- "traefik.tcp.services.tcpservice0.loadbalancer.server.port=foobar" +- "traefik.tcp.services.tcpservice1.loadbalancer.server.port=foobar" \ No newline at end of file diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md new file mode 100644 index 000000000..47384e163 --- /dev/null +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -0,0 +1,589 @@ + + +`--accesslog`: +Access log settings. (Default: ```false```) + +`--accesslog.bufferingsize`: +Number of access log lines to process in a buffered way. (Default: ```0```) + +`--accesslog.fields.defaultmode`: +Default mode for fields: keep | drop (Default: ```keep```) + +`--accesslog.fields.headers.defaultmode`: +Default mode for fields: keep | drop | redact (Default: ```drop```) + +`--accesslog.fields.headers.names.`: +Override mode for headers + +`--accesslog.fields.names.`: +Override mode for fields + +`--accesslog.filepath`: +Access log file path. Stdout is used when omitted or empty. + +`--accesslog.filters.minduration`: +Keep access logs when request took longer than the specified duration. (Default: ```0```) + +`--accesslog.filters.retryattempts`: +Keep access logs when at least one retry happened. (Default: ```false```) + +`--accesslog.filters.statuscodes`: +Keep access logs with status codes in the specified range. + +`--accesslog.format`: +Access log format: json | common (Default: ```common```) + +`--acme.acmelogging`: +Enable debug logging of ACME actions. (Default: ```false```) + +`--acme.caserver`: +CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) + +`--acme.dnschallenge`: +Activate DNS-01 Challenge. (Default: ```false```) + +`--acme.dnschallenge.delaybeforecheck`: +Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) + +`--acme.dnschallenge.disablepropagationcheck`: +Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) + +`--acme.dnschallenge.provider`: +Use a DNS-01 based challenge provider rather than HTTPS. + +`--acme.dnschallenge.resolvers`: +Use following DNS servers to resolve the FQDN authority. + +`--acme.domains`: +The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge. + +`--acme.domains[n].main`: +Default subject name. + +`--acme.domains[n].sans`: +Subject alternative names. + +`--acme.email`: +Email address used for registration. + +`--acme.entrypoint`: +EntryPoint to use. + +`--acme.httpchallenge`: +Activate HTTP-01 Challenge. (Default: ```false```) + +`--acme.httpchallenge.entrypoint`: +HTTP challenge EntryPoint + +`--acme.keytype`: +KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) + +`--acme.onhostrule`: +Enable certificate generation on router Host rules. (Default: ```false```) + +`--acme.storage`: +Storage to use. (Default: ```acme.json```) + +`--acme.tlschallenge`: +Activate TLS-ALPN-01 Challenge. (Default: ```true```) + +`--api`: +Enable api/dashboard. (Default: ```false```) + +`--api.dashboard`: +Activate dashboard. (Default: ```true```) + +`--api.debug`: +Enable additional endpoints for debugging and profiling. (Default: ```false```) + +`--api.entrypoint`: +The entry point that the API handler will be bound to. (Default: ```traefik```) + +`--api.middlewares`: +Middleware list. + +`--api.statistics`: +Enable more detailed statistics. (Default: ```false```) + +`--api.statistics.recenterrors`: +Number of recent errors logged. (Default: ```10```) + +`--entrypoints.`: +Entry points definition. (Default: ```false```) + +`--entrypoints..address`: +Entry point address. + +`--entrypoints..forwardedheaders.insecure`: +Trust all forwarded headers. (Default: ```false```) + +`--entrypoints..forwardedheaders.trustedips`: +Trust only forwarded headers from selected IPs. + +`--entrypoints..proxyprotocol`: +Proxy-Protocol configuration. (Default: ```false```) + +`--entrypoints..proxyprotocol.insecure`: +Trust all. (Default: ```false```) + +`--entrypoints..proxyprotocol.trustedips`: +Trust only selected IPs. + +`--entrypoints..transport.lifecycle.gracetimeout`: +Duration to give active requests a chance to finish before Traefik stops. (Default: ```10```) + +`--entrypoints..transport.lifecycle.requestacceptgracetimeout`: +Duration to keep accepting requests before Traefik initiates the graceful shutdown procedure. (Default: ```0```) + +`--entrypoints..transport.respondingtimeouts.idletimeout`: +IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set. (Default: ```180```) + +`--entrypoints..transport.respondingtimeouts.readtimeout`: +ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```0```) + +`--entrypoints..transport.respondingtimeouts.writetimeout`: +WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set. (Default: ```0```) + +`--global.checknewversion`: +Periodically check if a new version has been released. (Default: ```false```) + +`--global.sendanonymoususage`: +Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default. (Default: ```false```) + +`--hostresolver`: +Enable CNAME Flattening. (Default: ```false```) + +`--hostresolver.cnameflattening`: +A flag to enable/disable CNAME flattening (Default: ```false```) + +`--hostresolver.resolvconfig`: +resolv.conf used for DNS resolving (Default: ```/etc/resolv.conf```) + +`--hostresolver.resolvdepth`: +The maximal depth of DNS recursive resolving (Default: ```5```) + +`--log`: +Traefik log settings. (Default: ```false```) + +`--log.filepath`: +Traefik log file path. Stdout is used when omitted or empty. + +`--log.format`: +Traefik log format: json | common (Default: ```common```) + +`--log.level`: +Log level set to traefik logs. (Default: ```ERROR```) + +`--metrics.datadog`: +DataDog metrics exporter type. (Default: ```false```) + +`--metrics.datadog.address`: +DataDog's address. (Default: ```localhost:8125```) + +`--metrics.datadog.pushinterval`: +DataDog push interval. (Default: ```10```) + +`--metrics.influxdb`: +InfluxDB metrics exporter type. (Default: ```false```) + +`--metrics.influxdb.address`: +InfluxDB address. (Default: ```localhost:8089```) + +`--metrics.influxdb.database`: +InfluxDB database used when protocol is http. + +`--metrics.influxdb.password`: +InfluxDB password (only with http). + +`--metrics.influxdb.protocol`: +InfluxDB address protocol (udp or http). (Default: ```udp```) + +`--metrics.influxdb.pushinterval`: +InfluxDB push interval. (Default: ```10```) + +`--metrics.influxdb.retentionpolicy`: +InfluxDB retention policy used when protocol is http. + +`--metrics.influxdb.username`: +InfluxDB username (only with http). + +`--metrics.prometheus`: +Prometheus metrics exporter type. (Default: ```false```) + +`--metrics.prometheus.buckets`: +Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) + +`--metrics.prometheus.entrypoint`: +EntryPoint. (Default: ```traefik```) + +`--metrics.prometheus.middlewares`: +Middlewares. + +`--metrics.statsd`: +StatsD metrics exporter type. (Default: ```false```) + +`--metrics.statsd.address`: +StatsD address. (Default: ```localhost:8125```) + +`--metrics.statsd.pushinterval`: +StatsD push interval. (Default: ```10```) + +`--ping`: +Enable ping. (Default: ```false```) + +`--ping.entrypoint`: +Ping entryPoint. (Default: ```traefik```) + +`--ping.middlewares`: +Middleware list. + +`--providers.docker`: +Enable Docker backend with default settings. (Default: ```false```) + +`--providers.docker.constraints`: +Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. + +`--providers.docker.defaultrule`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`--providers.docker.endpoint`: +Docker server endpoint. Can be a tcp or a unix socket endpoint. (Default: ```unix:///var/run/docker.sock```) + +`--providers.docker.exposedbydefault`: +Expose containers by default. (Default: ```true```) + +`--providers.docker.network`: +Default Docker network used. + +`--providers.docker.swarmmode`: +Use Docker on Swarm Mode. (Default: ```false```) + +`--providers.docker.swarmmoderefreshseconds`: +Polling interval for swarm mode. (Default: ```15```) + +`--providers.docker.tls.ca`: +TLS CA + +`--providers.docker.tls.caoptional`: +TLS CA.Optional (Default: ```false```) + +`--providers.docker.tls.cert`: +TLS cert + +`--providers.docker.tls.insecureskipverify`: +TLS insecure skip verify (Default: ```false```) + +`--providers.docker.tls.key`: +TLS key + +`--providers.docker.usebindportip`: +Use the ip address from the bound port, rather than from the inner network. (Default: ```false```) + +`--providers.docker.watch`: +Watch provider. (Default: ```true```) + +`--providers.file`: +Enable File backend with default settings. (Default: ```false```) + +`--providers.file.debugloggeneratedtemplate`: +Enable debug logging of generated configuration template. (Default: ```false```) + +`--providers.file.directory`: +Load configuration from one or more .toml files in a directory. + +`--providers.file.filename`: +Override default configuration template. For advanced users :) + +`--providers.file.watch`: +Watch provider. (Default: ```true```) + +`--providers.kubernetes`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`--providers.kubernetes.certauthfilepath`: +Kubernetes certificate authority file path (not needed for in-cluster client). + +`--providers.kubernetes.disablepasshostheaders`: +Kubernetes disable PassHost Headers. (Default: ```false```) + +`--providers.kubernetes.endpoint`: +Kubernetes server endpoint (required for external cluster client). + +`--providers.kubernetes.ingressclass`: +Value of kubernetes.io/ingress.class annotation to watch for. + +`--providers.kubernetes.ingressendpoint.hostname`: +Hostname used for Kubernetes Ingress endpoints. + +`--providers.kubernetes.ingressendpoint.ip`: +IP used for Kubernetes Ingress endpoints. + +`--providers.kubernetes.ingressendpoint.publishedservice`: +Published Kubernetes Service to copy status from. + +`--providers.kubernetes.labelselector`: +Kubernetes Ingress label selector to use. + +`--providers.kubernetes.namespaces`: +Kubernetes namespaces. + +`--providers.kubernetes.token`: +Kubernetes bearer token (not needed for in-cluster client). + +`--providers.kubernetescrd`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`--providers.kubernetescrd.certauthfilepath`: +Kubernetes certificate authority file path (not needed for in-cluster client). + +`--providers.kubernetescrd.disablepasshostheaders`: +Kubernetes disable PassHost Headers. (Default: ```false```) + +`--providers.kubernetescrd.endpoint`: +Kubernetes server endpoint (required for external cluster client). + +`--providers.kubernetescrd.ingressclass`: +Value of kubernetes.io/ingress.class annotation to watch for. + +`--providers.kubernetescrd.labelselector`: +Kubernetes label selector to use. + +`--providers.kubernetescrd.namespaces`: +Kubernetes namespaces. + +`--providers.kubernetescrd.token`: +Kubernetes bearer token (not needed for in-cluster client). + +`--providers.marathon`: +Enable Marathon backend with default settings. (Default: ```false```) + +`--providers.marathon.basic.httpbasicauthuser`: +Basic authentication User. + +`--providers.marathon.basic.httpbasicpassword`: +Basic authentication Password. + +`--providers.marathon.constraints`: +Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application. + +`--providers.marathon.dcostoken`: +DCOSToken for DCOS environment, This will override the Authorization header. + +`--providers.marathon.defaultrule`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`--providers.marathon.dialertimeout`: +Set a dialer timeout for Marathon. (Default: ```5```) + +`--providers.marathon.endpoint`: +Marathon server endpoint. You can also specify multiple endpoint for Marathon. (Default: ```http://127.0.0.1:8080```) + +`--providers.marathon.exposedbydefault`: +Expose Marathon apps by default. (Default: ```true```) + +`--providers.marathon.forcetaskhostname`: +Force to use the task's hostname. (Default: ```false```) + +`--providers.marathon.keepalive`: +Set a TCP Keep Alive time. (Default: ```10```) + +`--providers.marathon.respectreadinesschecks`: +Filter out tasks with non-successful readiness checks during deployments. (Default: ```false```) + +`--providers.marathon.responseheadertimeout`: +Set a response header timeout for Marathon. (Default: ```60```) + +`--providers.marathon.tls.ca`: +TLS CA + +`--providers.marathon.tls.caoptional`: +TLS CA.Optional (Default: ```false```) + +`--providers.marathon.tls.cert`: +TLS cert + +`--providers.marathon.tls.insecureskipverify`: +TLS insecure skip verify (Default: ```false```) + +`--providers.marathon.tls.key`: +TLS key + +`--providers.marathon.tlshandshaketimeout`: +Set a TLS handshake timeout for Marathon. (Default: ```5```) + +`--providers.marathon.trace`: +Display additional provider logs. (Default: ```false```) + +`--providers.marathon.watch`: +Watch provider. (Default: ```true```) + +`--providers.providersthrottleduration`: +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. (Default: ```0```) + +`--providers.rancher`: +Enable Rancher backend with default settings. (Default: ```false```) + +`--providers.rancher.constraints`: +Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. + +`--providers.rancher.defaultrule`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`--providers.rancher.enableservicehealthfilter`: +Filter services with unhealthy states and inactive states. (Default: ```true```) + +`--providers.rancher.exposedbydefault`: +Expose containers by default. (Default: ```true```) + +`--providers.rancher.intervalpoll`: +Poll the Rancher metadata service every 'rancher.refreshseconds' (less accurate). (Default: ```false```) + +`--providers.rancher.prefix`: +Prefix used for accessing the Rancher metadata service. (Default: ```latest```) + +`--providers.rancher.refreshseconds`: +Defines the polling interval in seconds. (Default: ```15```) + +`--providers.rancher.watch`: +Watch provider. (Default: ```true```) + +`--providers.rest`: +Enable Rest backend with default settings. (Default: ```false```) + +`--providers.rest.entrypoint`: +EntryPoint. (Default: ```traefik```) + +`--serverstransport.forwardingtimeouts.dialtimeout`: +The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```) + +`--serverstransport.forwardingtimeouts.idleconntimeout`: +The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself (Default: ```90```) + +`--serverstransport.forwardingtimeouts.responseheadertimeout`: +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. (Default: ```0```) + +`--serverstransport.insecureskipverify`: +Disable SSL certificate verification. (Default: ```false```) + +`--serverstransport.maxidleconnsperhost`: +If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used (Default: ```0```) + +`--serverstransport.rootcas`: +Add cert file for self-signed certificate. + +`--tracing`: +OpenTracing configuration. (Default: ```false```) + +`--tracing.datadog`: +Settings for DataDog. (Default: ```false```) + +`--tracing.datadog.bagageprefixheadername`: +Specifies the header name prefix that will be used to store baggage items in a map. + +`--tracing.datadog.debug`: +Enable DataDog debug. (Default: ```false```) + +`--tracing.datadog.globaltag`: +Key:Value tag to be set on all the spans. + +`--tracing.datadog.localagenthostport`: +Set datadog-agent's host:port that the reporter will used. (Default: ```localhost:8126```) + +`--tracing.datadog.parentidheadername`: +Specifies the header name that will be used to store the parent ID. + +`--tracing.datadog.prioritysampling`: +Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled. (Default: ```false```) + +`--tracing.datadog.samplingpriorityheadername`: +Specifies the header name that will be used to store the sampling priority. + +`--tracing.datadog.traceidheadername`: +Specifies the header name that will be used to store the trace ID. + +`--tracing.haystack`: +Settings for Haystack. (Default: ```false```) + +`--tracing.haystack.baggageprefixheadername`: +Specifies the header name prefix that will be used to store baggage items in a map. + +`--tracing.haystack.globaltag`: +Key:Value tag to be set on all the spans. + +`--tracing.haystack.localagenthost`: +Set haystack-agent's host that the reporter will used. (Default: ```LocalAgentHost```) + +`--tracing.haystack.localagentport`: +Set haystack-agent's port that the reporter will used. (Default: ```35000```) + +`--tracing.haystack.parentidheadername`: +Specifies the header name that will be used to store the parent ID. + +`--tracing.haystack.spanidheadername`: +Specifies the header name that will be used to store the span ID. + +`--tracing.haystack.traceidheadername`: +Specifies the header name that will be used to store the trace ID. + +`--tracing.instana`: +Settings for Instana. (Default: ```false```) + +`--tracing.instana.localagenthost`: +Set instana-agent's host that the reporter will used. (Default: ```localhost```) + +`--tracing.instana.localagentport`: +Set instana-agent's port that the reporter will used. (Default: ```42699```) + +`--tracing.instana.loglevel`: +Set instana-agent's log level. ('error','warn','info','debug') (Default: ```info```) + +`--tracing.jaeger`: +Settings for Jaeger. (Default: ```false```) + +`--tracing.jaeger.gen128bit`: +Generate 128 bit span IDs. (Default: ```false```) + +`--tracing.jaeger.localagenthostport`: +Set jaeger-agent's host:port that the reporter will used. (Default: ```127.0.0.1:6831```) + +`--tracing.jaeger.propagation`: +Which propgation format to use (jaeger/b3). (Default: ```jaeger```) + +`--tracing.jaeger.samplingparam`: +Set the sampling parameter. (Default: ```1.000000```) + +`--tracing.jaeger.samplingserverurl`: +Set the sampling server url. (Default: ```http://localhost:5778/sampling```) + +`--tracing.jaeger.samplingtype`: +Set the sampling type. (Default: ```const```) + +`--tracing.jaeger.tracecontextheadername`: +Set the header to use for the trace-id. (Default: ```uber-trace-id```) + +`--tracing.servicename`: +Set the name for this service. (Default: ```traefik```) + +`--tracing.spannamelimit`: +Set the maximum character limit for Span names (default 0 = no limit). (Default: ```0```) + +`--tracing.zipkin`: +Settings for Zipkin. (Default: ```false```) + +`--tracing.zipkin.debug`: +Enable Zipkin debug. (Default: ```false```) + +`--tracing.zipkin.httpendpoint`: +HTTP Endpoint to report traces to. (Default: ```http://localhost:9411/api/v1/spans```) + +`--tracing.zipkin.id128bit`: +Use Zipkin 128 bit root span IDs. (Default: ```true```) + +`--tracing.zipkin.samespan`: +Use Zipkin SameSpan RPC style traces. (Default: ```false```) + +`--tracing.zipkin.samplerate`: +The rate between 0.0 and 1.0 of requests to trace. (Default: ```1.000000```) diff --git a/docs/content/reference/static-configuration/cli.md b/docs/content/reference/static-configuration/cli.md index 1111439df..73319a30d 100644 --- a/docs/content/reference/static-configuration/cli.md +++ b/docs/content/reference/static-configuration/cli.md @@ -1,5 +1,4 @@ # Static Configuration: CLI -```txt ---8<-- "content/reference/static-configuration/cli.txt" -``` +--8<-- "content/reference/static-configuration/cli-ref.md" + diff --git a/docs/content/reference/static-configuration/cli.txt b/docs/content/reference/static-configuration/cli.txt deleted file mode 100644 index dfece6186..000000000 --- a/docs/content/reference/static-configuration/cli.txt +++ /dev/null @@ -1,609 +0,0 @@ ---accesslog (Default: "false") - Access log settings. - ---accesslog.bufferingsize (Default: "0") - Number of access log lines to process in a buffered way. - ---accesslog.fields.defaultmode (Default: "keep") - Default mode for fields: keep | drop - ---accesslog.fields.headers.defaultmode (Default: "keep") - Default mode for fields: keep | drop | redact - ---accesslog.fields.headers.names. (Default: "") - Override mode for headers - ---accesslog.fields.names. (Default: "") - Override mode for fields - ---accesslog.filepath (Default: "") - Access log file path. Stdout is used when omitted or empty. - ---accesslog.filters.minduration (Default: "0") - Keep access logs when request took longer than the specified duration. - ---accesslog.filters.retryattempts (Default: "false") - Keep access logs when at least one retry happened. - ---accesslog.filters.statuscodes (Default: "") - Keep access logs with status codes in the specified range. - ---accesslog.format (Default: "common") - Access log format: json | common - ---acme.acmelogging (Default: "false") - Enable debug logging of ACME actions. - ---acme.caserver (Default: "https://acme-v02.api.letsencrypt.org/directory") - CA server to use. - ---acme.dnschallenge (Default: "false") - Activate DNS-01 Challenge. - ---acme.dnschallenge.delaybeforecheck (Default: "0") - Assume DNS propagates after a delay in seconds rather than finding and querying - nameservers. - ---acme.dnschallenge.disablepropagationcheck (Default: "false") - Disable the DNS propagation checks before notifying ACME that the DNS challenge - is ready. [not recommended] - ---acme.dnschallenge.provider (Default: "") - Use a DNS-01 based challenge provider rather than HTTPS. - ---acme.dnschallenge.resolvers (Default: "") - Use following DNS servers to resolve the FQDN authority. - ---acme.domains (Default: "") - The list of domains for which certificates are generated on startup. Wildcard - domains only accepted with DNSChallenge. - ---acme.domains[n].main (Default: "") - Default subject name. - ---acme.domains[n].sans (Default: "") - Subject alternative names. - ---acme.email (Default: "") - Email address used for registration. - ---acme.entrypoint (Default: "") - EntryPoint to use. - ---acme.httpchallenge (Default: "false") - Activate HTTP-01 Challenge. - ---acme.httpchallenge.entrypoint (Default: "") - HTTP challenge EntryPoint - ---acme.keytype (Default: "RSA4096") - KeyType used for generating certificate private key. Allow value 'EC256', - 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. - ---acme.onhostrule (Default: "false") - Enable certificate generation on router Host rules. - ---acme.storage (Default: "acme.json") - Storage to use. - ---acme.tlschallenge (Default: "true") - Activate TLS-ALPN-01 Challenge. - ---api (Default: "false") - Enable api/dashboard. - ---api.dashboard (Default: "true") - Activate dashboard. - ---api.debug (Default: "false") - Enable additional endpoints for debugging and profiling. - ---api.entrypoint (Default: "traefik") - The entry point that the API handler will be bound to. - ---api.middlewares (Default: "") - Middleware list. - ---api.statistics (Default: "false") - Enable more detailed statistics. - ---api.statistics.recenterrors (Default: "10") - Number of recent errors logged. - ---configfile (Default: "") - Configuration file to use. If specified all other flags are ignored. - ---entrypoints. (Default: "false") - Entry points definition. - ---entrypoints..address (Default: "") - Entry point address. - ---entrypoints..forwardedheaders.insecure (Default: "false") - Trust all forwarded headers. - ---entrypoints..forwardedheaders.trustedips (Default: "") - Trust only forwarded headers from selected IPs. - ---entrypoints..proxyprotocol (Default: "false") - Proxy-Protocol configuration. - ---entrypoints..proxyprotocol.insecure (Default: "false") - Trust all. - ---entrypoints..proxyprotocol.trustedips (Default: "") - Trust only selected IPs. - ---entrypoints..transport.lifecycle.gracetimeout (Default: "10") - Duration to give active requests a chance to finish before Traefik stops. - ---entrypoints..transport.lifecycle.requestacceptgracetimeout (Default: "0") - Duration to keep accepting requests before Traefik initiates the graceful - shutdown procedure. - ---entrypoints..transport.respondingtimeouts.idletimeout (Default: "180") - IdleTimeout is the maximum amount duration an idle (keep-alive) connection will - remain idle before closing itself. If zero, no timeout is set. - ---entrypoints..transport.respondingtimeouts.readtimeout (Default: "0") - ReadTimeout is the maximum duration for reading the entire request, including - the body. If zero, no timeout is set. - ---entrypoints..transport.respondingtimeouts.writetimeout (Default: "0") - WriteTimeout is the maximum duration before timing out writes of the response. - If zero, no timeout is set. - ---global.checknewversion (Default: "true") - Periodically check if a new version has been released. - ---global.sendanonymoususage - Periodically send anonymous usage statistics. If the option is not specified, it - will be enabled by default. - ---hostresolver (Default: "false") - Enable CNAME Flattening. - ---hostresolver.cnameflattening (Default: "false") - A flag to enable/disable CNAME flattening - ---hostresolver.resolvconfig (Default: "/etc/resolv.conf") - resolv.conf used for DNS resolving - ---hostresolver.resolvdepth (Default: "5") - The maximal depth of DNS recursive resolving - ---log (Default: "false") - Traefik log settings. - ---log.filepath (Default: "") - Traefik log file path. Stdout is used when omitted or empty. - ---log.format (Default: "common") - Traefik log format: json | common - ---log.level (Default: "ERROR") - Log level set to traefik logs. - ---metrics.datadog (Default: "false") - DataDog metrics exporter type. - ---metrics.datadog.address (Default: "localhost:8125") - DataDog's address. - ---metrics.datadog.pushinterval (Default: "10") - DataDog push interval. - ---metrics.influxdb (Default: "false") - InfluxDB metrics exporter type. - ---metrics.influxdb.address (Default: "localhost:8089") - InfluxDB address. - ---metrics.influxdb.database (Default: "") - InfluxDB database used when protocol is http. - ---metrics.influxdb.password (Default: "") - InfluxDB password (only with http). - ---metrics.influxdb.protocol (Default: "udp") - InfluxDB address protocol (udp or http). - ---metrics.influxdb.pushinterval (Default: "10") - InfluxDB push interval. - ---metrics.influxdb.retentionpolicy (Default: "") - InfluxDB retention policy used when protocol is http. - ---metrics.influxdb.username (Default: "") - InfluxDB username (only with http). - ---metrics.prometheus (Default: "false") - Prometheus metrics exporter type. - ---metrics.prometheus.buckets (Default: "0.100000, 0.300000, 1.200000, 5.000000") - Buckets for latency metrics. - ---metrics.prometheus.entrypoint (Default: "traefik") - EntryPoint. - ---metrics.prometheus.middlewares (Default: "") - Middlewares. - ---metrics.statsd (Default: "false") - StatsD metrics exporter type. - ---metrics.statsd.address (Default: "localhost:8125") - StatsD address. - ---metrics.statsd.pushinterval (Default: "10") - StatsD push interval. - ---ping (Default: "false") - Enable ping. - ---ping.entrypoint (Default: "traefik") - Ping entryPoint. - ---ping.middlewares (Default: "") - Middleware list. - ---providers.docker (Default: "false") - Enable Docker backend with default settings. - ---providers.docker.constraints (Default: "") - Constraints is an expression that Traefik matches against the container's labels - to determine whether to create any route for that container. - ---providers.docker.defaultrule (Default: "Host(`{{ normalize .Name }}`)") - Default rule. - ---providers.docker.endpoint (Default: "unix:///var/run/docker.sock") - Docker server endpoint. Can be a tcp or a unix socket endpoint. - ---providers.docker.exposedbydefault (Default: "true") - Expose containers by default. - ---providers.docker.network (Default: "") - Default Docker network used. - ---providers.docker.swarmmode (Default: "false") - Use Docker on Swarm Mode. - ---providers.docker.swarmmoderefreshseconds (Default: "15") - Polling interval for swarm mode. - ---providers.docker.tls.ca (Default: "") - TLS CA - ---providers.docker.tls.caoptional (Default: "false") - TLS CA.Optional - ---providers.docker.tls.cert (Default: "") - TLS cert - ---providers.docker.tls.insecureskipverify (Default: "false") - TLS insecure skip verify - ---providers.docker.tls.key (Default: "") - TLS key - ---providers.docker.usebindportip (Default: "false") - Use the ip address from the bound port, rather than from the inner network. - ---providers.docker.watch (Default: "true") - Watch provider. - ---providers.file (Default: "false") - Enable File backend with default settings. - ---providers.file.debugloggeneratedtemplate (Default: "false") - Enable debug logging of generated configuration template. - ---providers.file.directory (Default: "") - Load configuration from one or more .toml files in a directory. - ---providers.file.filename (Default: "") - Override default configuration template. For advanced users :) - ---providers.file.watch (Default: "true") - Watch provider. - ---providers.kubernetes (Default: "false") - Enable Kubernetes backend with default settings. - ---providers.kubernetes.certauthfilepath (Default: "") - Kubernetes certificate authority file path (not needed for in-cluster client). - ---providers.kubernetes.disablepasshostheaders (Default: "false") - Kubernetes disable PassHost Headers. - ---providers.kubernetes.endpoint (Default: "") - Kubernetes server endpoint (required for external cluster client). - ---providers.kubernetes.ingressclass (Default: "") - Value of kubernetes.io/ingress.class annotation to watch for. - ---providers.kubernetes.ingressendpoint.hostname (Default: "") - Hostname used for Kubernetes Ingress endpoints. - ---providers.kubernetes.ingressendpoint.ip (Default: "") - IP used for Kubernetes Ingress endpoints. - ---providers.kubernetes.ingressendpoint.publishedservice (Default: "") - Published Kubernetes Service to copy status from. - ---providers.kubernetes.labelselector (Default: "") - Kubernetes Ingress label selector to use. - ---providers.kubernetes.namespaces (Default: "") - Kubernetes namespaces. - ---providers.kubernetes.token (Default: "") - Kubernetes bearer token (not needed for in-cluster client). - ---providers.kubernetescrd (Default: "false") - Enable Kubernetes backend with default settings. - ---providers.kubernetescrd.certauthfilepath (Default: "") - Kubernetes certificate authority file path (not needed for in-cluster client). - ---providers.kubernetescrd.disablepasshostheaders (Default: "false") - Kubernetes disable PassHost Headers. - ---providers.kubernetescrd.endpoint (Default: "") - Kubernetes server endpoint (required for external cluster client). - ---providers.kubernetescrd.ingressclass (Default: "") - Value of kubernetes.io/ingress.class annotation to watch for. - ---providers.kubernetescrd.labelselector (Default: "") - Kubernetes label selector to use. - ---providers.kubernetescrd.namespaces (Default: "") - Kubernetes namespaces. - ---providers.kubernetescrd.token (Default: "") - Kubernetes bearer token (not needed for in-cluster client). - ---providers.marathon (Default: "false") - Enable Marathon backend with default settings. - ---providers.marathon.basic.httpbasicauthuser (Default: "") - Basic authentication User. - ---providers.marathon.basic.httpbasicpassword (Default: "") - Basic authentication Password. - ---providers.marathon.constraints (Default: "") - Constraints is an expression that Traefik matches against the application's - labels to determine whether to create any route for that application. - ---providers.marathon.dcostoken (Default: "") - DCOSToken for DCOS environment, This will override the Authorization header. - ---providers.marathon.defaultrule (Default: "Host(`{{ normalize .Name }}`)") - Default rule. - ---providers.marathon.dialertimeout (Default: "5") - Set a dialer timeout for Marathon. - ---providers.marathon.endpoint (Default: "http://127.0.0.1:8080") - Marathon server endpoint. You can also specify multiple endpoint for Marathon. - ---providers.marathon.exposedbydefault (Default: "true") - Expose Marathon apps by default. - ---providers.marathon.forcetaskhostname (Default: "false") - Force to use the task's hostname. - ---providers.marathon.keepalive (Default: "10") - Set a TCP Keep Alive time. - ---providers.marathon.respectreadinesschecks (Default: "false") - Filter out tasks with non-successful readiness checks during deployments. - ---providers.marathon.responseheadertimeout (Default: "60") - Set a response header timeout for Marathon. - ---providers.marathon.tls.ca (Default: "") - TLS CA - ---providers.marathon.tls.caoptional (Default: "false") - TLS CA.Optional - ---providers.marathon.tls.cert (Default: "") - TLS cert - ---providers.marathon.tls.insecureskipverify (Default: "false") - TLS insecure skip verify - ---providers.marathon.tls.key (Default: "") - TLS key - ---providers.marathon.tlshandshaketimeout (Default: "5") - Set a TLS handshake timeout for Marathon. - ---providers.marathon.trace (Default: "false") - Display additional provider logs. - ---providers.marathon.watch (Default: "true") - Watch provider. - ---providers.providersthrottleduration (Default: "2") - 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. - ---providers.rancher (Default: "false") - Enable Rancher backend with default settings. - ---providers.rancher.constraints (Default: "") - Constraints is an expression that Traefik matches against the container's labels - to determine whether to create any route for that container. - ---providers.rancher.defaultrule (Default: "Host(`{{ normalize .Name }}`)") - Default rule. - ---providers.rancher.enableservicehealthfilter (Default: "true") - Filter services with unhealthy states and inactive states. - ---providers.rancher.exposedbydefault (Default: "true") - Expose containers by default. - ---providers.rancher.intervalpoll (Default: "false") - Poll the Rancher metadata service every 'rancher.refreshseconds' (less - accurate). - ---providers.rancher.prefix (Default: "latest") - Prefix used for accessing the Rancher metadata service. - ---providers.rancher.refreshseconds (Default: "15") - Defines the polling interval in seconds. - ---providers.rancher.watch (Default: "true") - Watch provider. - ---providers.rest (Default: "false") - Enable Rest backend with default settings. - ---providers.rest.entrypoint (Default: "traefik") - EntryPoint. - ---serverstransport.forwardingtimeouts.dialtimeout (Default: "30") - The amount of time to wait until a connection to a backend server can be - established. If zero, no timeout exists. - ---serverstransport.forwardingtimeouts.responseheadertimeout (Default: "0") - 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. - ---serverstransport.forwardingtimeouts.idleconntimeout (Default: "90s") - The maximum period for which an idle HTTP keep-alive connection to a backend - server will remain open before closing itself. - ---serverstransport.insecureskipverify (Default: "false") - Disable SSL certificate verification. - ---serverstransport.maxidleconnsperhost (Default: "200") - If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, - DefaultMaxIdleConnsPerHost is used - ---serverstransport.rootcas (Default: "") - Add cert file for self-signed certificate. - ---tracing (Default: "false") - OpenTracing configuration. - ---tracing.datadog (Default: "false") - Settings for DataDog. - ---tracing.datadog.bagageprefixheadername (Default: "") - Specifies the header name prefix that will be used to store baggage items in a - map. - ---tracing.datadog.debug (Default: "false") - Enable DataDog debug. - ---tracing.datadog.globaltag (Default: "") - Key:Value tag to be set on all the spans. - ---tracing.datadog.localagenthostport (Default: "localhost:8126") - Set datadog-agent's host:port that the reporter will used. - ---tracing.datadog.parentidheadername (Default: "") - Specifies the header name that will be used to store the parent ID. - ---tracing.datadog.prioritysampling (Default: "false") - Enable priority sampling. When using distributed tracing, this option must be - enabled in order to get all the parts of a distributed trace sampled. - ---tracing.datadog.samplingpriorityheadername (Default: "") - Specifies the header name that will be used to store the sampling priority. - ---tracing.datadog.traceidheadername (Default: "") - Specifies the header name that will be used to store the trace ID. - ---tracing.haystack (Default: "false") - Settings for Haystack. - ---tracing.haystack.baggageprefixheadername (Default: "") - Specifies the header name prefix that will be used to store baggage items in a - map. - ---tracing.haystack.globaltag (Default: "") - Key:Value tag to be set on all the spans. - ---tracing.haystack.localagenthost (Default: "LocalAgentHost") - Set haystack-agent's host that the reporter will used. - ---tracing.haystack.localagentport (Default: "35000") - Set haystack-agent's port that the reporter will used. - ---tracing.haystack.parentidheadername (Default: "") - Specifies the header name that will be used to store the parent ID. - ---tracing.haystack.spanidheadername (Default: "") - Specifies the header name that will be used to store the span ID. - ---tracing.haystack.traceidheadername (Default: "") - Specifies the header name that will be used to store the trace ID. - ---tracing.instana (Default: "false") - Settings for Instana. - ---tracing.instana.localagenthost (Default: "localhost") - Set instana-agent's host that the reporter will used. - ---tracing.instana.localagentport (Default: "42699") - Set instana-agent's port that the reporter will used. - ---tracing.instana.loglevel (Default: "info") - Set instana-agent's log level. ('error','warn','info','debug') - ---tracing.jaeger (Default: "false") - Settings for jaeger. - ---tracing.jaeger.gen128bit (Default: "false") - Generate 128 bit span IDs. - ---tracing.jaeger.localagenthostport (Default: "127.0.0.1:6831") - Set jaeger-agent's host:port that the reporter will used. - ---tracing.jaeger.propagation (Default: "jaeger") - Which propgation format to use (jaeger/b3). - ---tracing.jaeger.samplingparam (Default: "1.000000") - Set the sampling parameter. - ---tracing.jaeger.samplingserverurl (Default: "http://localhost:5778/sampling") - Set the sampling server url. - ---tracing.jaeger.samplingtype (Default: "const") - Set the sampling type. - ---tracing.jaeger.tracecontextheadername (Default: "uber-trace-id") - Set the header to use for the trace-id. - ---tracing.servicename (Default: "traefik") - Set the name for this service. - ---tracing.spannamelimit (Default: "0") - Set the maximum character limit for Span names (default 0 = no limit). - ---tracing.zipkin (Default: "false") - Settings for zipkin. - ---tracing.zipkin.debug (Default: "false") - Enable Zipkin debug. - ---tracing.zipkin.httpendpoint (Default: "http://localhost:9411/api/v1/spans") - HTTP Endpoint to report traces to. - ---tracing.zipkin.id128bit (Default: "true") - Use Zipkin 128 bit root span IDs. - ---tracing.zipkin.samespan (Default: "false") - Use Zipkin SameSpan RPC style traces. - ---tracing.zipkin.samplerate (Default: "1.000000") - The rate between 0.0 and 1.0 of requests to trace. diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md new file mode 100644 index 000000000..48fd382b2 --- /dev/null +++ b/docs/content/reference/static-configuration/env-ref.md @@ -0,0 +1,589 @@ + + +`TRAEFIK_ACCESSLOG`: +Access log settings. (Default: ```false```) + +`TRAEFIK_ACCESSLOG_BUFFERINGSIZE`: +Number of access log lines to process in a buffered way. (Default: ```0```) + +`TRAEFIK_ACCESSLOG_FIELDS_DEFAULTMODE`: +Default mode for fields: keep | drop (Default: ```keep```) + +`TRAEFIK_ACCESSLOG_FIELDS_HEADERS_DEFAULTMODE`: +Default mode for fields: keep | drop | redact (Default: ```drop```) + +`TRAEFIK_ACCESSLOG_FIELDS_HEADERS_NAMES_`: +Override mode for headers + +`TRAEFIK_ACCESSLOG_FIELDS_NAMES_`: +Override mode for fields + +`TRAEFIK_ACCESSLOG_FILEPATH`: +Access log file path. Stdout is used when omitted or empty. + +`TRAEFIK_ACCESSLOG_FILTERS_MINDURATION`: +Keep access logs when request took longer than the specified duration. (Default: ```0```) + +`TRAEFIK_ACCESSLOG_FILTERS_RETRYATTEMPTS`: +Keep access logs when at least one retry happened. (Default: ```false```) + +`TRAEFIK_ACCESSLOG_FILTERS_STATUSCODES`: +Keep access logs with status codes in the specified range. + +`TRAEFIK_ACCESSLOG_FORMAT`: +Access log format: json | common (Default: ```common```) + +`TRAEFIK_ACME_ACMELOGGING`: +Enable debug logging of ACME actions. (Default: ```false```) + +`TRAEFIK_ACME_CASERVER`: +CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) + +`TRAEFIK_ACME_DNSCHALLENGE`: +Activate DNS-01 Challenge. (Default: ```false```) + +`TRAEFIK_ACME_DNSCHALLENGE_DELAYBEFORECHECK`: +Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) + +`TRAEFIK_ACME_DNSCHALLENGE_DISABLEPROPAGATIONCHECK`: +Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) + +`TRAEFIK_ACME_DNSCHALLENGE_PROVIDER`: +Use a DNS-01 based challenge provider rather than HTTPS. + +`TRAEFIK_ACME_DNSCHALLENGE_RESOLVERS`: +Use following DNS servers to resolve the FQDN authority. + +`TRAEFIK_ACME_DOMAINS`: +The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge. + +`TRAEFIK_ACME_DOMAINS[n]_MAIN`: +Default subject name. + +`TRAEFIK_ACME_DOMAINS[n]_SANS`: +Subject alternative names. + +`TRAEFIK_ACME_EMAIL`: +Email address used for registration. + +`TRAEFIK_ACME_ENTRYPOINT`: +EntryPoint to use. + +`TRAEFIK_ACME_HTTPCHALLENGE`: +Activate HTTP-01 Challenge. (Default: ```false```) + +`TRAEFIK_ACME_HTTPCHALLENGE_ENTRYPOINT`: +HTTP challenge EntryPoint + +`TRAEFIK_ACME_KEYTYPE`: +KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) + +`TRAEFIK_ACME_ONHOSTRULE`: +Enable certificate generation on router Host rules. (Default: ```false```) + +`TRAEFIK_ACME_STORAGE`: +Storage to use. (Default: ```acme.json```) + +`TRAEFIK_ACME_TLSCHALLENGE`: +Activate TLS-ALPN-01 Challenge. (Default: ```true```) + +`TRAEFIK_API`: +Enable api/dashboard. (Default: ```false```) + +`TRAEFIK_API_DASHBOARD`: +Activate dashboard. (Default: ```true```) + +`TRAEFIK_API_DEBUG`: +Enable additional endpoints for debugging and profiling. (Default: ```false```) + +`TRAEFIK_API_ENTRYPOINT`: +The entry point that the API handler will be bound to. (Default: ```traefik```) + +`TRAEFIK_API_MIDDLEWARES`: +Middleware list. + +`TRAEFIK_API_STATISTICS`: +Enable more detailed statistics. (Default: ```false```) + +`TRAEFIK_API_STATISTICS_RECENTERRORS`: +Number of recent errors logged. (Default: ```10```) + +`TRAEFIK_ENTRYPOINTS_`: +Entry points definition. (Default: ```false```) + +`TRAEFIK_ENTRYPOINTS__ADDRESS`: +Entry point address. + +`TRAEFIK_ENTRYPOINTS__FORWARDEDHEADERS_INSECURE`: +Trust all forwarded headers. (Default: ```false```) + +`TRAEFIK_ENTRYPOINTS__FORWARDEDHEADERS_TRUSTEDIPS`: +Trust only forwarded headers from selected IPs. + +`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL`: +Proxy-Protocol configuration. (Default: ```false```) + +`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL_INSECURE`: +Trust all. (Default: ```false```) + +`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL_TRUSTEDIPS`: +Trust only selected IPs. + +`TRAEFIK_ENTRYPOINTS__TRANSPORT_LIFECYCLE_GRACETIMEOUT`: +Duration to give active requests a chance to finish before Traefik stops. (Default: ```10```) + +`TRAEFIK_ENTRYPOINTS__TRANSPORT_LIFECYCLE_REQUESTACCEPTGRACETIMEOUT`: +Duration to keep accepting requests before Traefik initiates the graceful shutdown procedure. (Default: ```0```) + +`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_IDLETIMEOUT`: +IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set. (Default: ```180```) + +`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_READTIMEOUT`: +ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```0```) + +`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_WRITETIMEOUT`: +WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set. (Default: ```0```) + +`TRAEFIK_GLOBAL_CHECKNEWVERSION`: +Periodically check if a new version has been released. (Default: ```false```) + +`TRAEFIK_GLOBAL_SENDANONYMOUSUSAGE`: +Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default. (Default: ```false```) + +`TRAEFIK_HOSTRESOLVER`: +Enable CNAME Flattening. (Default: ```false```) + +`TRAEFIK_HOSTRESOLVER_CNAMEFLATTENING`: +A flag to enable/disable CNAME flattening (Default: ```false```) + +`TRAEFIK_HOSTRESOLVER_RESOLVCONFIG`: +resolv.conf used for DNS resolving (Default: ```/etc/resolv.conf```) + +`TRAEFIK_HOSTRESOLVER_RESOLVDEPTH`: +The maximal depth of DNS recursive resolving (Default: ```5```) + +`TRAEFIK_LOG`: +Traefik log settings. (Default: ```false```) + +`TRAEFIK_LOG_FILEPATH`: +Traefik log file path. Stdout is used when omitted or empty. + +`TRAEFIK_LOG_FORMAT`: +Traefik log format: json | common (Default: ```common```) + +`TRAEFIK_LOG_LEVEL`: +Log level set to traefik logs. (Default: ```ERROR```) + +`TRAEFIK_METRICS_DATADOG`: +DataDog metrics exporter type. (Default: ```false```) + +`TRAEFIK_METRICS_DATADOG_ADDRESS`: +DataDog's address. (Default: ```localhost:8125```) + +`TRAEFIK_METRICS_DATADOG_PUSHINTERVAL`: +DataDog push interval. (Default: ```10```) + +`TRAEFIK_METRICS_INFLUXDB`: +InfluxDB metrics exporter type. (Default: ```false```) + +`TRAEFIK_METRICS_INFLUXDB_ADDRESS`: +InfluxDB address. (Default: ```localhost:8089```) + +`TRAEFIK_METRICS_INFLUXDB_DATABASE`: +InfluxDB database used when protocol is http. + +`TRAEFIK_METRICS_INFLUXDB_PASSWORD`: +InfluxDB password (only with http). + +`TRAEFIK_METRICS_INFLUXDB_PROTOCOL`: +InfluxDB address protocol (udp or http). (Default: ```udp```) + +`TRAEFIK_METRICS_INFLUXDB_PUSHINTERVAL`: +InfluxDB push interval. (Default: ```10```) + +`TRAEFIK_METRICS_INFLUXDB_RETENTIONPOLICY`: +InfluxDB retention policy used when protocol is http. + +`TRAEFIK_METRICS_INFLUXDB_USERNAME`: +InfluxDB username (only with http). + +`TRAEFIK_METRICS_PROMETHEUS`: +Prometheus metrics exporter type. (Default: ```false```) + +`TRAEFIK_METRICS_PROMETHEUS_BUCKETS`: +Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) + +`TRAEFIK_METRICS_PROMETHEUS_ENTRYPOINT`: +EntryPoint. (Default: ```traefik```) + +`TRAEFIK_METRICS_PROMETHEUS_MIDDLEWARES`: +Middlewares. + +`TRAEFIK_METRICS_STATSD`: +StatsD metrics exporter type. (Default: ```false```) + +`TRAEFIK_METRICS_STATSD_ADDRESS`: +StatsD address. (Default: ```localhost:8125```) + +`TRAEFIK_METRICS_STATSD_PUSHINTERVAL`: +StatsD push interval. (Default: ```10```) + +`TRAEFIK_PING`: +Enable ping. (Default: ```false```) + +`TRAEFIK_PING_ENTRYPOINT`: +Ping entryPoint. (Default: ```traefik```) + +`TRAEFIK_PING_MIDDLEWARES`: +Middleware list. + +`TRAEFIK_PROVIDERS_DOCKER`: +Enable Docker backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_DOCKER_CONSTRAINTS`: +Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. + +`TRAEFIK_PROVIDERS_DOCKER_DEFAULTRULE`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`TRAEFIK_PROVIDERS_DOCKER_ENDPOINT`: +Docker server endpoint. Can be a tcp or a unix socket endpoint. (Default: ```unix:///var/run/docker.sock```) + +`TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT`: +Expose containers by default. (Default: ```true```) + +`TRAEFIK_PROVIDERS_DOCKER_NETWORK`: +Default Docker network used. + +`TRAEFIK_PROVIDERS_DOCKER_SWARMMODE`: +Use Docker on Swarm Mode. (Default: ```false```) + +`TRAEFIK_PROVIDERS_DOCKER_SWARMMODEREFRESHSECONDS`: +Polling interval for swarm mode. (Default: ```15```) + +`TRAEFIK_PROVIDERS_DOCKER_TLS_CA`: +TLS CA + +`TRAEFIK_PROVIDERS_DOCKER_TLS_CAOPTIONAL`: +TLS CA.Optional (Default: ```false```) + +`TRAEFIK_PROVIDERS_DOCKER_TLS_CERT`: +TLS cert + +`TRAEFIK_PROVIDERS_DOCKER_TLS_INSECURESKIPVERIFY`: +TLS insecure skip verify (Default: ```false```) + +`TRAEFIK_PROVIDERS_DOCKER_TLS_KEY`: +TLS key + +`TRAEFIK_PROVIDERS_DOCKER_USEBINDPORTIP`: +Use the ip address from the bound port, rather than from the inner network. (Default: ```false```) + +`TRAEFIK_PROVIDERS_DOCKER_WATCH`: +Watch provider. (Default: ```true```) + +`TRAEFIK_PROVIDERS_FILE`: +Enable File backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_FILE_DEBUGLOGGENERATEDTEMPLATE`: +Enable debug logging of generated configuration template. (Default: ```false```) + +`TRAEFIK_PROVIDERS_FILE_DIRECTORY`: +Load configuration from one or more .toml files in a directory. + +`TRAEFIK_PROVIDERS_FILE_FILENAME`: +Override default configuration template. For advanced users :) + +`TRAEFIK_PROVIDERS_FILE_WATCH`: +Watch provider. (Default: ```true```) + +`TRAEFIK_PROVIDERS_KUBERNETES`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_KUBERNETESCRD`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_CERTAUTHFILEPATH`: +Kubernetes certificate authority file path (not needed for in-cluster client). + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_DISABLEPASSHOSTHEADERS`: +Kubernetes disable PassHost Headers. (Default: ```false```) + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_ENDPOINT`: +Kubernetes server endpoint (required for external cluster client). + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_INGRESSCLASS`: +Value of kubernetes.io/ingress.class annotation to watch for. + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_LABELSELECTOR`: +Kubernetes label selector to use. + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_NAMESPACES`: +Kubernetes namespaces. + +`TRAEFIK_PROVIDERS_KUBERNETESCRD_TOKEN`: +Kubernetes bearer token (not needed for in-cluster client). + +`TRAEFIK_PROVIDERS_KUBERNETES_CERTAUTHFILEPATH`: +Kubernetes certificate authority file path (not needed for in-cluster client). + +`TRAEFIK_PROVIDERS_KUBERNETES_DISABLEPASSHOSTHEADERS`: +Kubernetes disable PassHost Headers. (Default: ```false```) + +`TRAEFIK_PROVIDERS_KUBERNETES_ENDPOINT`: +Kubernetes server endpoint (required for external cluster client). + +`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSCLASS`: +Value of kubernetes.io/ingress.class annotation to watch for. + +`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_HOSTNAME`: +Hostname used for Kubernetes Ingress endpoints. + +`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_IP`: +IP used for Kubernetes Ingress endpoints. + +`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_PUBLISHEDSERVICE`: +Published Kubernetes Service to copy status from. + +`TRAEFIK_PROVIDERS_KUBERNETES_LABELSELECTOR`: +Kubernetes Ingress label selector to use. + +`TRAEFIK_PROVIDERS_KUBERNETES_NAMESPACES`: +Kubernetes namespaces. + +`TRAEFIK_PROVIDERS_KUBERNETES_TOKEN`: +Kubernetes bearer token (not needed for in-cluster client). + +`TRAEFIK_PROVIDERS_MARATHON`: +Enable Marathon backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_BASIC_HTTPBASICAUTHUSER`: +Basic authentication User. + +`TRAEFIK_PROVIDERS_MARATHON_BASIC_HTTPBASICPASSWORD`: +Basic authentication Password. + +`TRAEFIK_PROVIDERS_MARATHON_CONSTRAINTS`: +Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application. + +`TRAEFIK_PROVIDERS_MARATHON_DCOSTOKEN`: +DCOSToken for DCOS environment, This will override the Authorization header. + +`TRAEFIK_PROVIDERS_MARATHON_DEFAULTRULE`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`TRAEFIK_PROVIDERS_MARATHON_DIALERTIMEOUT`: +Set a dialer timeout for Marathon. (Default: ```5```) + +`TRAEFIK_PROVIDERS_MARATHON_ENDPOINT`: +Marathon server endpoint. You can also specify multiple endpoint for Marathon. (Default: ```http://127.0.0.1:8080```) + +`TRAEFIK_PROVIDERS_MARATHON_EXPOSEDBYDEFAULT`: +Expose Marathon apps by default. (Default: ```true```) + +`TRAEFIK_PROVIDERS_MARATHON_FORCETASKHOSTNAME`: +Force to use the task's hostname. (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_KEEPALIVE`: +Set a TCP Keep Alive time. (Default: ```10```) + +`TRAEFIK_PROVIDERS_MARATHON_RESPECTREADINESSCHECKS`: +Filter out tasks with non-successful readiness checks during deployments. (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_RESPONSEHEADERTIMEOUT`: +Set a response header timeout for Marathon. (Default: ```60```) + +`TRAEFIK_PROVIDERS_MARATHON_TLSHANDSHAKETIMEOUT`: +Set a TLS handshake timeout for Marathon. (Default: ```5```) + +`TRAEFIK_PROVIDERS_MARATHON_TLS_CA`: +TLS CA + +`TRAEFIK_PROVIDERS_MARATHON_TLS_CAOPTIONAL`: +TLS CA.Optional (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_TLS_CERT`: +TLS cert + +`TRAEFIK_PROVIDERS_MARATHON_TLS_INSECURESKIPVERIFY`: +TLS insecure skip verify (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_TLS_KEY`: +TLS key + +`TRAEFIK_PROVIDERS_MARATHON_TRACE`: +Display additional provider logs. (Default: ```false```) + +`TRAEFIK_PROVIDERS_MARATHON_WATCH`: +Watch provider. (Default: ```true```) + +`TRAEFIK_PROVIDERS_PROVIDERSTHROTTLEDURATION`: +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. (Default: ```0```) + +`TRAEFIK_PROVIDERS_RANCHER`: +Enable Rancher backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_RANCHER_CONSTRAINTS`: +Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. + +`TRAEFIK_PROVIDERS_RANCHER_DEFAULTRULE`: +Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) + +`TRAEFIK_PROVIDERS_RANCHER_ENABLESERVICEHEALTHFILTER`: +Filter services with unhealthy states and inactive states. (Default: ```true```) + +`TRAEFIK_PROVIDERS_RANCHER_EXPOSEDBYDEFAULT`: +Expose containers by default. (Default: ```true```) + +`TRAEFIK_PROVIDERS_RANCHER_INTERVALPOLL`: +Poll the Rancher metadata service every 'rancher.refreshseconds' (less accurate). (Default: ```false```) + +`TRAEFIK_PROVIDERS_RANCHER_PREFIX`: +Prefix used for accessing the Rancher metadata service. (Default: ```latest```) + +`TRAEFIK_PROVIDERS_RANCHER_REFRESHSECONDS`: +Defines the polling interval in seconds. (Default: ```15```) + +`TRAEFIK_PROVIDERS_RANCHER_WATCH`: +Watch provider. (Default: ```true```) + +`TRAEFIK_PROVIDERS_REST`: +Enable Rest backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_REST_ENTRYPOINT`: +EntryPoint. (Default: ```traefik```) + +`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_DIALTIMEOUT`: +The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```) + +`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_IDLECONNTIMEOUT`: +The maximum period for which an idle HTTP keep-alive connection will remain open before closing itself (Default: ```90```) + +`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_RESPONSEHEADERTIMEOUT`: +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. (Default: ```0```) + +`TRAEFIK_SERVERSTRANSPORT_INSECURESKIPVERIFY`: +Disable SSL certificate verification. (Default: ```false```) + +`TRAEFIK_SERVERSTRANSPORT_MAXIDLECONNSPERHOST`: +If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used (Default: ```0```) + +`TRAEFIK_SERVERSTRANSPORT_ROOTCAS`: +Add cert file for self-signed certificate. + +`TRAEFIK_TRACING`: +OpenTracing configuration. (Default: ```false```) + +`TRAEFIK_TRACING_DATADOG`: +Settings for DataDog. (Default: ```false```) + +`TRAEFIK_TRACING_DATADOG_BAGAGEPREFIXHEADERNAME`: +Specifies the header name prefix that will be used to store baggage items in a map. + +`TRAEFIK_TRACING_DATADOG_DEBUG`: +Enable DataDog debug. (Default: ```false```) + +`TRAEFIK_TRACING_DATADOG_GLOBALTAG`: +Key:Value tag to be set on all the spans. + +`TRAEFIK_TRACING_DATADOG_LOCALAGENTHOSTPORT`: +Set datadog-agent's host:port that the reporter will used. (Default: ```localhost:8126```) + +`TRAEFIK_TRACING_DATADOG_PARENTIDHEADERNAME`: +Specifies the header name that will be used to store the parent ID. + +`TRAEFIK_TRACING_DATADOG_PRIORITYSAMPLING`: +Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled. (Default: ```false```) + +`TRAEFIK_TRACING_DATADOG_SAMPLINGPRIORITYHEADERNAME`: +Specifies the header name that will be used to store the sampling priority. + +`TRAEFIK_TRACING_DATADOG_TRACEIDHEADERNAME`: +Specifies the header name that will be used to store the trace ID. + +`TRAEFIK_TRACING_HAYSTACK`: +Settings for Haystack. (Default: ```false```) + +`TRAEFIK_TRACING_HAYSTACK_BAGGAGEPREFIXHEADERNAME`: +Specifies the header name prefix that will be used to store baggage items in a map. + +`TRAEFIK_TRACING_HAYSTACK_GLOBALTAG`: +Key:Value tag to be set on all the spans. + +`TRAEFIK_TRACING_HAYSTACK_LOCALAGENTHOST`: +Set haystack-agent's host that the reporter will used. (Default: ```LocalAgentHost```) + +`TRAEFIK_TRACING_HAYSTACK_LOCALAGENTPORT`: +Set haystack-agent's port that the reporter will used. (Default: ```35000```) + +`TRAEFIK_TRACING_HAYSTACK_PARENTIDHEADERNAME`: +Specifies the header name that will be used to store the parent ID. + +`TRAEFIK_TRACING_HAYSTACK_SPANIDHEADERNAME`: +Specifies the header name that will be used to store the span ID. + +`TRAEFIK_TRACING_HAYSTACK_TRACEIDHEADERNAME`: +Specifies the header name that will be used to store the trace ID. + +`TRAEFIK_TRACING_INSTANA`: +Settings for Instana. (Default: ```false```) + +`TRAEFIK_TRACING_INSTANA_LOCALAGENTHOST`: +Set instana-agent's host that the reporter will used. (Default: ```localhost```) + +`TRAEFIK_TRACING_INSTANA_LOCALAGENTPORT`: +Set instana-agent's port that the reporter will used. (Default: ```42699```) + +`TRAEFIK_TRACING_INSTANA_LOGLEVEL`: +Set instana-agent's log level. ('error','warn','info','debug') (Default: ```info```) + +`TRAEFIK_TRACING_JAEGER`: +Settings for Jaeger. (Default: ```false```) + +`TRAEFIK_TRACING_JAEGER_GEN128BIT`: +Generate 128 bit span IDs. (Default: ```false```) + +`TRAEFIK_TRACING_JAEGER_LOCALAGENTHOSTPORT`: +Set jaeger-agent's host:port that the reporter will used. (Default: ```127.0.0.1:6831```) + +`TRAEFIK_TRACING_JAEGER_PROPAGATION`: +Which propgation format to use (jaeger/b3). (Default: ```jaeger```) + +`TRAEFIK_TRACING_JAEGER_SAMPLINGPARAM`: +Set the sampling parameter. (Default: ```1.000000```) + +`TRAEFIK_TRACING_JAEGER_SAMPLINGSERVERURL`: +Set the sampling server url. (Default: ```http://localhost:5778/sampling```) + +`TRAEFIK_TRACING_JAEGER_SAMPLINGTYPE`: +Set the sampling type. (Default: ```const```) + +`TRAEFIK_TRACING_JAEGER_TRACECONTEXTHEADERNAME`: +Set the header to use for the trace-id. (Default: ```uber-trace-id```) + +`TRAEFIK_TRACING_SERVICENAME`: +Set the name for this service. (Default: ```traefik```) + +`TRAEFIK_TRACING_SPANNAMELIMIT`: +Set the maximum character limit for Span names (default 0 = no limit). (Default: ```0```) + +`TRAEFIK_TRACING_ZIPKIN`: +Settings for Zipkin. (Default: ```false```) + +`TRAEFIK_TRACING_ZIPKIN_DEBUG`: +Enable Zipkin debug. (Default: ```false```) + +`TRAEFIK_TRACING_ZIPKIN_HTTPENDPOINT`: +HTTP Endpoint to report traces to. (Default: ```http://localhost:9411/api/v1/spans```) + +`TRAEFIK_TRACING_ZIPKIN_ID128BIT`: +Use Zipkin 128 bit root span IDs. (Default: ```true```) + +`TRAEFIK_TRACING_ZIPKIN_SAMESPAN`: +Use Zipkin SameSpan RPC style traces. (Default: ```false```) + +`TRAEFIK_TRACING_ZIPKIN_SAMPLERATE`: +The rate between 0.0 and 1.0 of requests to trace. (Default: ```1.000000```) diff --git a/docs/content/reference/static-configuration/env.md b/docs/content/reference/static-configuration/env.md index 09eb82a09..0885c93d0 100644 --- a/docs/content/reference/static-configuration/env.md +++ b/docs/content/reference/static-configuration/env.md @@ -1,590 +1,3 @@ # Static Configuration: Environment variables -`TRAEFIK_ACCESSLOG`: -Access log settings. (Default: ```false```) - -`TRAEFIK_ACCESSLOG_BUFFERINGSIZE`: -Number of access log lines to process in a buffered way. (Default: ```0```) - -`TRAEFIK_ACCESSLOG_FIELDS_DEFAULTMODE`: -Default mode for fields: keep | drop (Default: ```keep```) - -`TRAEFIK_ACCESSLOG_FIELDS_HEADERS_DEFAULTMODE`: -Default mode for fields: keep | drop | redact (Default: ```keep```) - -`TRAEFIK_ACCESSLOG_FIELDS_HEADERS_NAMES_`: -Override mode for headers - -`TRAEFIK_ACCESSLOG_FIELDS_NAMES_`: -Override mode for fields - -`TRAEFIK_ACCESSLOG_FILEPATH`: -Access log file path. Stdout is used when omitted or empty. - -`TRAEFIK_ACCESSLOG_FILTERS_MINDURATION`: -Keep access logs when request took longer than the specified duration. (Default: ```0```) - -`TRAEFIK_ACCESSLOG_FILTERS_RETRYATTEMPTS`: -Keep access logs when at least one retry happened. (Default: ```false```) - -`TRAEFIK_ACCESSLOG_FILTERS_STATUSCODES`: -Keep access logs with status codes in the specified range. - -`TRAEFIK_ACCESSLOG_FORMAT`: -Access log format: json | common (Default: ```common```) - -`TRAEFIK_ACME_ACMELOGGING`: -Enable debug logging of ACME actions. (Default: ```false```) - -`TRAEFIK_ACME_CASERVER`: -CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) - -`TRAEFIK_ACME_DNSCHALLENGE`: -Activate DNS-01 Challenge. (Default: ```false```) - -`TRAEFIK_ACME_DNSCHALLENGE_DELAYBEFORECHECK`: -Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) - -`TRAEFIK_ACME_DNSCHALLENGE_DISABLEPROPAGATIONCHECK`: -Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) - -`TRAEFIK_ACME_DNSCHALLENGE_PROVIDER`: -Use a DNS-01 based challenge provider rather than HTTPS. - -`TRAEFIK_ACME_DNSCHALLENGE_RESOLVERS`: -Use following DNS servers to resolve the FQDN authority. - -`TRAEFIK_ACME_DOMAINS`: -The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge. - -`TRAEFIK_ACME_DOMAINS[n]_MAIN`: -Default subject name. - -`TRAEFIK_ACME_DOMAINS[n]_SANS`: -Subject alternative names. - -`TRAEFIK_ACME_EMAIL`: -Email address used for registration. - -`TRAEFIK_ACME_ENTRYPOINT`: -EntryPoint to use. - -`TRAEFIK_ACME_HTTPCHALLENGE`: -Activate HTTP-01 Challenge. (Default: ```false```) - -`TRAEFIK_ACME_HTTPCHALLENGE_ENTRYPOINT`: -HTTP challenge EntryPoint - -`TRAEFIK_ACME_KEYTYPE`: -KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) - -`TRAEFIK_ACME_ONHOSTRULE`: -Enable certificate generation on router Host rules. (Default: ```false```) - -`TRAEFIK_ACME_STORAGE`: -Storage to use. (Default: ```acme.json```) - -`TRAEFIK_ACME_TLSCHALLENGE`: -Activate TLS-ALPN-01 Challenge. (Default: ```true```) - -`TRAEFIK_API`: -Enable api/dashboard. (Default: ```false```) - -`TRAEFIK_API_DASHBOARD`: -Activate dashboard. (Default: ```true```) - -`TRAEFIK_API_DEBUG`: -Enable additional endpoints for debugging and profiling. (Default: ```false```) - -`TRAEFIK_API_ENTRYPOINT`: -The entry point that the API handler will be bound to. (Default: ```traefik```) - -`TRAEFIK_API_MIDDLEWARES`: -Middleware list. - -`TRAEFIK_API_STATISTICS`: -Enable more detailed statistics. (Default: ```false```) - -`TRAEFIK_API_STATISTICS_RECENTERRORS`: -Number of recent errors logged. (Default: ```10```) - -`TRAEFIK_CONFIGFILE`: -Configuration file to use. If specified all other flags are ignored. (Default: "") - -`TRAEFIK_ENTRYPOINTS_`: -Entry points definition. (Default: ```false```) - -`TRAEFIK_ENTRYPOINTS__ADDRESS`: -Entry point address. - -`TRAEFIK_ENTRYPOINTS__FORWARDEDHEADERS_INSECURE`: -Trust all forwarded headers. (Default: ```false```) - -`TRAEFIK_ENTRYPOINTS__FORWARDEDHEADERS_TRUSTEDIPS`: -Trust only forwarded headers from selected IPs. - -`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL`: -Proxy-Protocol configuration. (Default: ```false```) - -`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL_INSECURE`: -Trust all. (Default: ```false```) - -`TRAEFIK_ENTRYPOINTS__PROXYPROTOCOL_TRUSTEDIPS`: -Trust only selected IPs. - -`TRAEFIK_ENTRYPOINTS__TRANSPORT_LIFECYCLE_GRACETIMEOUT`: -Duration to give active requests a chance to finish before Traefik stops. (Default: ```10```) - -`TRAEFIK_ENTRYPOINTS__TRANSPORT_LIFECYCLE_REQUESTACCEPTGRACETIMEOUT`: -Duration to keep accepting requests before Traefik initiates the graceful shutdown procedure. (Default: ```0```) - -`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_IDLETIMEOUT`: -IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set. (Default: ```180```) - -`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_READTIMEOUT`: -ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```0```) - -`TRAEFIK_ENTRYPOINTS__TRANSPORT_RESPONDINGTIMEOUTS_WRITETIMEOUT`: -WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set. (Default: ```0```) - -`TRAEFIK_GLOBAL_CHECKNEWVERSION`: -Periodically check if a new version has been released. (Default: ```false```) - -`TRAEFIK_GLOBAL_SENDANONYMOUSUSAGE`: -Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default. - -`TRAEFIK_HOSTRESOLVER`: -Enable CNAME Flattening. (Default: ```false```) - -`TRAEFIK_HOSTRESOLVER_CNAMEFLATTENING`: -A flag to enable/disable CNAME flattening (Default: ```false```) - -`TRAEFIK_HOSTRESOLVER_RESOLVCONFIG`: -resolv.conf used for DNS resolving (Default: ```/etc/resolv.conf```) - -`TRAEFIK_HOSTRESOLVER_RESOLVDEPTH`: -The maximal depth of DNS recursive resolving (Default: ```5```) - -`TRAEFIK_LOG`: -Traefik log settings. (Default: "false") - -`TRAEFIK_LOG_FILEPATH`: -Traefik log file path. Stdout is used when omitted or empty. - -`TRAEFIK_LOG_FORMAT`: -Traefik log format: json | common (Default: ```common```) - -`TRAEFIK_LOG_LEVEL`: -Log level set to traefik logs. (Default: ```ERROR```) - -`TRAEFIK_METRICS_DATADOG`: -DataDog metrics exporter type. (Default: ```false```) - -`TRAEFIK_METRICS_DATADOG_ADDRESS`: -DataDog's address. (Default: ```localhost:8125```) - -`TRAEFIK_METRICS_DATADOG_PUSHINTERVAL`: -DataDog push interval. (Default: ```10```) - -`TRAEFIK_METRICS_INFLUXDB`: -InfluxDB metrics exporter type. (Default: ```false```) - -`TRAEFIK_METRICS_INFLUXDB_ADDRESS`: -InfluxDB address. (Default: ```localhost:8089```) - -`TRAEFIK_METRICS_INFLUXDB_DATABASE`: -InfluxDB database used when protocol is http. - -`TRAEFIK_METRICS_INFLUXDB_PASSWORD`: -InfluxDB password (only with http). - -`TRAEFIK_METRICS_INFLUXDB_PROTOCOL`: -InfluxDB address protocol (udp or http). (Default: ```udp```) - -`TRAEFIK_METRICS_INFLUXDB_PUSHINTERVAL`: -InfluxDB push interval. (Default: ```10```) - -`TRAEFIK_METRICS_INFLUXDB_RETENTIONPOLICY`: -InfluxDB retention policy used when protocol is http. - -`TRAEFIK_METRICS_INFLUXDB_USERNAME`: -InfluxDB username (only with http). - -`TRAEFIK_METRICS_PROMETHEUS`: -Prometheus metrics exporter type. (Default: ```false```) - -`TRAEFIK_METRICS_PROMETHEUS_BUCKETS`: -Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) - -`TRAEFIK_METRICS_PROMETHEUS_ENTRYPOINT`: -EntryPoint. (Default: ```traefik```) - -`TRAEFIK_METRICS_PROMETHEUS_MIDDLEWARES`: -Middlewares. - -`TRAEFIK_METRICS_STATSD`: -StatsD metrics exporter type. (Default: ```false```) - -`TRAEFIK_METRICS_STATSD_ADDRESS`: -StatsD address. (Default: ```localhost:8125```) - -`TRAEFIK_METRICS_STATSD_PUSHINTERVAL`: -StatsD push interval. (Default: ```10```) - -`TRAEFIK_PING`: -Enable ping. (Default: ```false```) - -`TRAEFIK_PING_ENTRYPOINT`: -Ping entryPoint. (Default: ```traefik```) - -`TRAEFIK_PING_MIDDLEWARES`: -Middleware list. - -`TRAEFIK_PROVIDERS_DOCKER`: -Enable Docker backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_DOCKER_CONSTRAINTS`: -Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. - -`TRAEFIK_PROVIDERS_DOCKER_DEFAULTRULE`: -Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) - -`TRAEFIK_PROVIDERS_DOCKER_ENDPOINT`: -Docker server endpoint. Can be a tcp or a unix socket endpoint. (Default: ```unix:///var/run/docker.sock```) - -`TRAEFIK_PROVIDERS_DOCKER_EXPOSEDBYDEFAULT`: -Expose containers by default. (Default: ```true```) - -`TRAEFIK_PROVIDERS_DOCKER_NETWORK`: -Default Docker network used. - -`TRAEFIK_PROVIDERS_DOCKER_SWARMMODE`: -Use Docker on Swarm Mode. (Default: ```false```) - -`TRAEFIK_PROVIDERS_DOCKER_SWARMMODEREFRESHSECONDS`: -Polling interval for swarm mode. (Default: ```15```) - -`TRAEFIK_PROVIDERS_DOCKER_TLS_CA`: -TLS CA - -`TRAEFIK_PROVIDERS_DOCKER_TLS_CAOPTIONAL`: -TLS CA.Optional (Default: ```false```) - -`TRAEFIK_PROVIDERS_DOCKER_TLS_CERT`: -TLS cert - -`TRAEFIK_PROVIDERS_DOCKER_TLS_INSECURESKIPVERIFY`: -TLS insecure skip verify (Default: ```false```) - -`TRAEFIK_PROVIDERS_DOCKER_TLS_KEY`: -TLS key - -`TRAEFIK_PROVIDERS_DOCKER_USEBINDPORTIP`: -Use the ip address from the bound port, rather than from the inner network. (Default: ```false```) - -`TRAEFIK_PROVIDERS_DOCKER_WATCH`: -Watch provider. (Default: ```true```) - -`TRAEFIK_PROVIDERS_FILE`: -Enable File backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_FILE_DEBUGLOGGENERATEDTEMPLATE`: -Enable debug logging of generated configuration template. (Default: ```false```) - -`TRAEFIK_PROVIDERS_FILE_DIRECTORY`: -Load configuration from one or more .toml files in a directory. - -`TRAEFIK_PROVIDERS_FILE_FILENAME`: -Override default configuration template. For advanced users :) - -`TRAEFIK_PROVIDERS_FILE_WATCH`: -Watch provider. (Default: ```true```) - -`TRAEFIK_PROVIDERS_KUBERNETES`: -Enable Kubernetes backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_KUBERNETESCRD`: -Enable Kubernetes backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_CERTAUTHFILEPATH`: -Kubernetes certificate authority file path (not needed for in-cluster client). - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_DISABLEPASSHOSTHEADERS`: -Kubernetes disable PassHost Headers. (Default: ```false```) - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_ENDPOINT`: -Kubernetes server endpoint (required for external cluster client). - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_INGRESSCLASS`: -Value of kubernetes.io/ingress.class annotation to watch for. - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_LABELSELECTOR`: -Kubernetes label selector to use. - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_NAMESPACES`: -Kubernetes namespaces. - -`TRAEFIK_PROVIDERS_KUBERNETESCRD_TOKEN`: -Kubernetes bearer token (not needed for in-cluster client). - -`TRAEFIK_PROVIDERS_KUBERNETES_CERTAUTHFILEPATH`: -Kubernetes certificate authority file path (not needed for in-cluster client). - -`TRAEFIK_PROVIDERS_KUBERNETES_DISABLEPASSHOSTHEADERS`: -Kubernetes disable PassHost Headers. (Default: ```false```) - -`TRAEFIK_PROVIDERS_KUBERNETES_ENDPOINT`: -Kubernetes server endpoint (required for external cluster client). - -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSCLASS`: -Value of kubernetes.io/ingress.class annotation to watch for. - -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_HOSTNAME`: -Hostname used for Kubernetes Ingress endpoints. - -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_IP`: -IP used for Kubernetes Ingress endpoints. - -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_PUBLISHEDSERVICE`: -Published Kubernetes Service to copy status from. - -`TRAEFIK_PROVIDERS_KUBERNETES_LABELSELECTOR`: -Kubernetes Ingress label selector to use. - -`TRAEFIK_PROVIDERS_KUBERNETES_NAMESPACES`: -Kubernetes namespaces. - -`TRAEFIK_PROVIDERS_KUBERNETES_TOKEN`: -Kubernetes bearer token (not needed for in-cluster client). - -`TRAEFIK_PROVIDERS_MARATHON`: -Enable Marathon backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_BASIC_HTTPBASICAUTHUSER`: -Basic authentication User. - -`TRAEFIK_PROVIDERS_MARATHON_BASIC_HTTPBASICPASSWORD`: -Basic authentication Password. - -`TRAEFIK_PROVIDERS_MARATHON_CONSTRAINTS`: -Constraints is an expression that Traefik matches against the application's labels to determine whether to create any route for that application. - -`TRAEFIK_PROVIDERS_MARATHON_DCOSTOKEN`: -DCOSToken for DCOS environment, This will override the Authorization header. - -`TRAEFIK_PROVIDERS_MARATHON_DEFAULTRULE`: -Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) - -`TRAEFIK_PROVIDERS_MARATHON_DIALERTIMEOUT`: -Set a dialer timeout for Marathon. (Default: ```5```) - -`TRAEFIK_PROVIDERS_MARATHON_ENDPOINT`: -Marathon server endpoint. You can also specify multiple endpoint for Marathon. (Default: ```http://127.0.0.1:8080```) - -`TRAEFIK_PROVIDERS_MARATHON_EXPOSEDBYDEFAULT`: -Expose Marathon apps by default. (Default: ```true```) - -`TRAEFIK_PROVIDERS_MARATHON_FORCETASKHOSTNAME`: -Force to use the task's hostname. (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_KEEPALIVE`: -Set a TCP Keep Alive time. (Default: ```10```) - -`TRAEFIK_PROVIDERS_MARATHON_RESPECTREADINESSCHECKS`: -Filter out tasks with non-successful readiness checks during deployments. (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_RESPONSEHEADERTIMEOUT`: -Set a response header timeout for Marathon. (Default: ```60```) - -`TRAEFIK_PROVIDERS_MARATHON_TLSHANDSHAKETIMEOUT`: -Set a TLS handshake timeout for Marathon. (Default: ```5```) - -`TRAEFIK_PROVIDERS_MARATHON_TLS_CA`: -TLS CA - -`TRAEFIK_PROVIDERS_MARATHON_TLS_CAOPTIONAL`: -TLS CA.Optional (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_TLS_CERT`: -TLS cert - -`TRAEFIK_PROVIDERS_MARATHON_TLS_INSECURESKIPVERIFY`: -TLS insecure skip verify (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_TLS_KEY`: -TLS key - -`TRAEFIK_PROVIDERS_MARATHON_TRACE`: -Display additional provider logs. (Default: ```false```) - -`TRAEFIK_PROVIDERS_MARATHON_WATCH`: -Watch provider. (Default: ```true```) - -`TRAEFIK_PROVIDERS_PROVIDERSTHROTTLEDURATION`: -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. (Default: ```0```) - -`TRAEFIK_PROVIDERS_RANCHER`: -Enable Rancher backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_RANCHER_CONSTRAINTS`: -Constraints is an expression that Traefik matches against the container's labels to determine whether to create any route for that container. - -`TRAEFIK_PROVIDERS_RANCHER_DEFAULTRULE`: -Default rule. (Default: ```Host(`{{ normalize .Name }}`)```) - -`TRAEFIK_PROVIDERS_RANCHER_ENABLESERVICEHEALTHFILTER`: -Filter services with unhealthy states and inactive states. (Default: ```true```) - -`TRAEFIK_PROVIDERS_RANCHER_EXPOSEDBYDEFAULT`: -Expose containers by default. (Default: ```true```) - -`TRAEFIK_PROVIDERS_RANCHER_INTERVALPOLL`: -Poll the Rancher metadata service every 'rancher.refreshseconds' (less accurate). (Default: ```false```) - -`TRAEFIK_PROVIDERS_RANCHER_PREFIX`: -Prefix used for accessing the Rancher metadata service. (Default: ```latest```) - -`TRAEFIK_PROVIDERS_RANCHER_REFRESHSECONDS`: -Defines the polling interval in seconds. (Default: ```15```) - -`TRAEFIK_PROVIDERS_RANCHER_WATCH`: -Watch provider. (Default: ```true```) - -`TRAEFIK_PROVIDERS_REST`: -Enable Rest backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_REST_ENTRYPOINT`: -EntryPoint. (Default: ```traefik```) - -`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_DIALTIMEOUT`: -The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```) - -`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_RESPONSEHEADERTIMEOUT`: -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. (Default: ```0```) - -`TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_IDLECONNTIMEOUT`: -The maximum period for which an idle HTTP keep-alive connection to a backend -server will remain open before closing itself. (Default: ```90s```) - -`TRAEFIK_SERVERSTRANSPORT_INSECURESKIPVERIFY`: -Disable SSL certificate verification. (Default: ```false```) - -`TRAEFIK_SERVERSTRANSPORT_MAXIDLECONNSPERHOST`: -If non-zero, controls the maximum idle (keep-alive) to keep per-host. If zero, DefaultMaxIdleConnsPerHost is used (Default: ```0```) - -`TRAEFIK_SERVERSTRANSPORT_ROOTCAS`: -Add cert file for self-signed certificate. - -`TRAEFIK_TRACING`: -OpenTracing configuration. (Default: ```false```) - -`TRAEFIK_TRACING_DATADOG`: -Settings for DataDog. (Default: ```false```) - -`TRAEFIK_TRACING_DATADOG_BAGAGEPREFIXHEADERNAME`: -Specifies the header name prefix that will be used to store baggage items in a map. - -`TRAEFIK_TRACING_DATADOG_DEBUG`: -Enable DataDog debug. (Default: ```false```) - -`TRAEFIK_TRACING_DATADOG_GLOBALTAG`: -Key:Value tag to be set on all the spans. - -`TRAEFIK_TRACING_DATADOG_LOCALAGENTHOSTPORT`: -Set datadog-agent's host:port that the reporter will used. (Default: ```localhost:8126```) - -`TRAEFIK_TRACING_DATADOG_PARENTIDHEADERNAME`: -Specifies the header name that will be used to store the parent ID. - -`TRAEFIK_TRACING_DATADOG_PRIORITYSAMPLING`: -Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled. (Default: ```false```) - -`TRAEFIK_TRACING_DATADOG_SAMPLINGPRIORITYHEADERNAME`: -Specifies the header name that will be used to store the sampling priority. - -`TRAEFIK_TRACING_DATADOG_TRACEIDHEADERNAME`: -Specifies the header name that will be used to store the trace ID. - -`TRAEFIK_TRACING_HAYSTACK`: -Settings for Haystack. (Default: ```false```) - -`TRAEFIK_TRACING_HAYSTACK_BAGGAGEPREFIXHEADERNAME`: -specifies the header name prefix that will be used to store baggage items in a map. - -`TRAEFIK_TRACING_HAYSTACK_GLOBALTAG`: -Key:Value tag to be set on all the spans. - -`TRAEFIK_TRACING_HAYSTACK_LOCALAGENTHOST`: -Set haystack-agent's host that the reporter will used. (Default: ```LocalAgentHost```) - -`TRAEFIK_TRACING_HAYSTACK_LOCALAGENTPORT`: -Set haystack-agent's port that the reporter will used. (Default: ```35000```) - -`TRAEFIK_TRACING_HAYSTACK_PARENTIDHEADERNAME`: -Specifies the header name that will be used to store the parent ID. - -`TRAEFIK_TRACING_HAYSTACK_SPANIDHEADERNAME`: -Specifies the header name that will be used to store the span ID. - -`TRAEFIK_TRACING_HAYSTACK_TRACEIDHEADERNAME`: -Specifies the header name that will be used to store the trace ID. - -`TRAEFIK_TRACING_INSTANA`: -Settings for Instana. (Default: ```false```) - -`TRAEFIK_TRACING_INSTANA_LOCALAGENTHOST`: -Set instana-agent's host that the reporter will used. (Default: ```localhost```) - -`TRAEFIK_TRACING_INSTANA_LOCALAGENTPORT`: -Set instana-agent's port that the reporter will used. (Default: ```42699```) - -`TRAEFIK_TRACING_INSTANA_LOGLEVEL`: -Set instana-agent's log level. ('error','warn','info','debug') (Default: ```info```) - -`TRAEFIK_TRACING_JAEGER`: -Settings for jaeger. (Default: ```false```) - -`TRAEFIK_TRACING_JAEGER_GEN128BIT`: -Generate 128 bit span IDs. (Default: ```false```) - -`TRAEFIK_TRACING_JAEGER_LOCALAGENTHOSTPORT`: -Set jaeger-agent's host:port that the reporter will used. (Default: ```127.0.0.1:6831```) - -`TRAEFIK_TRACING_JAEGER_PROPAGATION`: -Which propgation format to use (jaeger/b3). (Default: ```jaeger```) - -`TRAEFIK_TRACING_JAEGER_SAMPLINGPARAM`: -Set the sampling parameter. (Default: ```1.000000```) - -`TRAEFIK_TRACING_JAEGER_SAMPLINGSERVERURL`: -Set the sampling server url. (Default: ```http://localhost:5778/sampling```) - -`TRAEFIK_TRACING_JAEGER_SAMPLINGTYPE`: -Set the sampling type. (Default: ```const```) - -`TRAEFIK_TRACING_JAEGER_TRACECONTEXTHEADERNAME`: -Set the header to use for the trace-id. (Default: ```uber-trace-id```) - -`TRAEFIK_TRACING_SERVICENAME`: -Set the name for this service. (Default: ```traefik```) - -`TRAEFIK_TRACING_SPANNAMELIMIT`: -Set the maximum character limit for Span names (default 0 = no limit). (Default: ```0```) - -`TRAEFIK_TRACING_ZIPKIN`: -Settings for zipkin. (Default: ```false```) - -`TRAEFIK_TRACING_ZIPKIN_DEBUG`: -Enable Zipkin debug. (Default: ```false```) - -`TRAEFIK_TRACING_ZIPKIN_HTTPENDPOINT`: -HTTP Endpoint to report traces to. (Default: ```http://localhost:9411/api/v1/spans```) - -`TRAEFIK_TRACING_ZIPKIN_ID128BIT`: -Use Zipkin 128 bit root span IDs. (Default: ```true```) - -`TRAEFIK_TRACING_ZIPKIN_SAMESPAN`: -Use Zipkin SameSpan RPC style traces. (Default: ```false```) - -`TRAEFIK_TRACING_ZIPKIN_SAMPLERATE`: -The rate between 0.0 and 1.0 of requests to trace. (Default: ```1.000000```) +--8<-- "content/reference/static-configuration/env-ref.md" diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index c53815310..5b9236526 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -52,7 +52,6 @@ watch = true filename = "foobar" debugLogGeneratedTemplate = true - traefikFile = "foobar" [providers.marathon] constraints = "foobar" trace = true @@ -111,6 +110,7 @@ [api] entryPoint = "foobar" dashboard = true + debug = true middlewares = ["foobar", "foobar"] [api.statistics] recentErrors = 42 @@ -200,6 +200,7 @@ traceIDHeaderName = "foobar" parentIDHeaderName = "foobar" spanIDHeaderName = "foobar" + baggagePrefixHeaderName = "foobar" [hostResolver] cnameFlattening = true diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index f0ac4f3db..e7eae1a7c 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -4,36 +4,36 @@ global: serversTransport: insecureSkipVerify: true rootCAs: - - foobar - - foobar + - foobar + - foobar maxIdleConnsPerHost: 42 forwardingTimeouts: - dialTimeout: 42000000000 - responseHeaderTimeout: 42000000000 - idleConnTimeout: 42000000000 + dialTimeout: 42 + responseHeaderTimeout: 42 + idleConnTimeout: 42 entryPoints: EntryPoint0: address: foobar transport: lifeCycle: - requestAcceptGraceTimeout: 42000000000 - graceTimeOut: 42000000000 + requestAcceptGraceTimeout: 42 + graceTimeOut: 42 respondingTimeouts: - readTimeout: 42000000000 - writeTimeout: 42000000000 - idleTimeout: 42000000000 + readTimeout: 42 + writeTimeout: 42 + idleTimeout: 42 proxyProtocol: insecure: true trustedIPs: - - foobar - - foobar + - foobar + - foobar forwardedHeaders: insecure: true trustedIPs: - - foobar - - foobar + - foobar + - foobar providers: - providersThrottleDuration: 42000000000 + providersThrottleDuration: 42 docker: constraints: foobar watch: true @@ -49,13 +49,12 @@ providers: useBindPortIP: true swarmMode: true network: foobar - swarmModeRefreshSeconds: 42000000000 + swarmModeRefreshSeconds: 42 file: directory: foobar watch: true filename: foobar debugLogGeneratedTemplate: true - traefikFile: foobar marathon: constraints: foobar trace: true @@ -70,10 +69,10 @@ providers: cert: foobar key: foobar insecureSkipVerify: true - dialerTimeout: 42000000000 - responseHeaderTimeout: 42000000000 - tlsHandshakeTimeout: 42000000000 - keepAlive: 42000000000 + dialerTimeout: 42 + responseHeaderTimeout: 42 + tlsHandshakeTimeout: 42 + keepAlive: 42 forceTaskHostname: true basic: httpBasicAuthUser: foobar @@ -85,8 +84,8 @@ providers: certAuthFilePath: foobar disablePassHostHeaders: true namespaces: - - foobar - - foobar + - foobar + - foobar labelSelector: foobar ingressClass: foobar ingressEndpoint: @@ -99,8 +98,8 @@ providers: certAuthFilePath: foobar disablePassHostHeaders: true namespaces: - - foobar - - foobar + - foobar + - foobar labelSelector: foobar ingressClass: foobar rest: @@ -117,30 +116,31 @@ providers: api: entryPoint: foobar dashboard: true + debug: true statistics: recentErrors: 42 middlewares: - - foobar - - foobar + - foobar + - foobar metrics: prometheus: buckets: - - 42 - - 42 + - 42 + - 42 entryPoint: foobar middlewares: - - foobar - - foobar + - foobar + - foobar dataDog: address: foobar - pushInterval: 10000000000 + pushInterval: 42 statsD: address: foobar - pushInterval: 10000000000 + pushInterval: 42 influxDB: address: foobar protocol: foobar - pushInterval: 10000000000 + pushInterval: 42 database: foobar retentionPolicy: foobar username: foobar @@ -148,8 +148,8 @@ metrics: ping: entryPoint: foobar middlewares: - - foobar - - foobar + - foobar + - foobar log: level: foobar filePath: foobar @@ -159,10 +159,10 @@ accessLog: format: foobar filters: statusCodes: - - foobar - - foobar + - foobar + - foobar retryAttempts: true - minDuration: 42000000000 + minDuration: 42 fields: defaultMode: foobar names: @@ -211,6 +211,7 @@ tracing: traceIDHeaderName: foobar parentIDHeaderName: foobar spanIDHeaderName: foobar + baggagePrefixHeaderName: foobar hostResolver: cnameFlattening: true resolvConfig: foobar @@ -225,20 +226,20 @@ acme: onHostRule: true dnsChallenge: provider: foobar - delayBeforeCheck: 42000000000 + delayBeforeCheck: 42 resolvers: - - foobar - - foobar + - foobar + - foobar disablePropagationCheck: true httpChallenge: entryPoint: foobar tlsChallenge: {} domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar + - main: foobar + sans: + - foobar + - foobar + - main: foobar + sans: + - foobar + - foobar diff --git a/generate.go b/generate.go index cc8eedf95..720f4bd40 100644 --- a/generate.go +++ b/generate.go @@ -2,6 +2,7 @@ //go:generate rm -vf autogen/genstatic/gen.go //go:generate mkdir -p static //go:generate go-bindata -pkg genstatic -nocompress -o autogen/genstatic/gen.go ./static/... +//go:generate go run ./internal/ package main diff --git a/internal/gendoc.go b/internal/gendoc.go new file mode 100644 index 000000000..9b9efc01e --- /dev/null +++ b/internal/gendoc.go @@ -0,0 +1,83 @@ +package main + +import ( + "fmt" + "io" + "os" + "strings" + + "github.com/containous/traefik/pkg/config/env" + "github.com/containous/traefik/pkg/config/flag" + "github.com/containous/traefik/pkg/config/generator" + "github.com/containous/traefik/pkg/config/parser" + "github.com/containous/traefik/pkg/config/static" + "github.com/containous/traefik/pkg/log" +) + +func main() { + genStaticConfDoc("./docs/content/reference/static-configuration/env-ref.md", "", env.Encode) + genStaticConfDoc("./docs/content/reference/static-configuration/cli-ref.md", "--", flag.Encode) +} + +func genStaticConfDoc(outputFile string, prefix string, encodeFn func(interface{}) ([]parser.Flat, error)) { + logger := log.WithoutContext().WithField("file", outputFile) + + element := &static.Configuration{} + + generator.Generate(element) + + flats, err := encodeFn(element) + if err != nil { + logger.Fatal(err) + } + + err = os.RemoveAll(outputFile) + if err != nil { + logger.Fatal(err) + } + + file, err := os.OpenFile(outputFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666) + if err != nil { + logger.Fatal(err) + } + + defer file.Close() + + w := errWriter{w: file} + + w.writeln(` +`) + + for i, flat := range flats { + w.writeln("`" + prefix + strings.ReplaceAll(flat.Name, "[0]", "[n]") + "`: ") + if flat.Default == "" { + w.writeln(flat.Description) + } else { + w.writeln(flat.Description + " (Default: ```" + flat.Default + "```)") + } + + if i < len(flats)-1 { + w.writeln() + } + } + + if w.err != nil { + logger.Fatal(err) + } +} + +type errWriter struct { + w io.Writer + err error +} + +func (ew *errWriter) writeln(a ...interface{}) { + if ew.err != nil { + return + } + + _, ew.err = fmt.Fprintln(ew.w, a...) +} diff --git a/pkg/config/parser/tags.go b/pkg/config/parser/tags.go index 3860b9665..a4c479aea 100644 --- a/pkg/config/parser/tags.go +++ b/pkg/config/parser/tags.go @@ -11,6 +11,7 @@ const ( TagLabelSliceAsStruct = "label-slice-as-struct" // TagDescription is the documentation for the field. + // - "-": ignore the field. TagDescription = "description" // TagLabelAllowEmpty is related to TagLabel. diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index 2d64b0375..b7a485342 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -32,7 +32,7 @@ type Provider struct { 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"` + TraefikFile string `description:"-" json:"traefikFile,omitempty" toml:"-" yaml:"-"` } // SetDefaults sets the default values. diff --git a/pkg/types/duration.go b/pkg/types/duration.go index 87bc09f09..936f1f0fb 100644 --- a/pkg/types/duration.go +++ b/pkg/types/duration.go @@ -23,19 +23,11 @@ func (d *Duration) Set(s string) error { return err } -// Get returns the duration value. -func (d *Duration) Get() interface{} { return time.Duration(*d) } - // String returns a string representation of the duration value. -func (d *Duration) String() string { return (*time.Duration)(d).String() } - -// SetValue sets the duration from the given Duration-asserted value. -func (d *Duration) SetValue(val interface{}) { - *d = val.(Duration) -} +func (d Duration) String() string { return (time.Duration)(d).String() } // MarshalText serialize the given duration value into a text. -func (d *Duration) MarshalText() ([]byte, error) { +func (d Duration) MarshalText() ([]byte, error) { return []byte(d.String()), nil } @@ -46,8 +38,8 @@ func (d *Duration) UnmarshalText(text []byte) error { } // MarshalJSON serializes the given duration value. -func (d *Duration) MarshalJSON() ([]byte, error) { - return json.Marshal(time.Duration(*d)) +func (d Duration) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Duration(d)) } // UnmarshalJSON deserializes the given text into a duration value. From cc4258bf9d935fdcebb98c8d9ae9223db242e81f Mon Sep 17 00:00:00 2001 From: stffabi Date: Mon, 8 Jul 2019 17:56:04 +0200 Subject: [PATCH 05/49] Remove X-Forwarded-(Uri, Method, Tls-Client-Cert and Tls-Client-Cert-Info) from untrusted IP --- .../forwardedheaders/forwarded_header.go | 24 +++-- .../forwardedheaders/forwarded_header_test.go | 90 +++++++++++++++---- 2 files changed, 87 insertions(+), 27 deletions(-) diff --git a/pkg/middlewares/forwardedheaders/forwarded_header.go b/pkg/middlewares/forwardedheaders/forwarded_header.go index 74bdc3941..09f350353 100644 --- a/pkg/middlewares/forwardedheaders/forwarded_header.go +++ b/pkg/middlewares/forwardedheaders/forwarded_header.go @@ -10,14 +10,18 @@ import ( ) const ( - xForwardedProto = "X-Forwarded-Proto" - xForwardedFor = "X-Forwarded-For" - xForwardedHost = "X-Forwarded-Host" - xForwardedPort = "X-Forwarded-Port" - xForwardedServer = "X-Forwarded-Server" - xRealIP = "X-Real-Ip" - connection = "Connection" - upgrade = "Upgrade" + xForwardedProto = "X-Forwarded-Proto" + xForwardedFor = "X-Forwarded-For" + xForwardedHost = "X-Forwarded-Host" + xForwardedPort = "X-Forwarded-Port" + xForwardedServer = "X-Forwarded-Server" + xForwardedURI = "X-Forwarded-Uri" + xForwardedMethod = "X-Forwarded-Method" + xForwardedTLSClientCert = "X-Forwarded-Tls-Client-Cert" + xForwardedTLSClientCertInfo = "X-Forwarded-Tls-Client-Cert-Info" + xRealIP = "X-Real-Ip" + connection = "Connection" + upgrade = "Upgrade" ) var xHeaders = []string{ @@ -26,6 +30,10 @@ var xHeaders = []string{ xForwardedHost, xForwardedPort, xForwardedServer, + xForwardedURI, + xForwardedMethod, + xForwardedTLSClientCert, + xForwardedTLSClientCertInfo, xRealIP, } diff --git a/pkg/middlewares/forwardedheaders/forwarded_header_test.go b/pkg/middlewares/forwardedheaders/forwarded_header_test.go index dbcf04b41..0db1f638a 100644 --- a/pkg/middlewares/forwardedheaders/forwarded_header_test.go +++ b/pkg/middlewares/forwardedheaders/forwarded_header_test.go @@ -28,79 +28,131 @@ func TestServeHTTP(t *testing.T) { remoteAddr: "", incomingHeaders: map[string]string{}, expectedHeaders: map[string]string{ - "X-Forwarded-for": "", + "X-Forwarded-for": "", + "X-Forwarded-Uri": "", + "X-Forwarded-Method": "", + "X-Forwarded-Tls-Client-Cert": "", + "X-Forwarded-Tls-Client-Cert-Info": "", }, }, { - desc: "insecure true with incoming X-Forwarded-For", + desc: "insecure true with incoming X-Forwarded headers", insecure: true, trustedIps: nil, remoteAddr: "", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, }, { - desc: "insecure false with incoming X-Forwarded-For", + desc: "insecure false with incoming X-Forwarded headers", insecure: false, trustedIps: nil, remoteAddr: "", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "", + "X-Forwarded-for": "", + "X-Forwarded-Uri": "", + "X-Forwarded-Method": "", + "X-Forwarded-Tls-Client-Cert": "", + "X-Forwarded-Tls-Client-Cert-Info": "", }, }, { - desc: "insecure false with incoming X-Forwarded-For and valid Trusted Ips", + desc: "insecure false with incoming X-Forwarded headers and valid Trusted Ips", insecure: false, trustedIps: []string{"10.0.1.100"}, remoteAddr: "10.0.1.100:80", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, }, { - desc: "insecure false with incoming X-Forwarded-For and invalid Trusted Ips", + desc: "insecure false with incoming X-Forwarded headers and invalid Trusted Ips", insecure: false, trustedIps: []string{"10.0.1.100"}, remoteAddr: "10.0.1.101:80", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "", + "X-Forwarded-for": "", + "X-Forwarded-Uri": "", + "X-Forwarded-Method": "", + "X-Forwarded-Tls-Client-Cert": "", + "X-Forwarded-Tls-Client-Cert-Info": "", }, }, { - desc: "insecure false with incoming X-Forwarded-For and valid Trusted Ips CIDR", + desc: "insecure false with incoming X-Forwarded headers and valid Trusted Ips CIDR", insecure: false, trustedIps: []string{"1.2.3.4/24"}, remoteAddr: "1.2.3.156:80", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, }, { - desc: "insecure false with incoming X-Forwarded-For and invalid Trusted Ips CIDR", + desc: "insecure false with incoming X-Forwarded headers and invalid Trusted Ips CIDR", insecure: false, trustedIps: []string{"1.2.3.4/24"}, remoteAddr: "10.0.1.101:80", incomingHeaders: map[string]string{ - "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-for": "10.0.1.0, 10.0.1.12", + "X-Forwarded-Uri": "/bar", + "X-Forwarded-Method": "GET", + "X-Forwarded-Tls-Client-Cert": "Cert", + "X-Forwarded-Tls-Client-Cert-Info": "CertInfo", }, expectedHeaders: map[string]string{ - "X-Forwarded-for": "", + "X-Forwarded-for": "", + "X-Forwarded-Uri": "", + "X-Forwarded-Method": "", + "X-Forwarded-Tls-Client-Cert": "", + "X-Forwarded-Tls-Client-Cert-Info": "", }, }, { From 8ab33db51add22b44c3c89ff1feab89a13a9217f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou Date: Mon, 8 Jul 2019 21:36:03 +0200 Subject: [PATCH 06/49] Renamed `kubernetes` provider in `kubernetesIngress` provider --- .../reference/static-configuration/cli-ref.md | 66 +++++++++---------- .../reference/static-configuration/env-ref.md | 26 ++++---- .../reference/static-configuration/file.toml | 4 +- .../reference/static-configuration/file.yaml | 2 +- integration/fixtures/k8s_default.toml | 2 +- pkg/anonymize/anonymize_config_test.go | 2 +- pkg/anonymize/anonymize_doOnJSON_test.go | 6 +- pkg/config/file/file_node_test.go | 40 +++++------ pkg/config/file/fixtures/sample.toml | 4 +- pkg/config/file/fixtures/sample.yml | 2 +- pkg/config/static/static_config.go | 2 +- pkg/provider/aggregator/aggregator.go | 4 +- 12 files changed, 81 insertions(+), 79 deletions(-) diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index 47384e163..e7c9d66d0 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -300,39 +300,6 @@ Override default configuration template. For advanced users :) `--providers.file.watch`: Watch provider. (Default: ```true```) -`--providers.kubernetes`: -Enable Kubernetes backend with default settings. (Default: ```false```) - -`--providers.kubernetes.certauthfilepath`: -Kubernetes certificate authority file path (not needed for in-cluster client). - -`--providers.kubernetes.disablepasshostheaders`: -Kubernetes disable PassHost Headers. (Default: ```false```) - -`--providers.kubernetes.endpoint`: -Kubernetes server endpoint (required for external cluster client). - -`--providers.kubernetes.ingressclass`: -Value of kubernetes.io/ingress.class annotation to watch for. - -`--providers.kubernetes.ingressendpoint.hostname`: -Hostname used for Kubernetes Ingress endpoints. - -`--providers.kubernetes.ingressendpoint.ip`: -IP used for Kubernetes Ingress endpoints. - -`--providers.kubernetes.ingressendpoint.publishedservice`: -Published Kubernetes Service to copy status from. - -`--providers.kubernetes.labelselector`: -Kubernetes Ingress label selector to use. - -`--providers.kubernetes.namespaces`: -Kubernetes namespaces. - -`--providers.kubernetes.token`: -Kubernetes bearer token (not needed for in-cluster client). - `--providers.kubernetescrd`: Enable Kubernetes backend with default settings. (Default: ```false```) @@ -357,6 +324,39 @@ Kubernetes namespaces. `--providers.kubernetescrd.token`: Kubernetes bearer token (not needed for in-cluster client). +`--providers.kubernetesingress`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`--providers.kubernetesingress.certauthfilepath`: +Kubernetes certificate authority file path (not needed for in-cluster client). + +`--providers.kubernetesingress.disablepasshostheaders`: +Kubernetes disable PassHost Headers. (Default: ```false```) + +`--providers.kubernetesingress.endpoint`: +Kubernetes server endpoint (required for external cluster client). + +`--providers.kubernetesingress.ingressclass`: +Value of kubernetes.io/ingress.class annotation to watch for. + +`--providers.kubernetesingress.ingressendpoint.hostname`: +Hostname used for Kubernetes Ingress endpoints. + +`--providers.kubernetesingress.ingressendpoint.ip`: +IP used for Kubernetes Ingress endpoints. + +`--providers.kubernetesingress.ingressendpoint.publishedservice`: +Published Kubernetes Service to copy status from. + +`--providers.kubernetesingress.labelselector`: +Kubernetes Ingress label selector to use. + +`--providers.kubernetesingress.namespaces`: +Kubernetes namespaces. + +`--providers.kubernetesingress.token`: +Kubernetes bearer token (not needed for in-cluster client). + `--providers.marathon`: Enable Marathon backend with default settings. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index 48fd382b2..c8021d8c3 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -300,9 +300,6 @@ Override default configuration template. For advanced users :) `TRAEFIK_PROVIDERS_FILE_WATCH`: Watch provider. (Default: ```true```) -`TRAEFIK_PROVIDERS_KUBERNETES`: -Enable Kubernetes backend with default settings. (Default: ```false```) - `TRAEFIK_PROVIDERS_KUBERNETESCRD`: Enable Kubernetes backend with default settings. (Default: ```false```) @@ -327,34 +324,37 @@ Kubernetes namespaces. `TRAEFIK_PROVIDERS_KUBERNETESCRD_TOKEN`: Kubernetes bearer token (not needed for in-cluster client). -`TRAEFIK_PROVIDERS_KUBERNETES_CERTAUTHFILEPATH`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS`: +Enable Kubernetes backend with default settings. (Default: ```false```) + +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_CERTAUTHFILEPATH`: Kubernetes certificate authority file path (not needed for in-cluster client). -`TRAEFIK_PROVIDERS_KUBERNETES_DISABLEPASSHOSTHEADERS`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_DISABLEPASSHOSTHEADERS`: Kubernetes disable PassHost Headers. (Default: ```false```) -`TRAEFIK_PROVIDERS_KUBERNETES_ENDPOINT`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_ENDPOINT`: Kubernetes server endpoint (required for external cluster client). -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSCLASS`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_INGRESSCLASS`: Value of kubernetes.io/ingress.class annotation to watch for. -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_HOSTNAME`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_INGRESSENDPOINT_HOSTNAME`: Hostname used for Kubernetes Ingress endpoints. -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_IP`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_INGRESSENDPOINT_IP`: IP used for Kubernetes Ingress endpoints. -`TRAEFIK_PROVIDERS_KUBERNETES_INGRESSENDPOINT_PUBLISHEDSERVICE`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_INGRESSENDPOINT_PUBLISHEDSERVICE`: Published Kubernetes Service to copy status from. -`TRAEFIK_PROVIDERS_KUBERNETES_LABELSELECTOR`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_LABELSELECTOR`: Kubernetes Ingress label selector to use. -`TRAEFIK_PROVIDERS_KUBERNETES_NAMESPACES`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_NAMESPACES`: Kubernetes namespaces. -`TRAEFIK_PROVIDERS_KUBERNETES_TOKEN`: +`TRAEFIK_PROVIDERS_KUBERNETESINGRESS_TOKEN`: Kubernetes bearer token (not needed for in-cluster client). `TRAEFIK_PROVIDERS_MARATHON`: diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index 5b9236526..fc6e851ef 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -75,7 +75,7 @@ [providers.marathon.basic] httpBasicAuthUser = "foobar" httpBasicPassword = "foobar" - [providers.kubernetes] + [providers.kubernetesIngress] endpoint = "foobar" token = "foobar" certAuthFilePath = "foobar" @@ -83,7 +83,7 @@ namespaces = ["foobar", "foobar"] labelSelector = "foobar" ingressClass = "foobar" - [providers.kubernetes.ingressEndpoint] + [providers.kubernetesIngress.ingressEndpoint] ip = "foobar" hostname = "foobar" publishedService = "foobar" diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index e7eae1a7c..6d234f095 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -78,7 +78,7 @@ providers: httpBasicAuthUser: foobar httpBasicPassword: foobar respectReadinessChecks: true - kubernetes: + kubernetesIngress: endpoint: foobar token: foobar certAuthFilePath: foobar diff --git a/integration/fixtures/k8s_default.toml b/integration/fixtures/k8s_default.toml index c6bc9b298..2b39f0f65 100644 --- a/integration/fixtures/k8s_default.toml +++ b/integration/fixtures/k8s_default.toml @@ -11,4 +11,4 @@ [entryPoints.web] address = ":8000" -[providers.kubernetes] +[providers.kubernetesIngress] diff --git a/pkg/anonymize/anonymize_config_test.go b/pkg/anonymize/anonymize_config_test.go index 2f15468ad..d71afc806 100644 --- a/pkg/anonymize/anonymize_config_test.go +++ b/pkg/anonymize/anonymize_config_test.go @@ -171,7 +171,7 @@ func TestDo_globalConfiguration(t *testing.T) { SwarmModeRefreshSeconds: 42, } - config.Providers.Kubernetes = &ingress.Provider{ + config.Providers.KubernetesIngress = &ingress.Provider{ Endpoint: "MyEndpoint", Token: "MyToken", CertAuthFilePath: "MyCertAuthPath", diff --git a/pkg/anonymize/anonymize_doOnJSON_test.go b/pkg/anonymize/anonymize_doOnJSON_test.go index 24e565d2b..a005b8170 100644 --- a/pkg/anonymize/anonymize_doOnJSON_test.go +++ b/pkg/anonymize/anonymize_doOnJSON_test.go @@ -81,7 +81,8 @@ func Test_doOnJSON(t *testing.T) { "Etcd": null, "Zookeeper": null, "Boltdb": null, - "Kubernetes": null, + "KubernetesIngress": null, + "KubernetesCRD": null, "Mesos": null, "Eureka": null, "ECS": null, @@ -164,7 +165,8 @@ func Test_doOnJSON(t *testing.T) { "Etcd": null, "Zookeeper": null, "Boltdb": null, - "Kubernetes": null, + "KubernetesIngress": null, + "KubernetesCRD": null, "Mesos": null, "Eureka": null, "ECS": null, diff --git a/pkg/config/file/file_node_test.go b/pkg/config/file/file_node_test.go index 2a54fb47f..6ed2ba1c0 100644 --- a/pkg/config/file/file_node_test.go +++ b/pkg/config/file/file_node_test.go @@ -194,7 +194,16 @@ func Test_decodeFileToNode_Toml(t *testing.T) { {Name: "filename", Value: "foobar"}, {Name: "traefikFile", Value: "foobar"}, {Name: "watch", Value: "true"}}}, - {Name: "kubernetes", Children: []*parser.Node{ + {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: "kubernetesIngress", Children: []*parser.Node{ {Name: "certAuthFilePath", Value: "foobar"}, {Name: "disablePassHostHeaders", Value: "true"}, {Name: "endpoint", Value: "foobar"}, @@ -206,15 +215,6 @@ func Test_decodeFileToNode_Toml(t *testing.T) { {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"}, @@ -437,7 +437,16 @@ func Test_decodeFileToNode_Yaml(t *testing.T) { {Name: "filename", Value: "foobar"}, {Name: "traefikFile", Value: "foobar"}, {Name: "watch", Value: "true"}}}, - {Name: "kubernetes", Children: []*parser.Node{ + {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: "kubernetesIngress", Children: []*parser.Node{ {Name: "certAuthFilePath", Value: "foobar"}, {Name: "disablePassHostHeaders", Value: "true"}, {Name: "endpoint", Value: "foobar"}, @@ -449,15 +458,6 @@ func Test_decodeFileToNode_Yaml(t *testing.T) { {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"}, diff --git a/pkg/config/file/fixtures/sample.toml b/pkg/config/file/fixtures/sample.toml index 8db3b5093..0a288c010 100644 --- a/pkg/config/file/fixtures/sample.toml +++ b/pkg/config/file/fixtures/sample.toml @@ -76,7 +76,7 @@ [providers.marathon.basic] httpBasicAuthUser = "foobar" httpBasicPassword = "foobar" - [providers.kubernetes] + [providers.kubernetesIngress] endpoint = "foobar" token = "foobar" certAuthFilePath = "foobar" @@ -84,7 +84,7 @@ namespaces = ["foobar", "foobar"] labelSelector = "foobar" ingressClass = "foobar" - [providers.kubernetes.ingressEndpoint] + [providers.kubernetesIngress.ingressEndpoint] ip = "foobar" hostname = "foobar" publishedService = "foobar" diff --git a/pkg/config/file/fixtures/sample.yml b/pkg/config/file/fixtures/sample.yml index 40c269d72..f66fb2c93 100644 --- a/pkg/config/file/fixtures/sample.yml +++ b/pkg/config/file/fixtures/sample.yml @@ -79,7 +79,7 @@ providers: httpBasicAuthUser: foobar httpBasicPassword: foobar respectReadinessChecks: true - kubernetes: + kubernetesIngress: endpoint: foobar token: foobar certAuthFilePath: foobar diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index d34931506..b2290f8d6 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -151,7 +151,7 @@ type Providers struct { 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"` + KubernetesIngress *ingress.Provider `description:"Enable Kubernetes backend with default settings." json:"kubernetesIngress,omitempty" toml:"kubernetesIngress,omitempty" yaml:"kubernetesIngress,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"` diff --git a/pkg/provider/aggregator/aggregator.go b/pkg/provider/aggregator/aggregator.go index 016c9a632..d7053cd5d 100644 --- a/pkg/provider/aggregator/aggregator.go +++ b/pkg/provider/aggregator/aggregator.go @@ -37,8 +37,8 @@ func NewProviderAggregator(conf static.Providers) ProviderAggregator { p.quietAddProvider(conf.Rest) } - if conf.Kubernetes != nil { - p.quietAddProvider(conf.Kubernetes) + if conf.KubernetesIngress != nil { + p.quietAddProvider(conf.KubernetesIngress) } if conf.KubernetesCRD != nil { From 09cc1161c9947177102811035e9cc0363b615e4f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 9 Jul 2019 15:18:04 +0200 Subject: [PATCH 07/49] Generate deepcopy for configuration struct --- pkg/config/dyn_config.go | 38 +++ pkg/config/dyn_config_test.go | 37 ++ pkg/config/fixtures/sample.toml | 481 ++++++++++++++++++++++++++ pkg/config/zz_generated.deepcopy.go | 509 ++++++++++++++++++++++++++++ pkg/server/server_configuration.go | 5 +- pkg/tls/tls.go | 8 + pkg/tls/zz_generated.deepcopy.go | 115 +++++++ script/update-generated-crd-code.sh | 2 +- 8 files changed, 1190 insertions(+), 5 deletions(-) create mode 100644 pkg/config/dyn_config_test.go create mode 100644 pkg/config/fixtures/sample.toml create mode 100644 pkg/tls/zz_generated.deepcopy.go diff --git a/pkg/config/dyn_config.go b/pkg/config/dyn_config.go index 634fad4de..63e7c4daa 100644 --- a/pkg/config/dyn_config.go +++ b/pkg/config/dyn_config.go @@ -6,15 +6,21 @@ import ( traefiktls "github.com/containous/traefik/pkg/tls" ) +// +k8s:deepcopy-gen=true + // Message holds configuration information exchanged between parts of traefik. type Message struct { ProviderName string Configuration *Configuration } +// +k8s:deepcopy-gen=true + // Configurations is for currentConfigurations Map. type Configurations map[string]*Configuration +// +k8s:deepcopy-gen=true + // Configuration is the root of the dynamic configuration type Configuration struct { HTTP *HTTPConfiguration `json:"http,omitempty" toml:"http,omitempty" yaml:"http,omitempty"` @@ -22,6 +28,8 @@ type Configuration struct { TLS *TLSConfiguration `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"` } +// +k8s:deepcopy-gen=true + // TLSConfiguration contains all the configuration parameters of a TLS connection. type TLSConfiguration struct { Certificates []*traefiktls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"` @@ -29,6 +37,8 @@ type TLSConfiguration struct { Stores map[string]traefiktls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"` } +// +k8s:deepcopy-gen=true + // HTTPConfiguration contains all the HTTP configuration parameters. type HTTPConfiguration struct { Routers map[string]*Router `json:"routers,omitempty" toml:"routers,omitempty" yaml:"routers,omitempty"` @@ -36,22 +46,30 @@ type HTTPConfiguration struct { Services map[string]*Service `json:"services,omitempty" toml:"services,omitempty" yaml:"services,omitempty"` } +// +k8s:deepcopy-gen=true + // 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"` } +// +k8s:deepcopy-gen=true + // 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"` } +// +k8s:deepcopy-gen=true + // 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"` } +// +k8s:deepcopy-gen=true + // Router holds the router configuration. type Router struct { EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"` @@ -62,11 +80,15 @@ type Router struct { TLS *RouterTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"` } +// +k8s:deepcopy-gen=true + // RouterTLSConfig holds the TLS configuration for a router type RouterTLSConfig struct { Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` } +// +k8s:deepcopy-gen=true + // TCPRouter holds the router configuration. type TCPRouter struct { EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"` @@ -75,12 +97,16 @@ type TCPRouter struct { TLS *RouterTCPTLSConfig `json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty" label:"allowEmpty"` } +// +k8s:deepcopy-gen=true + // RouterTCPTLSConfig holds the TLS configuration for a router type RouterTCPTLSConfig struct { Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` } +// +k8s:deepcopy-gen=true + // LoadBalancerService holds the LoadBalancerService configuration. type LoadBalancerService struct { Stickiness *Stickiness `json:"stickiness,omitempty" toml:"stickiness,omitempty" yaml:"stickiness,omitempty" label:"allowEmpty"` @@ -90,6 +116,8 @@ type LoadBalancerService struct { ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty" toml:"responseForwarding,omitempty" yaml:"responseForwarding,omitempty"` } +// +k8s:deepcopy-gen=true + // TCPLoadBalancerService holds the LoadBalancerService configuration. type TCPLoadBalancerService struct { Servers []TCPServer `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server" label-slice-as-struct:"server"` @@ -134,11 +162,15 @@ func (l *LoadBalancerService) SetDefaults() { l.PassHostHeader = true } +// +k8s:deepcopy-gen=true + // ResponseForwarding holds configuration for the forward of the response. type ResponseForwarding struct { FlushInterval string `json:"flushInterval,omitempty" toml:"flushInterval,omitempty" yaml:"flushInterval,omitempty"` } +// +k8s:deepcopy-gen=true + // Stickiness holds the stickiness configuration. type Stickiness struct { CookieName string `json:"cookieName,omitempty" toml:"cookieName,omitempty" yaml:"cookieName,omitempty"` @@ -146,6 +178,8 @@ type Stickiness struct { HTTPOnlyCookie bool `json:"httpOnlyCookie,omitempty" toml:"httpOnlyCookie,omitempty" yaml:"httpOnlyCookie,omitempty"` } +// +k8s:deepcopy-gen=true + // Server holds the server configuration. type Server struct { URL string `json:"url,omitempty" toml:"url,omitempty" yaml:"url,omitempty" label:"-"` @@ -153,6 +187,8 @@ type Server struct { Port string `toml:"-" json:"-" yaml:"-"` } +// +k8s:deepcopy-gen=true + // TCPServer holds a TCP Server configuration type TCPServer struct { Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"` @@ -164,6 +200,8 @@ func (s *Server) SetDefaults() { s.Scheme = "http" } +// +k8s:deepcopy-gen=true + // HealthCheck holds the HealthCheck configuration. type HealthCheck struct { Scheme string `json:"scheme,omitempty" toml:"scheme,omitempty" yaml:"scheme,omitempty"` diff --git a/pkg/config/dyn_config_test.go b/pkg/config/dyn_config_test.go new file mode 100644 index 000000000..ee0467141 --- /dev/null +++ b/pkg/config/dyn_config_test.go @@ -0,0 +1,37 @@ +package config + +import ( + "reflect" + "testing" + + "github.com/BurntSushi/toml" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestDeepCopy(t *testing.T) { + cfg := &Configuration{} + _, err := toml.DecodeFile("./fixtures/sample.toml", &cfg) + require.NoError(t, err) + + cfgCopy := cfg + assert.Equal(t, reflect.ValueOf(cfgCopy), reflect.ValueOf(cfg)) + assert.Equal(t, reflect.ValueOf(cfgCopy), reflect.ValueOf(cfg)) + assert.Equal(t, cfgCopy, cfg) + + cfgDeepCopy := cfg.DeepCopy() + assert.NotEqual(t, reflect.ValueOf(cfgDeepCopy), reflect.ValueOf(cfg)) + assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) + assert.Equal(t, cfgDeepCopy, cfg) + + // Update cfg + cfg.HTTP.Routers["powpow"] = &Router{} + + assert.Equal(t, reflect.ValueOf(cfgCopy), reflect.ValueOf(cfg)) + assert.Equal(t, reflect.ValueOf(cfgCopy), reflect.ValueOf(cfg)) + assert.Equal(t, cfgCopy, cfg) + + assert.NotEqual(t, reflect.ValueOf(cfgDeepCopy), reflect.ValueOf(cfg)) + assert.Equal(t, reflect.TypeOf(cfgDeepCopy), reflect.TypeOf(cfg)) + assert.NotEqual(t, cfgDeepCopy, cfg) +} diff --git a/pkg/config/fixtures/sample.toml b/pkg/config/fixtures/sample.toml new file mode 100644 index 000000000..0a288c010 --- /dev/null +++ b/pkg/config/fixtures/sample.toml @@ -0,0 +1,481 @@ +[global] + checkNewVersion = true + sendAnonymousUsage = true + +[serversTransport] + insecureSkipVerify = true + rootCAs = ["foobar", "foobar"] + maxIdleConnsPerHost = 42 + [serversTransport.forwardingTimeouts] + dialTimeout = 42 + responseHeaderTimeout = 42 + idleConnTimeout = 42 + +[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"] + +[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.kubernetesIngress] + endpoint = "foobar" + token = "foobar" + certAuthFilePath = "foobar" + disablePassHostHeaders = true + namespaces = ["foobar", "foobar"] + labelSelector = "foobar" + ingressClass = "foobar" + [providers.kubernetesIngress.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" + +[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] + name0 = "foobar" + name1 = "foobar" + [accessLog.fields.headers] + defaultMode = "foobar" + [accessLog.fields.headers.names] + name0 = "foobar" + name1 = "foobar" + +[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" + +[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" + priority = 42 + [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] + name0 = "foobar" + name1 = "foobar" + [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.services.Service0.loadBalancer.servers]] + url = "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] + name0 = "foobar" + name1 = "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] + passthrough = true + [tcp.services] + [tcp.services.TCPService0] + [tcp.services.TCPService0.loadBalancer] + + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" + + [[tcp.services.TCPService0.loadBalancer.servers]] + address = "foobar" + +[tls] + + [[tls.Certificates]] + certFile = "foobar" + keyFile = "foobar" + stores = ["foobar", "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/zz_generated.deepcopy.go b/pkg/config/zz_generated.deepcopy.go index 2cf48762f..2b037b221 100644 --- a/pkg/config/zz_generated.deepcopy.go +++ b/pkg/config/zz_generated.deepcopy.go @@ -28,6 +28,10 @@ THE SOFTWARE. package config +import ( + tls "github.com/containous/traefik/pkg/tls" +) + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AddPrefix) DeepCopyInto(out *AddPrefix) { *out = *in @@ -181,6 +185,67 @@ func (in *Compress) DeepCopy() *Compress { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Configuration) DeepCopyInto(out *Configuration) { + *out = *in + if in.HTTP != nil { + in, out := &in.HTTP, &out.HTTP + *out = new(HTTPConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TCP != nil { + in, out := &in.TCP, &out.TCP + *out = new(TCPConfiguration) + (*in).DeepCopyInto(*out) + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(TLSConfiguration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configuration. +func (in *Configuration) DeepCopy() *Configuration { + if in == nil { + return nil + } + out := new(Configuration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Configurations) DeepCopyInto(out *Configurations) { + { + in := &in + *out = make(Configurations, len(*in)) + for key, val := range *in { + var outVal *Configuration + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Configuration) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Configurations. +func (in Configurations) DeepCopy() Configurations { + if in == nil { + return nil + } + out := new(Configurations) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DigestAuth) DeepCopyInto(out *DigestAuth) { *out = *in @@ -249,6 +314,67 @@ func (in *ForwardAuth) DeepCopy() *ForwardAuth { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HTTPConfiguration) DeepCopyInto(out *HTTPConfiguration) { + *out = *in + if in.Routers != nil { + in, out := &in.Routers, &out.Routers + *out = make(map[string]*Router, len(*in)) + for key, val := range *in { + var outVal *Router + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Router) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + if in.Middlewares != nil { + in, out := &in.Middlewares, &out.Middlewares + *out = make(map[string]*Middleware, len(*in)) + for key, val := range *in { + var outVal *Middleware + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Middleware) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make(map[string]*Service, len(*in)) + for key, val := range *in { + var outVal *Service + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(Service) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPConfiguration. +func (in *HTTPConfiguration) DeepCopy() *HTTPConfiguration { + if in == nil { + return nil + } + out := new(HTTPConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Headers) DeepCopyInto(out *Headers) { *out = *in @@ -311,6 +437,29 @@ func (in *Headers) DeepCopy() *Headers { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheck) DeepCopyInto(out *HealthCheck) { + *out = *in + if in.Headers != nil { + in, out := &in.Headers, &out.Headers + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheck. +func (in *HealthCheck) DeepCopy() *HealthCheck { + if in == nil { + return nil + } + out := new(HealthCheck) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IPStrategy) DeepCopyInto(out *IPStrategy) { *out = *in @@ -358,6 +507,42 @@ func (in *IPWhiteList) DeepCopy() *IPWhiteList { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancerService) DeepCopyInto(out *LoadBalancerService) { + *out = *in + if in.Stickiness != nil { + in, out := &in.Stickiness, &out.Stickiness + *out = new(Stickiness) + **out = **in + } + if in.Servers != nil { + in, out := &in.Servers, &out.Servers + *out = make([]Server, len(*in)) + copy(*out, *in) + } + if in.HealthCheck != nil { + in, out := &in.HealthCheck, &out.HealthCheck + *out = new(HealthCheck) + (*in).DeepCopyInto(*out) + } + if in.ResponseForwarding != nil { + in, out := &in.ResponseForwarding, &out.ResponseForwarding + *out = new(ResponseForwarding) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerService. +func (in *LoadBalancerService) DeepCopy() *LoadBalancerService { + if in == nil { + return nil + } + out := new(LoadBalancerService) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MaxConn) DeepCopyInto(out *MaxConn) { *out = *in @@ -374,6 +559,27 @@ func (in *MaxConn) DeepCopy() *MaxConn { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Message) DeepCopyInto(out *Message) { + *out = *in + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(Configuration) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Message. +func (in *Message) DeepCopy() *Message { + if in == nil { + return nil + } + out := new(Message) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Middleware) DeepCopyInto(out *Middleware) { *out = *in @@ -627,6 +833,22 @@ func (in *ReplacePathRegex) DeepCopy() *ReplacePathRegex { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResponseForwarding) DeepCopyInto(out *ResponseForwarding) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResponseForwarding. +func (in *ResponseForwarding) DeepCopy() *ResponseForwarding { + if in == nil { + return nil + } + out := new(ResponseForwarding) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Retry) DeepCopyInto(out *Retry) { *out = *in @@ -643,6 +865,122 @@ func (in *Retry) DeepCopy() *Retry { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Router) DeepCopyInto(out *Router) { + *out = *in + if in.EntryPoints != nil { + in, out := &in.EntryPoints, &out.EntryPoints + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Middlewares != nil { + in, out := &in.Middlewares, &out.Middlewares + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(RouterTLSConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Router. +func (in *Router) DeepCopy() *Router { + if in == nil { + return nil + } + out := new(Router) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouterTCPTLSConfig) DeepCopyInto(out *RouterTCPTLSConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouterTCPTLSConfig. +func (in *RouterTCPTLSConfig) DeepCopy() *RouterTCPTLSConfig { + if in == nil { + return nil + } + out := new(RouterTCPTLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RouterTLSConfig) DeepCopyInto(out *RouterTLSConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouterTLSConfig. +func (in *RouterTLSConfig) DeepCopy() *RouterTLSConfig { + if in == nil { + return nil + } + out := new(RouterTLSConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Server) DeepCopyInto(out *Server) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Server. +func (in *Server) DeepCopy() *Server { + if in == nil { + return nil + } + out := new(Server) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Service) DeepCopyInto(out *Service) { + *out = *in + if in.LoadBalancer != nil { + in, out := &in.LoadBalancer, &out.LoadBalancer + *out = new(LoadBalancerService) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service. +func (in *Service) DeepCopy() *Service { + if in == nil { + return nil + } + out := new(Service) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Stickiness) DeepCopyInto(out *Stickiness) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Stickiness. +func (in *Stickiness) DeepCopy() *Stickiness { + if in == nil { + return nil + } + out := new(Stickiness) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *StripPrefix) DeepCopyInto(out *StripPrefix) { *out = *in @@ -685,6 +1023,136 @@ func (in *StripPrefixRegex) DeepCopy() *StripPrefixRegex { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPConfiguration) DeepCopyInto(out *TCPConfiguration) { + *out = *in + if in.Routers != nil { + in, out := &in.Routers, &out.Routers + *out = make(map[string]*TCPRouter, len(*in)) + for key, val := range *in { + var outVal *TCPRouter + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(TCPRouter) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make(map[string]*TCPService, len(*in)) + for key, val := range *in { + var outVal *TCPService + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(TCPService) + (*in).DeepCopyInto(*out) + } + (*out)[key] = outVal + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPConfiguration. +func (in *TCPConfiguration) DeepCopy() *TCPConfiguration { + if in == nil { + return nil + } + out := new(TCPConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPLoadBalancerService) DeepCopyInto(out *TCPLoadBalancerService) { + *out = *in + if in.Servers != nil { + in, out := &in.Servers, &out.Servers + *out = make([]TCPServer, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPLoadBalancerService. +func (in *TCPLoadBalancerService) DeepCopy() *TCPLoadBalancerService { + if in == nil { + return nil + } + out := new(TCPLoadBalancerService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPRouter) DeepCopyInto(out *TCPRouter) { + *out = *in + if in.EntryPoints != nil { + in, out := &in.EntryPoints, &out.EntryPoints + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(RouterTCPTLSConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRouter. +func (in *TCPRouter) DeepCopy() *TCPRouter { + if in == nil { + return nil + } + out := new(TCPRouter) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPServer) DeepCopyInto(out *TCPServer) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPServer. +func (in *TCPServer) DeepCopy() *TCPServer { + if in == nil { + return nil + } + out := new(TCPServer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TCPService) DeepCopyInto(out *TCPService) { + *out = *in + if in.LoadBalancer != nil { + in, out := &in.LoadBalancer, &out.LoadBalancer + *out = new(TCPLoadBalancerService) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPService. +func (in *TCPService) DeepCopy() *TCPService { + if in == nil { + return nil + } + out := new(TCPService) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TLSCLientCertificateDNInfo) DeepCopyInto(out *TLSCLientCertificateDNInfo) { *out = *in @@ -727,6 +1195,47 @@ func (in *TLSClientCertificateInfo) DeepCopy() *TLSClientCertificateInfo { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TLSConfiguration) DeepCopyInto(out *TLSConfiguration) { + *out = *in + if in.Certificates != nil { + in, out := &in.Certificates, &out.Certificates + *out = make([]*tls.CertAndStores, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(tls.CertAndStores) + (*in).DeepCopyInto(*out) + } + } + } + if in.Options != nil { + in, out := &in.Options, &out.Options + *out = make(map[string]tls.Options, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + if in.Stores != nil { + in, out := &in.Stores, &out.Stores + *out = make(map[string]tls.Store, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSConfiguration. +func (in *TLSConfiguration) DeepCopy() *TLSConfiguration { + if in == nil { + return nil + } + out := new(TLSConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in Users) DeepCopyInto(out *Users) { { diff --git a/pkg/server/server_configuration.go b/pkg/server/server_configuration.go index dd397f82b..eb78e4023 100644 --- a/pkg/server/server_configuration.go +++ b/pkg/server/server_configuration.go @@ -30,10 +30,7 @@ func (s *Server) loadConfiguration(configMsg config.Message) { currentConfigurations := s.currentConfigurations.Get().(config.Configurations) // Copy configurations to new map so we don't change current if LoadConfig fails - newConfigurations := make(config.Configurations) - for k, v := range currentConfigurations { - newConfigurations[k] = v - } + newConfigurations := currentConfigurations.DeepCopy() newConfigurations[configMsg.ProviderName] = configMsg.Configuration s.metricsRegistry.ConfigReloadsCounter().Add(1) diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go index 8b855fcba..7193a5220 100644 --- a/pkg/tls/tls.go +++ b/pkg/tls/tls.go @@ -2,6 +2,8 @@ package tls const certificateHeader = "-----BEGIN CERTIFICATE-----\n" +// +k8s:deepcopy-gen=true + // 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 { @@ -9,6 +11,8 @@ type ClientCA struct { Optional bool `json:"optional,omitempty" toml:"optional,omitempty" yaml:"optional,omitempty"` } +// +k8s:deepcopy-gen=true + // Options configures TLS for an entry point type Options struct { MinVersion string `json:"minVersion,omitempty" toml:"minVersion,omitempty" yaml:"minVersion,omitempty" export:"true"` @@ -17,11 +21,15 @@ type Options struct { SniStrict bool `json:"sniStrict,omitempty" toml:"sniStrict,omitempty" yaml:"sniStrict,omitempty" export:"true"` } +// +k8s:deepcopy-gen=true + // Store holds the options for a given Store type Store struct { DefaultCertificate *Certificate `json:"defaultCertificate,omitempty" toml:"defaultCertificate,omitempty" yaml:"defaultCertificate,omitempty"` } +// +k8s:deepcopy-gen=true + // CertAndStores allows mapping a TLS certificate to a list of entry points. type CertAndStores struct { Certificate `yaml:",inline"` diff --git a/pkg/tls/zz_generated.deepcopy.go b/pkg/tls/zz_generated.deepcopy.go new file mode 100644 index 000000000..9823a1354 --- /dev/null +++ b/pkg/tls/zz_generated.deepcopy.go @@ -0,0 +1,115 @@ +// +build !ignore_autogenerated + +/* +The MIT License (MIT) + +Copyright (c) 2016-2019 Containous SAS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package tls + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CertAndStores) DeepCopyInto(out *CertAndStores) { + *out = *in + out.Certificate = in.Certificate + if in.Stores != nil { + in, out := &in.Stores, &out.Stores + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertAndStores. +func (in *CertAndStores) DeepCopy() *CertAndStores { + if in == nil { + return nil + } + out := new(CertAndStores) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientCA) DeepCopyInto(out *ClientCA) { + *out = *in + if in.Files != nil { + in, out := &in.Files, &out.Files + *out = make([]FileOrContent, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientCA. +func (in *ClientCA) DeepCopy() *ClientCA { + if in == nil { + return nil + } + out := new(ClientCA) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Options) DeepCopyInto(out *Options) { + *out = *in + if in.CipherSuites != nil { + in, out := &in.CipherSuites, &out.CipherSuites + *out = make([]string, len(*in)) + copy(*out, *in) + } + in.ClientCA.DeepCopyInto(&out.ClientCA) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Options. +func (in *Options) DeepCopy() *Options { + if in == nil { + return nil + } + out := new(Options) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Store) DeepCopyInto(out *Store) { + *out = *in + if in.DefaultCertificate != nil { + in, out := &in.DefaultCertificate, &out.DefaultCertificate + *out = new(Certificate) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Store. +func (in *Store) DeepCopy() *Store { + if in == nil { + return nil + } + out := new(Store) + in.DeepCopyInto(out) + return out +} diff --git a/script/update-generated-crd-code.sh b/script/update-generated-crd-code.sh index f6178477d..bbc02afdc 100755 --- a/script/update-generated-crd-code.sh +++ b/script/update-generated-crd-code.sh @@ -11,4 +11,4 @@ REPO_ROOT=${HACK_DIR}/.. --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \ "$@" -deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config -O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl +deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config --input-dirs github.com/containous/traefik/pkg/tls -O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl From c8bf8e896ad51bb419d5331b8703435c7cce0892 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Wed, 10 Jul 2019 09:26:04 +0200 Subject: [PATCH 08/49] Move dynamic config into a dedicated package. --- cmd/traefik/traefik.go | 4 +- integration/https_test.go | 6 +- integration/rest_test.go | 12 +- integration/simple_test.go | 6 +- internal/gendoc.go | 4 +- pkg/api/handler.go | 28 +- pkg/api/handler_test.go | 348 ++++---- pkg/config/dynamic/config.go | 36 + .../config_test.go} | 2 +- pkg/config/{ => dynamic}/fixtures/sample.toml | 0 .../{dyn_config.go => dynamic/http_config.go} | 104 +-- pkg/config/{ => dynamic}/middlewares.go | 2 +- pkg/config/{ => dynamic}/runtime.go | 2 +- pkg/config/{ => dynamic}/runtime_test.go | 440 +++++----- pkg/config/dynamic/tcp_config.go | 68 ++ .../{ => dynamic}/zz_generated.deepcopy.go | 2 +- pkg/config/label/label.go | 12 +- pkg/config/label/label_test.go | 206 ++--- pkg/healthcheck/healthcheck.go | 6 +- pkg/healthcheck/healthcheck_test.go | 4 +- pkg/metrics/prometheus.go | 4 +- pkg/metrics/prometheus_test.go | 6 +- pkg/middlewares/addprefix/add_prefix.go | 4 +- pkg/middlewares/addprefix/add_prefix_test.go | 14 +- pkg/middlewares/auth/basic_auth.go | 4 +- pkg/middlewares/auth/basic_auth_test.go | 16 +- pkg/middlewares/auth/digest_auth.go | 4 +- pkg/middlewares/auth/digest_auth_test.go | 8 +- pkg/middlewares/auth/forward.go | 4 +- pkg/middlewares/auth/forward_test.go | 12 +- pkg/middlewares/buffering/buffering.go | 4 +- pkg/middlewares/chain/chain.go | 4 +- .../circuitbreaker/circuit_breaker.go | 4 +- pkg/middlewares/customerrors/custom_errors.go | 4 +- .../customerrors/custom_errors_test.go | 14 +- pkg/middlewares/headers/headers.go | 10 +- pkg/middlewares/headers/headers_test.go | 54 +- pkg/middlewares/ipwhitelist/ip_whitelist.go | 4 +- .../ipwhitelist/ip_whitelist_test.go | 14 +- .../maxconnection/max_connection.go | 4 +- .../passtlsclientcert/pass_tls_client_cert.go | 8 +- .../pass_tls_client_cert_test.go | 58 +- pkg/middlewares/ratelimiter/rate_limiter.go | 4 +- pkg/middlewares/redirect/redirect_regex.go | 4 +- .../redirect/redirect_regex_test.go | 28 +- pkg/middlewares/redirect/redirect_scheme.go | 4 +- .../redirect/redirect_scheme_test.go | 36 +- pkg/middlewares/replacepath/replace_path.go | 4 +- .../replacepath/replace_path_test.go | 4 +- .../replacepathregex/replace_path_regex.go | 4 +- .../replace_path_regex_test.go | 14 +- pkg/middlewares/retry/retry.go | 4 +- pkg/middlewares/retry/retry_test.go | 22 +- pkg/middlewares/stripprefix/strip_prefix.go | 4 +- .../stripprefix/strip_prefix_test.go | 26 +- .../stripprefixregex/strip_prefix_regex.go | 4 +- .../strip_prefix_regex_test.go | 4 +- pkg/provider/acme/provider.go | 26 +- pkg/provider/aggregator/aggregator.go | 6 +- pkg/provider/configuration.go | 38 +- pkg/provider/docker/config.go | 36 +- pkg/provider/docker/config_test.go | 810 +++++++++--------- pkg/provider/docker/docker.go | 10 +- pkg/provider/file/file.go | 68 +- pkg/provider/file/file_test.go | 8 +- pkg/provider/kubernetes/crd/kubernetes.go | 66 +- .../kubernetes/crd/kubernetes_test.go | 764 ++++++++--------- .../crd/traefik/v1alpha1/middleware.go | 4 +- pkg/provider/kubernetes/ingress/kubernetes.go | 38 +- .../kubernetes/ingress/kubernetes_test.go | 518 +++++------ pkg/provider/marathon/config.go | 46 +- pkg/provider/marathon/config_test.go | 768 ++++++++--------- pkg/provider/marathon/marathon.go | 10 +- pkg/provider/provider.go | 4 +- pkg/provider/rancher/config.go | 44 +- pkg/provider/rancher/config_test.go | 330 +++---- pkg/provider/rancher/rancher.go | 6 +- pkg/provider/rest/rest.go | 10 +- pkg/responsemodifiers/headers.go | 4 +- pkg/responsemodifiers/response_modifier.go | 6 +- .../response_modifier_test.go | 46 +- pkg/server/aggregator.go | 22 +- pkg/server/aggregator_test.go | 112 +-- pkg/server/middleware/middlewares.go | 6 +- pkg/server/middleware/middlewares_test.go | 102 +-- .../router/route_appender_aggregator.go | 4 +- pkg/server/router/route_appender_factory.go | 4 +- pkg/server/router/router.go | 16 +- pkg/server/router/router_test.go | 238 ++--- pkg/server/router/tcp/router.go | 16 +- pkg/server/router/tcp/router_test.go | 76 +- pkg/server/server.go | 26 +- pkg/server/server_configuration.go | 32 +- pkg/server/server_configuration_test.go | 12 +- pkg/server/server_test.go | 34 +- pkg/server/service/proxy.go | 4 +- pkg/server/service/service.go | 14 +- pkg/server/service/service_test.go | 72 +- pkg/server/service/tcp/service.go | 6 +- pkg/server/service/tcp/service_test.go | 76 +- pkg/testhelpers/config.go | 80 +- script/update-generated-crd-code.sh | 2 +- 102 files changed, 3170 insertions(+), 3166 deletions(-) create mode 100644 pkg/config/dynamic/config.go rename pkg/config/{dyn_config_test.go => dynamic/config_test.go} (98%) rename pkg/config/{ => dynamic}/fixtures/sample.toml (100%) rename pkg/config/{dyn_config.go => dynamic/http_config.go} (57%) rename pkg/config/{ => dynamic}/middlewares.go (99%) rename pkg/config/{ => dynamic}/runtime.go (99%) rename pkg/config/{ => dynamic}/runtime_test.go (68%) create mode 100644 pkg/config/dynamic/tcp_config.go rename pkg/config/{ => dynamic}/zz_generated.deepcopy.go (99%) diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 0527ebfe9..d7f346593 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -17,7 +17,7 @@ import ( cmdVersion "github.com/containous/traefik/cmd/version" "github.com/containous/traefik/pkg/cli" "github.com/containous/traefik/pkg/collector" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider/aggregator" @@ -147,7 +147,7 @@ func runCmd(staticConfiguration *static.Configuration, configFile string) error svr := server.NewServer(*staticConfiguration, providerAggregator, serverEntryPointsTCP, tlsManager) if acmeProvider != nil && acmeProvider.OnHostRule { - acmeProvider.SetConfigListenerChan(make(chan config.Configuration)) + acmeProvider.SetConfigListenerChan(make(chan dynamic.Configuration)) svr.AddListener(acmeProvider.ListenConfiguration) } ctx := cmd.ContextWithSignal(context.Background()) diff --git a/integration/https_test.go b/integration/https_test.go index a226c54ce..d589f216d 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -12,7 +12,7 @@ import ( "github.com/BurntSushi/toml" "github.com/containous/traefik/integration/try" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" traefiktls "github.com/containous/traefik/pkg/tls" "github.com/go-check/check" checker "github.com/vdemeester/shakers" @@ -864,8 +864,8 @@ func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, en // If certificate file is not provided, just truncate the configuration file if len(certFileName) > 0 { - tlsConf := config.Configuration{ - TLS: &config.TLSConfiguration{ + tlsConf := dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Certificates: []*traefiktls.CertAndStores{{ Certificate: traefiktls.Certificate{ CertFile: traefiktls.FileOrContent("fixtures/https/" + certFileName + ".cert"), diff --git a/integration/rest_test.go b/integration/rest_test.go index 86cad9d90..1cb330cf2 100644 --- a/integration/rest_test.go +++ b/integration/rest_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/containous/traefik/integration/try" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/go-check/check" checker "github.com/vdemeester/shakers" ) @@ -32,8 +32,8 @@ func (s *RestSuite) TestSimpleConfiguration(c *check.C) { err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusNotFound)) c.Assert(err, checker.IsNil) - config := config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + config := dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router1": { EntryPoints: []string{"web"}, Middlewares: []string{}, @@ -41,10 +41,10 @@ func (s *RestSuite) TestSimpleConfiguration(c *check.C) { Rule: "PathPrefix(`/`)", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://" + s.composeProject.Container(c, "whoami1").NetworkSettings.IPAddress + ":80", }, diff --git a/integration/simple_test.go b/integration/simple_test.go index 063f0dfcc..a6c8a3ea5 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/containous/traefik/integration/try" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/go-check/check" checker "github.com/vdemeester/shakers" ) @@ -440,8 +440,8 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) { err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1000*time.Millisecond, try.BodyContains("service")) c.Assert(err, checker.IsNil) - config := config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + config := dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router1": { EntryPoints: []string{"web"}, Middlewares: []string{"customheader@file"}, diff --git a/internal/gendoc.go b/internal/gendoc.go index 9b9efc01e..92405a4d3 100644 --- a/internal/gendoc.go +++ b/internal/gendoc.go @@ -48,8 +48,8 @@ func genStaticConfDoc(outputFile string, prefix string, encodeFn func(interface{ w.writeln(` -`) +-->`) + w.writeln() for i, flat := range flats { w.writeln("`" + prefix + strings.ReplaceAll(flat.Name, "[0]", "[n]") + "`: ") diff --git a/pkg/api/handler.go b/pkg/api/handler.go index 4520343d9..2fecfc9c2 100644 --- a/pkg/api/handler.go +++ b/pkg/api/handler.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/types" @@ -25,46 +25,46 @@ const ( const nextPageHeader = "X-Next-Page" type serviceInfoRepresentation struct { - *config.ServiceInfo + *dynamic.ServiceInfo ServerStatus map[string]string `json:"serverStatus,omitempty"` } // RunTimeRepresentation is the configuration information exposed by the API handler. type RunTimeRepresentation struct { - Routers map[string]*config.RouterInfo `json:"routers,omitempty"` - Middlewares map[string]*config.MiddlewareInfo `json:"middlewares,omitempty"` + Routers map[string]*dynamic.RouterInfo `json:"routers,omitempty"` + Middlewares map[string]*dynamic.MiddlewareInfo `json:"middlewares,omitempty"` Services map[string]*serviceInfoRepresentation `json:"services,omitempty"` - TCPRouters map[string]*config.TCPRouterInfo `json:"tcpRouters,omitempty"` - TCPServices map[string]*config.TCPServiceInfo `json:"tcpServices,omitempty"` + TCPRouters map[string]*dynamic.TCPRouterInfo `json:"tcpRouters,omitempty"` + TCPServices map[string]*dynamic.TCPServiceInfo `json:"tcpServices,omitempty"` } type routerRepresentation struct { - *config.RouterInfo + *dynamic.RouterInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type serviceRepresentation struct { - *config.ServiceInfo + *dynamic.ServiceInfo ServerStatus map[string]string `json:"serverStatus,omitempty"` Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type middlewareRepresentation struct { - *config.MiddlewareInfo + *dynamic.MiddlewareInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type tcpRouterRepresentation struct { - *config.TCPRouterInfo + *dynamic.TCPRouterInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type tcpServiceRepresentation struct { - *config.TCPServiceInfo + *dynamic.TCPServiceInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } @@ -80,7 +80,7 @@ type Handler struct { dashboard bool debug bool // runtimeConfiguration is the data set used to create all the data representations exposed by the API. - runtimeConfiguration *config.RuntimeConfiguration + runtimeConfiguration *dynamic.RuntimeConfiguration statistics *types.Statistics // stats *thoasstats.Stats // FIXME stats // StatsRecorder *middlewares.StatsRecorder // FIXME stats @@ -89,10 +89,10 @@ type Handler struct { // New returns a Handler defined by staticConfig, and if provided, by runtimeConfig. // It finishes populating the information provided in the runtimeConfig. -func New(staticConfig static.Configuration, runtimeConfig *config.RuntimeConfiguration) *Handler { +func New(staticConfig static.Configuration, runtimeConfig *dynamic.RuntimeConfiguration) *Handler { rConfig := runtimeConfig if rConfig == nil { - rConfig = &config.RuntimeConfiguration{} + rConfig = &dynamic.RuntimeConfiguration{} } return &Handler{ diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go index ce10158a2..fa770b33a 100644 --- a/pkg/api/handler_test.go +++ b/pkg/api/handler_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,13 +29,13 @@ func TestHandlerTCP_API(t *testing.T) { testCases := []struct { desc string path string - conf config.RuntimeConfiguration + conf dynamic.RuntimeConfiguration expected expected }{ { desc: "all TCP routers, but no config", path: "/api/tcp/routers", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -45,20 +45,20 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "all TCP routers", path: "/api/tcp/routers", - conf: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "test@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, }, }, }, "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -75,24 +75,24 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "all TCP routers, pagination, 1 res per page, want page 2", path: "/api/tcp/routers?page=2&per_page=1", - conf: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", }, }, "baz@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`toto.bar`)", }, }, "test@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -109,10 +109,10 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one TCP router by id", path: "/api/tcp/routers/bar@myprovider", - conf: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -128,10 +128,10 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one TCP router by id, that does not exist", path: "/api/tcp/routers/foo@myprovider", - conf: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -146,7 +146,7 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one TCP router by id, but no config", path: "/api/tcp/routers/bar@myprovider", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -154,7 +154,7 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "all tcp services, but no config", path: "/api/tcp/services", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -164,12 +164,12 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "all tcp services", path: "/api/tcp/services", - conf: config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "bar@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:2345", }, @@ -179,9 +179,9 @@ func TestHandlerTCP_API(t *testing.T) { UsedBy: []string{"foo@myprovider", "test@myprovider"}, }, "baz@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.2:2345", }, @@ -201,12 +201,12 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "all tcp services, 1 res per page, want page 2", path: "/api/tcp/services?page=2&per_page=1", - conf: config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "bar@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:2345", }, @@ -216,9 +216,9 @@ func TestHandlerTCP_API(t *testing.T) { UsedBy: []string{"foo@myprovider", "test@myprovider"}, }, "baz@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.2:2345", }, @@ -228,9 +228,9 @@ func TestHandlerTCP_API(t *testing.T) { UsedBy: []string{"foo@myprovider"}, }, "test@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.3:2345", }, @@ -249,12 +249,12 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one tcp service by id", path: "/api/tcp/services/bar@myprovider", - conf: config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "bar@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:2345", }, @@ -273,12 +273,12 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one tcp service by id, that does not exist", path: "/api/tcp/services/nono@myprovider", - conf: config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "bar@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:2345", }, @@ -296,7 +296,7 @@ func TestHandlerTCP_API(t *testing.T) { { desc: "one tcp service by id, but no config", path: "/api/tcp/services/foo@myprovider", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -363,13 +363,13 @@ func TestHandlerHTTP_API(t *testing.T) { testCases := []struct { desc string path string - conf config.RuntimeConfiguration + conf dynamic.RuntimeConfiguration expected expected }{ { desc: "all routers, but no config", path: "/api/http/routers", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -379,10 +379,10 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all routers", path: "/api/http/routers", - conf: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "test@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -390,7 +390,7 @@ func TestHandlerHTTP_API(t *testing.T) { }, }, "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -408,10 +408,10 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all routers, pagination, 1 res per page, want page 2", path: "/api/http/routers?page=2&per_page=1", - conf: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -419,14 +419,14 @@ func TestHandlerHTTP_API(t *testing.T) { }, }, "baz@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`toto.bar`)", }, }, "test@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -444,7 +444,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all routers, pagination, 19 results overall, 7 res per page, want page 3", path: "/api/http/routers?page=3&per_page=7", - conf: config.RuntimeConfiguration{ + conf: dynamic.RuntimeConfiguration{ Routers: generateHTTPRouters(19), }, expected: expected{ @@ -456,7 +456,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all routers, pagination, 5 results overall, 10 res per page, want page 2", path: "/api/http/routers?page=2&per_page=10", - conf: config.RuntimeConfiguration{ + conf: dynamic.RuntimeConfiguration{ Routers: generateHTTPRouters(5), }, expected: expected{ @@ -466,7 +466,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all routers, pagination, 10 results overall, 10 res per page, want page 2", path: "/api/http/routers?page=2&per_page=10", - conf: config.RuntimeConfiguration{ + conf: dynamic.RuntimeConfiguration{ Routers: generateHTTPRouters(10), }, expected: expected{ @@ -476,10 +476,10 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one router by id", path: "/api/http/routers/bar@myprovider", - conf: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -496,10 +496,10 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one router by id, that does not exist", path: "/api/http/routers/foo@myprovider", - conf: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -515,7 +515,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one router by id, but no config", path: "/api/http/routers/foo@myprovider", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -523,7 +523,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all services, but no config", path: "/api/http/services", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -533,13 +533,13 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all services", path: "/api/http/services", - conf: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ - "bar@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -551,11 +551,11 @@ func TestHandlerHTTP_API(t *testing.T) { si.UpdateStatus("http://127.0.0.1", "UP") return si }(), - "baz@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + "baz@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.2", }, @@ -578,13 +578,13 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all services, 1 res per page, want page 2", path: "/api/http/services?page=2&per_page=1", - conf: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ - "bar@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -596,11 +596,11 @@ func TestHandlerHTTP_API(t *testing.T) { si.UpdateStatus("http://127.0.0.1", "UP") return si }(), - "baz@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + "baz@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.2", }, @@ -612,11 +612,11 @@ func TestHandlerHTTP_API(t *testing.T) { si.UpdateStatus("http://127.0.0.2", "UP") return si }(), - "test@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + "test@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.3", }, @@ -639,13 +639,13 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one service by id", path: "/api/http/services/bar@myprovider", - conf: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ - "bar@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -667,13 +667,13 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one service by id, that does not exist", path: "/api/http/services/nono@myprovider", - conf: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ - "bar@myprovider": func() *config.ServiceInfo { - si := &config.ServiceInfo{ - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -694,7 +694,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one service by id, but no config", path: "/api/http/services/foo@myprovider", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -702,7 +702,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all middlewares, but no config", path: "/api/http/middlewares", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -712,27 +712,27 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all middlewares", path: "/api/http/middlewares", - conf: config.RuntimeConfiguration{ - Middlewares: map[string]*config.MiddlewareInfo{ + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/titi", }, }, UsedBy: []string{"test@myprovider"}, }, "addPrefixTest@anotherprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, @@ -749,27 +749,27 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "all middlewares, 1 res per page, want page 2", path: "/api/http/middlewares?page=2&per_page=1", - conf: config.RuntimeConfiguration{ - Middlewares: map[string]*config.MiddlewareInfo{ + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/titi", }, }, UsedBy: []string{"test@myprovider"}, }, "addPrefixTest@anotherprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, @@ -786,27 +786,27 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one middleware by id", path: "/api/http/middlewares/auth@myprovider", - conf: config.RuntimeConfiguration{ - Middlewares: map[string]*config.MiddlewareInfo{ + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/titi", }, }, UsedBy: []string{"test@myprovider"}, }, "addPrefixTest@anotherprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, @@ -822,11 +822,11 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one middleware by id, that does not exist", path: "/api/http/middlewares/foo@myprovider", - conf: config.RuntimeConfiguration{ - Middlewares: map[string]*config.MiddlewareInfo{ + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, @@ -841,7 +841,7 @@ func TestHandlerHTTP_API(t *testing.T) { { desc: "one middleware by id, but no config", path: "/api/http/middlewares/foo@myprovider", - conf: config.RuntimeConfiguration{}, + conf: dynamic.RuntimeConfiguration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -906,18 +906,18 @@ func TestHandler_Configuration(t *testing.T) { testCases := []struct { desc string path string - conf config.RuntimeConfiguration + conf dynamic.RuntimeConfiguration expected expected }{ { desc: "Get rawdata", path: "/api/rawdata", - conf: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -926,32 +926,32 @@ func TestHandler_Configuration(t *testing.T) { }, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/titi", }, }, }, "addPrefixTest@anotherprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -959,7 +959,7 @@ func TestHandler_Configuration(t *testing.T) { }, }, "test@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -967,11 +967,11 @@ func TestHandler_Configuration(t *testing.T) { }, }, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "tcpfoo-service@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1", }, @@ -980,16 +980,16 @@ func TestHandler_Configuration(t *testing.T) { }, }, }, - TCPRouters: map[string]*config.TCPRouterInfo{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "tcpbar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "tcpfoo-service@myprovider", Rule: "HostSNI(`foo.bar`)", }, }, "tcptest@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "tcpfoo-service@myprovider", Rule: "HostSNI(`foo.bar.other`)", @@ -1054,11 +1054,11 @@ func TestHandler_Configuration(t *testing.T) { } } -func generateHTTPRouters(nbRouters int) map[string]*config.RouterInfo { - routers := make(map[string]*config.RouterInfo, nbRouters) +func generateHTTPRouters(nbRouters int) map[string]*dynamic.RouterInfo { + routers := make(map[string]*dynamic.RouterInfo, nbRouters) for i := 0; i < nbRouters; i++ { - routers[fmt.Sprintf("bar%2d@myprovider", i)] = &config.RouterInfo{ - Router: &config.Router{ + routers[fmt.Sprintf("bar%2d@myprovider", i)] = &dynamic.RouterInfo{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar" + strconv.Itoa(i) + "`)", diff --git a/pkg/config/dynamic/config.go b/pkg/config/dynamic/config.go new file mode 100644 index 000000000..07845ca97 --- /dev/null +++ b/pkg/config/dynamic/config.go @@ -0,0 +1,36 @@ +package dynamic + +import ( + "github.com/containous/traefik/pkg/tls" +) + +// +k8s:deepcopy-gen=true + +// Message holds configuration information exchanged between parts of traefik. +type Message struct { + ProviderName string + Configuration *Configuration +} + +// +k8s:deepcopy-gen=true + +// Configurations is for currentConfigurations Map. +type Configurations map[string]*Configuration + +// +k8s:deepcopy-gen=true + +// 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"` +} + +// +k8s:deepcopy-gen=true + +// TLSConfiguration contains all the configuration parameters of a TLS connection. +type TLSConfiguration struct { + Certificates []*tls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"` + Options map[string]tls.Options `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + Stores map[string]tls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"` +} diff --git a/pkg/config/dyn_config_test.go b/pkg/config/dynamic/config_test.go similarity index 98% rename from pkg/config/dyn_config_test.go rename to pkg/config/dynamic/config_test.go index ee0467141..4a04509c4 100644 --- a/pkg/config/dyn_config_test.go +++ b/pkg/config/dynamic/config_test.go @@ -1,4 +1,4 @@ -package config +package dynamic import ( "reflect" diff --git a/pkg/config/fixtures/sample.toml b/pkg/config/dynamic/fixtures/sample.toml similarity index 100% rename from pkg/config/fixtures/sample.toml rename to pkg/config/dynamic/fixtures/sample.toml diff --git a/pkg/config/dyn_config.go b/pkg/config/dynamic/http_config.go similarity index 57% rename from pkg/config/dyn_config.go rename to pkg/config/dynamic/http_config.go index 63e7c4daa..f58bd0753 100644 --- a/pkg/config/dyn_config.go +++ b/pkg/config/dynamic/http_config.go @@ -1,41 +1,6 @@ -package config +package dynamic -import ( - "reflect" - - traefiktls "github.com/containous/traefik/pkg/tls" -) - -// +k8s:deepcopy-gen=true - -// Message holds configuration information exchanged between parts of traefik. -type Message struct { - ProviderName string - Configuration *Configuration -} - -// +k8s:deepcopy-gen=true - -// Configurations is for currentConfigurations Map. -type Configurations map[string]*Configuration - -// +k8s:deepcopy-gen=true - -// 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"` -} - -// +k8s:deepcopy-gen=true - -// 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"` -} +import "reflect" // +k8s:deepcopy-gen=true @@ -48,14 +13,6 @@ type HTTPConfiguration struct { // +k8s:deepcopy-gen=true -// 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"` -} - -// +k8s:deepcopy-gen=true - // 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"` @@ -63,13 +20,6 @@ type Service struct { // +k8s:deepcopy-gen=true -// 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"` -} - -// +k8s:deepcopy-gen=true - // Router holds the router configuration. type Router struct { EntryPoints []string `json:"entryPoints,omitempty" toml:"entryPoints,omitempty" yaml:"entryPoints,omitempty"` @@ -89,24 +39,6 @@ type RouterTLSConfig struct { // +k8s:deepcopy-gen=true -// TCPRouter holds the router configuration. -type TCPRouter struct { - 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"` -} - -// +k8s:deepcopy-gen=true - -// RouterTCPTLSConfig holds the TLS configuration for a router -type RouterTCPTLSConfig struct { - Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` - Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` -} - -// +k8s:deepcopy-gen=true - // LoadBalancerService holds the LoadBalancerService configuration. type LoadBalancerService struct { Stickiness *Stickiness `json:"stickiness,omitempty" toml:"stickiness,omitempty" yaml:"stickiness,omitempty" label:"allowEmpty"` @@ -116,30 +48,6 @@ type LoadBalancerService struct { ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty" toml:"responseForwarding,omitempty" yaml:"responseForwarding,omitempty"` } -// +k8s:deepcopy-gen=true - -// TCPLoadBalancerService holds the LoadBalancerService configuration. -type TCPLoadBalancerService struct { - 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. -func (l *TCPLoadBalancerService) Mergeable(loadBalancer *TCPLoadBalancerService) bool { - savedServers := l.Servers - defer func() { - l.Servers = savedServers - }() - l.Servers = nil - - savedServersLB := loadBalancer.Servers - defer func() { - loadBalancer.Servers = savedServersLB - }() - loadBalancer.Servers = nil - - return reflect.DeepEqual(l, loadBalancer) -} - // Mergeable tells if the given service is mergeable. func (l *LoadBalancerService) Mergeable(loadBalancer *LoadBalancerService) bool { savedServers := l.Servers @@ -187,14 +95,6 @@ type Server struct { Port string `toml:"-" json:"-" yaml:"-"` } -// +k8s:deepcopy-gen=true - -// TCPServer holds a TCP Server configuration -type TCPServer struct { - Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"` - Port string `toml:"-" json:"-" yaml:"-"` -} - // SetDefaults Default values for a Server. func (s *Server) SetDefaults() { s.Scheme = "http" diff --git a/pkg/config/middlewares.go b/pkg/config/dynamic/middlewares.go similarity index 99% rename from pkg/config/middlewares.go rename to pkg/config/dynamic/middlewares.go index 8b8ee3599..2c7482e48 100644 --- a/pkg/config/middlewares.go +++ b/pkg/config/dynamic/middlewares.go @@ -1,4 +1,4 @@ -package config +package dynamic import ( "crypto/tls" diff --git a/pkg/config/runtime.go b/pkg/config/dynamic/runtime.go similarity index 99% rename from pkg/config/runtime.go rename to pkg/config/dynamic/runtime.go index d5a1c512a..94dfe2c94 100644 --- a/pkg/config/runtime.go +++ b/pkg/config/dynamic/runtime.go @@ -1,4 +1,4 @@ -package config +package dynamic import ( "context" diff --git a/pkg/config/runtime_test.go b/pkg/config/dynamic/runtime_test.go similarity index 68% rename from pkg/config/runtime_test.go rename to pkg/config/dynamic/runtime_test.go index 6bb7be89c..4cd1be4e1 100644 --- a/pkg/config/runtime_test.go +++ b/pkg/config/dynamic/runtime_test.go @@ -1,10 +1,10 @@ -package config_test +package dynamic_test import ( "context" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -13,42 +13,42 @@ import ( func TestPopulateUsedby(t *testing.T) { testCases := []struct { desc string - conf *config.RuntimeConfiguration - expected config.RuntimeConfiguration + conf *dynamic.RuntimeConfiguration + expected dynamic.RuntimeConfiguration }{ { desc: "nil config", conf: nil, - expected: config.RuntimeConfiguration{}, + expected: dynamic.RuntimeConfiguration{}, }, { desc: "One service used by two routers", - conf: &config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + conf: &dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "foo@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", }, }, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ {URL: "http://127.0.0.1:8085"}, {URL: "http://127.0.0.1:8086"}, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Interval: "500ms", Path: "/health", }, @@ -57,12 +57,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -71,28 +71,28 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "One service used by two routers, but one router with wrong rule", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ {URL: "http://127.0.0.1"}, }, }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "foo@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "WrongRule(`bar.foo`)", }, }, "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -100,12 +100,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -114,17 +114,17 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Broken Service used by one Router", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ + Service: &dynamic.Service{ LoadBalancer: nil, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -132,11 +132,11 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -145,12 +145,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 different Services each used by a disctinct router.", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:8085", }, @@ -158,7 +158,7 @@ func TestPopulateUsedby(t *testing.T) { URL: "http://127.0.0.1:8086", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Interval: "500ms", Path: "/health", }, @@ -166,9 +166,9 @@ func TestPopulateUsedby(t *testing.T) { }, }, "bar-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:8087", }, @@ -176,7 +176,7 @@ func TestPopulateUsedby(t *testing.T) { URL: "http://127.0.0.1:8088", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Interval: "500ms", Path: "/health", }, @@ -184,16 +184,16 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "foo@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "bar-service@myprovider", Rule: "Host(`foo.bar`)", @@ -201,12 +201,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": {}, "foo@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"foo@myprovider"}, }, @@ -218,12 +218,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 middlewares both used by 2 Routers", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -232,25 +232,25 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -258,7 +258,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, "test@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -267,17 +267,17 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": {}, "test@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, @@ -289,12 +289,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Unknown middleware is not used by the Router", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -303,18 +303,18 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -323,8 +323,8 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + expected: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -333,12 +333,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Broken middleware is used by Router", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -347,18 +347,18 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"badConf"}, }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -367,16 +367,16 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -385,12 +385,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 middlewares from 2 disctinct providers both used by 2 Routers", - conf: &config.RuntimeConfiguration{ - Services: map[string]*config.ServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -399,32 +399,32 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { - Middleware: &config.Middleware{ - BasicAuth: &config.BasicAuth{ + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, }, "addPrefixTest@myprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/titi", }, }, }, "addPrefixTest@anotherprovider": { - Middleware: &config.Middleware{ - AddPrefix: &config.AddPrefix{ + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, }, }, - Routers: map[string]*config.RouterInfo{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -432,7 +432,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, "test@myprovider": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar.other`)", @@ -441,17 +441,17 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - Routers: map[string]*config.RouterInfo{ + expected: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ "bar@myprovider": {}, "test@myprovider": {}, }, - Services: map[string]*config.ServiceInfo{ + Services: map[string]*dynamic.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, }, - Middlewares: map[string]*config.MiddlewareInfo{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, @@ -468,28 +468,28 @@ func TestPopulateUsedby(t *testing.T) { // TCP tests from hereon { desc: "TCP, One service used by two routers", - conf: &config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + conf: &dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "foo@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", }, }, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1", Port: "8085", @@ -504,12 +504,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + expected: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -518,12 +518,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, One service used by two routers, but one router with wrong rule", - conf: &config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1", }, @@ -532,16 +532,16 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - TCPRouters: map[string]*config.TCPRouterInfo{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "foo@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "WrongRule(`bar.foo`)", }, }, "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -549,12 +549,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + expected: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -563,17 +563,17 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, Broken Service used by one Router", - conf: &config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { - TCPService: &config.TCPService{ + TCPService: &dynamic.TCPService{ LoadBalancer: nil, }, }, }, - TCPRouters: map[string]*config.TCPRouterInfo{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", @@ -581,11 +581,11 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + expected: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": {}, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -594,12 +594,12 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, 2 different Services each used by a disctinct router.", - conf: &config.RuntimeConfiguration{ - TCPServices: map[string]*config.TCPServiceInfo{ + conf: &dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1", Port: "8085", @@ -613,9 +613,9 @@ func TestPopulateUsedby(t *testing.T) { }, }, "bar-service@myprovider": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1", Port: "8087", @@ -629,16 +629,16 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - TCPRouters: map[string]*config.TCPRouterInfo{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "foo@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "bar@myprovider": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "bar-service@myprovider", Rule: "Host(`foo.bar`)", @@ -646,12 +646,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: config.RuntimeConfiguration{ - TCPRouters: map[string]*config.TCPRouterInfo{ + expected: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ "bar@myprovider": {}, "foo@myprovider": {}, }, - TCPServices: map[string]*config.TCPServiceInfo{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"foo@myprovider"}, }, @@ -693,27 +693,27 @@ func TestPopulateUsedby(t *testing.T) { func TestGetTCPRoutersByEntrypoints(t *testing.T) { testCases := []struct { desc string - conf config.Configuration + conf dynamic.Configuration entryPoints []string - expected map[string]map[string]*config.TCPRouterInfo + expected map[string]map[string]*dynamic.TCPRouterInfo }{ { desc: "Empty Configuration without entrypoint", - conf: config.Configuration{}, + conf: dynamic.Configuration{}, entryPoints: []string{""}, - expected: map[string]map[string]*config.TCPRouterInfo{}, + expected: map[string]map[string]*dynamic.TCPRouterInfo{}, }, { desc: "Empty Configuration with unknown entrypoints", - conf: config.Configuration{}, + conf: dynamic.Configuration{}, entryPoints: []string{"foo"}, - expected: map[string]map[string]*config.TCPRouterInfo{}, + expected: map[string]map[string]*dynamic.TCPRouterInfo{}, }, { desc: "Valid configuration with an unknown entrypoint", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -721,8 +721,8 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -732,13 +732,13 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"foo"}, - expected: map[string]map[string]*config.TCPRouterInfo{}, + expected: map[string]map[string]*dynamic.TCPRouterInfo{}, }, { desc: "Valid configuration with a known entrypoint", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -756,8 +756,8 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -777,17 +777,17 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web"}, - expected: map[string]map[string]*config.TCPRouterInfo{ + expected: map[string]map[string]*dynamic.TCPRouterInfo{ "web": { "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "HostSNI(`bar.foo`)", }, }, "foobar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", @@ -798,9 +798,9 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, { desc: "Valid configuration with multiple known entrypoints", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -818,8 +818,8 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -839,17 +839,17 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web", "webs"}, - expected: map[string]map[string]*config.TCPRouterInfo{ + expected: map[string]map[string]*dynamic.TCPRouterInfo{ "web": { "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "HostSNI(`bar.foo`)", }, }, "foobar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", @@ -858,7 +858,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, "webs": { "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"webs"}, Service: "bar-service@myprovider", @@ -866,7 +866,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, "foobar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", @@ -881,7 +881,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() - runtimeConfig := config.NewRuntimeConfig(test.conf) + runtimeConfig := dynamic.NewRuntimeConfig(test.conf) actual := runtimeConfig.GetTCPRoutersByEntrypoints(context.Background(), test.entryPoints) assert.Equal(t, test.expected, actual) }) @@ -891,27 +891,27 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { func TestGetRoutersByEntrypoints(t *testing.T) { testCases := []struct { desc string - conf config.Configuration + conf dynamic.Configuration entryPoints []string - expected map[string]map[string]*config.RouterInfo + expected map[string]map[string]*dynamic.RouterInfo }{ { desc: "Empty Configuration without entrypoint", - conf: config.Configuration{}, + conf: dynamic.Configuration{}, entryPoints: []string{""}, - expected: map[string]map[string]*config.RouterInfo{}, + expected: map[string]map[string]*dynamic.RouterInfo{}, }, { desc: "Empty Configuration with unknown entrypoints", - conf: config.Configuration{}, + conf: dynamic.Configuration{}, entryPoints: []string{"foo"}, - expected: map[string]map[string]*config.RouterInfo{}, + expected: map[string]map[string]*dynamic.RouterInfo{}, }, { desc: "Valid configuration with an unknown entrypoint", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -919,8 +919,8 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -930,13 +930,13 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"foo"}, - expected: map[string]map[string]*config.RouterInfo{}, + expected: map[string]map[string]*dynamic.RouterInfo{}, }, { desc: "Valid configuration with a known entrypoint", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -954,8 +954,8 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -975,17 +975,17 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web"}, - expected: map[string]map[string]*config.RouterInfo{ + expected: map[string]map[string]*dynamic.RouterInfo{ "web": { "foo": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "foobar": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", @@ -996,9 +996,9 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, { desc: "Valid configuration with multiple known entrypoints", - conf: config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + conf: dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -1016,8 +1016,8 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service@myprovider", @@ -1037,17 +1037,17 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web", "webs"}, - expected: map[string]map[string]*config.RouterInfo{ + expected: map[string]map[string]*dynamic.RouterInfo{ "web": { "foo": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, }, "foobar": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", @@ -1056,7 +1056,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, "webs": { "bar": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"webs"}, Service: "bar-service@myprovider", @@ -1064,7 +1064,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, "foobar": { - Router: &config.Router{ + Router: &dynamic.Router{ EntryPoints: []string{"web", "webs"}, Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", @@ -1079,7 +1079,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() - runtimeConfig := config.NewRuntimeConfig(test.conf) + runtimeConfig := dynamic.NewRuntimeConfig(test.conf) actual := runtimeConfig.GetRoutersByEntrypoints(context.Background(), test.entryPoints, false) assert.Equal(t, test.expected, actual) }) diff --git a/pkg/config/dynamic/tcp_config.go b/pkg/config/dynamic/tcp_config.go new file mode 100644 index 000000000..be2ca9b1b --- /dev/null +++ b/pkg/config/dynamic/tcp_config.go @@ -0,0 +1,68 @@ +package dynamic + +import "reflect" + +// +k8s:deepcopy-gen=true + +// 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"` +} + +// +k8s:deepcopy-gen=true + +// 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"` +} + +// +k8s:deepcopy-gen=true + +// TCPRouter holds the router configuration. +type TCPRouter struct { + 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"` +} + +// +k8s:deepcopy-gen=true + +// RouterTCPTLSConfig holds the TLS configuration for a router +type RouterTCPTLSConfig struct { + Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` + Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` +} + +// +k8s:deepcopy-gen=true + +// TCPLoadBalancerService holds the LoadBalancerService configuration. +type TCPLoadBalancerService struct { + 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. +func (l *TCPLoadBalancerService) Mergeable(loadBalancer *TCPLoadBalancerService) bool { + savedServers := l.Servers + defer func() { + l.Servers = savedServers + }() + l.Servers = nil + + savedServersLB := loadBalancer.Servers + defer func() { + loadBalancer.Servers = savedServersLB + }() + loadBalancer.Servers = nil + + return reflect.DeepEqual(l, loadBalancer) +} + +// +k8s:deepcopy-gen=true + +// TCPServer holds a TCP Server configuration +type TCPServer struct { + Address string `json:"address,omitempty" toml:"address,omitempty" yaml:"address,omitempty" label:"-"` + Port string `toml:"-" json:"-" yaml:"-"` +} diff --git a/pkg/config/zz_generated.deepcopy.go b/pkg/config/dynamic/zz_generated.deepcopy.go similarity index 99% rename from pkg/config/zz_generated.deepcopy.go rename to pkg/config/dynamic/zz_generated.deepcopy.go index 2b037b221..9671e61db 100644 --- a/pkg/config/zz_generated.deepcopy.go +++ b/pkg/config/dynamic/zz_generated.deepcopy.go @@ -26,7 +26,7 @@ THE SOFTWARE. // Code generated by deepcopy-gen. DO NOT EDIT. -package config +package dynamic import ( tls "github.com/containous/traefik/pkg/tls" diff --git a/pkg/config/label/label.go b/pkg/config/label/label.go index 6b5478dee..09fdfac4e 100644 --- a/pkg/config/label/label.go +++ b/pkg/config/label/label.go @@ -2,15 +2,15 @@ package label import ( - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/parser" ) // DecodeConfiguration converts the labels to a configuration. -func DecodeConfiguration(labels map[string]string) (*config.Configuration, error) { - conf := &config.Configuration{ - HTTP: &config.HTTPConfiguration{}, - TCP: &config.TCPConfiguration{}, +func DecodeConfiguration(labels map[string]string) (*dynamic.Configuration, error) { + conf := &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{}, + TCP: &dynamic.TCPConfiguration{}, } err := parser.Decode(labels, conf, parser.DefaultRootName, "traefik.http", "traefik.tcp") @@ -22,7 +22,7 @@ func DecodeConfiguration(labels map[string]string) (*config.Configuration, error } // EncodeConfiguration converts a configuration to labels. -func EncodeConfiguration(conf *config.Configuration) (map[string]string, error) { +func EncodeConfiguration(conf *dynamic.Configuration) (map[string]string, error) { return parser.Encode(conf, parser.DefaultRootName) } diff --git a/pkg/config/label/label_test.go b/pkg/config/label/label_test.go index 88672cdc5..76550ad08 100644 --- a/pkg/config/label/label_test.go +++ b/pkg/config/label/label_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -175,9 +175,9 @@ func TestDecodeConfiguration(t *testing.T) { configuration, err := DecodeConfiguration(labels) require.NoError(t, err) - expected := &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected := &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "Router0": { EntryPoints: []string{ "foobar", @@ -185,7 +185,7 @@ func TestDecodeConfiguration(t *testing.T) { }, Service: "foobar", Rule: "foobar", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "foo", }, @@ -197,16 +197,16 @@ func TestDecodeConfiguration(t *testing.T) { }, Service: "foobar", Rule: "foobar", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "Service0": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Port: "42", }, @@ -214,8 +214,8 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Service1": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Port: "42", }, @@ -224,8 +224,8 @@ func TestDecodeConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router0": { EntryPoints: []string{ "foobar", @@ -238,7 +238,7 @@ func TestDecodeConfiguration(t *testing.T) { Service: "foobar", Rule: "foobar", Priority: 42, - TLS: &config.RouterTLSConfig{}, + TLS: &dynamic.RouterTLSConfig{}, }, "Router1": { EntryPoints: []string{ @@ -254,14 +254,14 @@ func TestDecodeConfiguration(t *testing.T) { Priority: 42, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware0": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "foobar", }, }, "Middleware1": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{ "foobar", "fiibar", @@ -273,18 +273,18 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware10": { - MaxConn: &config.MaxConn{ + MaxConn: &dynamic.MaxConn{ Amount: 42, ExtractorFunc: "foobar", }, }, "Middleware11": { - PassTLSClientCert: &config.PassTLSClientCert{ + PassTLSClientCert: &dynamic.PassTLSClientCert{ PEM: true, - Info: &config.TLSClientCertificateInfo{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, NotBefore: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -293,7 +293,7 @@ func TestDecodeConfiguration(t *testing.T) { SerialNumber: true, DomainComponent: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -307,8 +307,8 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware12": { - RateLimit: &config.RateLimit{ - RateSet: map[string]*config.Rate{ + RateLimit: &dynamic.RateLimit{ + RateSet: map[string]*dynamic.Rate{ "Rate0": { Period: types.Duration(42 * time.Second), Average: 42, @@ -324,37 +324,37 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware13": { - RedirectRegex: &config.RedirectRegex{ + RedirectRegex: &dynamic.RedirectRegex{ Regex: "foobar", Replacement: "foobar", Permanent: true, }, }, "Middleware13b": { - RedirectScheme: &config.RedirectScheme{ + RedirectScheme: &dynamic.RedirectScheme{ Scheme: "https", Port: "80", Permanent: true, }, }, "Middleware14": { - ReplacePath: &config.ReplacePath{ + ReplacePath: &dynamic.ReplacePath{ Path: "foobar", }, }, "Middleware15": { - ReplacePathRegex: &config.ReplacePathRegex{ + ReplacePathRegex: &dynamic.ReplacePathRegex{ Regex: "foobar", Replacement: "foobar", }, }, "Middleware16": { - Retry: &config.Retry{ + Retry: &dynamic.Retry{ Attempts: 42, }, }, "Middleware17": { - StripPrefix: &config.StripPrefix{ + StripPrefix: &dynamic.StripPrefix{ Prefixes: []string{ "foobar", "fiibar", @@ -362,7 +362,7 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware18": { - StripPrefixRegex: &config.StripPrefixRegex{ + StripPrefixRegex: &dynamic.StripPrefixRegex{ Regex: []string{ "foobar", "fiibar", @@ -370,10 +370,10 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware19": { - Compress: &config.Compress{}, + Compress: &dynamic.Compress{}, }, "Middleware2": { - Buffering: &config.Buffering{ + Buffering: &dynamic.Buffering{ MaxRequestBodyBytes: 42, MemRequestBodyBytes: 42, MaxResponseBodyBytes: 42, @@ -382,7 +382,7 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware3": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{ "foobar", "fiibar", @@ -390,12 +390,12 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware4": { - CircuitBreaker: &config.CircuitBreaker{ + CircuitBreaker: &dynamic.CircuitBreaker{ Expression: "foobar", }, }, "Middleware5": { - DigestAuth: &config.DigestAuth{ + DigestAuth: &dynamic.DigestAuth{ Users: []string{ "foobar", "fiibar", @@ -407,7 +407,7 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware6": { - Errors: &config.ErrorPage{ + Errors: &dynamic.ErrorPage{ Status: []string{ "foobar", "fiibar", @@ -417,9 +417,9 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware7": { - ForwardAuth: &config.ForwardAuth{ + ForwardAuth: &dynamic.ForwardAuth{ Address: "foobar", - TLS: &config.ClientTLS{ + TLS: &dynamic.ClientTLS{ CA: "foobar", CAOptional: true, Cert: "foobar", @@ -434,7 +434,7 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware8": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{ "name0": "foobar", "name1": "foobar", @@ -491,12 +491,12 @@ func TestDecodeConfiguration(t *testing.T) { }, }, "Middleware9": { - IPWhiteList: &config.IPWhiteList{ + IPWhiteList: &dynamic.IPWhiteList{ SourceRange: []string{ "foobar", "fiibar", }, - IPStrategy: &config.IPStrategy{ + IPStrategy: &dynamic.IPStrategy{ Depth: 42, ExcludedIPs: []string{ "foobar", @@ -506,21 +506,21 @@ func TestDecodeConfiguration(t *testing.T) { }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Service0": { - LoadBalancer: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{ + LoadBalancer: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{ CookieName: "foobar", SecureCookie: true, HTTPOnlyCookie: false, }, - Servers: []config.Server{ + Servers: []dynamic.Server{ { Scheme: "foobar", Port: "8080", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Scheme: "foobar", Path: "foobar", Port: 42, @@ -533,20 +533,20 @@ func TestDecodeConfiguration(t *testing.T) { }, }, PassHostHeader: true, - ResponseForwarding: &config.ResponseForwarding{ + ResponseForwarding: &dynamic.ResponseForwarding{ FlushInterval: "foobar", }, }, }, "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { Scheme: "foobar", Port: "8080", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Scheme: "foobar", Path: "foobar", Port: 42, @@ -559,7 +559,7 @@ func TestDecodeConfiguration(t *testing.T) { }, }, PassHostHeader: true, - ResponseForwarding: &config.ResponseForwarding{ + ResponseForwarding: &dynamic.ResponseForwarding{ FlushInterval: "foobar", }, }, @@ -572,9 +572,9 @@ func TestDecodeConfiguration(t *testing.T) { } func TestEncodeConfiguration(t *testing.T) { - configuration := &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + configuration := &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "Router0": { EntryPoints: []string{ "foobar", @@ -582,7 +582,7 @@ func TestEncodeConfiguration(t *testing.T) { }, Service: "foobar", Rule: "foobar", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "foo", }, @@ -594,16 +594,16 @@ func TestEncodeConfiguration(t *testing.T) { }, Service: "foobar", Rule: "foobar", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "Service0": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Port: "42", }, @@ -611,8 +611,8 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Service1": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Port: "42", }, @@ -621,8 +621,8 @@ func TestEncodeConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router0": { EntryPoints: []string{ "foobar", @@ -635,7 +635,7 @@ func TestEncodeConfiguration(t *testing.T) { Service: "foobar", Rule: "foobar", Priority: 42, - TLS: &config.RouterTLSConfig{}, + TLS: &dynamic.RouterTLSConfig{}, }, "Router1": { EntryPoints: []string{ @@ -651,14 +651,14 @@ func TestEncodeConfiguration(t *testing.T) { Priority: 42, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware0": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "foobar", }, }, "Middleware1": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{ "foobar", "fiibar", @@ -670,18 +670,18 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware10": { - MaxConn: &config.MaxConn{ + MaxConn: &dynamic.MaxConn{ Amount: 42, ExtractorFunc: "foobar", }, }, "Middleware11": { - PassTLSClientCert: &config.PassTLSClientCert{ + PassTLSClientCert: &dynamic.PassTLSClientCert{ PEM: true, - Info: &config.TLSClientCertificateInfo{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, NotBefore: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -690,7 +690,7 @@ func TestEncodeConfiguration(t *testing.T) { SerialNumber: true, DomainComponent: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -703,8 +703,8 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware12": { - RateLimit: &config.RateLimit{ - RateSet: map[string]*config.Rate{ + RateLimit: &dynamic.RateLimit{ + RateSet: map[string]*dynamic.Rate{ "Rate0": { Period: types.Duration(42 * time.Nanosecond), Average: 42, @@ -720,37 +720,37 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware13": { - RedirectRegex: &config.RedirectRegex{ + RedirectRegex: &dynamic.RedirectRegex{ Regex: "foobar", Replacement: "foobar", Permanent: true, }, }, "Middleware13b": { - RedirectScheme: &config.RedirectScheme{ + RedirectScheme: &dynamic.RedirectScheme{ Scheme: "https", Port: "80", Permanent: true, }, }, "Middleware14": { - ReplacePath: &config.ReplacePath{ + ReplacePath: &dynamic.ReplacePath{ Path: "foobar", }, }, "Middleware15": { - ReplacePathRegex: &config.ReplacePathRegex{ + ReplacePathRegex: &dynamic.ReplacePathRegex{ Regex: "foobar", Replacement: "foobar", }, }, "Middleware16": { - Retry: &config.Retry{ + Retry: &dynamic.Retry{ Attempts: 42, }, }, "Middleware17": { - StripPrefix: &config.StripPrefix{ + StripPrefix: &dynamic.StripPrefix{ Prefixes: []string{ "foobar", "fiibar", @@ -758,7 +758,7 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware18": { - StripPrefixRegex: &config.StripPrefixRegex{ + StripPrefixRegex: &dynamic.StripPrefixRegex{ Regex: []string{ "foobar", "fiibar", @@ -766,10 +766,10 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware19": { - Compress: &config.Compress{}, + Compress: &dynamic.Compress{}, }, "Middleware2": { - Buffering: &config.Buffering{ + Buffering: &dynamic.Buffering{ MaxRequestBodyBytes: 42, MemRequestBodyBytes: 42, MaxResponseBodyBytes: 42, @@ -778,7 +778,7 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware3": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{ "foobar", "fiibar", @@ -786,12 +786,12 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware4": { - CircuitBreaker: &config.CircuitBreaker{ + CircuitBreaker: &dynamic.CircuitBreaker{ Expression: "foobar", }, }, "Middleware5": { - DigestAuth: &config.DigestAuth{ + DigestAuth: &dynamic.DigestAuth{ Users: []string{ "foobar", "fiibar", @@ -803,7 +803,7 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware6": { - Errors: &config.ErrorPage{ + Errors: &dynamic.ErrorPage{ Status: []string{ "foobar", "fiibar", @@ -813,9 +813,9 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware7": { - ForwardAuth: &config.ForwardAuth{ + ForwardAuth: &dynamic.ForwardAuth{ Address: "foobar", - TLS: &config.ClientTLS{ + TLS: &dynamic.ClientTLS{ CA: "foobar", CAOptional: true, Cert: "foobar", @@ -830,7 +830,7 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware8": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{ "name0": "foobar", "name1": "foobar", @@ -887,12 +887,12 @@ func TestEncodeConfiguration(t *testing.T) { }, }, "Middleware9": { - IPWhiteList: &config.IPWhiteList{ + IPWhiteList: &dynamic.IPWhiteList{ SourceRange: []string{ "foobar", "fiibar", }, - IPStrategy: &config.IPStrategy{ + IPStrategy: &dynamic.IPStrategy{ Depth: 42, ExcludedIPs: []string{ "foobar", @@ -902,20 +902,20 @@ func TestEncodeConfiguration(t *testing.T) { }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Service0": { - LoadBalancer: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{ + LoadBalancer: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{ CookieName: "foobar", HTTPOnlyCookie: true, }, - Servers: []config.Server{ + Servers: []dynamic.Server{ { Scheme: "foobar", Port: "8080", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Scheme: "foobar", Path: "foobar", Port: 42, @@ -928,20 +928,20 @@ func TestEncodeConfiguration(t *testing.T) { }, }, PassHostHeader: true, - ResponseForwarding: &config.ResponseForwarding{ + ResponseForwarding: &dynamic.ResponseForwarding{ FlushInterval: "foobar", }, }, }, "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { Scheme: "foobar", Port: "8080", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Scheme: "foobar", Path: "foobar", Port: 42, @@ -954,7 +954,7 @@ func TestEncodeConfiguration(t *testing.T) { }, }, PassHostHeader: true, - ResponseForwarding: &config.ResponseForwarding{ + ResponseForwarding: &dynamic.ResponseForwarding{ FlushInterval: "foobar", }, }, diff --git a/pkg/healthcheck/healthcheck.go b/pkg/healthcheck/healthcheck.go index 11ccfab6f..f36a2b039 100644 --- a/pkg/healthcheck/healthcheck.go +++ b/pkg/healthcheck/healthcheck.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/safe" "github.com/go-kit/kit/metrics" @@ -229,7 +229,7 @@ func checkHealth(serverURL *url.URL, backend *BackendConfig) error { } // NewLBStatusUpdater returns a new LbStatusUpdater -func NewLBStatusUpdater(bh BalancerHandler, svinfo *config.ServiceInfo) *LbStatusUpdater { +func NewLBStatusUpdater(bh BalancerHandler, svinfo *dynamic.ServiceInfo) *LbStatusUpdater { return &LbStatusUpdater{ BalancerHandler: bh, serviceInfo: svinfo, @@ -240,7 +240,7 @@ func NewLBStatusUpdater(bh BalancerHandler, svinfo *config.ServiceInfo) *LbStatu // so it can keep track of the status of a server in the ServiceInfo. type LbStatusUpdater struct { BalancerHandler - serviceInfo *config.ServiceInfo // can be nil + serviceInfo *dynamic.ServiceInfo // can be nil } // RemoveServer removes the given server from the BalancerHandler, diff --git a/pkg/healthcheck/healthcheck_test.go b/pkg/healthcheck/healthcheck_test.go index e60126b8c..9dc9ef406 100644 --- a/pkg/healthcheck/healthcheck_test.go +++ b/pkg/healthcheck/healthcheck_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -443,7 +443,7 @@ func (th *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func TestLBStatusUpdater(t *testing.T) { lb := &testLoadBalancer{RWMutex: &sync.RWMutex{}} - svInfo := &config.ServiceInfo{} + svInfo := &dynamic.ServiceInfo{} lbsu := NewLBStatusUpdater(lb, svInfo) newServer, err := url.Parse("http://foo.com") assert.Nil(t, err) diff --git a/pkg/metrics/prometheus.go b/pkg/metrics/prometheus.go index fea31b8d1..e70b7d54e 100644 --- a/pkg/metrics/prometheus.go +++ b/pkg/metrics/prometheus.go @@ -8,7 +8,7 @@ import ( "sync" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/safe" "github.com/containous/traefik/pkg/types" @@ -189,7 +189,7 @@ func registerPromState(ctx context.Context) bool { // OnConfigurationUpdate receives the current configuration from Traefik. // It then converts the configuration to the optimized package internal format // and sets it to the promState. -func OnConfigurationUpdate(configurations config.Configurations) { +func OnConfigurationUpdate(configurations dynamic.Configurations) { dynamicConfig := newDynamicConfig() // FIXME metrics diff --git a/pkg/metrics/prometheus_test.go b/pkg/metrics/prometheus_test.go index fc32fc7a8..73f9b427d 100644 --- a/pkg/metrics/prometheus_test.go +++ b/pkg/metrics/prometheus_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" th "github.com/containous/traefik/pkg/testhelpers" "github.com/containous/traefik/pkg/types" "github.com/prometheus/client_golang/prometheus" @@ -276,8 +276,8 @@ func TestPrometheusMetricRemoval(t *testing.T) { prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{}) defer prometheus.Unregister(promState) - configurations := make(config.Configurations) - configurations["providerName"] = &config.Configuration{ + configurations := make(dynamic.Configurations) + configurations["providerName"] = &dynamic.Configuration{ HTTP: th.BuildConfiguration( th.WithRouters( th.WithRouter("foo", diff --git a/pkg/middlewares/addprefix/add_prefix.go b/pkg/middlewares/addprefix/add_prefix.go index a4883cc1b..c2d44c086 100644 --- a/pkg/middlewares/addprefix/add_prefix.go +++ b/pkg/middlewares/addprefix/add_prefix.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -23,7 +23,7 @@ type addPrefix struct { } // New creates a new handler. -func New(ctx context.Context, next http.Handler, config config.AddPrefix, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.AddPrefix, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") var result *addPrefix diff --git a/pkg/middlewares/addprefix/add_prefix_test.go b/pkg/middlewares/addprefix/add_prefix_test.go index 0f10e7cf1..01d1c16d1 100644 --- a/pkg/middlewares/addprefix/add_prefix_test.go +++ b/pkg/middlewares/addprefix/add_prefix_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" @@ -15,16 +15,16 @@ import ( func TestNewAddPrefix(t *testing.T) { testCases := []struct { desc string - prefix config.AddPrefix + prefix dynamic.AddPrefix expectsError bool }{ { desc: "Works with a non empty prefix", - prefix: config.AddPrefix{Prefix: "/a"}, + prefix: dynamic.AddPrefix{Prefix: "/a"}, }, { desc: "Fails if prefix is empty", - prefix: config.AddPrefix{Prefix: ""}, + prefix: dynamic.AddPrefix{Prefix: ""}, expectsError: true, }, } @@ -50,20 +50,20 @@ func TestAddPrefix(t *testing.T) { logrus.SetLevel(logrus.DebugLevel) testCases := []struct { desc string - prefix config.AddPrefix + prefix dynamic.AddPrefix path string expectedPath string expectedRawPath string }{ { desc: "Works with a regular path", - prefix: config.AddPrefix{Prefix: "/a"}, + prefix: dynamic.AddPrefix{Prefix: "/a"}, path: "/b", expectedPath: "/a/b", }, { desc: "Works with a raw path", - prefix: config.AddPrefix{Prefix: "/a"}, + prefix: dynamic.AddPrefix{Prefix: "/a"}, path: "/b%2Fc", expectedPath: "/a/b/c", expectedRawPath: "/a/b%2Fc", diff --git a/pkg/middlewares/auth/basic_auth.go b/pkg/middlewares/auth/basic_auth.go index 79179bd15..62ec3773e 100644 --- a/pkg/middlewares/auth/basic_auth.go +++ b/pkg/middlewares/auth/basic_auth.go @@ -8,7 +8,7 @@ import ( "strings" goauth "github.com/abbot/go-http-auth" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/tracing" @@ -29,7 +29,7 @@ type basicAuth struct { } // NewBasic creates a basicAuth middleware. -func NewBasic(ctx context.Context, next http.Handler, authConfig config.BasicAuth, name string) (http.Handler, error) { +func NewBasic(ctx context.Context, next http.Handler, authConfig dynamic.BasicAuth, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, basicTypeName).Debug("Creating middleware") users, err := getUsers(authConfig.UsersFile, authConfig.Users, basicUserParser) if err != nil { diff --git a/pkg/middlewares/auth/basic_auth_test.go b/pkg/middlewares/auth/basic_auth_test.go index 587197a46..103fd7771 100644 --- a/pkg/middlewares/auth/basic_auth_test.go +++ b/pkg/middlewares/auth/basic_auth_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -20,13 +20,13 @@ func TestBasicAuthFail(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.BasicAuth{ + auth := dynamic.BasicAuth{ Users: []string{"test"}, } _, err := NewBasic(context.Background(), next, auth, "authName") require.Error(t, err) - auth2 := config.BasicAuth{ + auth2 := dynamic.BasicAuth{ Users: []string{"test:test"}, } authMiddleware, err := NewBasic(context.Background(), next, auth2, "authTest") @@ -49,7 +49,7 @@ func TestBasicAuthSuccess(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.BasicAuth{ + auth := dynamic.BasicAuth{ Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"}, } authMiddleware, err := NewBasic(context.Background(), next, auth, "authName") @@ -79,7 +79,7 @@ func TestBasicAuthUserHeader(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.BasicAuth{ + auth := dynamic.BasicAuth{ Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"}, HeaderField: "X-Webauth-User", } @@ -110,7 +110,7 @@ func TestBasicAuthHeaderRemoved(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.BasicAuth{ + auth := dynamic.BasicAuth{ RemoveHeader: true, Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"}, } @@ -142,7 +142,7 @@ func TestBasicAuthHeaderPresent(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.BasicAuth{ + auth := dynamic.BasicAuth{ Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"}, } middleware, err := NewBasic(context.Background(), next, auth, "authName") @@ -226,7 +226,7 @@ func TestBasicAuthUsersFromFile(t *testing.T) { require.NoError(t, err) // Creates the configuration for our Authenticator - authenticatorConfiguration := config.BasicAuth{ + authenticatorConfiguration := dynamic.BasicAuth{ Users: test.givenUsers, UsersFile: usersFile.Name(), Realm: test.realm, diff --git a/pkg/middlewares/auth/digest_auth.go b/pkg/middlewares/auth/digest_auth.go index beca09db6..3611b2cd5 100644 --- a/pkg/middlewares/auth/digest_auth.go +++ b/pkg/middlewares/auth/digest_auth.go @@ -8,7 +8,7 @@ import ( "strings" goauth "github.com/abbot/go-http-auth" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/tracing" @@ -29,7 +29,7 @@ type digestAuth struct { } // NewDigest creates a digest auth middleware. -func NewDigest(ctx context.Context, next http.Handler, authConfig config.DigestAuth, name string) (http.Handler, error) { +func NewDigest(ctx context.Context, next http.Handler, authConfig dynamic.DigestAuth, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, digestTypeName).Debug("Creating middleware") users, err := getUsers(authConfig.UsersFile, authConfig.Users, digestUserParser) if err != nil { diff --git a/pkg/middlewares/auth/digest_auth_test.go b/pkg/middlewares/auth/digest_auth_test.go index 0210232ea..7fc16e1f1 100644 --- a/pkg/middlewares/auth/digest_auth_test.go +++ b/pkg/middlewares/auth/digest_auth_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -20,7 +20,7 @@ func TestDigestAuthError(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.DigestAuth{ + auth := dynamic.DigestAuth{ Users: []string{"test"}, } _, err := NewDigest(context.Background(), next, auth, "authName") @@ -32,7 +32,7 @@ func TestDigestAuthFail(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.DigestAuth{ + auth := dynamic.DigestAuth{ Users: []string{"test:traefik:a2688e031edb4be6a3797f3882655c05"}, } authMiddleware, err := NewDigest(context.Background(), next, auth, "authName") @@ -101,7 +101,7 @@ func TestDigestAuthUsersFromFile(t *testing.T) { require.NoError(t, err) // Creates the configuration for our Authenticator - authenticatorConfiguration := config.DigestAuth{ + authenticatorConfiguration := dynamic.DigestAuth{ Users: test.givenUsers, UsersFile: usersFile.Name(), Realm: test.realm, diff --git a/pkg/middlewares/auth/forward.go b/pkg/middlewares/auth/forward.go index ce2fd5736..7e074b29f 100644 --- a/pkg/middlewares/auth/forward.go +++ b/pkg/middlewares/auth/forward.go @@ -9,7 +9,7 @@ import ( "net/http" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -33,7 +33,7 @@ type forwardAuth struct { } // NewForward creates a forward auth middleware. -func NewForward(ctx context.Context, next http.Handler, config config.ForwardAuth, name string) (http.Handler, error) { +func NewForward(ctx context.Context, next http.Handler, config dynamic.ForwardAuth, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, forwardedTypeName).Debug("Creating middleware") fa := &forwardAuth{ diff --git a/pkg/middlewares/auth/forward_test.go b/pkg/middlewares/auth/forward_test.go index cd3089eef..9b698186d 100644 --- a/pkg/middlewares/auth/forward_test.go +++ b/pkg/middlewares/auth/forward_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestForwardAuthFail(t *testing.T) { })) defer server.Close() - middleware, err := NewForward(context.Background(), next, config.ForwardAuth{ + middleware, err := NewForward(context.Background(), next, dynamic.ForwardAuth{ Address: server.URL, }, "authTest") require.NoError(t, err) @@ -63,7 +63,7 @@ func TestForwardAuthSuccess(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.ForwardAuth{ + auth := dynamic.ForwardAuth{ Address: server.URL, AuthResponseHeaders: []string{"X-Auth-User", "X-Auth-Group"}, } @@ -96,7 +96,7 @@ func TestForwardAuthRedirect(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.ForwardAuth{ + auth := dynamic.ForwardAuth{ Address: authTs.URL, } authMiddleware, err := NewForward(context.Background(), next, auth, "authTest") @@ -147,7 +147,7 @@ func TestForwardAuthRemoveHopByHopHeaders(t *testing.T) { next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "traefik") }) - auth := config.ForwardAuth{ + auth := dynamic.ForwardAuth{ Address: authTs.URL, } authMiddleware, err := NewForward(context.Background(), next, auth, "authTest") @@ -193,7 +193,7 @@ func TestForwardAuthFailResponseHeaders(t *testing.T) { fmt.Fprintln(w, "traefik") }) - auth := config.ForwardAuth{ + auth := dynamic.ForwardAuth{ Address: authTs.URL, } authMiddleware, err := NewForward(context.Background(), next, auth, "authTest") diff --git a/pkg/middlewares/buffering/buffering.go b/pkg/middlewares/buffering/buffering.go index 5c00d839c..d247b2de2 100644 --- a/pkg/middlewares/buffering/buffering.go +++ b/pkg/middlewares/buffering/buffering.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -21,7 +21,7 @@ type buffer struct { } // New creates a buffering middleware. -func New(ctx context.Context, next http.Handler, config config.Buffering, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.Buffering, name string) (http.Handler, error) { logger := middlewares.GetLogger(ctx, name, typeName) logger.Debug("Creating middleware") logger.Debug("Setting up buffering: request limits: %d (mem), %d (max), response limits: %d (mem), %d (max) with retry: '%s'", diff --git a/pkg/middlewares/chain/chain.go b/pkg/middlewares/chain/chain.go index 1b25cd833..914766a9d 100644 --- a/pkg/middlewares/chain/chain.go +++ b/pkg/middlewares/chain/chain.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" ) @@ -18,7 +18,7 @@ type chainBuilder interface { } // New creates a chain middleware -func New(ctx context.Context, next http.Handler, config config.Chain, builder chainBuilder, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.Chain, builder chainBuilder, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") middlewareChain := builder.BuildChain(ctx, config.Middlewares) diff --git a/pkg/middlewares/circuitbreaker/circuit_breaker.go b/pkg/middlewares/circuitbreaker/circuit_breaker.go index 6dbafff94..cb57b8894 100644 --- a/pkg/middlewares/circuitbreaker/circuit_breaker.go +++ b/pkg/middlewares/circuitbreaker/circuit_breaker.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" @@ -22,7 +22,7 @@ type circuitBreaker struct { } // New creates a new circuit breaker middleware. -func New(ctx context.Context, next http.Handler, confCircuitBreaker config.CircuitBreaker, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, confCircuitBreaker dynamic.CircuitBreaker, name string) (http.Handler, error) { expression := confCircuitBreaker.Expression logger := middlewares.GetLogger(ctx, name, typeName) diff --git a/pkg/middlewares/customerrors/custom_errors.go b/pkg/middlewares/customerrors/custom_errors.go index c86ee3416..77a552c2f 100644 --- a/pkg/middlewares/customerrors/custom_errors.go +++ b/pkg/middlewares/customerrors/custom_errors.go @@ -11,7 +11,7 @@ import ( "strconv" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/containous/traefik/pkg/types" @@ -42,7 +42,7 @@ type customErrors struct { } // New creates a new custom error pages middleware. -func New(ctx context.Context, next http.Handler, config config.ErrorPage, serviceBuilder serviceBuilder, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.ErrorPage, serviceBuilder serviceBuilder, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") httpCodeRanges, err := types.NewHTTPCodeRanges(config.Status) diff --git a/pkg/middlewares/customerrors/custom_errors_test.go b/pkg/middlewares/customerrors/custom_errors_test.go index 27c33d98b..cf7d577b9 100644 --- a/pkg/middlewares/customerrors/custom_errors_test.go +++ b/pkg/middlewares/customerrors/custom_errors_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -17,14 +17,14 @@ import ( func TestHandler(t *testing.T) { testCases := []struct { desc string - errorPage *config.ErrorPage + errorPage *dynamic.ErrorPage backendCode int backendErrorHandler http.HandlerFunc validate func(t *testing.T, recorder *httptest.ResponseRecorder) }{ { desc: "no error", - errorPage: &config.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, + errorPage: &dynamic.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, backendCode: http.StatusOK, backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "My error page.") @@ -36,7 +36,7 @@ func TestHandler(t *testing.T) { }, { desc: "in the range", - errorPage: &config.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, + errorPage: &dynamic.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, backendCode: http.StatusInternalServerError, backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "My error page.") @@ -49,7 +49,7 @@ func TestHandler(t *testing.T) { }, { desc: "not in the range", - errorPage: &config.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, + errorPage: &dynamic.ErrorPage{Service: "error", Query: "/test", Status: []string{"500-501", "503-599"}}, backendCode: http.StatusBadGateway, backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "My error page.") @@ -62,7 +62,7 @@ func TestHandler(t *testing.T) { }, { desc: "query replacement", - errorPage: &config.ErrorPage{Service: "error", Query: "/{status}", Status: []string{"503-503"}}, + errorPage: &dynamic.ErrorPage{Service: "error", Query: "/{status}", Status: []string{"503-503"}}, backendCode: http.StatusServiceUnavailable, backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.RequestURI == "/503" { @@ -79,7 +79,7 @@ func TestHandler(t *testing.T) { }, { desc: "Single code", - errorPage: &config.ErrorPage{Service: "error", Query: "/{status}", Status: []string{"503"}}, + errorPage: &dynamic.ErrorPage{Service: "error", Query: "/{status}", Status: []string{"503"}}, backendCode: http.StatusServiceUnavailable, backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.RequestURI == "/503" { diff --git a/pkg/middlewares/headers/headers.go b/pkg/middlewares/headers/headers.go index 547fb7ef8..526bc8b8e 100644 --- a/pkg/middlewares/headers/headers.go +++ b/pkg/middlewares/headers/headers.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -26,7 +26,7 @@ type headers struct { } // New creates a Headers middleware. -func New(ctx context.Context, next http.Handler, config config.Headers, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.Headers, name string) (http.Handler, error) { // HeaderMiddleware -> SecureMiddleWare -> next logger := middlewares.GetLogger(ctx, name, typeName) logger.Debug("Creating middleware") @@ -73,7 +73,7 @@ type secureHeader struct { } // newSecure constructs a new secure instance with supplied options. -func newSecure(next http.Handler, headers config.Headers) *secureHeader { +func newSecure(next http.Handler, headers dynamic.Headers) *secureHeader { opt := secure.Options{ BrowserXssFilter: headers.BrowserXSSFilter, ContentTypeNosniff: headers.ContentTypeNosniff, @@ -111,11 +111,11 @@ func (s secureHeader) ServeHTTP(rw http.ResponseWriter, req *http.Request) { // provided to configure which features should be enabled, and the ability to override a few of the default values. type Header struct { next http.Handler - headers *config.Headers + headers *dynamic.Headers } // NewHeader constructs a new header instance from supplied frontend header struct. -func NewHeader(next http.Handler, headers config.Headers) *Header { +func NewHeader(next http.Handler, headers dynamic.Headers) *Header { return &Header{ next: next, headers: &headers, diff --git a/pkg/middlewares/headers/headers_test.go b/pkg/middlewares/headers/headers_test.go index 5c50452ce..6f637a6c0 100644 --- a/pkg/middlewares/headers/headers_test.go +++ b/pkg/middlewares/headers/headers_test.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/containous/traefik/pkg/tracing" "github.com/stretchr/testify/assert" @@ -18,7 +18,7 @@ import ( func TestCustomRequestHeader(t *testing.T) { emptyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - header := NewHeader(emptyHandler, config.Headers{ + header := NewHeader(emptyHandler, dynamic.Headers{ CustomRequestHeaders: map[string]string{ "X-Custom-Request-Header": "test_request", }, @@ -36,7 +36,7 @@ func TestCustomRequestHeader(t *testing.T) { func TestCustomRequestHeaderEmptyValue(t *testing.T) { emptyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - header := NewHeader(emptyHandler, config.Headers{ + header := NewHeader(emptyHandler, dynamic.Headers{ CustomRequestHeaders: map[string]string{ "X-Custom-Request-Header": "test_request", }, @@ -50,7 +50,7 @@ func TestCustomRequestHeaderEmptyValue(t *testing.T) { assert.Equal(t, http.StatusOK, res.Code) assert.Equal(t, "test_request", req.Header.Get("X-Custom-Request-Header")) - header = NewHeader(emptyHandler, config.Headers{ + header = NewHeader(emptyHandler, dynamic.Headers{ CustomRequestHeaders: map[string]string{ "X-Custom-Request-Header": "", }, @@ -86,7 +86,7 @@ func TestSecureHeader(t *testing.T) { } emptyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - header, err := New(context.Background(), emptyHandler, config.Headers{ + header, err := New(context.Background(), emptyHandler, dynamic.Headers{ AllowedHosts: []string{"foo.com", "bar.com"}, }, "foo") require.NoError(t, err) @@ -119,7 +119,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "http should return a 301", host: "http://powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: true, SSLHost: "powpow.example.com", @@ -129,7 +129,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "http sub domain should return a 301", host: "http://www.powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: true, SSLHost: "powpow.example.com", @@ -139,7 +139,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "https should return a 200", host: "https://powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: true, SSLHost: "powpow.example.com", @@ -149,7 +149,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "https sub domain should return a 301", host: "https://www.powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: true, SSLHost: "powpow.example.com", @@ -159,7 +159,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "http without force host and sub domain should return a 301", host: "http://www.powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: false, SSLHost: "powpow.example.com", @@ -169,7 +169,7 @@ func TestSSLForceHost(t *testing.T) { { desc: "https without force host and sub domain should return a 301", host: "https://www.powpow.example.com", - secureMiddleware: newSecure(next, config.Headers{ + secureMiddleware: newSecure(next, dynamic.Headers{ SSLRedirect: true, SSLForceHost: false, SSLHost: "powpow.example.com", @@ -201,7 +201,7 @@ func TestCORSPreflights(t *testing.T) { }{ { desc: "Test Simple Preflight", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowMethods: []string{"GET", "OPTIONS", "PUT"}, AccessControlAllowOrigin: "origin-list-or-null", AccessControlMaxAge: 600, @@ -219,7 +219,7 @@ func TestCORSPreflights(t *testing.T) { }, { desc: "Wildcard origin Preflight", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowMethods: []string{"GET", "OPTIONS", "PUT"}, AccessControlAllowOrigin: "*", AccessControlMaxAge: 600, @@ -237,7 +237,7 @@ func TestCORSPreflights(t *testing.T) { }, { desc: "Allow Credentials Preflight", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowMethods: []string{"GET", "OPTIONS", "PUT"}, AccessControlAllowOrigin: "*", AccessControlAllowCredentials: true, @@ -257,7 +257,7 @@ func TestCORSPreflights(t *testing.T) { }, { desc: "Allow Headers Preflight", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowMethods: []string{"GET", "OPTIONS", "PUT"}, AccessControlAllowOrigin: "*", AccessControlAllowHeaders: []string{"origin", "X-Forwarded-For"}, @@ -293,14 +293,14 @@ func TestCORSPreflights(t *testing.T) { func TestEmptyHeaderObject(t *testing.T) { next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - _, err := New(context.Background(), next, config.Headers{}, "testing") + _, err := New(context.Background(), next, dynamic.Headers{}, "testing") require.Errorf(t, err, "headers configuration not valid") } func TestCustomHeaderHandler(t *testing.T) { next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) - header, _ := New(context.Background(), next, config.Headers{ + header, _ := New(context.Background(), next, dynamic.Headers{ CustomRequestHeaders: map[string]string{ "X-Custom-Request-Header": "test_request", }, @@ -342,7 +342,7 @@ func TestCORSResponses(t *testing.T) { }{ { desc: "Test Simple Request", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "origin-list-or-null", }), requestHeaders: map[string][]string{ @@ -354,7 +354,7 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Wildcard origin Request", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "*", }), requestHeaders: map[string][]string{ @@ -366,7 +366,7 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Empty origin Request", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "origin-list-or-null", }), requestHeaders: map[string][]string{}, @@ -376,13 +376,13 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Not Defined origin Request", - header: NewHeader(emptyHandler, config.Headers{}), + header: NewHeader(emptyHandler, dynamic.Headers{}), requestHeaders: map[string][]string{}, expected: map[string][]string{}, }, { desc: "Allow Credentials Request", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "*", AccessControlAllowCredentials: true, }), @@ -396,7 +396,7 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Expose Headers Request", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "*", AccessControlExposeHeaders: []string{"origin", "X-Forwarded-For"}, }), @@ -410,7 +410,7 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Test Simple Request with Vary Headers", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "origin-list-or-null", AddVaryHeader: true, }), @@ -424,7 +424,7 @@ func TestCORSResponses(t *testing.T) { }, { desc: "Test Simple Request with Vary Headers and non-empty response", - header: NewHeader(nonEmptyHandler, config.Headers{ + header: NewHeader(nonEmptyHandler, dynamic.Headers{ AccessControlAllowOrigin: "origin-list-or-null", AddVaryHeader: true, }), @@ -462,7 +462,7 @@ func TestCustomResponseHeaders(t *testing.T) { }{ { desc: "Test Simple Response", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ CustomResponseHeaders: map[string]string{ "Testing": "foo", "Testing2": "bar", @@ -475,7 +475,7 @@ func TestCustomResponseHeaders(t *testing.T) { }, { desc: "Deleting Custom Header", - header: NewHeader(emptyHandler, config.Headers{ + header: NewHeader(emptyHandler, dynamic.Headers{ CustomResponseHeaders: map[string]string{ "Testing": "foo", "Testing2": "", diff --git a/pkg/middlewares/ipwhitelist/ip_whitelist.go b/pkg/middlewares/ipwhitelist/ip_whitelist.go index c144e9ca7..659800c51 100644 --- a/pkg/middlewares/ipwhitelist/ip_whitelist.go +++ b/pkg/middlewares/ipwhitelist/ip_whitelist.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/ip" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" @@ -27,7 +27,7 @@ type ipWhiteLister struct { } // New builds a new IPWhiteLister given a list of CIDR-Strings to whitelist -func New(ctx context.Context, next http.Handler, config config.IPWhiteList, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.IPWhiteList, name string) (http.Handler, error) { logger := middlewares.GetLogger(ctx, name, typeName) logger.Debug("Creating middleware") diff --git a/pkg/middlewares/ipwhitelist/ip_whitelist_test.go b/pkg/middlewares/ipwhitelist/ip_whitelist_test.go index 6b3cea987..5200dea54 100644 --- a/pkg/middlewares/ipwhitelist/ip_whitelist_test.go +++ b/pkg/middlewares/ipwhitelist/ip_whitelist_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -14,19 +14,19 @@ import ( func TestNewIPWhiteLister(t *testing.T) { testCases := []struct { desc string - whiteList config.IPWhiteList + whiteList dynamic.IPWhiteList expectedError bool }{ { desc: "invalid IP", - whiteList: config.IPWhiteList{ + whiteList: dynamic.IPWhiteList{ SourceRange: []string{"foo"}, }, expectedError: true, }, { desc: "valid IP", - whiteList: config.IPWhiteList{ + whiteList: dynamic.IPWhiteList{ SourceRange: []string{"10.10.10.10"}, }, }, @@ -53,13 +53,13 @@ func TestNewIPWhiteLister(t *testing.T) { func TestIPWhiteLister_ServeHTTP(t *testing.T) { testCases := []struct { desc string - whiteList config.IPWhiteList + whiteList dynamic.IPWhiteList remoteAddr string expected int }{ { desc: "authorized with remote address", - whiteList: config.IPWhiteList{ + whiteList: dynamic.IPWhiteList{ SourceRange: []string{"20.20.20.20"}, }, remoteAddr: "20.20.20.20:1234", @@ -67,7 +67,7 @@ func TestIPWhiteLister_ServeHTTP(t *testing.T) { }, { desc: "non authorized with remote address", - whiteList: config.IPWhiteList{ + whiteList: dynamic.IPWhiteList{ SourceRange: []string{"20.20.20.20"}, }, remoteAddr: "20.20.20.21:1234", diff --git a/pkg/middlewares/maxconnection/max_connection.go b/pkg/middlewares/maxconnection/max_connection.go index 352b6e696..e81c3089b 100644 --- a/pkg/middlewares/maxconnection/max_connection.go +++ b/pkg/middlewares/maxconnection/max_connection.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -23,7 +23,7 @@ type maxConnection struct { } // New creates a max connection middleware. -func New(ctx context.Context, next http.Handler, maxConns config.MaxConn, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, maxConns dynamic.MaxConn, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") extractFunc, err := utils.NewExtractor(maxConns.ExtractorFunc) diff --git a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go index e730440ab..9512854ef 100644 --- a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go +++ b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go @@ -11,7 +11,7 @@ import ( "net/url" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" @@ -40,7 +40,7 @@ type DistinguishedNameOptions struct { StateOrProvinceName bool } -func newDistinguishedNameOptions(info *config.TLSCLientCertificateDNInfo) *DistinguishedNameOptions { +func newDistinguishedNameOptions(info *dynamic.TLSCLientCertificateDNInfo) *DistinguishedNameOptions { if info == nil { return nil } @@ -65,7 +65,7 @@ type passTLSClientCert struct { } // New constructs a new PassTLSClientCert instance from supplied frontend header struct. -func New(ctx context.Context, next http.Handler, config config.PassTLSClientCert, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.PassTLSClientCert, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") return &passTLSClientCert{ @@ -85,7 +85,7 @@ type tlsClientCertificateInfo struct { issuer *DistinguishedNameOptions } -func newTLSClientInfo(info *config.TLSClientCertificateInfo) *tlsClientCertificateInfo { +func newTLSClientInfo(info *dynamic.TLSClientCertificateInfo) *tlsClientCertificateInfo { if info == nil { return nil } diff --git a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go index 694362f99..a2c6cd967 100644 --- a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go +++ b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go @@ -13,7 +13,7 @@ import ( "strings" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/require" ) @@ -367,7 +367,7 @@ func TestTLSClientHeadersWithPEM(t *testing.T) { testCases := []struct { desc string certContents []string // set the request TLS attribute if defined - config config.PassTLSClientCert + config dynamic.PassTLSClientCert expectedHeader string }{ { @@ -379,24 +379,24 @@ func TestTLSClientHeadersWithPEM(t *testing.T) { }, { desc: "No TLS, with pem option true", - config: config.PassTLSClientCert{PEM: true}, + config: dynamic.PassTLSClientCert{PEM: true}, }, { desc: "TLS with simple certificate, with pem option true", certContents: []string{minimalCheeseCrt}, - config: config.PassTLSClientCert{PEM: true}, + config: dynamic.PassTLSClientCert{PEM: true}, expectedHeader: getCleanCertContents([]string{minimalCert}), }, { desc: "TLS with complete certificate, with pem option true", certContents: []string{minimalCheeseCrt}, - config: config.PassTLSClientCert{PEM: true}, + config: dynamic.PassTLSClientCert{PEM: true}, expectedHeader: getCleanCertContents([]string{minimalCheeseCrt}), }, { desc: "TLS with two certificate, with pem option true", certContents: []string{minimalCert, minimalCheeseCrt}, - config: config.PassTLSClientCert{PEM: true}, + config: dynamic.PassTLSClientCert{PEM: true}, expectedHeader: getCleanCertContents([]string{minimalCert, minimalCheeseCrt}), }, } @@ -488,7 +488,7 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { testCases := []struct { desc string certContents []string // set the request TLS attribute if defined - config config.PassTLSClientCert + config dynamic.PassTLSClientCert expectedHeader string }{ { @@ -500,9 +500,9 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { }, { desc: "No TLS, with subject info", - config: config.PassTLSClientCert{ - Info: &config.TLSClientCertificateInfo{ - Subject: &config.TLSCLientCertificateDNInfo{ + config: dynamic.PassTLSClientCert{ + Info: &dynamic.TLSClientCertificateInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ CommonName: true, Organization: true, Locality: true, @@ -515,22 +515,22 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { }, { desc: "No TLS, with pem option false with empty subject info", - config: config.PassTLSClientCert{ + config: dynamic.PassTLSClientCert{ PEM: false, - Info: &config.TLSClientCertificateInfo{ - Subject: &config.TLSCLientCertificateDNInfo{}, + Info: &dynamic.TLSClientCertificateInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{}, }, }, }, { desc: "TLS with simple certificate, with all info", certContents: []string{minimalCheeseCrt}, - config: config.PassTLSClientCert{ - Info: &config.TLSClientCertificateInfo{ + config: dynamic.PassTLSClientCert{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, NotBefore: true, Sans: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ CommonName: true, Country: true, DomainComponent: true, @@ -539,7 +539,7 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { Province: true, SerialNumber: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ CommonName: true, Country: true, DomainComponent: true, @@ -555,14 +555,14 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { { desc: "TLS with simple certificate, with some info", certContents: []string{minimalCheeseCrt}, - config: config.PassTLSClientCert{ - Info: &config.TLSClientCertificateInfo{ + config: dynamic.PassTLSClientCert{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, Sans: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ Organization: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ Country: true, }, }, @@ -572,12 +572,12 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { { desc: "TLS with complete certificate, with all info", certContents: []string{completeCheeseCrt}, - config: config.PassTLSClientCert{ - Info: &config.TLSClientCertificateInfo{ + config: dynamic.PassTLSClientCert{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, NotBefore: true, Sans: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -586,7 +586,7 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { SerialNumber: true, DomainComponent: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -602,12 +602,12 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { { desc: "TLS with 2 certificates, with all info", certContents: []string{minimalCheeseCrt, completeCheeseCrt}, - config: config.PassTLSClientCert{ - Info: &config.TLSClientCertificateInfo{ + config: dynamic.PassTLSClientCert{ + Info: &dynamic.TLSClientCertificateInfo{ NotAfter: true, NotBefore: true, Sans: true, - Subject: &config.TLSCLientCertificateDNInfo{ + Subject: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, @@ -616,7 +616,7 @@ func TestTLSClientHeadersWithCertInfo(t *testing.T) { SerialNumber: true, DomainComponent: true, }, - Issuer: &config.TLSCLientCertificateDNInfo{ + Issuer: &dynamic.TLSCLientCertificateDNInfo{ Country: true, Province: true, Locality: true, diff --git a/pkg/middlewares/ratelimiter/rate_limiter.go b/pkg/middlewares/ratelimiter/rate_limiter.go index 76c4f3d51..4f9e53865 100644 --- a/pkg/middlewares/ratelimiter/rate_limiter.go +++ b/pkg/middlewares/ratelimiter/rate_limiter.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -23,7 +23,7 @@ type rateLimiter struct { } // New creates rate limiter middleware. -func New(ctx context.Context, next http.Handler, config config.RateLimit, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.RateLimit, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") extractFunc, err := utils.NewExtractor(config.ExtractorFunc) diff --git a/pkg/middlewares/redirect/redirect_regex.go b/pkg/middlewares/redirect/redirect_regex.go index 1b5d3033a..1028e2403 100644 --- a/pkg/middlewares/redirect/redirect_regex.go +++ b/pkg/middlewares/redirect/redirect_regex.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" ) @@ -13,7 +13,7 @@ const ( ) // NewRedirectRegex creates a redirect middleware. -func NewRedirectRegex(ctx context.Context, next http.Handler, conf config.RedirectRegex, name string) (http.Handler, error) { +func NewRedirectRegex(ctx context.Context, next http.Handler, conf dynamic.RedirectRegex, name string) (http.Handler, error) { logger := middlewares.GetLogger(ctx, name, typeRegexName) logger.Debug("Creating middleware") logger.Debugf("Setting up redirection from %s to %s", conf.Regex, conf.Replacement) diff --git a/pkg/middlewares/redirect/redirect_regex_test.go b/pkg/middlewares/redirect/redirect_regex_test.go index 3e48e6ff2..774f31b6d 100644 --- a/pkg/middlewares/redirect/redirect_regex_test.go +++ b/pkg/middlewares/redirect/redirect_regex_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -16,7 +16,7 @@ import ( func TestRedirectRegexHandler(t *testing.T) { testCases := []struct { desc string - config config.RedirectRegex + config dynamic.RedirectRegex method string url string secured bool @@ -26,7 +26,7 @@ func TestRedirectRegexHandler(t *testing.T) { }{ { desc: "simple redirection", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^(?:http?:\/\/)(foo)(\.com)(:\d+)(.*)$`, Replacement: "https://${1}bar$2:443$4", }, @@ -36,7 +36,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "use request header", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^(?:http?:\/\/)(foo)(\.com)(:\d+)(.*)$`, Replacement: `https://${1}{{ .Request.Header.Get "X-Foo" }}$2:443$4`, }, @@ -46,7 +46,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "URL doesn't match regex", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^(?:http?:\/\/)(foo)(\.com)(:\d+)(.*)$`, Replacement: "https://${1}bar$2:443$4", }, @@ -55,7 +55,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "invalid rewritten URL", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^(.*)$`, Replacement: "http://192.168.0.%31/", }, @@ -64,7 +64,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "invalid regex", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^(.*`, Replacement: "$1", }, @@ -73,7 +73,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTP to HTTPS permanent", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^http://`, Replacement: "https://$1", Permanent: true, @@ -84,7 +84,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTPS to HTTP permanent", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `https://foo`, Replacement: "http://foo", Permanent: true, @@ -96,7 +96,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTP to HTTPS", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `http://foo:80`, Replacement: "https://foo:443", }, @@ -106,7 +106,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTPS to HTTP", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `https://foo:443`, Replacement: "http://foo:80", }, @@ -117,7 +117,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTP to HTTP", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `http://foo:80`, Replacement: "http://foo:88", }, @@ -127,7 +127,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTP to HTTP POST", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^http://`, Replacement: "https://$1", }, @@ -138,7 +138,7 @@ func TestRedirectRegexHandler(t *testing.T) { }, { desc: "HTTP to HTTP POST permanent", - config: config.RedirectRegex{ + config: dynamic.RedirectRegex{ Regex: `^http://`, Replacement: "https://$1", Permanent: true, diff --git a/pkg/middlewares/redirect/redirect_scheme.go b/pkg/middlewares/redirect/redirect_scheme.go index 55e2553a6..f95679eab 100644 --- a/pkg/middlewares/redirect/redirect_scheme.go +++ b/pkg/middlewares/redirect/redirect_scheme.go @@ -5,7 +5,7 @@ import ( "errors" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" ) @@ -15,7 +15,7 @@ const ( ) // NewRedirectScheme creates a new RedirectScheme middleware. -func NewRedirectScheme(ctx context.Context, next http.Handler, conf config.RedirectScheme, name string) (http.Handler, error) { +func NewRedirectScheme(ctx context.Context, next http.Handler, conf dynamic.RedirectScheme, name string) (http.Handler, error) { logger := middlewares.GetLogger(ctx, name, typeSchemeName) logger.Debug("Creating middleware") logger.Debugf("Setting up redirection to %s %s", conf.Scheme, conf.Port) diff --git a/pkg/middlewares/redirect/redirect_scheme_test.go b/pkg/middlewares/redirect/redirect_scheme_test.go index 99205ef40..3e5072aa3 100644 --- a/pkg/middlewares/redirect/redirect_scheme_test.go +++ b/pkg/middlewares/redirect/redirect_scheme_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -16,7 +16,7 @@ import ( func TestRedirectSchemeHandler(t *testing.T) { testCases := []struct { desc string - config config.RedirectScheme + config dynamic.RedirectScheme method string url string secured bool @@ -26,13 +26,13 @@ func TestRedirectSchemeHandler(t *testing.T) { }{ { desc: "Without scheme", - config: config.RedirectScheme{}, + config: dynamic.RedirectScheme{}, url: "http://foo", errorExpected: true, }, { desc: "HTTP to HTTPS", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "http://foo", @@ -41,7 +41,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP with port to HTTPS without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "http://foo:8080", @@ -50,7 +50,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP without port to HTTPS with port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", Port: "8443", }, @@ -60,7 +60,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP with port to HTTPS with port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", Port: "8443", }, @@ -70,7 +70,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTPS with port to HTTPS with port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", Port: "8443", }, @@ -80,7 +80,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTPS with port to HTTPS without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "https://foo:8000", @@ -89,7 +89,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "redirection to HTTPS without port from an URL already in https", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "https://foo:8000/theother", @@ -98,7 +98,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP to HTTPS permanent", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", Port: "8443", Permanent: true, @@ -109,7 +109,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "to HTTP 80", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "http", Port: "80", }, @@ -119,7 +119,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP to wss", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "wss", Port: "9443", }, @@ -129,7 +129,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP to wss without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "wss", }, url: "http://foo", @@ -138,7 +138,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP with port to wss without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "wss", }, url: "http://foo:5678", @@ -147,7 +147,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP to HTTPS without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "http://foo:443", @@ -156,7 +156,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTP port redirection", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "http", Port: "8181", }, @@ -166,7 +166,7 @@ func TestRedirectSchemeHandler(t *testing.T) { }, { desc: "HTTPS with port 80 to HTTPS without port", - config: config.RedirectScheme{ + config: dynamic.RedirectScheme{ Scheme: "https", }, url: "https://foo:80", diff --git a/pkg/middlewares/replacepath/replace_path.go b/pkg/middlewares/replacepath/replace_path.go index 4e46a7a76..9706c425c 100644 --- a/pkg/middlewares/replacepath/replace_path.go +++ b/pkg/middlewares/replacepath/replace_path.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -24,7 +24,7 @@ type replacePath struct { } // New creates a new replace path middleware. -func New(ctx context.Context, next http.Handler, config config.ReplacePath, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.ReplacePath, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") return &replacePath{ diff --git a/pkg/middlewares/replacepath/replace_path_test.go b/pkg/middlewares/replacepath/replace_path_test.go index 102d0aa81..16d07442b 100644 --- a/pkg/middlewares/replacepath/replace_path_test.go +++ b/pkg/middlewares/replacepath/replace_path_test.go @@ -5,14 +5,14 @@ import ( "net/http" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestReplacePath(t *testing.T) { - var replacementConfig = config.ReplacePath{ + var replacementConfig = dynamic.ReplacePath{ Path: "/replacement-path", } diff --git a/pkg/middlewares/replacepathregex/replace_path_regex.go b/pkg/middlewares/replacepathregex/replace_path_regex.go index a3ca0b519..0421cc06f 100644 --- a/pkg/middlewares/replacepathregex/replace_path_regex.go +++ b/pkg/middlewares/replacepathregex/replace_path_regex.go @@ -7,7 +7,7 @@ import ( "regexp" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/middlewares/replacepath" "github.com/containous/traefik/pkg/tracing" @@ -27,7 +27,7 @@ type replacePathRegex struct { } // New creates a new replace path regex middleware. -func New(ctx context.Context, next http.Handler, config config.ReplacePathRegex, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.ReplacePathRegex, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") exp, err := regexp.Compile(strings.TrimSpace(config.Regex)) diff --git a/pkg/middlewares/replacepathregex/replace_path_regex_test.go b/pkg/middlewares/replacepathregex/replace_path_regex_test.go index 67ab607e8..fe73c6199 100644 --- a/pkg/middlewares/replacepathregex/replace_path_regex_test.go +++ b/pkg/middlewares/replacepathregex/replace_path_regex_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/replacepath" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -16,7 +16,7 @@ func TestReplacePathRegex(t *testing.T) { testCases := []struct { desc string path string - config config.ReplacePathRegex + config dynamic.ReplacePathRegex expectedPath string expectedHeader string expectsError bool @@ -24,7 +24,7 @@ func TestReplacePathRegex(t *testing.T) { { desc: "simple regex", path: "/whoami/and/whoami", - config: config.ReplacePathRegex{ + config: dynamic.ReplacePathRegex{ Replacement: "/who-am-i/$1", Regex: `^/whoami/(.*)`, }, @@ -34,7 +34,7 @@ func TestReplacePathRegex(t *testing.T) { { desc: "simple replace (no regex)", path: "/whoami/and/whoami", - config: config.ReplacePathRegex{ + config: dynamic.ReplacePathRegex{ Replacement: "/who-am-i", Regex: `/whoami`, }, @@ -44,7 +44,7 @@ func TestReplacePathRegex(t *testing.T) { { desc: "no match", path: "/whoami/and/whoami", - config: config.ReplacePathRegex{ + config: dynamic.ReplacePathRegex{ Replacement: "/whoami", Regex: `/no-match`, }, @@ -53,7 +53,7 @@ func TestReplacePathRegex(t *testing.T) { { desc: "multiple replacement", path: "/downloads/src/source.go", - config: config.ReplacePathRegex{ + config: dynamic.ReplacePathRegex{ Replacement: "/downloads/$1-$2", Regex: `^(?i)/downloads/([^/]+)/([^/]+)$`, }, @@ -63,7 +63,7 @@ func TestReplacePathRegex(t *testing.T) { { desc: "invalid regular expression", path: "/invalid/regexp/test", - config: config.ReplacePathRegex{ + config: dynamic.ReplacePathRegex{ Replacement: "/valid/regexp/$1", Regex: `^(?err)/invalid/regexp/([^/]+)$`, }, diff --git a/pkg/middlewares/retry/retry.go b/pkg/middlewares/retry/retry.go index da4c28e5a..3658e69f0 100644 --- a/pkg/middlewares/retry/retry.go +++ b/pkg/middlewares/retry/retry.go @@ -9,7 +9,7 @@ import ( "net/http" "net/http/httptrace" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -42,7 +42,7 @@ type retry struct { } // New returns a new retry middleware. -func New(ctx context.Context, next http.Handler, config config.Retry, listener Listener, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.Retry, listener Listener, name string) (http.Handler, error) { logger := middlewares.GetLogger(ctx, name, typeName) logger.Debug("Creating middleware") diff --git a/pkg/middlewares/retry/retry_test.go b/pkg/middlewares/retry/retry_test.go index 10eb3f725..9df97011b 100644 --- a/pkg/middlewares/retry/retry_test.go +++ b/pkg/middlewares/retry/retry_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/emptybackendhandler" "github.com/containous/traefik/pkg/testhelpers" "github.com/gorilla/websocket" @@ -22,42 +22,42 @@ import ( func TestRetry(t *testing.T) { testCases := []struct { desc string - config config.Retry + config dynamic.Retry wantRetryAttempts int wantResponseStatus int amountFaultyEndpoints int }{ { desc: "no retry on success", - config: config.Retry{Attempts: 1}, + config: dynamic.Retry{Attempts: 1}, wantRetryAttempts: 0, wantResponseStatus: http.StatusOK, amountFaultyEndpoints: 0, }, { desc: "no retry when max request attempts is one", - config: config.Retry{Attempts: 1}, + config: dynamic.Retry{Attempts: 1}, wantRetryAttempts: 0, wantResponseStatus: http.StatusInternalServerError, amountFaultyEndpoints: 1, }, { desc: "one retry when one server is faulty", - config: config.Retry{Attempts: 2}, + config: dynamic.Retry{Attempts: 2}, wantRetryAttempts: 1, wantResponseStatus: http.StatusOK, amountFaultyEndpoints: 1, }, { desc: "two retries when two servers are faulty", - config: config.Retry{Attempts: 3}, + config: dynamic.Retry{Attempts: 3}, wantRetryAttempts: 2, wantResponseStatus: http.StatusOK, amountFaultyEndpoints: 2, }, { desc: "max attempts exhausted delivers the 5xx response", - config: config.Retry{Attempts: 3}, + config: dynamic.Retry{Attempts: 3}, wantRetryAttempts: 2, wantResponseStatus: http.StatusInternalServerError, amountFaultyEndpoints: 3, @@ -124,7 +124,7 @@ func TestRetryEmptyServerList(t *testing.T) { next := emptybackendhandler.New(loadBalancer) retryListener := &countingRetryListener{} - retry, err := New(context.Background(), next, config.Retry{Attempts: 3}, retryListener, "traefikTest") + retry, err := New(context.Background(), next, dynamic.Retry{Attempts: 3}, retryListener, "traefikTest") require.NoError(t, err) recorder := httptest.NewRecorder() @@ -172,7 +172,7 @@ func TestMultipleRetriesShouldNotLooseHeaders(t *testing.T) { rw.WriteHeader(http.StatusNoContent) }) - retry, err := New(context.Background(), next, config.Retry{Attempts: 3}, &countingRetryListener{}, "traefikTest") + retry, err := New(context.Background(), next, dynamic.Retry{Attempts: 3}, &countingRetryListener{}, "traefikTest") require.NoError(t, err) responseRecorder := httptest.NewRecorder() @@ -218,7 +218,7 @@ func TestRetryWithFlush(t *testing.T) { } }) - retry, err := New(context.Background(), next, config.Retry{Attempts: 1}, &countingRetryListener{}, "traefikTest") + retry, err := New(context.Background(), next, dynamic.Retry{Attempts: 1}, &countingRetryListener{}, "traefikTest") require.NoError(t, err) responseRecorder := httptest.NewRecorder() @@ -293,7 +293,7 @@ func TestRetryWebsocket(t *testing.T) { } retryListener := &countingRetryListener{} - retryH, err := New(context.Background(), loadBalancer, config.Retry{Attempts: test.maxRequestAttempts}, retryListener, "traefikTest") + retryH, err := New(context.Background(), loadBalancer, dynamic.Retry{Attempts: test.maxRequestAttempts}, retryListener, "traefikTest") require.NoError(t, err) retryServer := httptest.NewServer(retryH) diff --git a/pkg/middlewares/stripprefix/strip_prefix.go b/pkg/middlewares/stripprefix/strip_prefix.go index 504f20fa3..94c8de90e 100644 --- a/pkg/middlewares/stripprefix/strip_prefix.go +++ b/pkg/middlewares/stripprefix/strip_prefix.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/tracing" "github.com/opentracing/opentracing-go/ext" @@ -25,7 +25,7 @@ type stripPrefix struct { } // New creates a new strip prefix middleware. -func New(ctx context.Context, next http.Handler, config config.StripPrefix, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.StripPrefix, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") return &stripPrefix{ prefixes: config.Prefixes, diff --git a/pkg/middlewares/stripprefix/strip_prefix_test.go b/pkg/middlewares/stripprefix/strip_prefix_test.go index 73690ce40..e1aed92cb 100644 --- a/pkg/middlewares/stripprefix/strip_prefix_test.go +++ b/pkg/middlewares/stripprefix/strip_prefix_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -15,7 +15,7 @@ import ( func TestStripPrefix(t *testing.T) { testCases := []struct { desc string - config config.StripPrefix + config dynamic.StripPrefix path string expectedStatusCode int expectedPath string @@ -24,7 +24,7 @@ func TestStripPrefix(t *testing.T) { }{ { desc: "no prefixes configured", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{}, }, path: "/noprefixes", @@ -32,7 +32,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "wildcard (.*) requests", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/"}, }, path: "/", @@ -42,7 +42,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "prefix and path matching", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat"}, }, path: "/stat", @@ -52,7 +52,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "path prefix on exactly matching path", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat/"}, }, path: "/stat/", @@ -62,7 +62,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "path prefix on matching longer path", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat/"}, }, path: "/stat/us", @@ -72,7 +72,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "path prefix on mismatching path", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat/"}, }, path: "/status", @@ -80,7 +80,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "general prefix on matching path", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat"}, }, path: "/stat/", @@ -90,7 +90,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "earlier prefix matching", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat", "/stat/us"}, }, @@ -101,7 +101,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "later prefix matching", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/mismatch", "/stat"}, }, path: "/stat", @@ -111,7 +111,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "prefix matching within slash boundaries", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat"}, }, path: "/status", @@ -121,7 +121,7 @@ func TestStripPrefix(t *testing.T) { }, { desc: "raw path is also stripped", - config: config.StripPrefix{ + config: dynamic.StripPrefix{ Prefixes: []string{"/stat"}, }, path: "/stat/a%2Fb", diff --git a/pkg/middlewares/stripprefixregex/strip_prefix_regex.go b/pkg/middlewares/stripprefixregex/strip_prefix_regex.go index 574092141..6af3bb090 100644 --- a/pkg/middlewares/stripprefixregex/strip_prefix_regex.go +++ b/pkg/middlewares/stripprefixregex/strip_prefix_regex.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares" "github.com/containous/traefik/pkg/middlewares/stripprefix" "github.com/containous/traefik/pkg/tracing" @@ -25,7 +25,7 @@ type stripPrefixRegex struct { } // New builds a new StripPrefixRegex middleware. -func New(ctx context.Context, next http.Handler, config config.StripPrefixRegex, name string) (http.Handler, error) { +func New(ctx context.Context, next http.Handler, config dynamic.StripPrefixRegex, name string) (http.Handler, error) { middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware") stripPrefix := stripPrefixRegex{ diff --git a/pkg/middlewares/stripprefixregex/strip_prefix_regex_test.go b/pkg/middlewares/stripprefixregex/strip_prefix_regex_test.go index d8a5ca0aa..01ba9224e 100644 --- a/pkg/middlewares/stripprefixregex/strip_prefix_regex_test.go +++ b/pkg/middlewares/stripprefixregex/strip_prefix_regex_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/stripprefix" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -14,7 +14,7 @@ import ( ) func TestStripPrefixRegex(t *testing.T) { - testPrefixRegex := config.StripPrefixRegex{ + testPrefixRegex := dynamic.StripPrefixRegex{ Regex: []string{"/a/api/", "/b/{regex}/", "/c/{category}/{id:[0-9]+}/"}, } diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index 75b6ff03b..9d6130481 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -14,7 +14,7 @@ import ( "sync" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/rules" "github.com/containous/traefik/pkg/safe" @@ -89,10 +89,10 @@ type Provider struct { account *Account client *lego.Client certsChan chan *Certificate - configurationChan chan<- config.Message + configurationChan chan<- dynamic.Message tlsManager *traefiktls.Manager clientMutex sync.Mutex - configFromListenerChan chan config.Configuration + configFromListenerChan chan dynamic.Configuration pool *safe.Pool resolvingDomains map[string]struct{} resolvingDomainsMutex sync.RWMutex @@ -104,12 +104,12 @@ func (p *Provider) SetTLSManager(tlsManager *traefiktls.Manager) { } // SetConfigListenerChan initializes the configFromListenerChan -func (p *Provider) SetConfigListenerChan(configFromListenerChan chan config.Configuration) { +func (p *Provider) SetConfigListenerChan(configFromListenerChan chan dynamic.Configuration) { p.configFromListenerChan = configFromListenerChan } // ListenConfiguration sets a new Configuration into the configFromListenerChan -func (p *Provider) ListenConfiguration(config config.Configuration) { +func (p *Provider) ListenConfiguration(config dynamic.Configuration) { p.configFromListenerChan <- config } @@ -187,7 +187,7 @@ func isAccountMatchingCaServer(ctx context.Context, accountURI string, serverURI // Provide allows the file provider to provide configurations to traefik // using the given Configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) p.pool = pool @@ -581,15 +581,15 @@ func (p *Provider) saveCertificates() error { } func (p *Provider) refreshCertificates() { - conf := config.Message{ + conf := dynamic.Message{ ProviderName: "ACME", - Configuration: &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + Configuration: &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, } diff --git a/pkg/provider/aggregator/aggregator.go b/pkg/provider/aggregator/aggregator.go index d7053cd5d..403dc1416 100644 --- a/pkg/provider/aggregator/aggregator.go +++ b/pkg/provider/aggregator/aggregator.go @@ -3,7 +3,7 @@ package aggregator import ( "encoding/json" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -80,7 +80,7 @@ func (p ProviderAggregator) Init() error { } // Provide calls the provide method of every providers -func (p ProviderAggregator) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p ProviderAggregator) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { if p.fileProvider != nil { launchProvider(configurationChan, pool, p.fileProvider) } @@ -94,7 +94,7 @@ func (p ProviderAggregator) Provide(configurationChan chan<- config.Message, poo return nil } -func launchProvider(configurationChan chan<- config.Message, pool *safe.Pool, prd provider.Provider) { +func launchProvider(configurationChan chan<- dynamic.Message, pool *safe.Pool, prd provider.Provider) { jsonConf, err := json.Marshal(prd) if err != nil { log.WithoutContext().Debugf("Cannot marshal the provider configuration %T: %v", prd, err) diff --git a/pkg/provider/configuration.go b/pkg/provider/configuration.go index b80781aca..882a58255 100644 --- a/pkg/provider/configuration.go +++ b/pkg/provider/configuration.go @@ -10,23 +10,23 @@ import ( "unicode" "github.com/Masterminds/sprig" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" ) // Merge Merges multiple configurations. -func Merge(ctx context.Context, configurations map[string]*config.Configuration) *config.Configuration { +func Merge(ctx context.Context, configurations map[string]*dynamic.Configuration) *dynamic.Configuration { logger := log.FromContext(ctx) - configuration := &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: make(map[string]*config.Router), - Middlewares: make(map[string]*config.Middleware), - Services: make(map[string]*config.Service), + configuration := &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: make(map[string]*dynamic.Router), + Middlewares: make(map[string]*dynamic.Middleware), + Services: make(map[string]*dynamic.Service), }, - TCP: &config.TCPConfiguration{ - Routers: make(map[string]*config.TCPRouter), - Services: make(map[string]*config.TCPService), + TCP: &dynamic.TCPConfiguration{ + Routers: make(map[string]*dynamic.TCPRouter), + Services: make(map[string]*dynamic.TCPService), }, } @@ -123,7 +123,7 @@ func Merge(ctx context.Context, configurations map[string]*config.Configuration) } // AddServiceTCP Adds a service to a configurations. -func AddServiceTCP(configuration *config.TCPConfiguration, serviceName string, service *config.TCPService) bool { +func AddServiceTCP(configuration *dynamic.TCPConfiguration, serviceName string, service *dynamic.TCPService) bool { if _, ok := configuration.Services[serviceName]; !ok { configuration.Services[serviceName] = service return true @@ -138,7 +138,7 @@ func AddServiceTCP(configuration *config.TCPConfiguration, serviceName string, s } // AddRouterTCP Adds a router to a configurations. -func AddRouterTCP(configuration *config.TCPConfiguration, routerName string, router *config.TCPRouter) bool { +func AddRouterTCP(configuration *dynamic.TCPConfiguration, routerName string, router *dynamic.TCPRouter) bool { if _, ok := configuration.Routers[routerName]; !ok { configuration.Routers[routerName] = router return true @@ -148,7 +148,7 @@ func AddRouterTCP(configuration *config.TCPConfiguration, routerName string, rou } // AddService Adds a service to a configurations. -func AddService(configuration *config.HTTPConfiguration, serviceName string, service *config.Service) bool { +func AddService(configuration *dynamic.HTTPConfiguration, serviceName string, service *dynamic.Service) bool { if _, ok := configuration.Services[serviceName]; !ok { configuration.Services[serviceName] = service return true @@ -163,7 +163,7 @@ func AddService(configuration *config.HTTPConfiguration, serviceName string, ser } // AddRouter Adds a router to a configurations. -func AddRouter(configuration *config.HTTPConfiguration, routerName string, router *config.Router) bool { +func AddRouter(configuration *dynamic.HTTPConfiguration, routerName string, router *dynamic.Router) bool { if _, ok := configuration.Routers[routerName]; !ok { configuration.Routers[routerName] = router return true @@ -173,7 +173,7 @@ func AddRouter(configuration *config.HTTPConfiguration, routerName string, route } // AddMiddleware Adds a middleware to a configurations. -func AddMiddleware(configuration *config.HTTPConfiguration, middlewareName string, middleware *config.Middleware) bool { +func AddMiddleware(configuration *dynamic.HTTPConfiguration, middlewareName string, middleware *dynamic.Middleware) bool { if _, ok := configuration.Middlewares[middlewareName]; !ok { configuration.Middlewares[middlewareName] = middleware return true @@ -195,7 +195,7 @@ func MakeDefaultRuleTemplate(defaultRule string, funcMap template.FuncMap) (*tem } // BuildTCPRouterConfiguration Builds a router configuration. -func BuildTCPRouterConfiguration(ctx context.Context, configuration *config.TCPConfiguration) { +func BuildTCPRouterConfiguration(ctx context.Context, configuration *dynamic.TCPConfiguration) { for routerName, router := range configuration.Routers { loggerRouter := log.FromContext(ctx).WithField(log.RouterName, routerName) if len(router.Rule) == 0 { @@ -220,13 +220,13 @@ func BuildTCPRouterConfiguration(ctx context.Context, configuration *config.TCPC } // BuildRouterConfiguration Builds a router configuration. -func BuildRouterConfiguration(ctx context.Context, configuration *config.HTTPConfiguration, defaultRouterName string, defaultRuleTpl *template.Template, model interface{}) { +func BuildRouterConfiguration(ctx context.Context, configuration *dynamic.HTTPConfiguration, defaultRouterName string, defaultRuleTpl *template.Template, model interface{}) { if len(configuration.Routers) == 0 { if len(configuration.Services) > 1 { log.FromContext(ctx).Info("Could not create a router for the container: too many services") } else { - configuration.Routers = make(map[string]*config.Router) - configuration.Routers[defaultRouterName] = &config.Router{} + configuration.Routers = make(map[string]*dynamic.Router) + configuration.Routers[defaultRouterName] = &dynamic.Router{} } } diff --git a/pkg/provider/docker/config.go b/pkg/provider/docker/config.go index ac179b096..d8474e60d 100644 --- a/pkg/provider/docker/config.go +++ b/pkg/provider/docker/config.go @@ -7,7 +7,7 @@ import ( "net" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/label" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -15,8 +15,8 @@ import ( "github.com/docker/go-connections/nat" ) -func (p *Provider) buildConfiguration(ctx context.Context, containersInspected []dockerData) *config.Configuration { - configurations := make(map[string]*config.Configuration) +func (p *Provider) buildConfiguration(ctx context.Context, containersInspected []dockerData) *dynamic.Configuration { + configurations := make(map[string]*dynamic.Configuration) for _, container := range containersInspected { containerName := getServiceName(container) + "-" + container.ID @@ -73,13 +73,13 @@ func (p *Provider) buildConfiguration(ctx context.Context, containersInspected [ return provider.Merge(ctx, configurations) } -func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, container dockerData, configuration *config.TCPConfiguration) error { +func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, container dockerData, configuration *dynamic.TCPConfiguration) error { serviceName := getServiceName(container) if len(configuration.Services) == 0 { - configuration.Services = make(map[string]*config.TCPService) - lb := &config.TCPLoadBalancerService{} - configuration.Services[serviceName] = &config.TCPService{ + configuration.Services = make(map[string]*dynamic.TCPService) + lb := &dynamic.TCPLoadBalancerService{} + configuration.Services[serviceName] = &dynamic.TCPService{ LoadBalancer: lb, } } @@ -94,14 +94,14 @@ func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, container d return nil } -func (p *Provider) buildServiceConfiguration(ctx context.Context, container dockerData, configuration *config.HTTPConfiguration) error { +func (p *Provider) buildServiceConfiguration(ctx context.Context, container dockerData, configuration *dynamic.HTTPConfiguration) error { serviceName := getServiceName(container) if len(configuration.Services) == 0 { - configuration.Services = make(map[string]*config.Service) - lb := &config.LoadBalancerService{} + configuration.Services = make(map[string]*dynamic.Service) + lb := &dynamic.LoadBalancerService{} lb.SetDefaults() - configuration.Services[serviceName] = &config.Service{ + configuration.Services[serviceName] = &dynamic.Service{ LoadBalancer: lb, } } @@ -142,7 +142,7 @@ func (p *Provider) keepContainer(ctx context.Context, container dockerData) bool return true } -func (p *Provider) addServerTCP(ctx context.Context, container dockerData, loadBalancer *config.TCPLoadBalancerService) error { +func (p *Provider) addServerTCP(ctx context.Context, container dockerData, loadBalancer *dynamic.TCPLoadBalancerService) error { serverPort := "" if loadBalancer != nil && len(loadBalancer.Servers) > 0 { serverPort = loadBalancer.Servers[0].Port @@ -153,9 +153,9 @@ func (p *Provider) addServerTCP(ctx context.Context, container dockerData, loadB } if len(loadBalancer.Servers) == 0 { - server := config.TCPServer{} + server := dynamic.TCPServer{} - loadBalancer.Servers = []config.TCPServer{server} + loadBalancer.Servers = []dynamic.TCPServer{server} } if serverPort != "" { @@ -171,7 +171,7 @@ func (p *Provider) addServerTCP(ctx context.Context, container dockerData, loadB return nil } -func (p *Provider) addServer(ctx context.Context, container dockerData, loadBalancer *config.LoadBalancerService) error { +func (p *Provider) addServer(ctx context.Context, container dockerData, loadBalancer *dynamic.LoadBalancerService) error { serverPort := getLBServerPort(loadBalancer) ip, port, err := p.getIPPort(ctx, container, serverPort) if err != nil { @@ -179,10 +179,10 @@ func (p *Provider) addServer(ctx context.Context, container dockerData, loadBala } if len(loadBalancer.Servers) == 0 { - server := config.Server{} + server := dynamic.Server{} server.SetDefaults() - loadBalancer.Servers = []config.Server{server} + loadBalancer.Servers = []dynamic.Server{server} } if serverPort != "" { @@ -291,7 +291,7 @@ func (p *Provider) getPortBinding(container dockerData, serverPort string) (*nat return nil, fmt.Errorf("unable to find the external IP:Port for the container %q", container.Name) } -func getLBServerPort(loadBalancer *config.LoadBalancerService) string { +func getLBServerPort(loadBalancer *dynamic.LoadBalancerService) string { if loadBalancer != nil && len(loadBalancer.Servers) > 0 { return loadBalancer.Servers[0].Port } diff --git a/pkg/provider/docker/config_test.go b/pkg/provider/docker/config_test.go index f7b8d94fb..107e9c4c6 100644 --- a/pkg/provider/docker/config_test.go +++ b/pkg/provider/docker/config_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" docker "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/go-connections/nat" @@ -18,7 +18,7 @@ func TestDefaultRule(t *testing.T) { desc string containers []dockerData defaultRule string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "default rule with no variable", @@ -41,23 +41,23 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: "Host(`foo.bar`)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`foo.bar`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -90,23 +90,23 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: "Host(`{{ .Name }}.foo.bar`)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.foo.bar`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -141,23 +141,23 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: `Host("{{ .Name }}.{{ index .Labels "traefik.domain" }}")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: `Host("Test.foo.bar")`, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -190,18 +190,18 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: `Host("{{ .Toto }}")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -234,18 +234,18 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: ``, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -278,23 +278,23 @@ func TestDefaultRule(t *testing.T) { }, }, defaultRule: DefaultTemplateRule, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -339,7 +339,7 @@ func Test_buildConfiguration(t *testing.T) { desc string containers []dockerData constraints string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "one container no label", @@ -361,23 +361,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -425,13 +425,13 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", @@ -441,11 +441,11 @@ func Test_buildConfiguration(t *testing.T) { Rule: "Host(`Test2.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -454,8 +454,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Test2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.2:80", }, @@ -505,23 +505,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -558,23 +558,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -610,23 +610,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -660,17 +660,17 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -679,7 +679,7 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - Routers: map[string]*config.Router{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Test", Rule: "Host(`foo.com`)", @@ -711,23 +711,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -763,18 +763,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -783,8 +783,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Service2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -838,20 +838,20 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -916,20 +916,20 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -975,23 +975,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1028,22 +1028,22 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1052,9 +1052,9 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - MaxConn: &config.MaxConn{ + MaxConn: &dynamic.MaxConn{ Amount: 42, ExtractorFunc: "request.host", }, @@ -1105,30 +1105,30 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - MaxConn: &config.MaxConn{ + MaxConn: &dynamic.MaxConn{ Amount: 42, ExtractorFunc: "request.host", }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1185,23 +1185,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1277,23 +1277,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1353,18 +1353,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1440,18 +1440,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1511,23 +1511,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Test", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1582,18 +1582,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1602,8 +1602,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Test2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.2:80", }, @@ -1637,23 +1637,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1688,23 +1688,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "h2c://127.0.0.1:8080", }, @@ -1739,18 +1739,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -1759,8 +1759,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Service2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:8080", }, @@ -1790,15 +1790,15 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1822,15 +1822,15 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1856,15 +1856,15 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1889,15 +1889,15 @@ func Test_buildConfiguration(t *testing.T) { Health: "not_healthy", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1924,15 +1924,15 @@ func Test_buildConfiguration(t *testing.T) { }, }, constraints: `Label("traefik.tags", "bar")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1959,23 +1959,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, constraints: `Label("traefik.tags", "foo")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -2010,22 +2010,22 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", Middlewares: []string{"Middleware1"}, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{ "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", @@ -2033,10 +2033,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -2071,19 +2071,19 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "Test", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "Test": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -2092,10 +2092,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -2121,13 +2121,13 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{ "Test": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -2136,10 +2136,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -2167,21 +2167,21 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -2190,10 +2190,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -2244,19 +2244,19 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -2268,18 +2268,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -2316,13 +2316,13 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -2331,10 +2331,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, diff --git a/pkg/provider/docker/docker.go b/pkg/provider/docker/docker.go index 7eaa48818..dc7dff779 100644 --- a/pkg/provider/docker/docker.go +++ b/pkg/provider/docker/docker.go @@ -12,7 +12,7 @@ import ( "time" "github.com/cenkalti/backoff" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/job" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -146,7 +146,7 @@ func (p *Provider) createClient() (client.APIClient, error) { } // Provide allows the docker provider to provide configurations to traefik using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { pool.GoCtx(func(routineCtx context.Context) { ctxLog := log.With(routineCtx, log.Str(log.ProviderName, "docker")) logger := log.FromContext(ctxLog) @@ -186,7 +186,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P } configuration := p.buildConfiguration(ctxLog, dockerDataList) - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "docker", Configuration: configuration, } @@ -213,7 +213,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P configuration := p.buildConfiguration(ctx, services) if configuration != nil { - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "docker", Configuration: configuration, } @@ -248,7 +248,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P configuration := p.buildConfiguration(ctx, containers) if configuration != nil { - message := config.Message{ + message := dynamic.Message{ ProviderName: "docker", Configuration: configuration, } diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index b7a485342..c89bc0be0 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -13,7 +13,7 @@ import ( "github.com/BurntSushi/toml" "github.com/Masterminds/sprig" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" "github.com/containous/traefik/pkg/safe" @@ -48,7 +48,7 @@ func (p *Provider) Init() error { // Provide allows the file provider to provide configurations to traefik // using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { configuration, err := p.BuildConfiguration() if err != nil { @@ -78,7 +78,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P // BuildConfiguration loads configuration either from file or a directory specified by 'Filename'/'Directory' // and returns a 'Configuration' object -func (p *Provider) BuildConfiguration() (*config.Configuration, error) { +func (p *Provider) BuildConfiguration() (*dynamic.Configuration, error) { ctx := log.With(context.Background(), log.Str(log.ProviderName, providerName)) if len(p.Directory) > 0 { @@ -96,7 +96,7 @@ func (p *Provider) BuildConfiguration() (*config.Configuration, error) { return nil, errors.New("error using file configuration backend, no filename defined") } -func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationChan chan<- config.Message, callback func(chan<- config.Message, fsnotify.Event)) error { +func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationChan chan<- dynamic.Message, callback func(chan<- dynamic.Message, fsnotify.Event)) error { watcher, err := fsnotify.NewWatcher() if err != nil { return fmt.Errorf("error creating file watcher: %s", err) @@ -139,7 +139,7 @@ func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationCh return nil } -func (p *Provider) watcherCallback(configurationChan chan<- config.Message, event fsnotify.Event) { +func (p *Provider) watcherCallback(configurationChan chan<- dynamic.Message, event fsnotify.Event) { watchItem := p.TraefikFile if len(p.Directory) > 0 { watchItem = p.Directory @@ -163,16 +163,16 @@ func (p *Provider) watcherCallback(configurationChan chan<- config.Message, even sendConfigToChannel(configurationChan, configuration) } -func sendConfigToChannel(configurationChan chan<- config.Message, configuration *config.Configuration) { - configurationChan <- config.Message{ +func sendConfigToChannel(configurationChan chan<- dynamic.Message, configuration *dynamic.Configuration) { + configurationChan <- dynamic.Message{ ProviderName: "file", Configuration: configuration, } } -func (p *Provider) loadFileConfig(filename string, parseTemplate bool) (*config.Configuration, error) { +func (p *Provider) loadFileConfig(filename string, parseTemplate bool) (*dynamic.Configuration, error) { var err error - var configuration *config.Configuration + var configuration *dynamic.Configuration if parseTemplate { configuration, err = p.CreateConfiguration(filename, template.FuncMap{}, false) } else { @@ -189,7 +189,7 @@ func (p *Provider) loadFileConfig(filename string, parseTemplate bool) (*config. return configuration, nil } -func flattenCertificates(tlsConfig *config.TLSConfiguration) []*tls.CertAndStores { +func flattenCertificates(tlsConfig *dynamic.TLSConfiguration) []*tls.CertAndStores { var certs []*tls.CertAndStores for _, cert := range tlsConfig.Certificates { content, err := cert.Certificate.CertFile.Read() @@ -212,7 +212,7 @@ func flattenCertificates(tlsConfig *config.TLSConfiguration) []*tls.CertAndStore return certs } -func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory string, configuration *config.Configuration) (*config.Configuration, error) { +func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory string, configuration *dynamic.Configuration) (*dynamic.Configuration, error) { logger := log.FromContext(ctx) fileList, err := ioutil.ReadDir(directory) @@ -221,17 +221,17 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st } if configuration == nil { - configuration = &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: make(map[string]*config.Router), - Middlewares: make(map[string]*config.Middleware), - Services: make(map[string]*config.Service), + configuration = &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: make(map[string]*dynamic.Router), + Middlewares: make(map[string]*dynamic.Middleware), + Services: make(map[string]*dynamic.Service), }, - TCP: &config.TCPConfiguration{ - Routers: make(map[string]*config.TCPRouter), - Services: make(map[string]*config.TCPService), + TCP: &dynamic.TCPConfiguration{ + Routers: make(map[string]*dynamic.TCPRouter), + Services: make(map[string]*dynamic.TCPService), }, - TLS: &config.TLSConfiguration{ + TLS: &dynamic.TLSConfiguration{ Stores: make(map[string]tls.Store), Options: make(map[string]tls.Options), }, @@ -256,7 +256,7 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st continue } - var c *config.Configuration + var c *dynamic.Configuration c, err = p.loadFileConfig(filepath.Join(directory, item.Name()), true) if err != nil { return configuration, err @@ -312,7 +312,7 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st } if len(configTLSMaps) > 0 { - configuration.TLS = &config.TLSConfiguration{} + configuration.TLS = &dynamic.TLSConfiguration{} } for conf := range configTLSMaps { @@ -323,7 +323,7 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st } // CreateConfiguration creates a provider configuration from content using templating. -func (p *Provider) CreateConfiguration(filename string, funcMap template.FuncMap, templateObjects interface{}) (*config.Configuration, error) { +func (p *Provider) CreateConfiguration(filename string, funcMap template.FuncMap, templateObjects interface{}) (*dynamic.Configuration, error) { tmplContent, err := readFile(filename) if err != nil { return nil, fmt.Errorf("error reading configuration file: %s - %s", filename, err) @@ -360,7 +360,7 @@ func (p *Provider) CreateConfiguration(filename string, funcMap template.FuncMap } // DecodeConfiguration Decodes a *types.Configuration from a content. -func (p *Provider) DecodeConfiguration(filename string) (*config.Configuration, error) { +func (p *Provider) DecodeConfiguration(filename string) (*dynamic.Configuration, error) { content, err := readFile(filename) if err != nil { return nil, fmt.Errorf("error reading configuration file: %s - %s", filename, err) @@ -369,18 +369,18 @@ func (p *Provider) DecodeConfiguration(filename string) (*config.Configuration, return p.decodeConfiguration(filename, content) } -func (p *Provider) decodeConfiguration(filePath string, content string) (*config.Configuration, error) { - configuration := &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: make(map[string]*config.Router), - Middlewares: make(map[string]*config.Middleware), - Services: make(map[string]*config.Service), +func (p *Provider) decodeConfiguration(filePath string, content string) (*dynamic.Configuration, error) { + configuration := &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: make(map[string]*dynamic.Router), + Middlewares: make(map[string]*dynamic.Middleware), + Services: make(map[string]*dynamic.Service), }, - TCP: &config.TCPConfiguration{ - Routers: make(map[string]*config.TCPRouter), - Services: make(map[string]*config.TCPService), + TCP: &dynamic.TCPConfiguration{ + Routers: make(map[string]*dynamic.TCPRouter), + Services: make(map[string]*dynamic.TCPService), }, - TLS: &config.TLSConfiguration{ + TLS: &dynamic.TLSConfiguration{ Stores: make(map[string]tls.Store), Options: make(map[string]tls.Options), }, diff --git a/pkg/provider/file/file_test.go b/pkg/provider/file/file_test.go index 019e74036..3907b6e9e 100644 --- a/pkg/provider/file/file_test.go +++ b/pkg/provider/file/file_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/safe" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -55,7 +55,7 @@ func TestTLSContent(t *testing.T) { func TestErrorWhenEmptyConfig(t *testing.T) { provider := &Provider{} - configChan := make(chan config.Message) + configChan := make(chan dynamic.Message) errorChan := make(chan struct{}) go func() { err := provider.Provide(configChan, safe.NewPool(context.Background())) @@ -78,7 +78,7 @@ func TestProvideWithoutWatch(t *testing.T) { t.Run(test.desc+" without watch", func(t *testing.T) { provider, clean := createProvider(t, test, false) defer clean() - configChan := make(chan config.Message) + configChan := make(chan dynamic.Message) provider.DebugLogGeneratedTemplate = true @@ -107,7 +107,7 @@ func TestProvideWithWatch(t *testing.T) { t.Run(test.desc+" with watch", func(t *testing.T) { provider, clean := createProvider(t, test, true) defer clean() - configChan := make(chan config.Message) + configChan := make(chan dynamic.Message) go func() { err := provider.Provide(configChan, safe.NewPool(context.Background())) diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 94144a8b8..9de6cdf9c 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -14,7 +14,7 @@ import ( "time" "github.com/cenkalti/backoff" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/job" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider/kubernetes/crd/traefik/v1alpha1" @@ -80,7 +80,7 @@ func (p *Provider) Init() error { // Provide allows the k8s provider to provide configurations to traefik // using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { ctxLog := log.With(context.Background(), log.Str(log.ProviderName, "kubernetescrd")) logger := log.FromContext(ctxLog) // Tell glog (used by client-go) to log into STDERR. Otherwise, we risk @@ -124,7 +124,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P logger.Debugf("Skipping Kubernetes event kind %T", event) } else { p.lastConfiguration.Set(conf) - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "kubernetescrd", Configuration: conf, } @@ -150,7 +150,7 @@ func checkStringQuoteValidity(value string) error { return err } -func loadTCPServers(client Client, namespace string, svc v1alpha1.ServiceTCP) ([]config.TCPServer, error) { +func loadTCPServers(client Client, namespace string, svc v1alpha1.ServiceTCP) ([]dynamic.TCPServer, error) { service, exists, err := client.GetService(namespace, svc.Name) if err != nil { return nil, err @@ -172,9 +172,9 @@ func loadTCPServers(client Client, namespace string, svc v1alpha1.ServiceTCP) ([ return nil, errors.New("service port not found") } - var servers []config.TCPServer + var servers []dynamic.TCPServer if service.Spec.Type == corev1.ServiceTypeExternalName { - servers = append(servers, config.TCPServer{ + servers = append(servers, dynamic.TCPServer{ Address: fmt.Sprintf("%s:%d", service.Spec.ExternalName, portSpec.Port), }) } else { @@ -205,7 +205,7 @@ func loadTCPServers(client Client, namespace string, svc v1alpha1.ServiceTCP) ([ } for _, addr := range subset.Addresses { - servers = append(servers, config.TCPServer{ + servers = append(servers, dynamic.TCPServer{ Address: fmt.Sprintf("%s:%d", addr.IP, port), }) } @@ -215,7 +215,7 @@ func loadTCPServers(client Client, namespace string, svc v1alpha1.ServiceTCP) ([ return servers, nil } -func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]config.Server, error) { +func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]dynamic.Server, error) { strategy := svc.Strategy if strategy == "" { strategy = "RoundRobin" @@ -245,9 +245,9 @@ func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]confi return nil, errors.New("service port not found") } - var servers []config.Server + var servers []dynamic.Server if service.Spec.Type == corev1.ServiceTypeExternalName { - servers = append(servers, config.Server{ + servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("http://%s:%d", service.Spec.ExternalName, portSpec.Port), }) } else { @@ -290,7 +290,7 @@ func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]confi } for _, addr := range subset.Addresses { - servers = append(servers, config.Server{ + servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("%s://%s:%d", protocol, addr.IP, port), }) } @@ -347,11 +347,11 @@ func buildTLSOptions(ctx context.Context, client Client) map[string]tls.Options return tlsOptions } -func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Client, tlsConfigs map[string]*tls.CertAndStores) *config.HTTPConfiguration { - conf := &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, +func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Client, tlsConfigs map[string]*tls.CertAndStores) *dynamic.HTTPConfiguration { + conf := &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, } for _, ingressRoute := range client.GetIngressRoutes() { @@ -388,7 +388,7 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli continue } - var allServers []config.Server + var allServers []dynamic.Server for _, service := range route.Services { servers, err := loadServers(client, ingressRoute.Namespace, service) if err != nil { @@ -429,7 +429,7 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli serviceName := makeID(ingressRoute.Namespace, key) - conf.Routers[serviceName] = &config.Router{ + conf.Routers[serviceName] = &dynamic.Router{ Middlewares: mds, Priority: route.Priority, EntryPoints: ingressRoute.Spec.EntryPoints, @@ -438,7 +438,7 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli } if ingressRoute.Spec.TLS != nil { - tlsConf := &config.RouterTLSConfig{} + tlsConf := &dynamic.RouterTLSConfig{} if ingressRoute.Spec.TLS.Options != nil && len(ingressRoute.Spec.TLS.Options.Name) > 0 { tlsOptionsName := ingressRoute.Spec.TLS.Options.Name // Is a Kubernetes CRD reference, (i.e. not a cross-provider reference) @@ -459,8 +459,8 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli conf.Routers[serviceName].TLS = tlsConf } - conf.Services[serviceName] = &config.Service{ - LoadBalancer: &config.LoadBalancerService{ + conf.Services[serviceName] = &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ Servers: allServers, // TODO: support other strategies. PassHostHeader: true, @@ -472,10 +472,10 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli return conf } -func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client Client, tlsConfigs map[string]*tls.CertAndStores) *config.TCPConfiguration { - conf := &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, +func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client Client, tlsConfigs map[string]*tls.CertAndStores) *dynamic.TCPConfiguration { + conf := &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, } for _, ingressRouteTCP := range client.GetIngressRouteTCPs() { @@ -508,7 +508,7 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client continue } - var allServers []config.TCPServer + var allServers []dynamic.TCPServer for _, service := range route.Services { servers, err := loadTCPServers(client, ingressRouteTCP.Namespace, service) if err != nil { @@ -529,14 +529,14 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client } serviceName := makeID(ingressRouteTCP.Namespace, key) - conf.Routers[serviceName] = &config.TCPRouter{ + conf.Routers[serviceName] = &dynamic.TCPRouter{ EntryPoints: ingressRouteTCP.Spec.EntryPoints, Rule: route.Match, Service: serviceName, } if ingressRouteTCP.Spec.TLS != nil { - conf.Routers[serviceName].TLS = &config.RouterTCPTLSConfig{ + conf.Routers[serviceName].TLS = &dynamic.RouterTCPTLSConfig{ Passthrough: ingressRouteTCP.Spec.TLS.Passthrough, } @@ -560,8 +560,8 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client } } - conf.Services[serviceName] = &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ + conf.Services[serviceName] = &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ Servers: allServers, }, } @@ -571,12 +571,12 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client return conf } -func (p *Provider) loadConfigurationFromCRD(ctx context.Context, client Client) *config.Configuration { +func (p *Provider) loadConfigurationFromCRD(ctx context.Context, client Client) *dynamic.Configuration { tlsConfigs := make(map[string]*tls.CertAndStores) - conf := &config.Configuration{ + conf := &dynamic.Configuration{ HTTP: p.loadIngressRouteConfiguration(ctx, client, tlsConfigs), TCP: p.loadIngressRouteTCPConfiguration(ctx, client, tlsConfigs), - TLS: &config.TLSConfiguration{ + TLS: &dynamic.TLSConfiguration{ Certificates: getTLSConfig(tlsConfigs), Options: buildTLSOptions(ctx, client), }, diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index c88ffcb0d..9ece08d30 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/provider" "github.com/containous/traefik/pkg/tls" "github.com/stretchr/testify/assert" @@ -17,44 +17,44 @@ func TestLoadIngressRouteTCPs(t *testing.T) { desc string ingressClass string paths []string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "Empty", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Simple Ingress Route, with foo entrypoint", paths: []string{"tcp/services.yml", "tcp/simple.yml"}, - expected: &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -68,15 +68,15 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "One ingress Route with two different rules", paths: []string{"tcp/services.yml", "tcp/with_two_rules.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", @@ -88,10 +88,10 @@ func TestLoadIngressRouteTCPs(t *testing.T) { Rule: "HostSNI(`bar.com`)", }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -104,8 +104,8 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, "default/test.route-f44ce589164e656d231c": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -119,30 +119,30 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "One ingress Route with two different services, their servers will merge", paths: []string{"tcp/services.yml", "tcp/with_two_services.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -163,68 +163,68 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Ingress class does not match", paths: []string{"tcp/services.yml", "tcp/simple.yml"}, ingressClass: "tchouk", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Route with empty rule value is ignored", paths: []string{"tcp/services.yml", "tcp/with_no_rule_value.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "check rule quoting validity", paths: []string{"tcp/services.yml", "tcp/with_bad_host_rule.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "TLS", paths: []string{"tcp/services.yml", "tcp/with_tls.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Certificates: []*tls.CertAndStores{ { Certificate: tls.Certificate{ @@ -234,19 +234,19 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -260,32 +260,32 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with passthrough", paths: []string{"tcp/services.yml", "tcp/with_tls_passthrough.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: true, }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -299,19 +299,19 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "TLS with tls options", paths: []string{"tcp/services.yml", "tcp/with_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", @@ -330,21 +330,21 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "default/foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -358,18 +358,18 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with tls options and specific namespace", paths: []string{"tcp/services.yml", "tcp/with_tls_options_and_specific_namespace.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "myns/foo": { MinVersion: "VersionTLS12", @@ -388,21 +388,21 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "myns/foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -416,18 +416,18 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with bad tls options", paths: []string{"tcp/services.yml", "tcp/with_bad_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", @@ -445,21 +445,21 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "default/foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -473,39 +473,39 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with unknown tls options", paths: []string{"tcp/services.yml", "tcp/with_unknown_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "default/unknown", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -519,39 +519,39 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with unknown tls options namespace", paths: []string{"tcp/services.yml", "tcp/with_unknown_tls_options_namespace.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Options: "unknown/foo", }, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -565,30 +565,30 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS with ACME", paths: []string{"tcp/services.yml", "tcp/with_tls_acme.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "default/test.route-fdd3e9338e47a45efefc": { EntryPoints: []string{"foo"}, Service: "default/test.route-fdd3e9338e47a45efefc", Rule: "HostSNI(`foo.com`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "default/test.route-fdd3e9338e47a45efefc": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "10.10.0.1:8000", Port: "", @@ -602,12 +602,12 @@ func TestLoadIngressRouteTCPs(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, } @@ -634,33 +634,33 @@ func TestLoadIngressRoutes(t *testing.T) { desc string ingressClass string paths []string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "Empty", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Simple Ingress Route, with foo entrypoint", paths: []string{"services.yml", "simple.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"foo"}, Service: "default/test.route-6b204d94623b3df4370c", @@ -668,11 +668,11 @@ func TestLoadIngressRoutes(t *testing.T) { Priority: 12, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -685,19 +685,19 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Simple Ingress Route with middleware", paths: []string{"services.yml", "with_middleware.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test2.route-23c7f4c450289ee29016": { EntryPoints: []string{"web"}, Service: "default/test2.route-23c7f4c450289ee29016", @@ -706,22 +706,22 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: []string{"default/stripprefix", "foo/addprefix"}, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "default/stripprefix": { - StripPrefix: &config.StripPrefix{ + StripPrefix: &dynamic.StripPrefix{ Prefixes: []string{"/tobestripped"}, }, }, "foo/addprefix": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/tobeadded", }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "default/test2.route-23c7f4c450289ee29016": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -734,20 +734,20 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "Simple Ingress Route with middleware crossprovider", paths: []string{"services.yml", "with_middleware_crossprovider.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test2.route-23c7f4c450289ee29016": { EntryPoints: []string{"web"}, Service: "default/test2.route-23c7f4c450289ee29016", @@ -756,22 +756,22 @@ func TestLoadIngressRoutes(t *testing.T) { Middlewares: []string{"default/stripprefix", "foo/addprefix", "basicauth@file", "redirect@file"}, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "default/stripprefix": { - StripPrefix: &config.StripPrefix{ + StripPrefix: &dynamic.StripPrefix{ Prefixes: []string{"/tobestripped"}, }, }, "foo/addprefix": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/tobeadded", }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "default/test2.route-23c7f4c450289ee29016": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -789,13 +789,13 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "One ingress Route with two different rules", paths: []string{"services.yml", "with_two_rules.yml"}, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", @@ -809,11 +809,11 @@ func TestLoadIngressRoutes(t *testing.T) { Priority: 12, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -825,8 +825,8 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, "default/test.route-77c62dfe9517144aeeaa": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -839,20 +839,20 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TLS: &config.TLSConfiguration{}, + TLS: &dynamic.TLSConfiguration{}, }, }, { desc: "One ingress Route with two different services, their servers will merge", paths: []string{"services.yml", "with_two_services.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-77c62dfe9517144aeeaa": { EntryPoints: []string{"web"}, Service: "default/test.route-77c62dfe9517144aeeaa", @@ -860,11 +860,11 @@ func TestLoadIngressRoutes(t *testing.T) { Priority: 12, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-77c62dfe9517144aeeaa": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -889,72 +889,72 @@ func TestLoadIngressRoutes(t *testing.T) { desc: "Ingress class", paths: []string{"services.yml", "simple.yml"}, ingressClass: "tchouk", - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Route with empty rule value is ignored", paths: []string{"services.yml", "with_no_rule_value.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Route with kind not of a rule type (empty kind) is ignored", paths: []string{"services.yml", "with_wrong_rule_kind.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "check rule quoting validity", paths: []string{"services.yml", "with_bad_host_rule.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "TLS", paths: []string{"services.yml", "with_tls.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Certificates: []*tls.CertAndStores{ { Certificate: tls.Certificate{ @@ -964,25 +964,25 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{}, + TLS: &dynamic.RouterTLSConfig{}, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1000,8 +1000,8 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with tls options", paths: []string{"services.yml", "with_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", @@ -1020,27 +1020,27 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{ + TLS: &dynamic.RouterTLSConfig{ Options: "default/foo", }, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1058,8 +1058,8 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with tls options and specific namespace", paths: []string{"services.yml", "with_tls_options_and_specific_namespace.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "myns/foo": { MinVersion: "VersionTLS12", @@ -1078,27 +1078,27 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{ + TLS: &dynamic.RouterTLSConfig{ Options: "myns/foo", }, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1116,8 +1116,8 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with bad tls options", paths: []string{"services.yml", "with_bad_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", @@ -1135,27 +1135,27 @@ func TestLoadIngressRoutes(t *testing.T) { }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{ + TLS: &dynamic.RouterTLSConfig{ Options: "default/foo", }, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1173,35 +1173,35 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with unknown tls options", paths: []string{"services.yml", "with_unknown_tls_options.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{ + TLS: &dynamic.RouterTLSConfig{ Options: "default/unknown", }, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1219,35 +1219,35 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with unknown tls options namespace", paths: []string{"services.yml", "with_unknown_tls_options_namespace.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{ + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "default/foo": { MinVersion: "VersionTLS12", }, }, }, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{ + TLS: &dynamic.RouterTLSConfig{ Options: "unknown/foo", }, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1265,27 +1265,27 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "TLS with ACME", paths: []string{"services.yml", "with_tls_acme.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"web"}, Service: "default/test.route-6b204d94623b3df4370c", Rule: "Host(`foo.com`) && PathPrefix(`/bar`)", Priority: 12, - TLS: &config.RouterTLSConfig{}, + TLS: &dynamic.RouterTLSConfig{}, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:80", }, @@ -1303,14 +1303,14 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "Simple Ingress Route, defaulting to https for servers", paths: []string{"services.yml", "with_https_default.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"foo"}, Service: "default/test.route-6b204d94623b3df4370c", @@ -1318,11 +1318,11 @@ func TestLoadIngressRoutes(t *testing.T) { Priority: 12, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "https://10.10.0.5:443", }, @@ -1340,14 +1340,14 @@ func TestLoadIngressRoutes(t *testing.T) { { desc: "Simple Ingress Route, explicit https scheme", paths: []string{"services.yml", "with_https_scheme.yml"}, - expected: &config.Configuration{ - TLS: &config.TLSConfiguration{}, - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{}, + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "default/test.route-6b204d94623b3df4370c": { EntryPoints: []string{"foo"}, Service: "default/test.route-6b204d94623b3df4370c", @@ -1355,11 +1355,11 @@ func TestLoadIngressRoutes(t *testing.T) { Priority: 12, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "default/test.route-6b204d94623b3df4370c": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "https://10.10.0.7:8443", }, diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/middleware.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/middleware.go index 5cb9c8eb6..eeb4b9d06 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/middleware.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/middleware.go @@ -1,7 +1,7 @@ package v1alpha1 import ( - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -13,7 +13,7 @@ type Middleware struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata"` - Spec config.Middleware `json:"spec"` + Spec dynamic.Middleware `json:"spec"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/provider/kubernetes/ingress/kubernetes.go b/pkg/provider/kubernetes/ingress/kubernetes.go index 16bfc30d1..6be714a28 100644 --- a/pkg/provider/kubernetes/ingress/kubernetes.go +++ b/pkg/provider/kubernetes/ingress/kubernetes.go @@ -14,7 +14,7 @@ import ( "time" "github.com/cenkalti/backoff" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/job" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/safe" @@ -92,7 +92,7 @@ func (p *Provider) Init() error { // Provide allows the k8s provider to provide configurations to traefik // using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { ctxLog := log.With(context.Background(), log.Str(log.ProviderName, "kubernetes")) logger := log.FromContext(ctxLog) // Tell glog (used by client-go) to log into STDERR. Otherwise, we risk @@ -138,7 +138,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P logger.Debugf("Skipping Kubernetes event kind %T", event) } else { p.lastConfiguration.Set(conf) - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "kubernetes", Configuration: conf, } @@ -164,7 +164,7 @@ func checkStringQuoteValidity(value string) error { return err } -func loadService(client Client, namespace string, backend v1beta1.IngressBackend) (*config.Service, error) { +func loadService(client Client, namespace string, backend v1beta1.IngressBackend) (*dynamic.Service, error) { service, exists, err := client.GetService(namespace, backend.ServiceName) if err != nil { return nil, err @@ -174,7 +174,7 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend return nil, errors.New("service not found") } - var servers []config.Server + var servers []dynamic.Server var portName string var portSpec corev1.ServicePort var match bool @@ -193,7 +193,7 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend } if service.Spec.Type == corev1.ServiceTypeExternalName { - servers = append(servers, config.Server{ + servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("http://%s:%d", service.Spec.ExternalName, portSpec.Port), }) } else { @@ -230,29 +230,29 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend } for _, addr := range subset.Addresses { - servers = append(servers, config.Server{ + servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("%s://%s:%d", protocol, addr.IP, port), }) } } } - return &config.Service{ - LoadBalancer: &config.LoadBalancerService{ + return &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ Servers: servers, PassHostHeader: true, }, }, nil } -func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Client) *config.Configuration { - conf := &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, +func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Client) *dynamic.Configuration { + conf := &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, - TCP: &config.TCPConfiguration{}, + TCP: &dynamic.TCPConfiguration{}, } ingresses := client.GetIngresses() @@ -286,7 +286,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl continue } - conf.HTTP.Routers["/"] = &config.Router{ + conf.HTTP.Routers["/"] = &dynamic.Router{ Rule: "PathPrefix(`/`)", Priority: math.MinInt32, Service: "default-backend", @@ -327,7 +327,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl rules = append(rules, "PathPrefix(`"+p.Path+"`)") } - conf.HTTP.Routers[strings.Replace(rule.Host, ".", "-", -1)+p.Path] = &config.Router{ + conf.HTTP.Routers[strings.Replace(rule.Host, ".", "-", -1)+p.Path] = &dynamic.Router{ Rule: strings.Join(rules, " && "), Service: serviceName, } @@ -343,7 +343,7 @@ func (p *Provider) loadConfigurationFromIngresses(ctx context.Context, client Cl certs := getTLSConfig(tlsConfigs) if len(certs) > 0 { - conf.TLS = &config.TLSConfiguration{ + conf.TLS = &dynamic.TLSConfiguration{ Certificates: certs, } } diff --git a/pkg/provider/kubernetes/ingress/kubernetes_test.go b/pkg/provider/kubernetes/ingress/kubernetes_test.go index ffb0e273f..c9d434e2c 100644 --- a/pkg/provider/kubernetes/ingress/kubernetes_test.go +++ b/pkg/provider/kubernetes/ingress/kubernetes_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/provider" "github.com/containous/traefik/pkg/tls" "github.com/stretchr/testify/assert" @@ -23,36 +23,36 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { testCases := []struct { desc string ingressClass string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "Empty ingresses", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with a basic rule on one path", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -68,11 +68,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with two different rules with one path", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -82,11 +82,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -102,11 +102,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress one rule with two paths", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -116,11 +116,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -136,21 +136,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress one rule with one path and one host", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -165,21 +165,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, }, { desc: "Ingress with one host without path", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "example-com": { Rule: "Host(`example.com`)", Service: "testing/example-com/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/example-com/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.11.0.1:80", }, @@ -192,11 +192,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress one rule with one host and two paths", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -206,11 +206,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -226,11 +226,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress Two rules with one host and one path", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -240,11 +240,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -260,11 +260,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with a bad path syntax", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -274,11 +274,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -294,32 +294,32 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with only a bad path syntax", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with a bad host syntax", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-courgette/carotte": { Rule: "Host(`traefik.courgette`) && PathPrefix(`/carotte`)", Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -335,22 +335,22 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with only a bad host syntax", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with two services", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/80", @@ -360,11 +360,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service2/8082", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -375,9 +375,9 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, }, "testing/service2/8082": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.2:8080", }, @@ -393,44 +393,44 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with one service without endpoints subset", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with one service without endpoint", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Single Service Ingress (without any rules)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/": { Rule: "PathPrefix(`/`)", Service: "default-backend", Priority: math.MinInt32, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "default-backend": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -446,21 +446,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with port value in backend and no pod replica", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8089", }, @@ -476,21 +476,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with port name in backend and no pod replica", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/tchouk", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/tchouk": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8089", }, @@ -506,21 +506,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with with port name in backend and 2 pod replica", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/tchouk", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/tchouk": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8089", }, @@ -536,11 +536,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with two paths using same service and different port name", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/tchouk", @@ -550,11 +550,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "testing/service1/carotte", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/tchouk": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8089", }, @@ -565,9 +565,9 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, }, "testing/service1/carotte": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8090", }, @@ -583,11 +583,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "2 ingresses in different namespace with same service name", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/tchouk", @@ -597,11 +597,11 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { Service: "toto/service1/tchouk", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/tchouk": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8089", }, @@ -612,9 +612,9 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, }, "toto/service1/tchouk": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.11.0.1:8089", }, @@ -630,43 +630,43 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with unknown service port name", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with unknown service port", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with service with externalName", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "traefik-tchouk/bar": { Rule: "Host(`traefik.tchouk`) && PathPrefix(`/bar`)", Service: "testing/service1/8080", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/8080": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://traefik.wtf:8080", }, @@ -679,21 +679,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "TLS support", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "example-com": { Rule: "Host(`example.com`)", Service: "testing/example-com/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/example-com/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.11.0.1:80", }, @@ -702,7 +702,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, }, }, - TLS: &config.TLSConfiguration{ + TLS: &dynamic.TLSConfiguration{ Certificates: []*tls.CertAndStores{ { Certificate: tls.Certificate{ @@ -716,21 +716,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with a basic rule on one path with https (port == 443)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/443", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/443": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "https://10.10.0.1:443", }, @@ -746,21 +746,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with a basic rule on one path with https (portname == https)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/8443", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/8443": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "https://10.10.0.1:8443", }, @@ -776,22 +776,22 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with a basic rule on one path with https (portname starts with https)", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, - Routers: map[string]*config.Router{ + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/8443", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/8443": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "https://10.10.0.1:8443", }, @@ -807,22 +807,22 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Double Single Service Ingress", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/": { Rule: "PathPrefix(`/`)", Service: "default-backend", Priority: math.MinInt32, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "default-backend": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.30.0.1:8080", }, @@ -838,21 +838,21 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress with default traefik ingressClass", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{ "/bar": { Rule: "PathPrefix(`/bar`)", Service: "testing/service1/80", }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "testing/service1/80": { - LoadBalancer: &config.LoadBalancerService{ + LoadBalancer: &dynamic.LoadBalancerService{ PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: "http://10.10.0.1:8080", }, @@ -865,48 +865,48 @@ func TestLoadConfigurationFromIngresses(t *testing.T) { }, { desc: "Ingress without provider traefik ingressClass and unknown annotation", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with non matching provider traefik ingressClass and annotation", ingressClass: "tchouk", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with ingressClass without annotation", ingressClass: "tchouk", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, { desc: "Ingress with ingressClass without annotation", ingressClass: "toto", - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{}, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Routers: map[string]*config.Router{}, - Services: map[string]*config.Service{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{}, + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Routers: map[string]*dynamic.Router{}, + Services: map[string]*dynamic.Service{}, }, }, }, diff --git a/pkg/provider/marathon/config.go b/pkg/provider/marathon/config.go index 1624390af..43ce3016d 100644 --- a/pkg/provider/marathon/config.go +++ b/pkg/provider/marathon/config.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/label" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -17,8 +17,8 @@ import ( "github.com/gambol99/go-marathon" ) -func (p *Provider) buildConfiguration(ctx context.Context, applications *marathon.Applications) *config.Configuration { - configurations := make(map[string]*config.Configuration) +func (p *Provider) buildConfiguration(ctx context.Context, applications *marathon.Applications) *dynamic.Configuration { + configurations := make(map[string]*dynamic.Configuration) for _, app := range applications.Apps { ctxApp := log.With(ctx, log.Str("applicationID", app.ID)) @@ -92,23 +92,23 @@ func getServiceName(app marathon.Application) string { return strings.Replace(strings.TrimPrefix(app.ID, "/"), "/", "_", -1) } -func (p *Provider) buildServiceConfiguration(ctx context.Context, app marathon.Application, extraConf configuration, conf *config.HTTPConfiguration) error { +func (p *Provider) buildServiceConfiguration(ctx context.Context, app marathon.Application, extraConf configuration, conf *dynamic.HTTPConfiguration) error { appName := getServiceName(app) appCtx := log.With(ctx, log.Str("ApplicationID", appName)) if len(conf.Services) == 0 { - conf.Services = make(map[string]*config.Service) - lb := &config.LoadBalancerService{} + conf.Services = make(map[string]*dynamic.Service) + lb := &dynamic.LoadBalancerService{} lb.SetDefaults() - conf.Services[appName] = &config.Service{ + conf.Services[appName] = &dynamic.Service{ LoadBalancer: lb, } } for serviceName, service := range conf.Services { - var servers []config.Server + var servers []dynamic.Server - defaultServer := config.Server{} + defaultServer := dynamic.Server{} defaultServer.SetDefaults() if len(service.LoadBalancer.Servers) > 0 { @@ -134,22 +134,22 @@ func (p *Provider) buildServiceConfiguration(ctx context.Context, app marathon.A return nil } -func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, app marathon.Application, extraConf configuration, conf *config.TCPConfiguration) error { +func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, app marathon.Application, extraConf configuration, conf *dynamic.TCPConfiguration) error { appName := getServiceName(app) appCtx := log.With(ctx, log.Str("ApplicationID", appName)) if len(conf.Services) == 0 { - conf.Services = make(map[string]*config.TCPService) - lb := &config.TCPLoadBalancerService{} - conf.Services[appName] = &config.TCPService{ + conf.Services = make(map[string]*dynamic.TCPService) + lb := &dynamic.TCPLoadBalancerService{} + conf.Services[appName] = &dynamic.TCPService{ LoadBalancer: lb, } } for serviceName, service := range conf.Services { - var servers []config.TCPServer + var servers []dynamic.TCPServer - defaultServer := config.TCPServer{} + defaultServer := dynamic.TCPServer{} if len(service.LoadBalancer.Servers) > 0 { defaultServer = service.LoadBalancer.Servers[0] @@ -210,36 +210,36 @@ func (p *Provider) taskFilter(ctx context.Context, task marathon.Task, applicati return true } -func (p *Provider) getTCPServer(app marathon.Application, task marathon.Task, extraConf configuration, defaultServer config.TCPServer) (config.TCPServer, error) { +func (p *Provider) getTCPServer(app marathon.Application, task marathon.Task, extraConf configuration, defaultServer dynamic.TCPServer) (dynamic.TCPServer, error) { host, err := p.getServerHost(task, app, extraConf) if len(host) == 0 { - return config.TCPServer{}, err + return dynamic.TCPServer{}, err } port, err := getPort(task, app, defaultServer.Port) if err != nil { - return config.TCPServer{}, err + return dynamic.TCPServer{}, err } - server := config.TCPServer{ + server := dynamic.TCPServer{ Address: net.JoinHostPort(host, port), } return server, nil } -func (p *Provider) getServer(app marathon.Application, task marathon.Task, extraConf configuration, defaultServer config.Server) (config.Server, error) { +func (p *Provider) getServer(app marathon.Application, task marathon.Task, extraConf configuration, defaultServer dynamic.Server) (dynamic.Server, error) { host, err := p.getServerHost(task, app, extraConf) if len(host) == 0 { - return config.Server{}, err + return dynamic.Server{}, err } port, err := getPort(task, app, defaultServer.Port) if err != nil { - return config.Server{}, err + return dynamic.Server{}, err } - server := config.Server{ + server := dynamic.Server{ URL: fmt.Sprintf("%s://%s", defaultServer.Scheme, net.JoinHostPort(host, port)), } diff --git a/pkg/provider/marathon/config_test.go b/pkg/provider/marathon/config_test.go index 34adeaf4c..83ce1e89a 100644 --- a/pkg/provider/marathon/config_test.go +++ b/pkg/provider/marathon/config_test.go @@ -5,7 +5,7 @@ import ( "math" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/gambol99/go-marathon" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -32,7 +32,7 @@ func TestBuildConfiguration(t *testing.T) { applications *marathon.Applications constraints string defaultRule string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "simple application", @@ -42,22 +42,22 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80), withTasks(localhostTask(taskPorts(80))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "app": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "app": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -76,15 +76,15 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80), withTasks(localhostTask(taskPorts(80), taskState(taskStateStaging))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -96,22 +96,22 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80, 81), withTasks(localhostTask(taskPorts(80, 81))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "app": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "app": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -132,22 +132,22 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.app.middlewares", "Middleware1"), withTasks(localhostTask(taskPorts(80))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", Middlewares: []string{"Middleware1"}, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{ "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", @@ -155,9 +155,9 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - Services: map[string]*config.Service{ - "app": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Services: map[string]*dynamic.Service{ + "app": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -186,22 +186,22 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.Router1.rule", "Host(`app.marathon.localhost`)"), ), ), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "Service1": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "Service1": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:8080", }, @@ -235,22 +235,22 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.Router1.rule", "Host(`app.marathon.localhost`)"), ), ), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "Service1": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "Service1": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:8080", }, @@ -282,13 +282,13 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(8081))), ), ), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "foo": { Service: "foo", Rule: "Host(`foo.marathon.localhost`)", @@ -298,18 +298,18 @@ func TestBuildConfiguration(t *testing.T) { Rule: "Host(`bar.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "foo": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "foo": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:8080", }, }, PassHostHeader: true, }}, - "bar": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + "bar": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:8081", }, @@ -328,23 +328,23 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80), withTasks(localhostTask(taskPorts(80)), localhostTask(taskPorts(81))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -368,22 +368,22 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80))), withLabel("traefik.http.services.Service1.loadbalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "Service1", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ - "Service1": {LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ + "Service1": {LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -405,23 +405,23 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.Router1.rule", "Host(`foo.com`)"), withLabel("traefik.http.routers.Router1.service", "Service1"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -442,17 +442,17 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.routers.Router1.rule", "Host(`foo.com`)"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -461,7 +461,7 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - Routers: map[string]*config.Router{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "app", Rule: "Host(`foo.com`)", @@ -480,23 +480,23 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.Router1.rule", "Host(`foo.com`)"), withLabel("traefik.http.services.Service1.loadbalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -519,18 +519,18 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.services.Service1.loadbalancer.passhostheader", "true"), withLabel("traefik.http.services.Service2.loadbalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -539,8 +539,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "Service2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -567,13 +567,13 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.services.Service1.loadbalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "Service1", Rule: "Host(`app.marathon.localhost`)", @@ -583,8 +583,8 @@ func TestBuildConfiguration(t *testing.T) { Rule: "Host(`app2.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -603,13 +603,13 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.middlewares.Middleware1.maxconn.amount", "42"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", @@ -619,18 +619,18 @@ func TestBuildConfiguration(t *testing.T) { Rule: "Host(`app2.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - MaxConn: &config.MaxConn{ + MaxConn: &dynamic.MaxConn{ Amount: 42, ExtractorFunc: "request.host", }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -639,8 +639,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "app2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -667,13 +667,13 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.middlewares.Middleware1.maxconn.amount", "41"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", @@ -683,11 +683,11 @@ func TestBuildConfiguration(t *testing.T) { Rule: "Host(`app2.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -696,8 +696,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "app2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -724,18 +724,18 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.routers.Router1.rule", "Host(`bar.com`)"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -744,8 +744,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "app2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -774,23 +774,23 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.routers.Router1.rule", "Host(`foo.com`)"), withLabel("traefik.http.services.Service1.LoadBalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -820,18 +820,18 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.http.routers.Router1.rule", "Host(`foo.com`)"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -840,8 +840,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "app2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -862,23 +862,23 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.wrong.label", "tchouk"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -900,23 +900,23 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.services.Service1.LoadBalancer.server.scheme", "h2c"), withLabel("traefik.http.services.Service1.LoadBalancer.server.port", "90"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "Service1", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "h2c://localhost:90", }, @@ -938,18 +938,18 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.http.services.Service1.LoadBalancer.server.port", ""), withLabel("traefik.http.services.Service2.LoadBalancer.server.port", "8080"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -958,8 +958,8 @@ func TestBuildConfiguration(t *testing.T) { }, }, "Service2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:8080", }, @@ -979,15 +979,15 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80, 81), withTasks(localhostTask()), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1000,15 +1000,15 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask()), withLabel("traefik.http.middlewares.Middleware1.basicauth.users", "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/,test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1021,15 +1021,15 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask()), withLabel("traefik.enable", "false"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1042,15 +1042,15 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask()), withLabel("traefik.enable", "false"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1064,15 +1064,15 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.tags", "foo"), )), constraints: `Label("traefik.tags", "bar")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1086,15 +1086,15 @@ func TestBuildConfiguration(t *testing.T) { constraint("rack_id:CLUSTER:rack-1"), )), constraints: `MarathonConstraint("rack_id:CLUSTER:rack-2")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1108,23 +1108,23 @@ func TestBuildConfiguration(t *testing.T) { constraint("rack_id:CLUSTER:rack-1"), )), constraints: `MarathonConstraint("rack_id:CLUSTER:rack-1")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -1146,23 +1146,23 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.tags", "bar"), )), constraints: `Label("traefik.tags", "bar")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "app", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -1183,23 +1183,23 @@ func TestBuildConfiguration(t *testing.T) { appPorts(80, 81), withTasks(localhostTask(taskPorts(80, 81))), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "a_b_app": { Service: "a_b_app", Rule: `Host("app.b.a.marathon.localhost")`, }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "a_b_app": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -1221,19 +1221,19 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.tcp.routers.foo.rule", "HostSNI(`foo.bar`)"), withLabel("traefik.tcp.routers.foo.tls", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "app", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "app": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "localhost:80", }, @@ -1242,10 +1242,10 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1258,13 +1258,13 @@ func TestBuildConfiguration(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), withLabel("traefik.tcp.routers.foo.tls", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{ "app": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "localhost:80", }, @@ -1273,10 +1273,10 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1291,19 +1291,19 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.tcp.routers.foo.tls", "true"), withLabel("traefik.tcp.services.foo.loadbalancer.server.port", "8080"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "localhost:8080", }, @@ -1312,10 +1312,10 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -1331,19 +1331,19 @@ func TestBuildConfiguration(t *testing.T) { withLabel("traefik.tcp.services.foo.loadbalancer.server.port", "8080"), withLabel("traefik.http.services.bar.loadbalancer.passhostheader", "true"), )), - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "localhost:8080", }, @@ -1352,18 +1352,18 @@ func TestBuildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "app": { Service: "bar", Rule: "Host(`app.marathon.localhost`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "bar": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://localhost:80", }, @@ -1452,7 +1452,7 @@ func TestApplicationFilterEnabled(t *testing.T) { func TestGetServer(t *testing.T) { type expected struct { - server config.Server + server dynamic.Server error string } @@ -1461,7 +1461,7 @@ func TestGetServer(t *testing.T) { provider Provider app marathon.Application extraConf configuration - defaultServer config.Server + defaultServer dynamic.Server expected expected }{ { @@ -1469,7 +1469,7 @@ func TestGetServer(t *testing.T) { provider: Provider{}, app: application(), extraConf: configuration{}, - defaultServer: config.Server{}, + defaultServer: dynamic.Server{}, expected: expected{ error: `host is undefined for task "taskID" app ""`, }, @@ -1483,11 +1483,11 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://localhost:80", }, }, @@ -1501,7 +1501,7 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask()), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ @@ -1517,12 +1517,12 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "88", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://localhost:88", }, }, @@ -1536,7 +1536,7 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "aaaa", }, @@ -1553,7 +1553,7 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "-6", }, @@ -1570,12 +1570,12 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "index:1", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://localhost:81", }, }, @@ -1589,7 +1589,7 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "index:2", }, @@ -1606,7 +1606,7 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", Port: "index:aaa", }, @@ -1624,11 +1624,11 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask()), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://localhost:80", }, }, @@ -1643,11 +1643,11 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask()), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://127.0.0.1:88", }, }, @@ -1662,11 +1662,11 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://127.0.0.1:80", }, }, @@ -1681,11 +1681,11 @@ func TestGetServer(t *testing.T) { withTasks(localhostTask(taskPorts(80, 81))), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://localhost:80", }, }, @@ -1710,11 +1710,11 @@ func TestGetServer(t *testing.T) { IPAddressIdx: 0, }, }, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ - server: config.Server{ + server: dynamic.Server{ URL: "http://127.0.0.1:88", }, }, @@ -1738,7 +1738,7 @@ func TestGetServer(t *testing.T) { IPAddressIdx: math.MinInt32, }, }, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ @@ -1764,7 +1764,7 @@ func TestGetServer(t *testing.T) { IPAddressIdx: 3, }, }, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ @@ -1785,7 +1785,7 @@ func TestGetServer(t *testing.T) { )), ), extraConf: configuration{}, - defaultServer: config.Server{ + defaultServer: dynamic.Server{ Scheme: "http", }, expected: expected{ diff --git a/pkg/provider/marathon/marathon.go b/pkg/provider/marathon/marathon.go index b08d7f425..379d61d57 100644 --- a/pkg/provider/marathon/marathon.go +++ b/pkg/provider/marathon/marathon.go @@ -10,7 +10,7 @@ import ( "time" "github.com/cenkalti/backoff" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/job" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -106,7 +106,7 @@ func (p *Provider) Init() error { // Provide allows the marathon provider to provide configurations to traefik // using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { ctx := log.With(context.Background(), log.Str(log.ProviderName, "marathon")) logger := log.FromContext(ctx) @@ -171,7 +171,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P conf := p.getConfigurations(ctx) if conf != nil { - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "marathon", Configuration: conf, } @@ -182,7 +182,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P } configuration := p.getConfigurations(ctx) - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "marathon", Configuration: configuration, } @@ -199,7 +199,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P return nil } -func (p *Provider) getConfigurations(ctx context.Context) *config.Configuration { +func (p *Provider) getConfigurations(ctx context.Context) *dynamic.Configuration { applications, err := p.getApplications() if err != nil { log.FromContext(ctx).Errorf("Failed to retrieve Marathon applications: %v", err) diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index d64b69914..e9c1b64ed 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -1,7 +1,7 @@ package provider import ( - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/safe" ) @@ -9,6 +9,6 @@ import ( type Provider interface { // Provide allows the provider to provide configurations to traefik // using the given configuration channel. - Provide(configurationChan chan<- config.Message, pool *safe.Pool) error + Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error Init() error } diff --git a/pkg/provider/rancher/config.go b/pkg/provider/rancher/config.go index 3eb15ee69..08c48406a 100644 --- a/pkg/provider/rancher/config.go +++ b/pkg/provider/rancher/config.go @@ -7,15 +7,15 @@ import ( "net" "strings" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/label" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" "github.com/containous/traefik/pkg/provider/constraints" ) -func (p *Provider) buildConfiguration(ctx context.Context, services []rancherData) *config.Configuration { - configurations := make(map[string]*config.Configuration) +func (p *Provider) buildConfiguration(ctx context.Context, services []rancherData) *dynamic.Configuration { + configurations := make(map[string]*dynamic.Configuration) for _, service := range services { ctxService := log.With(ctx, log.Str("service", service.Name)) @@ -69,13 +69,13 @@ func (p *Provider) buildConfiguration(ctx context.Context, services []rancherDat return provider.Merge(ctx, configurations) } -func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, service rancherData, configuration *config.TCPConfiguration) error { +func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, service rancherData, configuration *dynamic.TCPConfiguration) error { serviceName := service.Name if len(configuration.Services) == 0 { - configuration.Services = make(map[string]*config.TCPService) - lb := &config.TCPLoadBalancerService{} - configuration.Services[serviceName] = &config.TCPService{ + configuration.Services = make(map[string]*dynamic.TCPService) + lb := &dynamic.TCPLoadBalancerService{} + configuration.Services[serviceName] = &dynamic.TCPService{ LoadBalancer: lb, } } @@ -90,15 +90,15 @@ func (p *Provider) buildTCPServiceConfiguration(ctx context.Context, service ran return nil } -func (p *Provider) buildServiceConfiguration(ctx context.Context, service rancherData, configuration *config.HTTPConfiguration) error { +func (p *Provider) buildServiceConfiguration(ctx context.Context, service rancherData, configuration *dynamic.HTTPConfiguration) error { serviceName := service.Name if len(configuration.Services) == 0 { - configuration.Services = make(map[string]*config.Service) - lb := &config.LoadBalancerService{} + configuration.Services = make(map[string]*dynamic.Service) + lb := &dynamic.LoadBalancerService{} lb.SetDefaults() - configuration.Services[serviceName] = &config.Service{ + configuration.Services[serviceName] = &dynamic.Service{ LoadBalancer: lb, } } @@ -145,7 +145,7 @@ func (p *Provider) keepService(ctx context.Context, service rancherData) bool { return true } -func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBalancer *config.TCPLoadBalancerService) error { +func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBalancer *dynamic.TCPLoadBalancerService) error { log.FromContext(ctx).Debugf("Trying to add servers for service %s \n", service.Name) serverPort := "" @@ -157,9 +157,9 @@ func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBa port := getServicePort(service) if len(loadBalancer.Servers) == 0 { - server := config.TCPServer{} + server := dynamic.TCPServer{} - loadBalancer.Servers = []config.TCPServer{server} + loadBalancer.Servers = []dynamic.TCPServer{server} } if serverPort != "" { @@ -171,9 +171,9 @@ func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBa return errors.New("port is missing") } - var servers []config.TCPServer + var servers []dynamic.TCPServer for _, containerIP := range service.Containers { - servers = append(servers, config.TCPServer{ + servers = append(servers, dynamic.TCPServer{ Address: net.JoinHostPort(containerIP, port), }) } @@ -183,17 +183,17 @@ func (p *Provider) addServerTCP(ctx context.Context, service rancherData, loadBa } -func (p *Provider) addServers(ctx context.Context, service rancherData, loadBalancer *config.LoadBalancerService) error { +func (p *Provider) addServers(ctx context.Context, service rancherData, loadBalancer *dynamic.LoadBalancerService) error { log.FromContext(ctx).Debugf("Trying to add servers for service %s \n", service.Name) serverPort := getLBServerPort(loadBalancer) port := getServicePort(service) if len(loadBalancer.Servers) == 0 { - server := config.Server{} + server := dynamic.Server{} server.SetDefaults() - loadBalancer.Servers = []config.Server{server} + loadBalancer.Servers = []dynamic.Server{server} } if serverPort != "" { @@ -205,9 +205,9 @@ func (p *Provider) addServers(ctx context.Context, service rancherData, loadBala return errors.New("port is missing") } - var servers []config.Server + var servers []dynamic.Server for _, containerIP := range service.Containers { - servers = append(servers, config.Server{ + servers = append(servers, dynamic.Server{ URL: fmt.Sprintf("%s://%s", loadBalancer.Servers[0].Scheme, net.JoinHostPort(containerIP, port)), }) } @@ -216,7 +216,7 @@ func (p *Provider) addServers(ctx context.Context, service rancherData, loadBala return nil } -func getLBServerPort(loadBalancer *config.LoadBalancerService) string { +func getLBServerPort(loadBalancer *dynamic.LoadBalancerService) string { if loadBalancer != nil && len(loadBalancer.Servers) > 0 { return loadBalancer.Servers[0].Port } diff --git a/pkg/provider/rancher/config_test.go b/pkg/provider/rancher/config_test.go index 3cdf36f6e..7a180260c 100644 --- a/pkg/provider/rancher/config_test.go +++ b/pkg/provider/rancher/config_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -14,7 +14,7 @@ func Test_buildConfiguration(t *testing.T) { desc string containers []rancherData constraints string - expected *config.Configuration + expected *dynamic.Configuration }{ { desc: "one service no label", @@ -28,23 +28,23 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -76,13 +76,13 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test1": { Service: "Test1", Rule: "Host(`Test1.traefik.wtf`)", @@ -92,11 +92,11 @@ func Test_buildConfiguration(t *testing.T) { Rule: "Host(`Test2.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -105,8 +105,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Test2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.2:80", }, @@ -138,13 +138,13 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test1": { Service: "Test1", Rule: "Host(`Test1.traefik.wtf`)", @@ -154,11 +154,11 @@ func Test_buildConfiguration(t *testing.T) { Rule: "Host(`Test2.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -170,8 +170,8 @@ func Test_buildConfiguration(t *testing.T) { }, }, "Test2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://128.0.0.1:80", }, @@ -199,23 +199,23 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Service1", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -238,15 +238,15 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -261,15 +261,15 @@ func Test_buildConfiguration(t *testing.T) { State: "upgradefailed", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -287,23 +287,23 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Router1": { Service: "Test", Rule: "Host(`foo.com`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -330,15 +330,15 @@ func Test_buildConfiguration(t *testing.T) { }, }, constraints: `Label("traefik.tags", "bar")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -357,23 +357,23 @@ func Test_buildConfiguration(t *testing.T) { }, }, constraints: `Label("traefik.tags", "foo")`, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -400,22 +400,22 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", Middlewares: []string{"Middleware1"}, }, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "Middleware1": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{ "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", @@ -423,10 +423,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -452,23 +452,23 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{}, + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{}, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Test", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Test": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -495,19 +495,19 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "Test", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "Test": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -516,10 +516,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -537,13 +537,13 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{ "Test": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -552,10 +552,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -574,18 +574,18 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -594,10 +594,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, @@ -618,19 +618,19 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ "foo": { Service: "foo", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{}, + TLS: &dynamic.RouterTCPTLSConfig{}, }, }, - Services: map[string]*config.TCPService{ + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -642,18 +642,18 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "Test": { Service: "Service1", Rule: "Host(`Test.traefik.wtf`)", }, }, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{ + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{ "Service1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:80", }, @@ -682,13 +682,13 @@ func Test_buildConfiguration(t *testing.T) { State: "", }, }, - expected: &config.Configuration{ - TCP: &config.TCPConfiguration{ - Routers: map[string]*config.TCPRouter{}, - Services: map[string]*config.TCPService{ + expected: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{}, + Services: map[string]*dynamic.TCPService{ "foo": { - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:8080", }, @@ -697,10 +697,10 @@ func Test_buildConfiguration(t *testing.T) { }, }, }, - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{}, - Middlewares: map[string]*config.Middleware{}, - Services: map[string]*config.Service{}, + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{}, + Middlewares: map[string]*dynamic.Middleware{}, + Services: map[string]*dynamic.Service{}, }, }, }, diff --git a/pkg/provider/rancher/rancher.go b/pkg/provider/rancher/rancher.go index 9d12ac6bc..8d1c118a5 100644 --- a/pkg/provider/rancher/rancher.go +++ b/pkg/provider/rancher/rancher.go @@ -7,7 +7,7 @@ import ( "time" "github.com/cenkalti/backoff" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/job" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" @@ -94,7 +94,7 @@ func (p *Provider) createClient(ctx context.Context) (rancher.Client, error) { } // Provide allows the rancher provider to provide configurations to traefik using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { pool.GoCtx(func(routineCtx context.Context) { ctxLog := log.With(routineCtx, log.Str(log.ProviderName, "rancher")) logger := log.FromContext(ctxLog) @@ -118,7 +118,7 @@ func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.P logger.Printf("Received Rancher data %+v", rancherData) configuration := p.buildConfiguration(ctxLog, rancherData) - configurationChan <- config.Message{ + configurationChan <- dynamic.Message{ ProviderName: "rancher", Configuration: configuration, } diff --git a/pkg/provider/rest/rest.go b/pkg/provider/rest/rest.go index b7cc8e065..45cf025bf 100644 --- a/pkg/provider/rest/rest.go +++ b/pkg/provider/rest/rest.go @@ -7,7 +7,7 @@ import ( "net/http" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/provider" "github.com/containous/traefik/pkg/safe" @@ -18,7 +18,7 @@ var _ provider.Provider = (*Provider)(nil) // Provider is a provider.Provider implementation that provides a Rest API. type Provider struct { - configurationChan chan<- config.Message + configurationChan chan<- dynamic.Message EntryPoint string `description:"EntryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` } @@ -48,7 +48,7 @@ func (p *Provider) Append(systemRouter *mux.Router) { return } - configuration := new(config.HTTPConfiguration) + configuration := new(dynamic.HTTPConfiguration) body, _ := ioutil.ReadAll(request.Body) if err := json.Unmarshal(body, configuration); err != nil { @@ -57,7 +57,7 @@ func (p *Provider) Append(systemRouter *mux.Router) { return } - p.configurationChan <- config.Message{ProviderName: "rest", Configuration: &config.Configuration{ + p.configurationChan <- dynamic.Message{ProviderName: "rest", Configuration: &dynamic.Configuration{ HTTP: configuration, }} if err := templatesRenderer.JSON(response, http.StatusOK, configuration); err != nil { @@ -68,7 +68,7 @@ func (p *Provider) Append(systemRouter *mux.Router) { // Provide allows the provider to provide configurations to traefik // using the given configuration channel. -func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error { +func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { p.configurationChan = configurationChan return nil } diff --git a/pkg/responsemodifiers/headers.go b/pkg/responsemodifiers/headers.go index 4796b9be4..5c104729a 100644 --- a/pkg/responsemodifiers/headers.go +++ b/pkg/responsemodifiers/headers.go @@ -3,12 +3,12 @@ package responsemodifiers import ( "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/headers" "github.com/unrolled/secure" ) -func buildHeaders(hdrs *config.Headers) func(*http.Response) error { +func buildHeaders(hdrs *dynamic.Headers) func(*http.Response) error { opt := secure.Options{ BrowserXssFilter: hdrs.BrowserXSSFilter, ContentTypeNosniff: hdrs.ContentTypeNosniff, diff --git a/pkg/responsemodifiers/response_modifier.go b/pkg/responsemodifiers/response_modifier.go index bd3199a18..cf30f42cf 100644 --- a/pkg/responsemodifiers/response_modifier.go +++ b/pkg/responsemodifiers/response_modifier.go @@ -4,17 +4,17 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" ) // NewBuilder creates a builder. -func NewBuilder(configs map[string]*config.MiddlewareInfo) *Builder { +func NewBuilder(configs map[string]*dynamic.MiddlewareInfo) *Builder { return &Builder{configs: configs} } // Builder holds builder configuration. type Builder struct { - configs map[string]*config.MiddlewareInfo + configs map[string]*dynamic.MiddlewareInfo } // Build Builds the response modifier. diff --git a/pkg/responsemodifiers/response_modifier_test.go b/pkg/responsemodifiers/response_modifier_test.go index f409d80ce..f407c124c 100644 --- a/pkg/responsemodifiers/response_modifier_test.go +++ b/pkg/responsemodifiers/response_modifier_test.go @@ -6,13 +6,13 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/headers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func stubResponse(_ map[string]*config.Middleware) *http.Response { +func stubResponse(_ map[string]*dynamic.Middleware) *http.Response { return &http.Response{Header: make(http.Header)} } @@ -21,24 +21,24 @@ func TestBuilderBuild(t *testing.T) { desc string middlewares []string // buildResponse is needed because secure use a private context key - buildResponse func(map[string]*config.Middleware) *http.Response - conf map[string]*config.Middleware + buildResponse func(map[string]*dynamic.Middleware) *http.Response + conf map[string]*dynamic.Middleware assertResponse func(*testing.T, *http.Response) }{ { desc: "no configuration", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, - conf: map[string]*config.Middleware{}, + conf: map[string]*dynamic.Middleware{}, assertResponse: func(t *testing.T, resp *http.Response) {}, }, { desc: "one modifier", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, - conf: map[string]*config.Middleware{ + conf: map[string]*dynamic.Middleware{ "foo": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, @@ -52,7 +52,7 @@ func TestBuilderBuild(t *testing.T) { { desc: "secure: one modifier", middlewares: []string{"foo", "bar"}, - buildResponse: func(middlewares map[string]*config.Middleware) *http.Response { + buildResponse: func(middlewares map[string]*dynamic.Middleware) *http.Response { ctx := context.Background() var request *http.Request @@ -69,14 +69,14 @@ func TestBuilderBuild(t *testing.T) { return &http.Response{Header: make(http.Header), Request: request} }, - conf: map[string]*config.Middleware{ + conf: map[string]*dynamic.Middleware{ "foo": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ ReferrerPolicy: "no-referrer", }, }, "bar": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Bar": "bar"}, }, }, @@ -91,14 +91,14 @@ func TestBuilderBuild(t *testing.T) { desc: "two modifiers", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, - conf: map[string]*config.Middleware{ + conf: map[string]*dynamic.Middleware{ "foo": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Bar": "bar"}, }, }, @@ -114,14 +114,14 @@ func TestBuilderBuild(t *testing.T) { desc: "modifier order", middlewares: []string{"foo", "bar"}, buildResponse: stubResponse, - conf: map[string]*config.Middleware{ + conf: map[string]*dynamic.Middleware{ "foo": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "bar"}, }, }, @@ -136,19 +136,19 @@ func TestBuilderBuild(t *testing.T) { desc: "chain", middlewares: []string{"chain"}, buildResponse: stubResponse, - conf: map[string]*config.Middleware{ + conf: map[string]*dynamic.Middleware{ "foo": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "foo"}, }, }, "bar": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomResponseHeaders: map[string]string{"X-Foo": "bar"}, }, }, "chain": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"foo", "bar"}, }, }, @@ -166,8 +166,8 @@ func TestBuilderBuild(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Middlewares: test.conf, }, }) diff --git a/pkg/server/aggregator.go b/pkg/server/aggregator.go index 5d2c25cc9..c00255ec3 100644 --- a/pkg/server/aggregator.go +++ b/pkg/server/aggregator.go @@ -1,24 +1,24 @@ package server import ( - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/server/internal" "github.com/containous/traefik/pkg/tls" ) -func mergeConfiguration(configurations config.Configurations) config.Configuration { - conf := config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: make(map[string]*config.Router), - Middlewares: make(map[string]*config.Middleware), - Services: make(map[string]*config.Service), +func mergeConfiguration(configurations dynamic.Configurations) dynamic.Configuration { + conf := dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: make(map[string]*dynamic.Router), + Middlewares: make(map[string]*dynamic.Middleware), + Services: make(map[string]*dynamic.Service), }, - TCP: &config.TCPConfiguration{ - Routers: make(map[string]*config.TCPRouter), - Services: make(map[string]*config.TCPService), + TCP: &dynamic.TCPConfiguration{ + Routers: make(map[string]*dynamic.TCPRouter), + Services: make(map[string]*dynamic.TCPService), }, - TLS: &config.TLSConfiguration{ + TLS: &dynamic.TLSConfiguration{ Stores: make(map[string]tls.Store), Options: make(map[string]tls.Options), }, diff --git a/pkg/server/aggregator_test.go b/pkg/server/aggregator_test.go index 92733f3e0..98e92166f 100644 --- a/pkg/server/aggregator_test.go +++ b/pkg/server/aggregator_test.go @@ -3,7 +3,7 @@ package server import ( "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/tls" "github.com/stretchr/testify/assert" ) @@ -11,87 +11,87 @@ import ( func TestAggregator(t *testing.T) { testCases := []struct { desc string - given config.Configurations - expected *config.HTTPConfiguration + given dynamic.Configurations + expected *dynamic.HTTPConfiguration }{ { desc: "Nil returns an empty configuration", given: nil, - expected: &config.HTTPConfiguration{ - Routers: make(map[string]*config.Router), - Middlewares: make(map[string]*config.Middleware), - Services: make(map[string]*config.Service), + expected: &dynamic.HTTPConfiguration{ + Routers: make(map[string]*dynamic.Router), + Middlewares: make(map[string]*dynamic.Middleware), + Services: make(map[string]*dynamic.Service), }, }, { desc: "Returns fully qualified elements from a mono-provider configuration map", - given: config.Configurations{ - "provider-1": &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router-1": {}, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "middleware-1": {}, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service-1": {}, }, }, }, }, - expected: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + expected: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router-1@provider-1": {}, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "middleware-1@provider-1": {}, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service-1@provider-1": {}, }, }, }, { desc: "Returns fully qualified elements from a multi-provider configuration map", - given: config.Configurations{ - "provider-1": &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router-1": {}, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "middleware-1": {}, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service-1": {}, }, }, }, - "provider-2": &config.Configuration{ - HTTP: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + "provider-2": &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router-1": {}, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "middleware-1": {}, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service-1": {}, }, }, }, }, - expected: &config.HTTPConfiguration{ - Routers: map[string]*config.Router{ + expected: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ "router-1@provider-1": {}, "router-1@provider-2": {}, }, - Middlewares: map[string]*config.Middleware{ + Middlewares: map[string]*dynamic.Middleware{ "middleware-1@provider-1": {}, "middleware-1@provider-2": {}, }, - Services: map[string]*config.Service{ + Services: map[string]*dynamic.Service{ "service-1@provider-1": {}, "service-1@provider-2": {}, }, @@ -113,7 +113,7 @@ func TestAggregator(t *testing.T) { func TestAggregator_tlsoptions(t *testing.T) { testCases := []struct { desc string - given config.Configurations + given dynamic.Configurations expected map[string]tls.Options }{ { @@ -125,9 +125,9 @@ func TestAggregator_tlsoptions(t *testing.T) { }, { desc: "Returns fully qualified elements from a mono-provider configuration map", - given: config.Configurations{ - "provider-1": &config.Configuration{ - TLS: &config.TLSConfiguration{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS12", @@ -145,9 +145,9 @@ func TestAggregator_tlsoptions(t *testing.T) { }, { desc: "Returns fully qualified elements from a multi-provider configuration map", - given: config.Configurations{ - "provider-1": &config.Configuration{ - TLS: &config.TLSConfiguration{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS13", @@ -155,8 +155,8 @@ func TestAggregator_tlsoptions(t *testing.T) { }, }, }, - "provider-2": &config.Configuration{ - TLS: &config.TLSConfiguration{ + "provider-2": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS12", @@ -177,9 +177,9 @@ func TestAggregator_tlsoptions(t *testing.T) { }, { desc: "Create a valid default tls option when appears only in one provider", - given: config.Configurations{ - "provider-1": &config.Configuration{ - TLS: &config.TLSConfiguration{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS13", @@ -190,8 +190,8 @@ func TestAggregator_tlsoptions(t *testing.T) { }, }, }, - "provider-2": &config.Configuration{ - TLS: &config.TLSConfiguration{ + "provider-2": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS12", @@ -214,9 +214,9 @@ func TestAggregator_tlsoptions(t *testing.T) { }, { desc: "No default tls option if it is defined in multiple providers", - given: config.Configurations{ - "provider-1": &config.Configuration{ - TLS: &config.TLSConfiguration{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS12", @@ -227,8 +227,8 @@ func TestAggregator_tlsoptions(t *testing.T) { }, }, }, - "provider-2": &config.Configuration{ - TLS: &config.TLSConfiguration{ + "provider-2": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS13", @@ -251,9 +251,9 @@ func TestAggregator_tlsoptions(t *testing.T) { }, { desc: "Create a default TLS Options configuration if none was provided", - given: config.Configurations{ - "provider-1": &config.Configuration{ - TLS: &config.TLSConfiguration{ + given: dynamic.Configurations{ + "provider-1": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS12", @@ -261,8 +261,8 @@ func TestAggregator_tlsoptions(t *testing.T) { }, }, }, - "provider-2": &config.Configuration{ - TLS: &config.TLSConfiguration{ + "provider-2": &dynamic.Configuration{ + TLS: &dynamic.TLSConfiguration{ Options: map[string]tls.Options{ "foo": { MinVersion: "VersionTLS13", diff --git a/pkg/server/middleware/middlewares.go b/pkg/server/middleware/middlewares.go index 10cb83d46..7d2609623 100644 --- a/pkg/server/middleware/middlewares.go +++ b/pkg/server/middleware/middlewares.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/addprefix" "github.com/containous/traefik/pkg/middlewares/auth" "github.com/containous/traefik/pkg/middlewares/buffering" @@ -39,7 +39,7 @@ const ( // Builder the middleware builder type Builder struct { - configs map[string]*config.MiddlewareInfo + configs map[string]*dynamic.MiddlewareInfo serviceBuilder serviceBuilder } @@ -48,7 +48,7 @@ type serviceBuilder interface { } // NewBuilder creates a new Builder -func NewBuilder(configs map[string]*config.MiddlewareInfo, serviceBuilder serviceBuilder) *Builder { +func NewBuilder(configs map[string]*dynamic.MiddlewareInfo, serviceBuilder serviceBuilder) *Builder { return &Builder{configs: configs, serviceBuilder: serviceBuilder} } diff --git a/pkg/server/middleware/middlewares_test.go b/pkg/server/middleware/middlewares_test.go index 0de9b0ef5..ead213a69 100644 --- a/pkg/server/middleware/middlewares_test.go +++ b/pkg/server/middleware/middlewares_test.go @@ -7,14 +7,14 @@ import ( "net/http/httptest" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/server/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestBuilder_BuildChainNilConfig(t *testing.T) { - testConfig := map[string]*config.MiddlewareInfo{ + testConfig := map[string]*dynamic.MiddlewareInfo{ "empty": {}, } middlewaresBuilder := NewBuilder(testConfig, nil) @@ -25,7 +25,7 @@ func TestBuilder_BuildChainNilConfig(t *testing.T) { } func TestBuilder_BuildChainNonExistentChain(t *testing.T) { - testConfig := map[string]*config.MiddlewareInfo{ + testConfig := map[string]*dynamic.MiddlewareInfo{ "foobar": {}, } middlewaresBuilder := NewBuilder(testConfig, nil) @@ -39,7 +39,7 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { testCases := []struct { desc string buildChain []string - configuration map[string]*config.Middleware + configuration map[string]*dynamic.Middleware expected map[string]string contextProvider string expectedError error @@ -47,9 +47,9 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Simple middleware", buildChain: []string{"middleware-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1": "value-middleware-1"}, }, }, @@ -59,14 +59,14 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Middleware that references a chain", buildChain: []string{"middleware-chain-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1": "value-middleware-1"}, }, }, "middleware-chain-1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"middleware-1"}, }, }, @@ -76,9 +76,9 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Should suffix the middlewareName with the provider in the context", buildChain: []string{"middleware-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1@provider-1": "value-middleware-1"}, }, }, @@ -89,9 +89,9 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Should not suffix a qualified middlewareName with the provider in the context", buildChain: []string{"middleware-1@provider-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1@provider-1": "value-middleware-1"}, }, }, @@ -102,14 +102,14 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Should be context aware if a chain references another middleware", buildChain: []string{"middleware-chain-1@provider-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1": "value-middleware-1"}, }, }, "middleware-chain-1@provider-1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"middleware-1"}, }, }, @@ -119,29 +119,29 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Should handle nested chains with different context", buildChain: []string{"middleware-chain-1@provider-1", "middleware-chain-1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "middleware-1@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-1": "value-middleware-1"}, }, }, "middleware-2@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"middleware-2": "value-middleware-2"}, }, }, "middleware-chain-1@provider-1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"middleware-1"}, }, }, "middleware-chain-2@provider-1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"middleware-2"}, }, }, "middleware-chain-1@provider-2": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"middleware-2@provider-1", "middleware-chain-2@provider-1"}, }, }, @@ -152,22 +152,22 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Detects recursion in Middleware chain", buildChain: []string{"m1"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "ok": { - Retry: &config.Retry{}, + Retry: &dynamic.Retry{}, }, "m1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m2"}, }, }, "m2": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"ok", "m3"}, }, }, "m3": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m1"}, }, }, @@ -177,22 +177,22 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Detects recursion in Middleware chain", buildChain: []string{"m1@provider"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "ok@provider2": { - Retry: &config.Retry{}, + Retry: &dynamic.Retry{}, }, "m1@provider": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m2@provider2"}, }, }, "m2@provider2": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"ok", "m3@provider"}, }, }, "m3@provider": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m1"}, }, }, @@ -201,12 +201,12 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { }, { buildChain: []string{"ok", "m0"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "ok": { - Retry: &config.Retry{}, + Retry: &dynamic.Retry{}, }, "m0": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m0"}, }, }, @@ -216,24 +216,24 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "Detects MiddlewareChain that references a Chain that references a Chain with a missing middleware", buildChain: []string{"m0"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "m0": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m1"}, }, }, "m1": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m2"}, }, }, "m2": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m3"}, }, }, "m3": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m2"}, }, }, @@ -243,9 +243,9 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { { desc: "--", buildChain: []string{"m0"}, - configuration: map[string]*config.Middleware{ + configuration: map[string]*dynamic.Middleware{ "m0": { - Chain: &config.Chain{ + Chain: &dynamic.Chain{ Middlewares: []string{"m0"}, }, }, @@ -264,8 +264,8 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { ctx = internal.AddProviderInContext(ctx, "foobar@"+test.contextProvider) } - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Middlewares: test.configuration, }, }) @@ -292,31 +292,31 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { } func TestBuilder_buildConstructor(t *testing.T) { - testConfig := map[string]*config.Middleware{ + testConfig := map[string]*dynamic.Middleware{ "cb-empty": { - CircuitBreaker: &config.CircuitBreaker{ + CircuitBreaker: &dynamic.CircuitBreaker{ Expression: "", }, }, "cb-foo": { - CircuitBreaker: &config.CircuitBreaker{ + CircuitBreaker: &dynamic.CircuitBreaker{ Expression: "NetworkErrorRatio() > 0.5", }, }, "ap-empty": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "", }, }, "ap-foo": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "foo/", }, }, } - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Middlewares: testConfig, }, }) diff --git a/pkg/server/router/route_appender_aggregator.go b/pkg/server/router/route_appender_aggregator.go index fcea9aec7..5f1423546 100644 --- a/pkg/server/router/route_appender_aggregator.go +++ b/pkg/server/router/route_appender_aggregator.go @@ -6,7 +6,7 @@ import ( "github.com/containous/alice" "github.com/containous/mux" "github.com/containous/traefik/pkg/api" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/metrics" @@ -20,7 +20,7 @@ type chainBuilder interface { // NewRouteAppenderAggregator Creates a new RouteAppenderAggregator func NewRouteAppenderAggregator(ctx context.Context, chainBuilder chainBuilder, conf static.Configuration, - entryPointName string, runtimeConfiguration *config.RuntimeConfiguration) *RouteAppenderAggregator { + entryPointName string, runtimeConfiguration *dynamic.RuntimeConfiguration) *RouteAppenderAggregator { aggregator := &RouteAppenderAggregator{} if conf.Providers != nil && conf.Providers.Rest != nil { diff --git a/pkg/server/router/route_appender_factory.go b/pkg/server/router/route_appender_factory.go index eec0b36b5..ea44a4e21 100644 --- a/pkg/server/router/route_appender_factory.go +++ b/pkg/server/router/route_appender_factory.go @@ -3,7 +3,7 @@ package router import ( "context" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/provider/acme" "github.com/containous/traefik/pkg/server/middleware" @@ -27,7 +27,7 @@ type RouteAppenderFactory struct { } // NewAppender Creates a new RouteAppender -func (r *RouteAppenderFactory) NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *config.RuntimeConfiguration) types.RouteAppender { +func (r *RouteAppenderFactory) NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *dynamic.RuntimeConfiguration) types.RouteAppender { aggregator := NewRouteAppenderAggregator(ctx, middlewaresBuilder, r.staticConfiguration, r.entryPointName, runtimeConfiguration) if r.acmeProvider != nil && r.acmeProvider.HTTPChallenge != nil && r.acmeProvider.HTTPChallenge.EntryPoint == r.entryPointName { diff --git a/pkg/server/router/router.go b/pkg/server/router/router.go index 51f6aae14..104e9b42f 100644 --- a/pkg/server/router/router.go +++ b/pkg/server/router/router.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/recovery" @@ -22,7 +22,7 @@ const ( ) // NewManager Creates a new Manager -func NewManager(conf *config.RuntimeConfiguration, +func NewManager(conf *dynamic.RuntimeConfiguration, serviceManager *service.Manager, middlewaresBuilder *middleware.Builder, modifierBuilder *responsemodifiers.Builder, @@ -42,15 +42,15 @@ type Manager struct { serviceManager *service.Manager middlewaresBuilder *middleware.Builder modifierBuilder *responsemodifiers.Builder - conf *config.RuntimeConfiguration + conf *dynamic.RuntimeConfiguration } -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*config.RouterInfo { +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*dynamic.RouterInfo { if m.conf != nil { return m.conf.GetRoutersByEntrypoints(ctx, entryPoints, tls) } - return make(map[string]map[string]*config.RouterInfo) + return make(map[string]map[string]*dynamic.RouterInfo) } // BuildHandlers Builds handler for all entry points @@ -83,7 +83,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string, t return entryPointHandlers } -func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*config.RouterInfo) (http.Handler, error) { +func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*dynamic.RouterInfo) (http.Handler, error) { router, err := rules.NewRouter() if err != nil { return nil, err @@ -118,7 +118,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string return chain.Then(router) } -func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, routerConfig *config.RouterInfo) (http.Handler, error) { +func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, routerConfig *dynamic.RouterInfo) (http.Handler, error) { if handler, ok := m.routerHandlers[routerName]; ok { return handler, nil } @@ -141,7 +141,7 @@ func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, rou return m.routerHandlers[routerName], nil } -func (m *Manager) buildHTTPHandler(ctx context.Context, router *config.RouterInfo, routerName string) (http.Handler, error) { +func (m *Manager) buildHTTPHandler(ctx context.Context, router *dynamic.RouterInfo, routerName string) (http.Handler, error) { qualifiedNames := make([]string, len(router.Middlewares)) for i, name := range router.Middlewares { qualifiedNames[i] = internal.GetQualifiedName(ctx, name) diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index 6c17df155..8e110008f 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/requestdecorator" "github.com/containous/traefik/pkg/responsemodifiers" @@ -30,25 +30,25 @@ func TestRouterManager_Get(t *testing.T) { testCases := []struct { desc string - routersConfig map[string]*config.Router - serviceConfig map[string]*config.Service - middlewaresConfig map[string]*config.Middleware + routersConfig map[string]*dynamic.Router + serviceConfig map[string]*dynamic.Service + middlewaresConfig map[string]*dynamic.Middleware entryPoints []string expected ExpectedResult }{ { desc: "no middleware", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -61,14 +61,14 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "no load balancer", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": {}, }, entryPoints: []string{"web"}, @@ -76,16 +76,16 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "no middleware, default entry point", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { Service: "foo-service", Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -98,17 +98,17 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "no middleware, no matching", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`bar.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -121,7 +121,7 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "middleware: headers > auth", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Middlewares: []string{"headers-middle", "auth-middle"}, @@ -129,10 +129,10 @@ func TestRouterManager_Get(t *testing.T) { Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -140,14 +140,14 @@ func TestRouterManager_Get(t *testing.T) { }, }, }, - middlewaresConfig: map[string]*config.Middleware{ + middlewaresConfig: map[string]*dynamic.Middleware{ "auth-middle": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"toto:titi"}, }, }, "headers-middle": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"X-Apero": "beer"}, }, }, @@ -162,7 +162,7 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "middleware: auth > header", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Middlewares: []string{"auth-middle", "headers-middle"}, @@ -170,10 +170,10 @@ func TestRouterManager_Get(t *testing.T) { Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -181,14 +181,14 @@ func TestRouterManager_Get(t *testing.T) { }, }, }, - middlewaresConfig: map[string]*config.Middleware{ + middlewaresConfig: map[string]*dynamic.Middleware{ "auth-middle": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"toto:titi"}, }, }, "headers-middle": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"X-Apero": "beer"}, }, }, @@ -203,17 +203,17 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "no middleware with provider name", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo@provider-1": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service@provider-1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -226,17 +226,17 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "no middleware with specified provider name", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo@provider-1": { EntryPoints: []string{"web"}, Service: "foo-service@provider-2", Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service@provider-2": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -249,7 +249,7 @@ func TestRouterManager_Get(t *testing.T) { }, { desc: "middleware: chain with provider name", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo@provider-1": { EntryPoints: []string{"web"}, Middlewares: []string{"chain-middle@provider-2", "headers-middle"}, @@ -257,10 +257,10 @@ func TestRouterManager_Get(t *testing.T) { Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service@provider-1": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -268,17 +268,17 @@ func TestRouterManager_Get(t *testing.T) { }, }, }, - middlewaresConfig: map[string]*config.Middleware{ + middlewaresConfig: map[string]*dynamic.Middleware{ "chain-middle@provider-2": { - Chain: &config.Chain{Middlewares: []string{"auth-middle"}}, + Chain: &dynamic.Chain{Middlewares: []string{"auth-middle"}}, }, "auth-middle@provider-2": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"toto:titi"}, }, }, "headers-middle@provider-1": { - Headers: &config.Headers{ + Headers: &dynamic.Headers{ CustomRequestHeaders: map[string]string{"X-Apero": "beer"}, }, }, @@ -298,8 +298,8 @@ func TestRouterManager_Get(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routersConfig, Middlewares: test.middlewaresConfig, @@ -332,15 +332,15 @@ func TestAccessLog(t *testing.T) { testCases := []struct { desc string - routersConfig map[string]*config.Router - serviceConfig map[string]*config.Service - middlewaresConfig map[string]*config.Middleware + routersConfig map[string]*dynamic.Router + serviceConfig map[string]*dynamic.Service + middlewaresConfig map[string]*dynamic.Middleware entryPoints []string expected string }{ { desc: "apply routerName in accesslog (first match)", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -352,10 +352,10 @@ func TestAccessLog(t *testing.T) { Rule: "Host(`bar.foo`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -368,7 +368,7 @@ func TestAccessLog(t *testing.T) { }, { desc: "apply routerName in accesslog (second match)", - routersConfig: map[string]*config.Router{ + routersConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -380,10 +380,10 @@ func TestAccessLog(t *testing.T) { Rule: "Host(`foo.bar`)", }, }, - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -399,8 +399,8 @@ func TestAccessLog(t *testing.T) { for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routersConfig, Middlewares: test.middlewaresConfig, @@ -438,17 +438,17 @@ func TestAccessLog(t *testing.T) { func TestRuntimeConfiguration(t *testing.T) { testCases := []struct { desc string - serviceConfig map[string]*config.Service - routerConfig map[string]*config.Router - middlewareConfig map[string]*config.Middleware + serviceConfig map[string]*dynamic.Service + routerConfig map[string]*dynamic.Router + middlewareConfig map[string]*dynamic.Middleware expectedError int }{ { desc: "No error", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1:8085", }, @@ -456,14 +456,14 @@ func TestRuntimeConfiguration(t *testing.T) { URL: "http://127.0.0.1:8086", }, }, - HealthCheck: &config.HealthCheck{ + HealthCheck: &dynamic.HealthCheck{ Interval: "500ms", Path: "/health", }, }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -479,10 +479,10 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "One router with wrong rule", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -490,7 +490,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -506,10 +506,10 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "All router with wrong rule", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -517,7 +517,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -533,10 +533,10 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with unknown service", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -544,7 +544,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "wrong-service", @@ -560,12 +560,12 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with broken service", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { LoadBalancer: nil, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "bar": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -576,10 +576,10 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with middleware", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -587,19 +587,19 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - middlewareConfig: map[string]*config.Middleware{ + middlewareConfig: map[string]*dynamic.Middleware{ "auth": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, "addPrefixTest": { - AddPrefix: &config.AddPrefix{ + AddPrefix: &dynamic.AddPrefix{ Prefix: "/toto", }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "bar": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -616,10 +616,10 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with unknown middleware", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -627,14 +627,14 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - middlewareConfig: map[string]*config.Middleware{ + middlewareConfig: map[string]*dynamic.Middleware{ "auth": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"admin:admin"}, }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "bar": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -647,10 +647,10 @@ func TestRuntimeConfiguration(t *testing.T) { { desc: "Router with broken middleware", - serviceConfig: map[string]*config.Service{ + serviceConfig: map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://127.0.0.1", }, @@ -658,14 +658,14 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - middlewareConfig: map[string]*config.Middleware{ + middlewareConfig: map[string]*dynamic.Middleware{ "auth": { - BasicAuth: &config.BasicAuth{ + BasicAuth: &dynamic.BasicAuth{ Users: []string{"foo"}, }, }, }, - routerConfig: map[string]*config.Router{ + routerConfig: map[string]*dynamic.Router{ "bar": { EntryPoints: []string{"web"}, Service: "foo-service", @@ -685,8 +685,8 @@ func TestRuntimeConfiguration(t *testing.T) { entryPoints := []string{"web"} - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routerConfig, Middlewares: test.middlewareConfig, @@ -694,7 +694,7 @@ func TestRuntimeConfiguration(t *testing.T) { }) serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) - responseModifierFactory := responsemodifiers.NewBuilder(map[string]*config.MiddlewareInfo{}) + responseModifierFactory := responsemodifiers.NewBuilder(map[string]*dynamic.MiddlewareInfo{}) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) _ = routerManager.BuildHandlers(context.Background(), entryPoints, false) @@ -739,17 +739,17 @@ func BenchmarkRouterServe(b *testing.B) { StatusCode: 200, Body: ioutil.NopCloser(strings.NewReader("")), } - routersConfig := map[string]*config.Router{ + routersConfig := map[string]*dynamic.Router{ "foo": { EntryPoints: []string{"web"}, Service: "foo-service", Rule: "Host(`foo.bar`) && Path(`/`)", }, } - serviceConfig := map[string]*config.Service{ + serviceConfig := map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server.URL, }, @@ -759,11 +759,11 @@ func BenchmarkRouterServe(b *testing.B) { } entryPoints := []string{"web"} - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Services: serviceConfig, Routers: routersConfig, - Middlewares: map[string]*config.Middleware{}, + Middlewares: map[string]*dynamic.Middleware{}, }, }) serviceManager := service.NewManager(rtConf.Services, &staticTransport{res}) @@ -790,10 +790,10 @@ func BenchmarkService(b *testing.B) { Body: ioutil.NopCloser(strings.NewReader("")), } - serviceConfig := map[string]*config.Service{ + serviceConfig := map[string]*dynamic.Service{ "foo-service": { - LoadBalancer: &config.LoadBalancerService{ - Servers: []config.Server{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "tchouck", }, @@ -802,8 +802,8 @@ func BenchmarkService(b *testing.B) { }, } - rtConf := config.NewRuntimeConfig(config.Configuration{ - HTTP: &config.HTTPConfiguration{ + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ Services: serviceConfig, }, }) diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index 26ed3d096..fba89d2c6 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/rules" "github.com/containous/traefik/pkg/server/internal" @@ -16,7 +16,7 @@ import ( ) // NewManager Creates a new Manager -func NewManager(conf *config.RuntimeConfiguration, +func NewManager(conf *dynamic.RuntimeConfiguration, serviceManager *tcpservice.Manager, httpHandlers map[string]http.Handler, httpsHandlers map[string]http.Handler, @@ -37,23 +37,23 @@ type Manager struct { httpHandlers map[string]http.Handler httpsHandlers map[string]http.Handler tlsManager *traefiktls.Manager - conf *config.RuntimeConfiguration + conf *dynamic.RuntimeConfiguration } -func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*config.TCPRouterInfo { +func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*dynamic.TCPRouterInfo { if m.conf != nil { return m.conf.GetTCPRoutersByEntrypoints(ctx, entryPoints) } - return make(map[string]map[string]*config.TCPRouterInfo) + return make(map[string]map[string]*dynamic.TCPRouterInfo) } -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*config.RouterInfo { +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*dynamic.RouterInfo { if m.conf != nil { return m.conf.GetRoutersByEntrypoints(ctx, entryPoints, tls) } - return make(map[string]map[string]*config.RouterInfo) + return make(map[string]map[string]*dynamic.RouterInfo) } // BuildHandlers builds the handlers for the given entrypoints @@ -79,7 +79,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m return entryPointHandlers } -func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*config.TCPRouterInfo, configsHTTP map[string]*config.RouterInfo, handlerHTTP http.Handler, handlerHTTPS http.Handler) (*tcp.Router, error) { +func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*dynamic.TCPRouterInfo, configsHTTP map[string]*dynamic.RouterInfo, handlerHTTP http.Handler, handlerHTTPS http.Handler) (*tcp.Router, error) { router := &tcp.Router{} router.HTTPHandler(handlerHTTP) const defaultTLSConfigName = "default" diff --git a/pkg/server/router/tcp/router_test.go b/pkg/server/router/tcp/router_test.go index e65e549e2..b2320f9e0 100644 --- a/pkg/server/router/tcp/router_test.go +++ b/pkg/server/router/tcp/router_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/server/service/tcp" "github.com/containous/traefik/pkg/tls" "github.com/stretchr/testify/assert" @@ -13,17 +13,17 @@ import ( func TestRuntimeConfiguration(t *testing.T) { testCases := []struct { desc string - serviceConfig map[string]*config.TCPServiceInfo - routerConfig map[string]*config.TCPRouterInfo + serviceConfig map[string]*dynamic.TCPServiceInfo + routerConfig map[string]*dynamic.TCPRouterInfo expectedError int }{ { desc: "No error", - serviceConfig: map[string]*config.TCPServiceInfo{ + serviceConfig: map[string]*dynamic.TCPServiceInfo{ "foo-service": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Port: "8085", Address: "127.0.0.1:8085", @@ -37,25 +37,25 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.TCPRouterInfo{ + routerConfig: map[string]*dynamic.TCPRouterInfo{ "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "HostSNI(`bar.foo`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "foo", }, }, }, "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "HostSNI(`foo.bar`)", - TLS: &config.RouterTCPTLSConfig{ + TLS: &dynamic.RouterTCPTLSConfig{ Passthrough: false, Options: "bar", }, @@ -66,11 +66,11 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "One router with wrong rule", - serviceConfig: map[string]*config.TCPServiceInfo{ + serviceConfig: map[string]*dynamic.TCPServiceInfo{ "foo-service": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -79,9 +79,9 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.TCPRouterInfo{ + routerConfig: map[string]*dynamic.TCPRouterInfo{ "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "WrongRule(`bar.foo`)", @@ -89,7 +89,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "HostSNI(`foo.bar`)", @@ -100,11 +100,11 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "All router with wrong rule", - serviceConfig: map[string]*config.TCPServiceInfo{ + serviceConfig: map[string]*dynamic.TCPServiceInfo{ "foo-service": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -113,16 +113,16 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.TCPRouterInfo{ + routerConfig: map[string]*dynamic.TCPRouterInfo{ "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "WrongRule(`bar.foo`)", }, }, "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "WrongRule(`foo.bar`)", @@ -133,11 +133,11 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with unknown service", - serviceConfig: map[string]*config.TCPServiceInfo{ + serviceConfig: map[string]*dynamic.TCPServiceInfo{ "foo-service": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "127.0.0.1:80", }, @@ -146,16 +146,16 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*config.TCPRouterInfo{ + routerConfig: map[string]*dynamic.TCPRouterInfo{ "foo": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "wrong-service", Rule: "HostSNI(`bar.foo`)", }, }, "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", @@ -167,16 +167,16 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with broken service", - serviceConfig: map[string]*config.TCPServiceInfo{ + serviceConfig: map[string]*dynamic.TCPServiceInfo{ "foo-service": { - TCPService: &config.TCPService{ + TCPService: &dynamic.TCPService{ LoadBalancer: nil, }, }, }, - routerConfig: map[string]*config.TCPRouterInfo{ + routerConfig: map[string]*dynamic.TCPRouterInfo{ "bar": { - TCPRouter: &config.TCPRouter{ + TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, Service: "foo-service", Rule: "HostSNI(`foo.bar`)", @@ -195,7 +195,7 @@ func TestRuntimeConfiguration(t *testing.T) { entryPoints := []string{"web"} - conf := &config.RuntimeConfiguration{ + conf := &dynamic.RuntimeConfiguration{ TCPServices: test.serviceConfig, TCPRouters: test.routerConfig, } diff --git a/pkg/server/server.go b/pkg/server/server.go index c84f1c84a..0feadb30f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/metrics" @@ -27,19 +27,19 @@ import ( // Server is the reverse-proxy/load-balancer engine type Server struct { entryPointsTCP TCPEntryPoints - configurationChan chan config.Message - configurationValidatedChan chan config.Message + configurationChan chan dynamic.Message + configurationValidatedChan chan dynamic.Message signals chan os.Signal stopChan chan bool currentConfigurations safe.Safe - providerConfigUpdateMap map[string]chan config.Message + providerConfigUpdateMap map[string]chan dynamic.Message accessLoggerMiddleware *accesslog.Handler tracer *tracing.Tracing routinesPool *safe.Pool defaultRoundTripper http.RoundTripper metricsRegistry metrics.Registry provider provider.Provider - configurationListeners []func(config.Configuration) + configurationListeners []func(dynamic.Configuration) requestDecorator *requestdecorator.RequestDecorator providersThrottleDuration time.Duration tlsManager *tls.Manager @@ -47,7 +47,7 @@ type Server struct { // RouteAppenderFactory the route appender factory interface type RouteAppenderFactory interface { - NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *config.RuntimeConfiguration) types.RouteAppender + NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *dynamic.RuntimeConfiguration) types.RouteAppender } func setupTracing(conf *static.Tracing) tracing.Backend { @@ -104,14 +104,14 @@ func NewServer(staticConfiguration static.Configuration, provider provider.Provi server.provider = provider server.entryPointsTCP = entryPoints - server.configurationChan = make(chan config.Message, 100) - server.configurationValidatedChan = make(chan config.Message, 100) + server.configurationChan = make(chan dynamic.Message, 100) + server.configurationValidatedChan = make(chan dynamic.Message, 100) server.signals = make(chan os.Signal, 1) server.stopChan = make(chan bool, 1) server.configureSignals() - currentConfigurations := make(config.Configurations) + currentConfigurations := make(dynamic.Configurations) server.currentConfigurations.Set(currentConfigurations) - server.providerConfigUpdateMap = make(map[string]chan config.Message) + server.providerConfigUpdateMap = make(map[string]chan dynamic.Message) server.tlsManager = tlsManager if staticConfiguration.Providers != nil { @@ -236,7 +236,7 @@ func (s *Server) Close() { func (s *Server) startTCPServers() { // Use an empty configuration in order to initialize the default handlers with internal routes - routers := s.loadConfigurationTCP(config.Configurations{}) + routers := s.loadConfigurationTCP(dynamic.Configurations{}) for entryPointName, router := range routers { s.entryPointsTCP[entryPointName].switchRouter(router) } @@ -266,9 +266,9 @@ func (s *Server) listenProviders(stop chan bool) { } // AddListener adds a new listener function used when new configuration is provided -func (s *Server) AddListener(listener func(config.Configuration)) { +func (s *Server) AddListener(listener func(dynamic.Configuration)) { if s.configurationListeners == nil { - s.configurationListeners = make([]func(config.Configuration), 0) + s.configurationListeners = make([]func(dynamic.Configuration), 0) } s.configurationListeners = append(s.configurationListeners, listener) } diff --git a/pkg/server/server_configuration.go b/pkg/server/server_configuration.go index eb78e4023..c0aa203ac 100644 --- a/pkg/server/server_configuration.go +++ b/pkg/server/server_configuration.go @@ -9,7 +9,7 @@ import ( "github.com/containous/alice" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/requestdecorator" @@ -26,8 +26,8 @@ import ( ) // loadConfiguration manages dynamically routers, middlewares, servers and TLS configurations -func (s *Server) loadConfiguration(configMsg config.Message) { - currentConfigurations := s.currentConfigurations.Get().(config.Configurations) +func (s *Server) loadConfiguration(configMsg dynamic.Message) { + currentConfigurations := s.currentConfigurations.Get().(dynamic.Configurations) // Copy configurations to new map so we don't change current if LoadConfig fails newConfigurations := currentConfigurations.DeepCopy() @@ -53,7 +53,7 @@ func (s *Server) loadConfiguration(configMsg config.Message) { // loadConfigurationTCP returns a new gorilla.mux Route from the specified global configuration and the dynamic // provider configurations. -func (s *Server) loadConfigurationTCP(configurations config.Configurations) map[string]*tcpCore.Router { +func (s *Server) loadConfigurationTCP(configurations dynamic.Configurations) map[string]*tcpCore.Router { ctx := context.TODO() var entryPoints []string @@ -65,7 +65,7 @@ func (s *Server) loadConfigurationTCP(configurations config.Configurations) map[ s.tlsManager.UpdateConfigs(conf.TLS.Stores, conf.TLS.Options, conf.TLS.Certificates) - rtConf := config.NewRuntimeConfig(conf) + rtConf := dynamic.NewRuntimeConfig(conf) handlersNonTLS, handlersTLS := s.createHTTPHandlers(ctx, rtConf, entryPoints) routersTCP := s.createTCPRouters(ctx, rtConf, entryPoints, handlersNonTLS, handlersTLS) rtConf.PopulateUsedBy() @@ -74,7 +74,7 @@ func (s *Server) loadConfigurationTCP(configurations config.Configurations) map[ } // the given configuration must not be nil. its fields will get mutated. -func (s *Server) createTCPRouters(ctx context.Context, configuration *config.RuntimeConfiguration, entryPoints []string, handlers map[string]http.Handler, handlersTLS map[string]http.Handler) map[string]*tcpCore.Router { +func (s *Server) createTCPRouters(ctx context.Context, configuration *dynamic.RuntimeConfiguration, entryPoints []string, handlers map[string]http.Handler, handlersTLS map[string]http.Handler) map[string]*tcpCore.Router { if configuration == nil { return make(map[string]*tcpCore.Router) } @@ -87,7 +87,7 @@ func (s *Server) createTCPRouters(ctx context.Context, configuration *config.Run } // createHTTPHandlers returns, for the given configuration and entryPoints, the HTTP handlers for non-TLS connections, and for the TLS ones. the given configuration must not be nil. its fields will get mutated. -func (s *Server) createHTTPHandlers(ctx context.Context, configuration *config.RuntimeConfiguration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) { +func (s *Server) createHTTPHandlers(ctx context.Context, configuration *dynamic.RuntimeConfiguration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) { serviceManager := service.NewManager(configuration.Services, s.defaultRoundTripper) middlewaresBuilder := middleware.NewBuilder(configuration.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(configuration.Middlewares) @@ -150,15 +150,15 @@ func (s *Server) createHTTPHandlers(ctx context.Context, configuration *config.R return routerHandlers, handlersTLS } -func isEmptyConfiguration(conf *config.Configuration) bool { +func isEmptyConfiguration(conf *dynamic.Configuration) bool { if conf == nil { return true } if conf.TCP == nil { - conf.TCP = &config.TCPConfiguration{} + conf.TCP = &dynamic.TCPConfiguration{} } if conf.HTTP == nil { - conf.HTTP = &config.HTTPConfiguration{} + conf.HTTP = &dynamic.HTTPConfiguration{} } return conf.HTTP.Routers == nil && @@ -169,9 +169,9 @@ func isEmptyConfiguration(conf *config.Configuration) bool { conf.TCP.Services == nil } -func (s *Server) preLoadConfiguration(configMsg config.Message) { +func (s *Server) preLoadConfiguration(configMsg dynamic.Message) { s.defaultConfigurationValues(configMsg.Configuration.HTTP) - currentConfigurations := s.currentConfigurations.Get().(config.Configurations) + currentConfigurations := s.currentConfigurations.Get().(dynamic.Configurations) logger := log.WithoutContext().WithField(log.ProviderName, configMsg.ProviderName) if log.GetLevel() == logrus.DebugLevel { @@ -191,7 +191,7 @@ func (s *Server) preLoadConfiguration(configMsg config.Message) { providerConfigUpdateCh, ok := s.providerConfigUpdateMap[configMsg.ProviderName] if !ok { - providerConfigUpdateCh = make(chan config.Message) + providerConfigUpdateCh = make(chan dynamic.Message) s.providerConfigUpdateMap[configMsg.ProviderName] = providerConfigUpdateCh s.routinesPool.Go(func(stop chan bool) { s.throttleProviderConfigReload(s.providersThrottleDuration, s.configurationValidatedChan, providerConfigUpdateCh, stop) @@ -201,7 +201,7 @@ func (s *Server) preLoadConfiguration(configMsg config.Message) { providerConfigUpdateCh <- configMsg } -func (s *Server) defaultConfigurationValues(configuration *config.HTTPConfiguration) { +func (s *Server) defaultConfigurationValues(configuration *dynamic.HTTPConfiguration) { // FIXME create a config hook } @@ -223,7 +223,7 @@ func (s *Server) listenConfigurations(stop chan bool) { // It will immediately publish a new configuration and then only publish the next configuration after the throttle duration. // Note that in the case it receives N new configs in the timeframe of the throttle duration after publishing, // it will publish the last of the newly received configurations. -func (s *Server) throttleProviderConfigReload(throttle time.Duration, publish chan<- config.Message, in <-chan config.Message, stop chan bool) { +func (s *Server) throttleProviderConfigReload(throttle time.Duration, publish chan<- dynamic.Message, in <-chan dynamic.Message, stop chan bool) { ring := channels.NewRingChannel(1) defer ring.Close() @@ -233,7 +233,7 @@ func (s *Server) throttleProviderConfigReload(throttle time.Duration, publish ch case <-stop: return case nextConfig := <-ring.Out(): - if config, ok := nextConfig.(config.Message); ok { + if config, ok := nextConfig.(dynamic.Message); ok { publish <- config time.Sleep(throttle) } diff --git a/pkg/server/server_configuration_test.go b/pkg/server/server_configuration_test.go index a5d8b1fdc..6bdcc706d 100644 --- a/pkg/server/server_configuration_test.go +++ b/pkg/server/server_configuration_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" th "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -37,7 +37,7 @@ func TestReuseService(t *testing.T) { th.WithRouterMiddlewares("basicauth")), ), th.WithMiddlewares(th.WithMiddleware("basicauth", - th.WithBasicAuth(&config.BasicAuth{Users: []string{"foo:bar"}}), + th.WithBasicAuth(&dynamic.BasicAuth{Users: []string{"foo:bar"}}), )), th.WithLoadBalancerServices(th.WithService("bar", th.WithServers(th.WithServer(testServer.URL))), @@ -46,7 +46,7 @@ func TestReuseService(t *testing.T) { srv := NewServer(staticConfig, nil, entryPoints, nil) - rtConf := config.NewRuntimeConfig(config.Configuration{HTTP: dynamicConfigs}) + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{HTTP: dynamicConfigs}) entrypointsHandlers, _ := srv.createHTTPHandlers(context.Background(), rtConf, []string{"http"}) // Test that the /ok path returns a status 200. @@ -67,8 +67,8 @@ func TestReuseService(t *testing.T) { func TestThrottleProviderConfigReload(t *testing.T) { throttleDuration := 30 * time.Millisecond - publishConfig := make(chan config.Message) - providerConfig := make(chan config.Message) + publishConfig := make(chan dynamic.Message) + providerConfig := make(chan dynamic.Message) stop := make(chan bool) defer func() { stop <- true @@ -96,7 +96,7 @@ func TestThrottleProviderConfigReload(t *testing.T) { // publish 5 new configs, one new config each 10 milliseconds for i := 0; i < 5; i++ { - providerConfig <- config.Message{} + providerConfig <- dynamic.Message{} time.Sleep(10 * time.Millisecond) } diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 255b8aa5a..e2b2219f9 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" th "github.com/containous/traefik/pkg/testhelpers" "github.com/containous/traefik/pkg/types" @@ -29,7 +29,7 @@ func TestListenProvidersSkipsEmptyConfigs(t *testing.T) { } }() - server.configurationChan <- config.Message{ProviderName: "kubernetes"} + server.configurationChan <- dynamic.Message{ProviderName: "kubernetes"} // give some time so that the configuration can be processed time.Sleep(100 * time.Millisecond) @@ -49,7 +49,7 @@ func TestListenProvidersSkipsSameConfigurationForProvider(t *testing.T) { // set the current configuration // this is usually done in the processing part of the published configuration // so we have to emulate the behavior here - currentConfigurations := server.currentConfigurations.Get().(config.Configurations) + currentConfigurations := server.currentConfigurations.Get().(dynamic.Configurations) currentConfigurations[conf.ProviderName] = conf.Configuration server.currentConfigurations.Set(currentConfigurations) @@ -60,20 +60,20 @@ func TestListenProvidersSkipsSameConfigurationForProvider(t *testing.T) { } } }() - conf := &config.Configuration{} + conf := &dynamic.Configuration{} conf.HTTP = th.BuildConfiguration( th.WithRouters(th.WithRouter("foo")), th.WithLoadBalancerServices(th.WithService("bar")), ) // provide a configuration - server.configurationChan <- config.Message{ProviderName: "kubernetes", Configuration: conf} + server.configurationChan <- dynamic.Message{ProviderName: "kubernetes", Configuration: conf} // give some time so that the configuration can be processed time.Sleep(20 * time.Millisecond) // provide the same configuration a second time - server.configurationChan <- config.Message{ProviderName: "kubernetes", Configuration: conf} + server.configurationChan <- dynamic.Message{ProviderName: "kubernetes", Configuration: conf} // give some time so that the configuration can be processed time.Sleep(100 * time.Millisecond) @@ -102,13 +102,13 @@ func TestListenProvidersPublishesConfigForEachProvider(t *testing.T) { } }() - conf := &config.Configuration{} + conf := &dynamic.Configuration{} conf.HTTP = th.BuildConfiguration( th.WithRouters(th.WithRouter("foo")), th.WithLoadBalancerServices(th.WithService("bar")), ) - server.configurationChan <- config.Message{ProviderName: "kubernetes", Configuration: conf} - server.configurationChan <- config.Message{ProviderName: "marathon", Configuration: conf} + server.configurationChan <- dynamic.Message{ProviderName: "kubernetes", Configuration: conf} + server.configurationChan <- dynamic.Message{ProviderName: "marathon", Configuration: conf} select { case <-consumePublishedConfigsDone: @@ -148,12 +148,12 @@ func TestServerResponseEmptyBackend(t *testing.T) { testCases := []struct { desc string - config func(testServerURL string) *config.HTTPConfiguration + config func(testServerURL string) *dynamic.HTTPConfiguration expectedStatusCode int }{ { desc: "Ok", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration( th.WithRouters(th.WithRouter("foo", th.WithEntryPoints("http"), @@ -169,14 +169,14 @@ func TestServerResponseEmptyBackend(t *testing.T) { }, { desc: "No Frontend", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration() }, expectedStatusCode: http.StatusNotFound, }, { desc: "Empty Backend LB", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration( th.WithRouters(th.WithRouter("foo", th.WithEntryPoints("http"), @@ -190,7 +190,7 @@ func TestServerResponseEmptyBackend(t *testing.T) { }, { desc: "Empty Backend LB Sticky", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration( th.WithRouters(th.WithRouter("foo", th.WithEntryPoints("http"), @@ -206,7 +206,7 @@ func TestServerResponseEmptyBackend(t *testing.T) { }, { desc: "Empty Backend LB", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration( th.WithRouters(th.WithRouter("foo", th.WithEntryPoints("http"), @@ -220,7 +220,7 @@ func TestServerResponseEmptyBackend(t *testing.T) { }, { desc: "Empty Backend LB Sticky", - config: func(testServerURL string) *config.HTTPConfiguration { + config: func(testServerURL string) *dynamic.HTTPConfiguration { return th.BuildConfiguration( th.WithRouters(th.WithRouter("foo", th.WithEntryPoints("http"), @@ -253,7 +253,7 @@ func TestServerResponseEmptyBackend(t *testing.T) { } srv := NewServer(globalConfig, nil, entryPointsConfig, nil) - rtConf := config.NewRuntimeConfig(config.Configuration{HTTP: test.config(testServer.URL)}) + rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{HTTP: test.config(testServer.URL)}) entryPoints, _ := srv.createHTTPHandlers(context.Background(), rtConf, []string{"http"}) responseRecorder := &httptest.ResponseRecorder{} diff --git a/pkg/server/service/proxy.go b/pkg/server/service/proxy.go index b4f970748..2c59c6475 100644 --- a/pkg/server/service/proxy.go +++ b/pkg/server/service/proxy.go @@ -10,7 +10,7 @@ import ( "net/url" "time" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/types" ) @@ -21,7 +21,7 @@ const StatusClientClosedRequest = 499 // StatusClientClosedRequestText non-standard HTTP status for client disconnection const StatusClientClosedRequestText = "Client Closed Request" -func buildProxy(passHostHeader bool, responseForwarding *config.ResponseForwarding, defaultRoundTripper http.RoundTripper, bufferPool httputil.BufferPool, responseModifier func(*http.Response) error) (http.Handler, error) { +func buildProxy(passHostHeader bool, responseForwarding *dynamic.ResponseForwarding, defaultRoundTripper http.RoundTripper, bufferPool httputil.BufferPool, responseModifier func(*http.Response) error) (http.Handler, error) { var flushInterval types.Duration if responseForwarding != nil { err := flushInterval.Set(responseForwarding.FlushInterval) diff --git a/pkg/server/service/service.go b/pkg/server/service/service.go index a92047bdd..03ec8e138 100644 --- a/pkg/server/service/service.go +++ b/pkg/server/service/service.go @@ -9,7 +9,7 @@ import ( "time" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/healthcheck" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" @@ -26,7 +26,7 @@ const ( ) // NewManager creates a new Manager -func NewManager(configs map[string]*config.ServiceInfo, defaultRoundTripper http.RoundTripper) *Manager { +func NewManager(configs map[string]*dynamic.ServiceInfo, defaultRoundTripper http.RoundTripper) *Manager { return &Manager{ bufferPool: newBufferPool(), defaultRoundTripper: defaultRoundTripper, @@ -40,7 +40,7 @@ type Manager struct { bufferPool httputil.BufferPool defaultRoundTripper http.RoundTripper balancers map[string][]healthcheck.BalancerHandler - configs map[string]*config.ServiceInfo + configs map[string]*dynamic.ServiceInfo } // BuildHTTP Creates a http.Handler for a service configuration. @@ -74,7 +74,7 @@ func (m *Manager) BuildHTTP(rootCtx context.Context, serviceName string, respons func (m *Manager) getLoadBalancerServiceHandler( ctx context.Context, serviceName string, - service *config.LoadBalancerService, + service *dynamic.LoadBalancerService, responseModifier func(*http.Response) error, ) (http.Handler, error) { fwd, err := buildProxy(service.PassHostHeader, service.ResponseForwarding, m.defaultRoundTripper, m.bufferPool, responseModifier) @@ -134,7 +134,7 @@ func (m *Manager) LaunchHealthCheck() { healthcheck.GetHealthCheck().SetBackendsConfiguration(context.TODO(), backendConfigs) } -func buildHealthCheckOptions(ctx context.Context, lb healthcheck.BalancerHandler, backend string, hc *config.HealthCheck) *healthcheck.Options { +func buildHealthCheckOptions(ctx context.Context, lb healthcheck.BalancerHandler, backend string, hc *dynamic.HealthCheck) *healthcheck.Options { if hc == nil || hc.Path == "" { return nil } @@ -183,7 +183,7 @@ func buildHealthCheckOptions(ctx context.Context, lb healthcheck.BalancerHandler } } -func (m *Manager) getLoadBalancer(ctx context.Context, serviceName string, service *config.LoadBalancerService, fwd http.Handler) (healthcheck.BalancerHandler, error) { +func (m *Manager) getLoadBalancer(ctx context.Context, serviceName string, service *dynamic.LoadBalancerService, fwd http.Handler) (healthcheck.BalancerHandler, error) { logger := log.FromContext(ctx) logger.Debug("Creating load-balancer") @@ -210,7 +210,7 @@ func (m *Manager) getLoadBalancer(ctx context.Context, serviceName string, servi return lb, nil } -func (m *Manager) upsertServers(ctx context.Context, lb healthcheck.BalancerHandler, servers []config.Server) error { +func (m *Manager) upsertServers(ctx context.Context, lb healthcheck.BalancerHandler, servers []dynamic.Server) error { logger := log.FromContext(ctx) for name, srv := range servers { diff --git a/pkg/server/service/service_test.go b/pkg/server/service/service_test.go index f2892a61f..963d67b25 100644 --- a/pkg/server/service/service_test.go +++ b/pkg/server/service/service_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/server/internal" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -26,15 +26,15 @@ func TestGetLoadBalancer(t *testing.T) { testCases := []struct { desc string serviceName string - service *config.LoadBalancerService + service *dynamic.LoadBalancerService fwd http.Handler expectError bool }{ { desc: "Fails when provided an invalid URL", serviceName: "test", - service: &config.LoadBalancerService{ - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: ":", }, @@ -46,15 +46,15 @@ func TestGetLoadBalancer(t *testing.T) { { desc: "Succeeds when there are no servers", serviceName: "test", - service: &config.LoadBalancerService{}, + service: &dynamic.LoadBalancerService{}, fwd: &MockForwarder{}, expectError: false, }, { desc: "Succeeds when stickiness is set", serviceName: "test", - service: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{}, + service: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{}, }, fwd: &MockForwarder{}, expectError: false, @@ -113,7 +113,7 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { testCases := []struct { desc string serviceName string - service *config.LoadBalancerService + service *dynamic.LoadBalancerService responseModifier func(*http.Response) error expected []ExpectedResult @@ -121,8 +121,8 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "Load balances between the two servers", serviceName: "test", - service: &config.LoadBalancerService{ - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: server1.URL, }, @@ -145,8 +145,8 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "StatusBadGateway when the server is not reachable", serviceName: "test", - service: &config.LoadBalancerService{ - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ { URL: "http://foo", }, @@ -161,8 +161,8 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "ServiceUnavailable when no servers are available", serviceName: "test", - service: &config.LoadBalancerService{ - Servers: []config.Server{}, + service: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{}, }, expected: []ExpectedResult{ { @@ -173,9 +173,9 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "Always call the same server when stickiness is true", serviceName: "test", - service: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{}, - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{}, + Servers: []dynamic.Server{ { URL: server1.URL, }, @@ -198,9 +198,9 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "Sticky Cookie's options set correctly", serviceName: "test", - service: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{HTTPOnlyCookie: true, SecureCookie: true}, - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{HTTPOnlyCookie: true, SecureCookie: true}, + Servers: []dynamic.Server{ { URL: server1.URL, }, @@ -218,10 +218,10 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "PassHost passes the host instead of the IP", serviceName: "test", - service: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{}, + service: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{}, PassHostHeader: true, - Servers: []config.Server{ + Servers: []dynamic.Server{ { URL: serverPassHost.URL, }, @@ -237,9 +237,9 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) { { desc: "PassHost doesn't passe the host instead of the IP", serviceName: "test", - service: &config.LoadBalancerService{ - Stickiness: &config.Stickiness{}, - Servers: []config.Server{ + service: &dynamic.LoadBalancerService{ + Stickiness: &dynamic.Stickiness{}, + Servers: []dynamic.Server{ { URL: serverPassHostFalse.URL, }, @@ -287,16 +287,16 @@ func TestManager_Build(t *testing.T) { testCases := []struct { desc string serviceName string - configs map[string]*config.ServiceInfo + configs map[string]*dynamic.ServiceInfo providerName string }{ { desc: "Simple service name", serviceName: "serviceName", - configs: map[string]*config.ServiceInfo{ + configs: map[string]*dynamic.ServiceInfo{ "serviceName": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{}, + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{}, }, }, }, @@ -304,10 +304,10 @@ func TestManager_Build(t *testing.T) { { desc: "Service name with provider", serviceName: "serviceName@provider-1", - configs: map[string]*config.ServiceInfo{ + configs: map[string]*dynamic.ServiceInfo{ "serviceName@provider-1": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{}, + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{}, }, }, }, @@ -315,10 +315,10 @@ func TestManager_Build(t *testing.T) { { desc: "Service name with provider in context", serviceName: "serviceName", - configs: map[string]*config.ServiceInfo{ + configs: map[string]*dynamic.ServiceInfo{ "serviceName@provider-1": { - Service: &config.Service{ - LoadBalancer: &config.LoadBalancerService{}, + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{}, }, }, }, diff --git a/pkg/server/service/tcp/service.go b/pkg/server/service/tcp/service.go index 9116f4648..704ba9fc2 100644 --- a/pkg/server/service/tcp/service.go +++ b/pkg/server/service/tcp/service.go @@ -5,7 +5,7 @@ import ( "fmt" "net" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/server/internal" "github.com/containous/traefik/pkg/tcp" @@ -13,11 +13,11 @@ import ( // Manager is the TCPHandlers factory type Manager struct { - configs map[string]*config.TCPServiceInfo + configs map[string]*dynamic.TCPServiceInfo } // NewManager creates a new manager -func NewManager(conf *config.RuntimeConfiguration) *Manager { +func NewManager(conf *dynamic.RuntimeConfiguration) *Manager { return &Manager{ configs: conf.TCPServices, } diff --git a/pkg/server/service/tcp/service_test.go b/pkg/server/service/tcp/service_test.go index 13b27ed6d..15550eb63 100644 --- a/pkg/server/service/tcp/service_test.go +++ b/pkg/server/service/tcp/service_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/server/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -14,7 +14,7 @@ func TestManager_BuildTCP(t *testing.T) { testCases := []struct { desc string serviceName string - configs map[string]*config.TCPServiceInfo + configs map[string]*dynamic.TCPServiceInfo providerName string expectedError string }{ @@ -27,9 +27,9 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing lb configuration", serviceName: "test", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "test": { - TCPService: &config.TCPService{}, + TCPService: &dynamic.TCPService{}, }, }, expectedError: `the service "test" doesn't have any TCP load balancer`, @@ -37,11 +37,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "no such host, server is skipped, error is logged", serviceName: "test", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "test": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ {Address: "test:31"}, }, }, @@ -52,11 +52,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "invalid IP address, server is skipped, error is logged", serviceName: "test", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "test": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ {Address: "foobar"}, }, }, @@ -67,10 +67,10 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Simple service name", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{}, + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{}, }, }, }, @@ -78,10 +78,10 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Service name with provider", serviceName: "serviceName@provider-1", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{}, + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{}, }, }, }, @@ -89,10 +89,10 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Service name with provider in context", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{}, + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{}, }, }, }, @@ -101,11 +101,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Server with correct host:port as address", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "foobar.com:80", }, @@ -119,11 +119,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Server with correct ip:port as address", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "192.168.0.12:80", }, @@ -137,11 +137,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing port in address with hostname, server is skipped, error is logged", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "foobar.com", }, @@ -155,11 +155,11 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing port in address with ip, server is skipped, error is logged", serviceName: "serviceName", - configs: map[string]*config.TCPServiceInfo{ + configs: map[string]*dynamic.TCPServiceInfo{ "serviceName@provider-1": { - TCPService: &config.TCPService{ - LoadBalancer: &config.TCPLoadBalancerService{ - Servers: []config.TCPServer{ + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ { Address: "192.168.0.12", }, @@ -177,7 +177,7 @@ func TestManager_BuildTCP(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - manager := NewManager(&config.RuntimeConfiguration{ + manager := NewManager(&dynamic.RuntimeConfiguration{ TCPServices: test.configs, }) diff --git a/pkg/testhelpers/config.go b/pkg/testhelpers/config.go index ba2ebfebd..6cfcbbb43 100644 --- a/pkg/testhelpers/config.go +++ b/pkg/testhelpers/config.go @@ -1,12 +1,12 @@ package testhelpers import ( - "github.com/containous/traefik/pkg/config" + "github.com/containous/traefik/pkg/config/dynamic" ) // BuildConfiguration is a helper to create a configuration. -func BuildConfiguration(dynamicConfigBuilders ...func(*config.HTTPConfiguration)) *config.HTTPConfiguration { - conf := &config.HTTPConfiguration{} +func BuildConfiguration(dynamicConfigBuilders ...func(*dynamic.HTTPConfiguration)) *dynamic.HTTPConfiguration { + conf := &dynamic.HTTPConfiguration{} for _, build := range dynamicConfigBuilders { build(conf) } @@ -14,11 +14,11 @@ func BuildConfiguration(dynamicConfigBuilders ...func(*config.HTTPConfiguration) } // WithRouters is a helper to create a configuration. -func WithRouters(opts ...func(*config.Router) string) func(*config.HTTPConfiguration) { - return func(c *config.HTTPConfiguration) { - c.Routers = make(map[string]*config.Router) +func WithRouters(opts ...func(*dynamic.Router) string) func(*dynamic.HTTPConfiguration) { + return func(c *dynamic.HTTPConfiguration) { + c.Routers = make(map[string]*dynamic.Router) for _, opt := range opts { - b := &config.Router{} + b := &dynamic.Router{} name := opt(b) c.Routers[name] = b } @@ -26,8 +26,8 @@ func WithRouters(opts ...func(*config.Router) string) func(*config.HTTPConfigura } // WithRouter is a helper to create a configuration. -func WithRouter(routerName string, opts ...func(*config.Router)) func(*config.Router) string { - return func(r *config.Router) string { +func WithRouter(routerName string, opts ...func(*dynamic.Router)) func(*dynamic.Router) string { + return func(r *dynamic.Router) string { for _, opt := range opts { opt(r) } @@ -36,27 +36,27 @@ func WithRouter(routerName string, opts ...func(*config.Router)) func(*config.Ro } // WithRouterMiddlewares is a helper to create a configuration. -func WithRouterMiddlewares(middlewaresName ...string) func(*config.Router) { - return func(r *config.Router) { +func WithRouterMiddlewares(middlewaresName ...string) func(*dynamic.Router) { + return func(r *dynamic.Router) { r.Middlewares = middlewaresName } } // WithServiceName is a helper to create a configuration. -func WithServiceName(serviceName string) func(*config.Router) { - return func(r *config.Router) { +func WithServiceName(serviceName string) func(*dynamic.Router) { + return func(r *dynamic.Router) { r.Service = serviceName } } // WithLoadBalancerServices is a helper to create a configuration. -func WithLoadBalancerServices(opts ...func(service *config.LoadBalancerService) string) func(*config.HTTPConfiguration) { - return func(c *config.HTTPConfiguration) { - c.Services = make(map[string]*config.Service) +func WithLoadBalancerServices(opts ...func(service *dynamic.LoadBalancerService) string) func(*dynamic.HTTPConfiguration) { + return func(c *dynamic.HTTPConfiguration) { + c.Services = make(map[string]*dynamic.Service) for _, opt := range opts { - b := &config.LoadBalancerService{} + b := &dynamic.LoadBalancerService{} name := opt(b) - c.Services[name] = &config.Service{ + c.Services[name] = &dynamic.Service{ LoadBalancer: b, } } @@ -64,8 +64,8 @@ func WithLoadBalancerServices(opts ...func(service *config.LoadBalancerService) } // WithService is a helper to create a configuration. -func WithService(name string, opts ...func(*config.LoadBalancerService)) func(*config.LoadBalancerService) string { - return func(r *config.LoadBalancerService) string { +func WithService(name string, opts ...func(*dynamic.LoadBalancerService)) func(*dynamic.LoadBalancerService) string { + return func(r *dynamic.LoadBalancerService) string { for _, opt := range opts { opt(r) } @@ -74,11 +74,11 @@ func WithService(name string, opts ...func(*config.LoadBalancerService)) func(*c } // WithMiddlewares is a helper to create a configuration. -func WithMiddlewares(opts ...func(*config.Middleware) string) func(*config.HTTPConfiguration) { - return func(c *config.HTTPConfiguration) { - c.Middlewares = make(map[string]*config.Middleware) +func WithMiddlewares(opts ...func(*dynamic.Middleware) string) func(*dynamic.HTTPConfiguration) { + return func(c *dynamic.HTTPConfiguration) { + c.Middlewares = make(map[string]*dynamic.Middleware) for _, opt := range opts { - b := &config.Middleware{} + b := &dynamic.Middleware{} name := opt(b) c.Middlewares[name] = b } @@ -86,8 +86,8 @@ func WithMiddlewares(opts ...func(*config.Middleware) string) func(*config.HTTPC } // WithMiddleware is a helper to create a configuration. -func WithMiddleware(name string, opts ...func(*config.Middleware)) func(*config.Middleware) string { - return func(r *config.Middleware) string { +func WithMiddleware(name string, opts ...func(*dynamic.Middleware)) func(*dynamic.Middleware) string { + return func(r *dynamic.Middleware) string { for _, opt := range opts { opt(r) } @@ -96,31 +96,31 @@ func WithMiddleware(name string, opts ...func(*config.Middleware)) func(*config. } // WithBasicAuth is a helper to create a configuration. -func WithBasicAuth(auth *config.BasicAuth) func(*config.Middleware) { - return func(r *config.Middleware) { +func WithBasicAuth(auth *dynamic.BasicAuth) func(*dynamic.Middleware) { + return func(r *dynamic.Middleware) { r.BasicAuth = auth } } // WithEntryPoints is a helper to create a configuration. -func WithEntryPoints(eps ...string) func(*config.Router) { - return func(f *config.Router) { +func WithEntryPoints(eps ...string) func(*dynamic.Router) { + return func(f *dynamic.Router) { f.EntryPoints = eps } } // WithRule is a helper to create a configuration. -func WithRule(rule string) func(*config.Router) { - return func(f *config.Router) { +func WithRule(rule string) func(*dynamic.Router) { + return func(f *dynamic.Router) { f.Rule = rule } } // WithServers is a helper to create a configuration. -func WithServers(opts ...func(*config.Server)) func(*config.LoadBalancerService) { - return func(b *config.LoadBalancerService) { +func WithServers(opts ...func(*dynamic.Server)) func(*dynamic.LoadBalancerService) { + return func(b *dynamic.LoadBalancerService) { for _, opt := range opts { - server := config.Server{} + server := dynamic.Server{} opt(&server) b.Servers = append(b.Servers, server) } @@ -128,8 +128,8 @@ func WithServers(opts ...func(*config.Server)) func(*config.LoadBalancerService) } // WithServer is a helper to create a configuration. -func WithServer(url string, opts ...func(*config.Server)) func(*config.Server) { - return func(s *config.Server) { +func WithServer(url string, opts ...func(*dynamic.Server)) func(*dynamic.Server) { + return func(s *dynamic.Server) { for _, opt := range opts { opt(s) } @@ -138,9 +138,9 @@ func WithServer(url string, opts ...func(*config.Server)) func(*config.Server) { } // WithStickiness is a helper to create a configuration. -func WithStickiness(cookieName string) func(*config.LoadBalancerService) { - return func(b *config.LoadBalancerService) { - b.Stickiness = &config.Stickiness{ +func WithStickiness(cookieName string) func(*dynamic.LoadBalancerService) { + return func(b *dynamic.LoadBalancerService) { + b.Stickiness = &dynamic.Stickiness{ CookieName: cookieName, } } diff --git a/script/update-generated-crd-code.sh b/script/update-generated-crd-code.sh index bbc02afdc..b7f7a5e4b 100755 --- a/script/update-generated-crd-code.sh +++ b/script/update-generated-crd-code.sh @@ -11,4 +11,4 @@ REPO_ROOT=${HACK_DIR}/.. --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \ "$@" -deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config --input-dirs github.com/containous/traefik/pkg/tls -O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl +deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config/dynamic --input-dirs github.com/containous/traefik/pkg/tls -O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl From 74c5ec70a923da8685358512d1346d31052134f9 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 12 Jul 2019 11:10:03 +0200 Subject: [PATCH 09/49] Improve API endpoints --- docs/content/operations/api.md | 2 + pkg/api/handler.go | 317 +------ pkg/api/handler_entrypoint.go | 70 ++ pkg/api/handler_entrypoint_test.go | 253 +++++ pkg/api/handler_http.go | 198 ++++ pkg/api/handler_http_test.go | 575 +++++++++++ pkg/api/handler_overview.go | 200 ++++ pkg/api/handler_overview_test.go | 230 +++++ pkg/api/handler_tcp.go | 134 +++ pkg/api/handler_tcp_test.go | 349 +++++++ pkg/api/handler_test.go | 896 +----------------- pkg/api/testdata/entrypoint-bar.json | 4 + pkg/api/testdata/entrypoints-empty.json | 1 + .../testdata/entrypoints-many-lastpage.json | 22 + pkg/api/testdata/entrypoints-page2.json | 6 + pkg/api/testdata/entrypoints.json | 60 ++ pkg/api/testdata/overview-dynamic.json | 36 + pkg/api/testdata/overview-empty.json | 36 + pkg/api/testdata/overview-features.json | 36 + pkg/api/testdata/overview-providers.json | 45 + 20 files changed, 2266 insertions(+), 1204 deletions(-) create mode 100644 pkg/api/handler_entrypoint.go create mode 100644 pkg/api/handler_entrypoint_test.go create mode 100644 pkg/api/handler_http.go create mode 100644 pkg/api/handler_http_test.go create mode 100644 pkg/api/handler_overview.go create mode 100644 pkg/api/handler_overview_test.go create mode 100644 pkg/api/handler_tcp.go create mode 100644 pkg/api/handler_tcp_test.go create mode 100644 pkg/api/testdata/entrypoint-bar.json create mode 100644 pkg/api/testdata/entrypoints-empty.json create mode 100644 pkg/api/testdata/entrypoints-many-lastpage.json create mode 100644 pkg/api/testdata/entrypoints-page2.json create mode 100644 pkg/api/testdata/entrypoints.json create mode 100644 pkg/api/testdata/overview-dynamic.json create mode 100644 pkg/api/testdata/overview-empty.json create mode 100644 pkg/api/testdata/overview-features.json create mode 100644 pkg/api/testdata/overview-providers.json diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index a7a4c41f1..70117dc7a 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -111,6 +111,8 @@ All the following endpoints must be accessed with a `GET` HTTP request. | `/api/tcp/routers/{name}` | Returns the information of the TCP router specified by `name`. | | `/api/tcp/services` | Lists all the TCP services information. | | `/api/tcp/services/{name}` | Returns the information of the TCP service specified by `name`. | +| `/api/entrypoints` | Lists all the entry points information. | +| `/api/entrypoints/{name}` | Returns the information of the entry point specified by `name`. | | `/api/version` | Returns information about Traefik version. | | `/debug/vars` | See the [expvar](https://golang.org/pkg/expvar/) Go documentation. | | `/debug/pprof/` | See the [pprof Index](https://golang.org/pkg/net/http/pprof/#Index) Go documentation. | diff --git a/pkg/api/handler.go b/pkg/api/handler.go index 2fecfc9c2..79e0540d7 100644 --- a/pkg/api/handler.go +++ b/pkg/api/handler.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "net/http" - "sort" "strconv" "strings" @@ -38,37 +37,6 @@ type RunTimeRepresentation struct { TCPServices map[string]*dynamic.TCPServiceInfo `json:"tcpServices,omitempty"` } -type routerRepresentation struct { - *dynamic.RouterInfo - Name string `json:"name,omitempty"` - Provider string `json:"provider,omitempty"` -} - -type serviceRepresentation struct { - *dynamic.ServiceInfo - ServerStatus map[string]string `json:"serverStatus,omitempty"` - Name string `json:"name,omitempty"` - Provider string `json:"provider,omitempty"` -} - -type middlewareRepresentation struct { - *dynamic.MiddlewareInfo - Name string `json:"name,omitempty"` - Provider string `json:"provider,omitempty"` -} - -type tcpRouterRepresentation struct { - *dynamic.TCPRouterInfo - Name string `json:"name,omitempty"` - Provider string `json:"provider,omitempty"` -} - -type tcpServiceRepresentation struct { - *dynamic.TCPServiceInfo - Name string `json:"name,omitempty"` - Provider string `json:"provider,omitempty"` -} - type pageInfo struct { startIndex int endIndex int @@ -81,6 +49,7 @@ type Handler struct { debug bool // runtimeConfiguration is the data set used to create all the data representations exposed by the API. runtimeConfiguration *dynamic.RuntimeConfiguration + staticConfig static.Configuration statistics *types.Statistics // stats *thoasstats.Stats // FIXME stats // StatsRecorder *middlewares.StatsRecorder // FIXME stats @@ -100,6 +69,7 @@ func New(staticConfig static.Configuration, runtimeConfig *dynamic.RuntimeConfig statistics: staticConfig.API.Statistics, dashboardAssets: staticConfig.API.DashboardAssets, runtimeConfiguration: rConfig, + staticConfig: staticConfig, debug: staticConfig.API.Debug, } } @@ -112,6 +82,12 @@ func (h Handler) Append(router *mux.Router) { router.Methods(http.MethodGet).Path("/api/rawdata").HandlerFunc(h.getRuntimeConfiguration) + // Experimental endpoint + router.Methods(http.MethodGet).Path("/api/overview").HandlerFunc(h.getOverview) + + router.Methods(http.MethodGet).Path("/api/entrypoints").HandlerFunc(h.getEntryPoints) + router.Methods(http.MethodGet).Path("/api/entrypoints/{entryPointID}").HandlerFunc(h.getEntryPoint) + router.Methods(http.MethodGet).Path("/api/http/routers").HandlerFunc(h.getRouters) router.Methods(http.MethodGet).Path("/api/http/routers/{routerID}").HandlerFunc(h.getRouter) router.Methods(http.MethodGet).Path("/api/http/services").HandlerFunc(h.getServices) @@ -135,283 +111,6 @@ func (h Handler) Append(router *mux.Router) { } } -func (h Handler) getRouters(rw http.ResponseWriter, request *http.Request) { - results := make([]routerRepresentation, 0, len(h.runtimeConfiguration.Routers)) - - for name, rt := range h.runtimeConfiguration.Routers { - results = append(results, routerRepresentation{ - RouterInfo: rt, - Name: name, - Provider: getProviderName(name), - }) - } - - sort.Slice(results, func(i, j int) bool { - return results[i].Name < results[j].Name - }) - - pageInfo, err := pagination(request, len(results)) - if err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - rw.Header().Set("Content-Type", "application/json") - rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) - - err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getRouter(rw http.ResponseWriter, request *http.Request) { - routerID := mux.Vars(request)["routerID"] - - router, ok := h.runtimeConfiguration.Routers[routerID] - if !ok { - http.NotFound(rw, request) - return - } - - result := routerRepresentation{ - RouterInfo: router, - Name: routerID, - Provider: getProviderName(routerID), - } - - rw.Header().Set("Content-Type", "application/json") - - err := json.NewEncoder(rw).Encode(result) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getServices(rw http.ResponseWriter, request *http.Request) { - results := make([]serviceRepresentation, 0, len(h.runtimeConfiguration.Services)) - - for name, si := range h.runtimeConfiguration.Services { - results = append(results, serviceRepresentation{ - ServiceInfo: si, - Name: name, - Provider: getProviderName(name), - ServerStatus: si.GetAllStatus(), - }) - } - - sort.Slice(results, func(i, j int) bool { - return results[i].Name < results[j].Name - }) - - pageInfo, err := pagination(request, len(results)) - if err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - rw.Header().Set("Content-Type", "application/json") - rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) - - err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getService(rw http.ResponseWriter, request *http.Request) { - serviceID := mux.Vars(request)["serviceID"] - - service, ok := h.runtimeConfiguration.Services[serviceID] - if !ok { - http.NotFound(rw, request) - return - } - - result := serviceRepresentation{ - ServiceInfo: service, - Name: serviceID, - Provider: getProviderName(serviceID), - ServerStatus: service.GetAllStatus(), - } - - rw.Header().Add("Content-Type", "application/json") - - err := json.NewEncoder(rw).Encode(result) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getMiddlewares(rw http.ResponseWriter, request *http.Request) { - results := make([]middlewareRepresentation, 0, len(h.runtimeConfiguration.Middlewares)) - - for name, mi := range h.runtimeConfiguration.Middlewares { - results = append(results, middlewareRepresentation{ - MiddlewareInfo: mi, - Name: name, - Provider: getProviderName(name), - }) - } - - sort.Slice(results, func(i, j int) bool { - return results[i].Name < results[j].Name - }) - - pageInfo, err := pagination(request, len(results)) - if err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - rw.Header().Set("Content-Type", "application/json") - rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) - - err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getMiddleware(rw http.ResponseWriter, request *http.Request) { - middlewareID := mux.Vars(request)["middlewareID"] - - middleware, ok := h.runtimeConfiguration.Middlewares[middlewareID] - if !ok { - http.NotFound(rw, request) - return - } - - result := middlewareRepresentation{ - MiddlewareInfo: middleware, - Name: middlewareID, - Provider: getProviderName(middlewareID), - } - - rw.Header().Set("Content-Type", "application/json") - - err := json.NewEncoder(rw).Encode(result) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getTCPRouters(rw http.ResponseWriter, request *http.Request) { - results := make([]tcpRouterRepresentation, 0, len(h.runtimeConfiguration.TCPRouters)) - - for name, rt := range h.runtimeConfiguration.TCPRouters { - results = append(results, tcpRouterRepresentation{ - TCPRouterInfo: rt, - Name: name, - Provider: getProviderName(name), - }) - } - - sort.Slice(results, func(i, j int) bool { - return results[i].Name < results[j].Name - }) - - pageInfo, err := pagination(request, len(results)) - if err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - rw.Header().Set("Content-Type", "application/json") - rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) - - err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getTCPRouter(rw http.ResponseWriter, request *http.Request) { - routerID := mux.Vars(request)["routerID"] - - router, ok := h.runtimeConfiguration.TCPRouters[routerID] - if !ok { - http.NotFound(rw, request) - return - } - - result := tcpRouterRepresentation{ - TCPRouterInfo: router, - Name: routerID, - Provider: getProviderName(routerID), - } - - rw.Header().Set("Content-Type", "application/json") - - err := json.NewEncoder(rw).Encode(result) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getTCPServices(rw http.ResponseWriter, request *http.Request) { - results := make([]tcpServiceRepresentation, 0, len(h.runtimeConfiguration.TCPServices)) - - for name, si := range h.runtimeConfiguration.TCPServices { - results = append(results, tcpServiceRepresentation{ - TCPServiceInfo: si, - Name: name, - Provider: getProviderName(name), - }) - } - - sort.Slice(results, func(i, j int) bool { - return results[i].Name < results[j].Name - }) - - pageInfo, err := pagination(request, len(results)) - if err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - rw.Header().Set("Content-Type", "application/json") - rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) - - err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - -func (h Handler) getTCPService(rw http.ResponseWriter, request *http.Request) { - serviceID := mux.Vars(request)["serviceID"] - - service, ok := h.runtimeConfiguration.TCPServices[serviceID] - if !ok { - http.NotFound(rw, request) - return - } - - result := tcpServiceRepresentation{ - TCPServiceInfo: service, - Name: serviceID, - Provider: getProviderName(serviceID), - } - - rw.Header().Set("Content-Type", "application/json") - - err := json.NewEncoder(rw).Encode(result) - if err != nil { - log.FromContext(request.Context()).Error(err) - http.Error(rw, err.Error(), http.StatusInternalServerError) - } -} - func (h Handler) getRuntimeConfiguration(rw http.ResponseWriter, request *http.Request) { siRepr := make(map[string]*serviceInfoRepresentation, len(h.runtimeConfiguration.Services)) for k, v := range h.runtimeConfiguration.Services { diff --git a/pkg/api/handler_entrypoint.go b/pkg/api/handler_entrypoint.go new file mode 100644 index 000000000..b36dd619c --- /dev/null +++ b/pkg/api/handler_entrypoint.go @@ -0,0 +1,70 @@ +package api + +import ( + "encoding/json" + "net/http" + "sort" + "strconv" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/static" + "github.com/containous/traefik/pkg/log" +) + +type entryPointRepresentation struct { + *static.EntryPoint + Name string `json:"name,omitempty"` +} + +func (h Handler) getEntryPoints(rw http.ResponseWriter, request *http.Request) { + results := make([]entryPointRepresentation, 0, len(h.staticConfig.EntryPoints)) + + for name, ep := range h.staticConfig.EntryPoints { + results = append(results, entryPointRepresentation{ + EntryPoint: ep, + Name: name, + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getEntryPoint(rw http.ResponseWriter, request *http.Request) { + entryPointID := mux.Vars(request)["entryPointID"] + + ep, ok := h.staticConfig.EntryPoints[entryPointID] + if !ok { + http.NotFound(rw, request) + return + } + + result := entryPointRepresentation{ + EntryPoint: ep, + Name: entryPointID, + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} diff --git a/pkg/api/handler_entrypoint_test.go b/pkg/api/handler_entrypoint_test.go new file mode 100644 index 000000000..162e655a2 --- /dev/null +++ b/pkg/api/handler_entrypoint_test.go @@ -0,0 +1,253 @@ +package api + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "strconv" + "testing" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/static" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestHandler_EntryPoints(t *testing.T) { + type expected struct { + statusCode int + nextPage string + jsonFile string + } + + testCases := []struct { + desc string + path string + conf static.Configuration + expected expected + }{ + { + desc: "all entry points, but no config", + path: "/api/entrypoints", + conf: static.Configuration{API: &static.API{}, Global: &static.Global{}}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/entrypoints-empty.json", + }, + }, + { + desc: "all entry points", + path: "/api/entrypoints", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: map[string]*static.EntryPoint{ + "web": { + Address: ":80", + Transport: &static.EntryPointsTransport{ + LifeCycle: &static.LifeCycle{ + RequestAcceptGraceTimeout: 1, + GraceTimeOut: 2, + }, + RespondingTimeouts: &static.RespondingTimeouts{ + ReadTimeout: 3, + WriteTimeout: 4, + IdleTimeout: 5, + }, + }, + ProxyProtocol: &static.ProxyProtocol{ + Insecure: true, + TrustedIPs: []string{"192.168.1.1", "192.168.1.2"}, + }, + ForwardedHeaders: &static.ForwardedHeaders{ + Insecure: true, + TrustedIPs: []string{"192.168.1.3", "192.168.1.4"}, + }, + }, + "web-secure": { + Address: ":443", + Transport: &static.EntryPointsTransport{ + LifeCycle: &static.LifeCycle{ + RequestAcceptGraceTimeout: 10, + GraceTimeOut: 20, + }, + RespondingTimeouts: &static.RespondingTimeouts{ + ReadTimeout: 30, + WriteTimeout: 40, + IdleTimeout: 50, + }, + }, + ProxyProtocol: &static.ProxyProtocol{ + Insecure: true, + TrustedIPs: []string{"192.168.1.10", "192.168.1.20"}, + }, + ForwardedHeaders: &static.ForwardedHeaders{ + Insecure: true, + TrustedIPs: []string{"192.168.1.30", "192.168.1.40"}, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/entrypoints.json", + }, + }, + { + desc: "all entry points, pagination, 1 res per page, want page 2", + path: "/api/entrypoints?page=2&per_page=1", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: map[string]*static.EntryPoint{ + "web1": {Address: ":81"}, + "web2": {Address: ":82"}, + "web3": {Address: ":83"}, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/entrypoints-page2.json", + }, + }, + { + desc: "all entry points, pagination, 19 results overall, 7 res per page, want page 3", + path: "/api/entrypoints?page=3&per_page=7", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: generateEntryPoints(19), + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/entrypoints-many-lastpage.json", + }, + }, + { + desc: "all entry points, pagination, 5 results overall, 10 res per page, want page 2", + path: "/api/entrypoints?page=2&per_page=10", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: generateEntryPoints(5), + }, + expected: expected{ + statusCode: http.StatusBadRequest, + }, + }, + { + desc: "all entry points, pagination, 10 results overall, 10 res per page, want page 2", + path: "/api/entrypoints?page=2&per_page=10", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: generateEntryPoints(10), + }, + expected: expected{ + statusCode: http.StatusBadRequest, + }, + }, + { + desc: "one entry point by id", + path: "/api/entrypoints/bar", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: map[string]*static.EntryPoint{ + "bar": {Address: ":81"}, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/entrypoint-bar.json", + }, + }, + { + desc: "one entry point by id, that does not exist", + path: "/api/entrypoints/foo", + conf: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + EntryPoints: map[string]*static.EntryPoint{ + "bar": {Address: ":81"}, + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one entry point by id, but no config", + path: "/api/entrypoints/foo", + conf: static.Configuration{API: &static.API{}, Global: &static.Global{}}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + } + + for _, test := range testCases { + test := test + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + + handler := New(test.conf, &dynamic.RuntimeConfiguration{}) + router := mux.NewRouter() + handler.Append(router) + + server := httptest.NewServer(router) + + resp, err := http.DefaultClient.Get(server.URL + test.path) + require.NoError(t, err) + + require.Equal(t, test.expected.statusCode, resp.StatusCode) + + assert.Equal(t, test.expected.nextPage, resp.Header.Get(nextPageHeader)) + + if test.expected.jsonFile == "" { + return + } + + assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") + contents, err := ioutil.ReadAll(resp.Body) + require.NoError(t, err) + + err = resp.Body.Close() + require.NoError(t, err) + + if *updateExpected { + var results interface{} + err := json.Unmarshal(contents, &results) + require.NoError(t, err) + + newJSON, err := json.MarshalIndent(results, "", "\t") + require.NoError(t, err) + + err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) + require.NoError(t, err) + } + + data, err := ioutil.ReadFile(test.expected.jsonFile) + require.NoError(t, err) + assert.JSONEq(t, string(data), string(contents)) + }) + } +} + +func generateEntryPoints(nb int) map[string]*static.EntryPoint { + eps := make(map[string]*static.EntryPoint, nb) + for i := 0; i < nb; i++ { + eps[fmt.Sprintf("ep%2d", i)] = &static.EntryPoint{ + Address: ":" + strconv.Itoa(i), + } + } + + return eps +} diff --git a/pkg/api/handler_http.go b/pkg/api/handler_http.go new file mode 100644 index 000000000..02b8165f9 --- /dev/null +++ b/pkg/api/handler_http.go @@ -0,0 +1,198 @@ +package api + +import ( + "encoding/json" + "net/http" + "sort" + "strconv" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/log" +) + +type routerRepresentation struct { + *dynamic.RouterInfo + Name string `json:"name,omitempty"` + Provider string `json:"provider,omitempty"` +} + +type serviceRepresentation struct { + *dynamic.ServiceInfo + ServerStatus map[string]string `json:"serverStatus,omitempty"` + Name string `json:"name,omitempty"` + Provider string `json:"provider,omitempty"` +} + +type middlewareRepresentation struct { + *dynamic.MiddlewareInfo + Name string `json:"name,omitempty"` + Provider string `json:"provider,omitempty"` +} + +func (h Handler) getRouters(rw http.ResponseWriter, request *http.Request) { + results := make([]routerRepresentation, 0, len(h.runtimeConfiguration.Routers)) + + for name, rt := range h.runtimeConfiguration.Routers { + results = append(results, routerRepresentation{ + RouterInfo: rt, + Name: name, + Provider: getProviderName(name), + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getRouter(rw http.ResponseWriter, request *http.Request) { + routerID := mux.Vars(request)["routerID"] + + router, ok := h.runtimeConfiguration.Routers[routerID] + if !ok { + http.NotFound(rw, request) + return + } + + result := routerRepresentation{ + RouterInfo: router, + Name: routerID, + Provider: getProviderName(routerID), + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getServices(rw http.ResponseWriter, request *http.Request) { + results := make([]serviceRepresentation, 0, len(h.runtimeConfiguration.Services)) + + for name, si := range h.runtimeConfiguration.Services { + results = append(results, serviceRepresentation{ + ServiceInfo: si, + Name: name, + Provider: getProviderName(name), + ServerStatus: si.GetAllStatus(), + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getService(rw http.ResponseWriter, request *http.Request) { + serviceID := mux.Vars(request)["serviceID"] + + service, ok := h.runtimeConfiguration.Services[serviceID] + if !ok { + http.NotFound(rw, request) + return + } + + result := serviceRepresentation{ + ServiceInfo: service, + Name: serviceID, + Provider: getProviderName(serviceID), + ServerStatus: service.GetAllStatus(), + } + + rw.Header().Add("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getMiddlewares(rw http.ResponseWriter, request *http.Request) { + results := make([]middlewareRepresentation, 0, len(h.runtimeConfiguration.Middlewares)) + + for name, mi := range h.runtimeConfiguration.Middlewares { + results = append(results, middlewareRepresentation{ + MiddlewareInfo: mi, + Name: name, + Provider: getProviderName(name), + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getMiddleware(rw http.ResponseWriter, request *http.Request) { + middlewareID := mux.Vars(request)["middlewareID"] + + middleware, ok := h.runtimeConfiguration.Middlewares[middlewareID] + if !ok { + http.NotFound(rw, request) + return + } + + result := middlewareRepresentation{ + MiddlewareInfo: middleware, + Name: middlewareID, + Provider: getProviderName(middlewareID), + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} diff --git a/pkg/api/handler_http_test.go b/pkg/api/handler_http_test.go new file mode 100644 index 000000000..2d9a2235a --- /dev/null +++ b/pkg/api/handler_http_test.go @@ -0,0 +1,575 @@ +package api + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "strconv" + "testing" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/static" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestHandler_HTTP(t *testing.T) { + type expected struct { + statusCode int + nextPage string + jsonFile string + } + + testCases := []struct { + desc string + path string + conf dynamic.RuntimeConfiguration + expected expected + }{ + { + desc: "all routers, but no config", + path: "/api/http/routers", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/routers-empty.json", + }, + }, + { + desc: "all routers", + path: "/api/http/routers", + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ + "test@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + Middlewares: []string{"addPrefixTest", "auth"}, + }, + }, + "bar@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/routers.json", + }, + }, + { + desc: "all routers, pagination, 1 res per page, want page 2", + path: "/api/http/routers?page=2&per_page=1", + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ + "bar@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, + }, + }, + "baz@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`toto.bar`)", + }, + }, + "test@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + Middlewares: []string{"addPrefixTest", "auth"}, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/routers-page2.json", + }, + }, + { + desc: "all routers, pagination, 19 results overall, 7 res per page, want page 3", + path: "/api/http/routers?page=3&per_page=7", + conf: dynamic.RuntimeConfiguration{ + Routers: generateHTTPRouters(19), + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/routers-many-lastpage.json", + }, + }, + { + desc: "all routers, pagination, 5 results overall, 10 res per page, want page 2", + path: "/api/http/routers?page=2&per_page=10", + conf: dynamic.RuntimeConfiguration{ + Routers: generateHTTPRouters(5), + }, + expected: expected{ + statusCode: http.StatusBadRequest, + }, + }, + { + desc: "all routers, pagination, 10 results overall, 10 res per page, want page 2", + path: "/api/http/routers?page=2&per_page=10", + conf: dynamic.RuntimeConfiguration{ + Routers: generateHTTPRouters(10), + }, + expected: expected{ + statusCode: http.StatusBadRequest, + }, + }, + { + desc: "one router by id", + path: "/api/http/routers/bar@myprovider", + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ + "bar@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/router-bar.json", + }, + }, + { + desc: "one router by id, that does not exist", + path: "/api/http/routers/foo@myprovider", + conf: dynamic.RuntimeConfiguration{ + Routers: map[string]*dynamic.RouterInfo{ + "bar@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one router by id, but no config", + path: "/api/http/routers/foo@myprovider", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "all services, but no config", + path: "/api/http/services", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/services-empty.json", + }, + }, + { + desc: "all services", + path: "/api/http/services", + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.1", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + } + si.UpdateStatus("http://127.0.0.1", "UP") + return si + }(), + "baz@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.2", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider"}, + } + si.UpdateStatus("http://127.0.0.2", "UP") + return si + }(), + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/services.json", + }, + }, + { + desc: "all services, 1 res per page, want page 2", + path: "/api/http/services?page=2&per_page=1", + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.1", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + } + si.UpdateStatus("http://127.0.0.1", "UP") + return si + }(), + "baz@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.2", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider"}, + } + si.UpdateStatus("http://127.0.0.2", "UP") + return si + }(), + "test@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.3", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + } + si.UpdateStatus("http://127.0.0.4", "UP") + return si + }(), + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/services-page2.json", + }, + }, + { + desc: "one service by id", + path: "/api/http/services/bar@myprovider", + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.1", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + } + si.UpdateStatus("http://127.0.0.1", "UP") + return si + }(), + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/service-bar.json", + }, + }, + { + desc: "one service by id, that does not exist", + path: "/api/http/services/nono@myprovider", + conf: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "bar@myprovider": func() *dynamic.ServiceInfo { + si := &dynamic.ServiceInfo{ + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.1", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + } + si.UpdateStatus("http://127.0.0.1", "UP") + return si + }(), + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one service by id, but no config", + path: "/api/http/services/foo@myprovider", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "all middlewares, but no config", + path: "/api/http/middlewares", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/middlewares-empty.json", + }, + }, + { + desc: "all middlewares", + path: "/api/http/middlewares", + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ + "auth@myprovider": { + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ + Users: []string{"admin:admin"}, + }, + }, + UsedBy: []string{"bar@myprovider", "test@myprovider"}, + }, + "addPrefixTest@myprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/titi", + }, + }, + UsedBy: []string{"test@myprovider"}, + }, + "addPrefixTest@anotherprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/toto", + }, + }, + UsedBy: []string{"bar@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/middlewares.json", + }, + }, + { + desc: "all middlewares, 1 res per page, want page 2", + path: "/api/http/middlewares?page=2&per_page=1", + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ + "auth@myprovider": { + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ + Users: []string{"admin:admin"}, + }, + }, + UsedBy: []string{"bar@myprovider", "test@myprovider"}, + }, + "addPrefixTest@myprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/titi", + }, + }, + UsedBy: []string{"test@myprovider"}, + }, + "addPrefixTest@anotherprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/toto", + }, + }, + UsedBy: []string{"bar@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/middlewares-page2.json", + }, + }, + { + desc: "one middleware by id", + path: "/api/http/middlewares/auth@myprovider", + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ + "auth@myprovider": { + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ + Users: []string{"admin:admin"}, + }, + }, + UsedBy: []string{"bar@myprovider", "test@myprovider"}, + }, + "addPrefixTest@myprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/titi", + }, + }, + UsedBy: []string{"test@myprovider"}, + }, + "addPrefixTest@anotherprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/toto", + }, + }, + UsedBy: []string{"bar@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/middleware-auth.json", + }, + }, + { + desc: "one middleware by id, that does not exist", + path: "/api/http/middlewares/foo@myprovider", + conf: dynamic.RuntimeConfiguration{ + Middlewares: map[string]*dynamic.MiddlewareInfo{ + "auth@myprovider": { + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ + Users: []string{"admin:admin"}, + }, + }, + UsedBy: []string{"bar@myprovider", "test@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one middleware by id, but no config", + path: "/api/http/middlewares/foo@myprovider", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + } + + for _, test := range testCases { + test := test + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + + rtConf := &test.conf + handler := New(static.Configuration{API: &static.API{}, Global: &static.Global{}}, rtConf) + router := mux.NewRouter() + handler.Append(router) + + server := httptest.NewServer(router) + + resp, err := http.DefaultClient.Get(server.URL + test.path) + require.NoError(t, err) + + require.Equal(t, test.expected.statusCode, resp.StatusCode) + + assert.Equal(t, test.expected.nextPage, resp.Header.Get(nextPageHeader)) + + if test.expected.jsonFile == "" { + return + } + + assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") + contents, err := ioutil.ReadAll(resp.Body) + require.NoError(t, err) + + err = resp.Body.Close() + require.NoError(t, err) + + if *updateExpected { + var results interface{} + err := json.Unmarshal(contents, &results) + require.NoError(t, err) + + newJSON, err := json.MarshalIndent(results, "", "\t") + require.NoError(t, err) + + err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) + require.NoError(t, err) + } + + data, err := ioutil.ReadFile(test.expected.jsonFile) + require.NoError(t, err) + assert.JSONEq(t, string(data), string(contents)) + }) + } +} + +func generateHTTPRouters(nbRouters int) map[string]*dynamic.RouterInfo { + routers := make(map[string]*dynamic.RouterInfo, nbRouters) + for i := 0; i < nbRouters; i++ { + routers[fmt.Sprintf("bar%2d@myprovider", i)] = &dynamic.RouterInfo{ + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar" + strconv.Itoa(i) + "`)", + }, + } + } + return routers +} diff --git a/pkg/api/handler_overview.go b/pkg/api/handler_overview.go new file mode 100644 index 000000000..01c15f2b5 --- /dev/null +++ b/pkg/api/handler_overview.go @@ -0,0 +1,200 @@ +package api + +import ( + "encoding/json" + "net/http" + "reflect" + + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/static" + "github.com/containous/traefik/pkg/log" +) + +type schemeOverview struct { + Routers *section `json:"routers,omitempty"` + Services *section `json:"services,omitempty"` + Middlewares *section `json:"middlewares,omitempty"` +} + +type section struct { + Total int `json:"total"` + Warnings int `json:"warnings"` + Errors int `json:"errors"` +} + +type features struct { + Tracing string `json:"tracing"` + Metrics string `json:"metrics"` + AccessLog bool `json:"accessLog"` + // TODO add certificates resolvers +} + +type overview struct { + HTTP schemeOverview `json:"http"` + TCP schemeOverview `json:"tcp"` + Features features `json:"features,omitempty"` + Providers []string `json:"providers,omitempty"` +} + +func (h Handler) getOverview(rw http.ResponseWriter, request *http.Request) { + result := overview{ + HTTP: schemeOverview{ + Routers: getHTTPRouterSection(h.runtimeConfiguration.Routers), + Services: getHTTPServiceSection(h.runtimeConfiguration.Services), + Middlewares: getHTTPMiddlewareSection(h.runtimeConfiguration.Middlewares), + }, + TCP: schemeOverview{ + Routers: getTCPRouterSection(h.runtimeConfiguration.TCPRouters), + Services: getTCPServiceSection(h.runtimeConfiguration.TCPServices), + }, + Features: getFeatures(h.staticConfig), + Providers: getProviders(h.staticConfig), + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func getHTTPRouterSection(routers map[string]*dynamic.RouterInfo) *section { + var countErrors int + for _, rt := range routers { + if rt.Err != "" { + countErrors++ + } + } + + return §ion{ + Total: len(routers), + Warnings: 0, // TODO + Errors: countErrors, + } +} + +func getHTTPServiceSection(services map[string]*dynamic.ServiceInfo) *section { + var countErrors int + for _, svc := range services { + if svc.Err != nil { + countErrors++ + } + } + + return §ion{ + Total: len(services), + Warnings: 0, // TODO + Errors: countErrors, + } +} + +func getHTTPMiddlewareSection(middlewares map[string]*dynamic.MiddlewareInfo) *section { + var countErrors int + for _, md := range middlewares { + if md.Err != nil { + countErrors++ + } + } + + return §ion{ + Total: len(middlewares), + Warnings: 0, // TODO + Errors: countErrors, + } +} + +func getTCPRouterSection(routers map[string]*dynamic.TCPRouterInfo) *section { + var countErrors int + for _, rt := range routers { + if rt.Err != "" { + countErrors++ + } + } + + return §ion{ + Total: len(routers), + Warnings: 0, // TODO + Errors: countErrors, + } +} + +func getTCPServiceSection(services map[string]*dynamic.TCPServiceInfo) *section { + var countErrors int + for _, svc := range services { + if svc.Err != nil { + countErrors++ + } + } + + return §ion{ + Total: len(services), + Warnings: 0, // TODO + Errors: countErrors, + } +} + +func getProviders(conf static.Configuration) []string { + if conf.Providers == nil { + return nil + } + + var providers []string + + v := reflect.ValueOf(conf.Providers).Elem() + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Kind() == reflect.Ptr && field.Elem().Kind() == reflect.Struct { + if !field.IsNil() { + providers = append(providers, v.Type().Field(i).Name) + } + } + } + + return providers +} + +func getFeatures(conf static.Configuration) features { + return features{ + Tracing: getTracing(conf), + Metrics: getMetrics(conf), + AccessLog: conf.AccessLog != nil, + } +} + +func getMetrics(conf static.Configuration) string { + if conf.Metrics == nil { + return "" + } + + v := reflect.ValueOf(conf.Metrics).Elem() + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Kind() == reflect.Ptr && field.Elem().Kind() == reflect.Struct { + if !field.IsNil() { + return v.Type().Field(i).Name + } + } + } + + return "" +} + +func getTracing(conf static.Configuration) string { + if conf.Tracing == nil { + return "" + } + + v := reflect.ValueOf(conf.Tracing).Elem() + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Kind() == reflect.Ptr && field.Elem().Kind() == reflect.Struct { + if !field.IsNil() { + return v.Type().Field(i).Name + } + } + } + + return "" +} diff --git a/pkg/api/handler_overview_test.go b/pkg/api/handler_overview_test.go new file mode 100644 index 000000000..bfdaf0b42 --- /dev/null +++ b/pkg/api/handler_overview_test.go @@ -0,0 +1,230 @@ +package api + +import ( + "encoding/json" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/static" + "github.com/containous/traefik/pkg/provider/docker" + "github.com/containous/traefik/pkg/provider/file" + "github.com/containous/traefik/pkg/provider/kubernetes/crd" + "github.com/containous/traefik/pkg/provider/kubernetes/ingress" + "github.com/containous/traefik/pkg/provider/marathon" + "github.com/containous/traefik/pkg/provider/rancher" + "github.com/containous/traefik/pkg/provider/rest" + "github.com/containous/traefik/pkg/tracing/jaeger" + "github.com/containous/traefik/pkg/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestHandler_Overview(t *testing.T) { + type expected struct { + statusCode int + jsonFile string + } + + testCases := []struct { + desc string + path string + confStatic static.Configuration + confDyn dynamic.RuntimeConfiguration + expected expected + }{ + { + desc: "without data in the dynamic configuration", + path: "/api/overview", + confStatic: static.Configuration{API: &static.API{}, Global: &static.Global{}}, + confDyn: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/overview-empty.json", + }, + }, + { + desc: "with data in the dynamic configuration", + path: "/api/overview", + confStatic: static.Configuration{API: &static.API{}, Global: &static.Global{}}, + confDyn: dynamic.RuntimeConfiguration{ + Services: map[string]*dynamic.ServiceInfo{ + "foo-service@myprovider": { + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://127.0.0.1", + }, + }, + }, + }, + }, + }, + Middlewares: map[string]*dynamic.MiddlewareInfo{ + "auth@myprovider": { + Middleware: &dynamic.Middleware{ + BasicAuth: &dynamic.BasicAuth{ + Users: []string{"admin:admin"}, + }, + }, + }, + "addPrefixTest@myprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/titi", + }, + }, + }, + "addPrefixTest@anotherprovider": { + Middleware: &dynamic.Middleware{ + AddPrefix: &dynamic.AddPrefix{ + Prefix: "/toto", + }, + }, + }, + }, + Routers: map[string]*dynamic.RouterInfo{ + "bar@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, + }, + }, + "test@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + Middlewares: []string{"addPrefixTest", "auth"}, + }, + }, + }, + TCPServices: map[string]*dynamic.TCPServiceInfo{ + "tcpfoo-service@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.1", + }, + }, + }, + }, + }, + }, + TCPRouters: map[string]*dynamic.TCPRouterInfo{ + "tcpbar@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "tcpfoo-service@myprovider", + Rule: "HostSNI(`foo.bar`)", + }, + }, + "tcptest@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "tcpfoo-service@myprovider", + Rule: "HostSNI(`foo.bar.other`)", + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/overview-dynamic.json", + }, + }, + { + desc: "with providers", + path: "/api/overview", + confStatic: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + Providers: &static.Providers{ + Docker: &docker.Provider{}, + File: &file.Provider{}, + Marathon: &marathon.Provider{}, + KubernetesIngress: &ingress.Provider{}, + KubernetesCRD: &crd.Provider{}, + Rest: &rest.Provider{}, + Rancher: &rancher.Provider{}, + }, + }, + confDyn: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/overview-providers.json", + }, + }, + { + desc: "with features", + path: "/api/overview", + confStatic: static.Configuration{ + Global: &static.Global{}, + API: &static.API{}, + Metrics: &types.Metrics{ + Prometheus: &types.Prometheus{}, + }, + Tracing: &static.Tracing{ + Jaeger: &jaeger.Config{}, + }, + }, + confDyn: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/overview-features.json", + }, + }, + } + + for _, test := range testCases { + test := test + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + + handler := New(test.confStatic, &test.confDyn) + router := mux.NewRouter() + handler.Append(router) + + server := httptest.NewServer(router) + + resp, err := http.DefaultClient.Get(server.URL + test.path) + require.NoError(t, err) + + require.Equal(t, test.expected.statusCode, resp.StatusCode) + + if test.expected.jsonFile == "" { + return + } + + assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") + contents, err := ioutil.ReadAll(resp.Body) + require.NoError(t, err) + + err = resp.Body.Close() + require.NoError(t, err) + + if *updateExpected { + var results interface{} + err := json.Unmarshal(contents, &results) + require.NoError(t, err) + + newJSON, err := json.MarshalIndent(results, "", "\t") + require.NoError(t, err) + + err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) + require.NoError(t, err) + } + + data, err := ioutil.ReadFile(test.expected.jsonFile) + require.NoError(t, err) + assert.JSONEq(t, string(data), string(contents)) + }) + } +} diff --git a/pkg/api/handler_tcp.go b/pkg/api/handler_tcp.go new file mode 100644 index 000000000..81217f240 --- /dev/null +++ b/pkg/api/handler_tcp.go @@ -0,0 +1,134 @@ +package api + +import ( + "encoding/json" + "net/http" + "sort" + "strconv" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/log" +) + +type tcpRouterRepresentation struct { + *dynamic.TCPRouterInfo + Name string `json:"name,omitempty"` + Provider string `json:"provider,omitempty"` +} + +type tcpServiceRepresentation struct { + *dynamic.TCPServiceInfo + Name string `json:"name,omitempty"` + Provider string `json:"provider,omitempty"` +} + +func (h Handler) getTCPRouters(rw http.ResponseWriter, request *http.Request) { + results := make([]tcpRouterRepresentation, 0, len(h.runtimeConfiguration.TCPRouters)) + + for name, rt := range h.runtimeConfiguration.TCPRouters { + results = append(results, tcpRouterRepresentation{ + TCPRouterInfo: rt, + Name: name, + Provider: getProviderName(name), + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getTCPRouter(rw http.ResponseWriter, request *http.Request) { + routerID := mux.Vars(request)["routerID"] + + router, ok := h.runtimeConfiguration.TCPRouters[routerID] + if !ok { + http.NotFound(rw, request) + return + } + + result := tcpRouterRepresentation{ + TCPRouterInfo: router, + Name: routerID, + Provider: getProviderName(routerID), + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getTCPServices(rw http.ResponseWriter, request *http.Request) { + results := make([]tcpServiceRepresentation, 0, len(h.runtimeConfiguration.TCPServices)) + + for name, si := range h.runtimeConfiguration.TCPServices { + results = append(results, tcpServiceRepresentation{ + TCPServiceInfo: si, + Name: name, + Provider: getProviderName(name), + }) + } + + sort.Slice(results, func(i, j int) bool { + return results[i].Name < results[j].Name + }) + + pageInfo, err := pagination(request, len(results)) + if err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + rw.Header().Set("Content-Type", "application/json") + rw.Header().Set(nextPageHeader, strconv.Itoa(pageInfo.nextPage)) + + err = json.NewEncoder(rw).Encode(results[pageInfo.startIndex:pageInfo.endIndex]) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} + +func (h Handler) getTCPService(rw http.ResponseWriter, request *http.Request) { + serviceID := mux.Vars(request)["serviceID"] + + service, ok := h.runtimeConfiguration.TCPServices[serviceID] + if !ok { + http.NotFound(rw, request) + return + } + + result := tcpServiceRepresentation{ + TCPServiceInfo: service, + Name: serviceID, + Provider: getProviderName(serviceID), + } + + rw.Header().Set("Content-Type", "application/json") + + err := json.NewEncoder(rw).Encode(result) + if err != nil { + log.FromContext(request.Context()).Error(err) + http.Error(rw, err.Error(), http.StatusInternalServerError) + } +} diff --git a/pkg/api/handler_tcp_test.go b/pkg/api/handler_tcp_test.go new file mode 100644 index 000000000..20f7cbeb8 --- /dev/null +++ b/pkg/api/handler_tcp_test.go @@ -0,0 +1,349 @@ +package api + +import ( + "encoding/json" + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" + + "github.com/containous/mux" + "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/static" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestHandler_TCP(t *testing.T) { + type expected struct { + statusCode int + nextPage string + jsonFile string + } + + testCases := []struct { + desc string + path string + conf dynamic.RuntimeConfiguration + expected expected + }{ + { + desc: "all TCP routers, but no config", + path: "/api/tcp/routers", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/tcprouters-empty.json", + }, + }, + { + desc: "all TCP routers", + path: "/api/tcp/routers", + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ + "test@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + TLS: &dynamic.RouterTCPTLSConfig{ + Passthrough: false, + }, + }, + }, + "bar@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/tcprouters.json", + }, + }, + { + desc: "all TCP routers, pagination, 1 res per page, want page 2", + path: "/api/tcp/routers?page=2&per_page=1", + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ + "bar@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + }, + }, + "baz@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`toto.bar`)", + }, + }, + "test@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/tcprouters-page2.json", + }, + }, + { + desc: "one TCP router by id", + path: "/api/tcp/routers/bar@myprovider", + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ + "bar@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/tcprouter-bar.json", + }, + }, + { + desc: "one TCP router by id, that does not exist", + path: "/api/tcp/routers/foo@myprovider", + conf: dynamic.RuntimeConfiguration{ + TCPRouters: map[string]*dynamic.TCPRouterInfo{ + "bar@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one TCP router by id, but no config", + path: "/api/tcp/routers/bar@myprovider", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "all tcp services, but no config", + path: "/api/tcp/services", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/tcpservices-empty.json", + }, + }, + { + desc: "all tcp services", + path: "/api/tcp/services", + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ + "bar@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.1:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + }, + "baz@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.2:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "1", + jsonFile: "testdata/tcpservices.json", + }, + }, + { + desc: "all tcp services, 1 res per page, want page 2", + path: "/api/tcp/services?page=2&per_page=1", + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ + "bar@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.1:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + }, + "baz@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.2:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider"}, + }, + "test@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.3:2345", + }, + }, + }, + }, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + nextPage: "3", + jsonFile: "testdata/tcpservices-page2.json", + }, + }, + { + desc: "one tcp service by id", + path: "/api/tcp/services/bar@myprovider", + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ + "bar@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.1:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusOK, + jsonFile: "testdata/tcpservice-bar.json", + }, + }, + { + desc: "one tcp service by id, that does not exist", + path: "/api/tcp/services/nono@myprovider", + conf: dynamic.RuntimeConfiguration{ + TCPServices: map[string]*dynamic.TCPServiceInfo{ + "bar@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.1:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider", "test@myprovider"}, + }, + }, + }, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + { + desc: "one tcp service by id, but no config", + path: "/api/tcp/services/foo@myprovider", + conf: dynamic.RuntimeConfiguration{}, + expected: expected{ + statusCode: http.StatusNotFound, + }, + }, + } + + for _, test := range testCases { + test := test + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + + rtConf := &test.conf + handler := New(static.Configuration{API: &static.API{}, Global: &static.Global{}}, rtConf) + router := mux.NewRouter() + handler.Append(router) + + server := httptest.NewServer(router) + + resp, err := http.DefaultClient.Get(server.URL + test.path) + require.NoError(t, err) + + assert.Equal(t, test.expected.nextPage, resp.Header.Get(nextPageHeader)) + + require.Equal(t, test.expected.statusCode, resp.StatusCode) + + if test.expected.jsonFile == "" { + return + } + + assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") + + contents, err := ioutil.ReadAll(resp.Body) + require.NoError(t, err) + + err = resp.Body.Close() + require.NoError(t, err) + + if *updateExpected { + var results interface{} + err := json.Unmarshal(contents, &results) + require.NoError(t, err) + + newJSON, err := json.MarshalIndent(results, "", "\t") + require.NoError(t, err) + + err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) + require.NoError(t, err) + } + + data, err := ioutil.ReadFile(test.expected.jsonFile) + require.NoError(t, err) + assert.JSONEq(t, string(data), string(contents)) + }) + } +} diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go index fa770b33a..59f0d5edc 100644 --- a/pkg/api/handler_test.go +++ b/pkg/api/handler_test.go @@ -3,11 +3,9 @@ package api import ( "encoding/json" "flag" - "fmt" "io/ioutil" "net/http" "net/http/httptest" - "strconv" "testing" "github.com/containous/mux" @@ -19,885 +17,7 @@ import ( var updateExpected = flag.Bool("update_expected", false, "Update expected files in testdata") -func TestHandlerTCP_API(t *testing.T) { - type expected struct { - statusCode int - nextPage string - jsonFile string - } - - testCases := []struct { - desc string - path string - conf dynamic.RuntimeConfiguration - expected expected - }{ - { - desc: "all TCP routers, but no config", - path: "/api/tcp/routers", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/tcprouters-empty.json", - }, - }, - { - desc: "all TCP routers", - path: "/api/tcp/routers", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ - "test@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar.other`)", - TLS: &dynamic.RouterTCPTLSConfig{ - Passthrough: false, - }, - }, - }, - "bar@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/tcprouters.json", - }, - }, - { - desc: "all TCP routers, pagination, 1 res per page, want page 2", - path: "/api/tcp/routers?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ - "bar@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - }, - }, - "baz@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`toto.bar`)", - }, - }, - "test@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar.other`)", - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "3", - jsonFile: "testdata/tcprouters-page2.json", - }, - }, - { - desc: "one TCP router by id", - path: "/api/tcp/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ - "bar@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - jsonFile: "testdata/tcprouter-bar.json", - }, - }, - { - desc: "one TCP router by id, that does not exist", - path: "/api/tcp/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ - "bar@myprovider": { - TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "one TCP router by id, but no config", - path: "/api/tcp/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "all tcp services, but no config", - path: "/api/tcp/services", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/tcpservices-empty.json", - }, - }, - { - desc: "all tcp services", - path: "/api/tcp/services", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ - "bar@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.1:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - }, - "baz@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.2:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/tcpservices.json", - }, - }, - { - desc: "all tcp services, 1 res per page, want page 2", - path: "/api/tcp/services?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ - "bar@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.1:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - }, - "baz@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.2:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider"}, - }, - "test@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.3:2345", - }, - }, - }, - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "3", - jsonFile: "testdata/tcpservices-page2.json", - }, - }, - { - desc: "one tcp service by id", - path: "/api/tcp/services/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ - "bar@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.1:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - jsonFile: "testdata/tcpservice-bar.json", - }, - }, - { - desc: "one tcp service by id, that does not exist", - path: "/api/tcp/services/nono@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ - "bar@myprovider": { - TCPService: &dynamic.TCPService{ - LoadBalancer: &dynamic.TCPLoadBalancerService{ - Servers: []dynamic.TCPServer{ - { - Address: "127.0.0.1:2345", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "one tcp service by id, but no config", - path: "/api/tcp/services/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - } - - for _, test := range testCases { - test := test - t.Run(test.desc, func(t *testing.T) { - t.Parallel() - - rtConf := &test.conf - handler := New(static.Configuration{API: &static.API{}, Global: &static.Global{}}, rtConf) - router := mux.NewRouter() - handler.Append(router) - - server := httptest.NewServer(router) - - resp, err := http.DefaultClient.Get(server.URL + test.path) - require.NoError(t, err) - - assert.Equal(t, test.expected.nextPage, resp.Header.Get(nextPageHeader)) - - require.Equal(t, test.expected.statusCode, resp.StatusCode) - - if test.expected.jsonFile == "" { - return - } - - assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") - - contents, err := ioutil.ReadAll(resp.Body) - require.NoError(t, err) - - err = resp.Body.Close() - require.NoError(t, err) - - if *updateExpected { - var results interface{} - err := json.Unmarshal(contents, &results) - require.NoError(t, err) - - newJSON, err := json.MarshalIndent(results, "", "\t") - require.NoError(t, err) - - err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) - require.NoError(t, err) - } - - data, err := ioutil.ReadFile(test.expected.jsonFile) - require.NoError(t, err) - assert.JSONEq(t, string(data), string(contents)) - }) - } -} - -func TestHandlerHTTP_API(t *testing.T) { - type expected struct { - statusCode int - nextPage string - jsonFile string - } - - testCases := []struct { - desc string - path string - conf dynamic.RuntimeConfiguration - expected expected - }{ - { - desc: "all routers, but no config", - path: "/api/http/routers", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/routers-empty.json", - }, - }, - { - desc: "all routers", - path: "/api/http/routers", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ - "test@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar.other`)", - Middlewares: []string{"addPrefixTest", "auth"}, - }, - }, - "bar@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/routers.json", - }, - }, - { - desc: "all routers, pagination, 1 res per page, want page 2", - path: "/api/http/routers?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ - "bar@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, - }, - }, - "baz@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`toto.bar`)", - }, - }, - "test@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar.other`)", - Middlewares: []string{"addPrefixTest", "auth"}, - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "3", - jsonFile: "testdata/routers-page2.json", - }, - }, - { - desc: "all routers, pagination, 19 results overall, 7 res per page, want page 3", - path: "/api/http/routers?page=3&per_page=7", - conf: dynamic.RuntimeConfiguration{ - Routers: generateHTTPRouters(19), - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/routers-many-lastpage.json", - }, - }, - { - desc: "all routers, pagination, 5 results overall, 10 res per page, want page 2", - path: "/api/http/routers?page=2&per_page=10", - conf: dynamic.RuntimeConfiguration{ - Routers: generateHTTPRouters(5), - }, - expected: expected{ - statusCode: http.StatusBadRequest, - }, - }, - { - desc: "all routers, pagination, 10 results overall, 10 res per page, want page 2", - path: "/api/http/routers?page=2&per_page=10", - conf: dynamic.RuntimeConfiguration{ - Routers: generateHTTPRouters(10), - }, - expected: expected{ - statusCode: http.StatusBadRequest, - }, - }, - { - desc: "one router by id", - path: "/api/http/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ - "bar@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - jsonFile: "testdata/router-bar.json", - }, - }, - { - desc: "one router by id, that does not exist", - path: "/api/http/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ - "bar@myprovider": { - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar`)", - Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, - }, - }, - }, - }, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "one router by id, but no config", - path: "/api/http/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "all services, but no config", - path: "/api/http/services", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/services-empty.json", - }, - }, - { - desc: "all services", - path: "/api/http/services", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.1", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - } - si.UpdateStatus("http://127.0.0.1", "UP") - return si - }(), - "baz@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.2", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider"}, - } - si.UpdateStatus("http://127.0.0.2", "UP") - return si - }(), - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/services.json", - }, - }, - { - desc: "all services, 1 res per page, want page 2", - path: "/api/http/services?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.1", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - } - si.UpdateStatus("http://127.0.0.1", "UP") - return si - }(), - "baz@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.2", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider"}, - } - si.UpdateStatus("http://127.0.0.2", "UP") - return si - }(), - "test@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.3", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - } - si.UpdateStatus("http://127.0.0.4", "UP") - return si - }(), - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "3", - jsonFile: "testdata/services-page2.json", - }, - }, - { - desc: "one service by id", - path: "/api/http/services/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.1", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - } - si.UpdateStatus("http://127.0.0.1", "UP") - return si - }(), - }, - }, - expected: expected{ - statusCode: http.StatusOK, - jsonFile: "testdata/service-bar.json", - }, - }, - { - desc: "one service by id, that does not exist", - path: "/api/http/services/nono@myprovider", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ - Service: &dynamic.Service{ - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.1", - }, - }, - }, - }, - UsedBy: []string{"foo@myprovider", "test@myprovider"}, - } - si.UpdateStatus("http://127.0.0.1", "UP") - return si - }(), - }, - }, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "one service by id, but no config", - path: "/api/http/services/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "all middlewares, but no config", - path: "/api/http/middlewares", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/middlewares-empty.json", - }, - }, - { - desc: "all middlewares", - path: "/api/http/middlewares", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ - "auth@myprovider": { - Middleware: &dynamic.Middleware{ - BasicAuth: &dynamic.BasicAuth{ - Users: []string{"admin:admin"}, - }, - }, - UsedBy: []string{"bar@myprovider", "test@myprovider"}, - }, - "addPrefixTest@myprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/titi", - }, - }, - UsedBy: []string{"test@myprovider"}, - }, - "addPrefixTest@anotherprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/toto", - }, - }, - UsedBy: []string{"bar@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "1", - jsonFile: "testdata/middlewares.json", - }, - }, - { - desc: "all middlewares, 1 res per page, want page 2", - path: "/api/http/middlewares?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ - "auth@myprovider": { - Middleware: &dynamic.Middleware{ - BasicAuth: &dynamic.BasicAuth{ - Users: []string{"admin:admin"}, - }, - }, - UsedBy: []string{"bar@myprovider", "test@myprovider"}, - }, - "addPrefixTest@myprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/titi", - }, - }, - UsedBy: []string{"test@myprovider"}, - }, - "addPrefixTest@anotherprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/toto", - }, - }, - UsedBy: []string{"bar@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - nextPage: "3", - jsonFile: "testdata/middlewares-page2.json", - }, - }, - { - desc: "one middleware by id", - path: "/api/http/middlewares/auth@myprovider", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ - "auth@myprovider": { - Middleware: &dynamic.Middleware{ - BasicAuth: &dynamic.BasicAuth{ - Users: []string{"admin:admin"}, - }, - }, - UsedBy: []string{"bar@myprovider", "test@myprovider"}, - }, - "addPrefixTest@myprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/titi", - }, - }, - UsedBy: []string{"test@myprovider"}, - }, - "addPrefixTest@anotherprovider": { - Middleware: &dynamic.Middleware{ - AddPrefix: &dynamic.AddPrefix{ - Prefix: "/toto", - }, - }, - UsedBy: []string{"bar@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusOK, - jsonFile: "testdata/middleware-auth.json", - }, - }, - { - desc: "one middleware by id, that does not exist", - path: "/api/http/middlewares/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ - "auth@myprovider": { - Middleware: &dynamic.Middleware{ - BasicAuth: &dynamic.BasicAuth{ - Users: []string{"admin:admin"}, - }, - }, - UsedBy: []string{"bar@myprovider", "test@myprovider"}, - }, - }, - }, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - { - desc: "one middleware by id, but no config", - path: "/api/http/middlewares/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, - expected: expected{ - statusCode: http.StatusNotFound, - }, - }, - } - - for _, test := range testCases { - test := test - t.Run(test.desc, func(t *testing.T) { - t.Parallel() - - rtConf := &test.conf - handler := New(static.Configuration{API: &static.API{}, Global: &static.Global{}}, rtConf) - router := mux.NewRouter() - handler.Append(router) - - server := httptest.NewServer(router) - - resp, err := http.DefaultClient.Get(server.URL + test.path) - require.NoError(t, err) - - require.Equal(t, test.expected.statusCode, resp.StatusCode) - - assert.Equal(t, test.expected.nextPage, resp.Header.Get(nextPageHeader)) - - if test.expected.jsonFile == "" { - return - } - - assert.Equal(t, resp.Header.Get("Content-Type"), "application/json") - contents, err := ioutil.ReadAll(resp.Body) - require.NoError(t, err) - - err = resp.Body.Close() - require.NoError(t, err) - - if *updateExpected { - var results interface{} - err := json.Unmarshal(contents, &results) - require.NoError(t, err) - - newJSON, err := json.MarshalIndent(results, "", "\t") - require.NoError(t, err) - - err = ioutil.WriteFile(test.expected.jsonFile, newJSON, 0644) - require.NoError(t, err) - } - - data, err := ioutil.ReadFile(test.expected.jsonFile) - require.NoError(t, err) - assert.JSONEq(t, string(data), string(contents)) - }) - } -} - -func TestHandler_Configuration(t *testing.T) { +func TestHandler_RawData(t *testing.T) { type expected struct { statusCode int json string @@ -1053,17 +173,3 @@ func TestHandler_Configuration(t *testing.T) { }) } } - -func generateHTTPRouters(nbRouters int) map[string]*dynamic.RouterInfo { - routers := make(map[string]*dynamic.RouterInfo, nbRouters) - for i := 0; i < nbRouters; i++ { - routers[fmt.Sprintf("bar%2d@myprovider", i)] = &dynamic.RouterInfo{ - Router: &dynamic.Router{ - EntryPoints: []string{"web"}, - Service: "foo-service@myprovider", - Rule: "Host(`foo.bar" + strconv.Itoa(i) + "`)", - }, - } - } - return routers -} diff --git a/pkg/api/testdata/entrypoint-bar.json b/pkg/api/testdata/entrypoint-bar.json new file mode 100644 index 000000000..31177544f --- /dev/null +++ b/pkg/api/testdata/entrypoint-bar.json @@ -0,0 +1,4 @@ +{ + "address": ":81", + "name": "bar" +} \ No newline at end of file diff --git a/pkg/api/testdata/entrypoints-empty.json b/pkg/api/testdata/entrypoints-empty.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/pkg/api/testdata/entrypoints-empty.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/pkg/api/testdata/entrypoints-many-lastpage.json b/pkg/api/testdata/entrypoints-many-lastpage.json new file mode 100644 index 000000000..588b0e2e3 --- /dev/null +++ b/pkg/api/testdata/entrypoints-many-lastpage.json @@ -0,0 +1,22 @@ +[ + { + "address": ":14", + "name": "ep14" + }, + { + "address": ":15", + "name": "ep15" + }, + { + "address": ":16", + "name": "ep16" + }, + { + "address": ":17", + "name": "ep17" + }, + { + "address": ":18", + "name": "ep18" + } +] \ No newline at end of file diff --git a/pkg/api/testdata/entrypoints-page2.json b/pkg/api/testdata/entrypoints-page2.json new file mode 100644 index 000000000..142f5b9e7 --- /dev/null +++ b/pkg/api/testdata/entrypoints-page2.json @@ -0,0 +1,6 @@ +[ + { + "address": ":82", + "name": "web2" + } +] \ No newline at end of file diff --git a/pkg/api/testdata/entrypoints.json b/pkg/api/testdata/entrypoints.json new file mode 100644 index 000000000..4c8e5ae55 --- /dev/null +++ b/pkg/api/testdata/entrypoints.json @@ -0,0 +1,60 @@ +[ + { + "address": ":80", + "forwardedHeaders": { + "insecure": true, + "trustedIPs": [ + "192.168.1.3", + "192.168.1.4" + ] + }, + "name": "web", + "proxyProtocol": { + "insecure": true, + "trustedIPs": [ + "192.168.1.1", + "192.168.1.2" + ] + }, + "transport": { + "lifeCycle": { + "graceTimeOut": 2, + "requestAcceptGraceTimeout": 1 + }, + "respondingTimeouts": { + "idleTimeout": 5, + "readTimeout": 3, + "writeTimeout": 4 + } + } + }, + { + "address": ":443", + "forwardedHeaders": { + "insecure": true, + "trustedIPs": [ + "192.168.1.30", + "192.168.1.40" + ] + }, + "name": "web-secure", + "proxyProtocol": { + "insecure": true, + "trustedIPs": [ + "192.168.1.10", + "192.168.1.20" + ] + }, + "transport": { + "lifeCycle": { + "graceTimeOut": 20, + "requestAcceptGraceTimeout": 10 + }, + "respondingTimeouts": { + "idleTimeout": 50, + "readTimeout": 30, + "writeTimeout": 40 + } + } + } +] \ No newline at end of file diff --git a/pkg/api/testdata/overview-dynamic.json b/pkg/api/testdata/overview-dynamic.json new file mode 100644 index 000000000..346f47433 --- /dev/null +++ b/pkg/api/testdata/overview-dynamic.json @@ -0,0 +1,36 @@ +{ + "features": { + "accessLog": false, + "metrics": "", + "tracing": "" + }, + "http": { + "middlewares": { + "errors": 0, + "total": 3, + "warnings": 0 + }, + "routers": { + "errors": 0, + "total": 2, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 1, + "warnings": 0 + } + }, + "tcp": { + "routers": { + "errors": 0, + "total": 2, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 1, + "warnings": 0 + } + } +} \ No newline at end of file diff --git a/pkg/api/testdata/overview-empty.json b/pkg/api/testdata/overview-empty.json new file mode 100644 index 000000000..974fa846a --- /dev/null +++ b/pkg/api/testdata/overview-empty.json @@ -0,0 +1,36 @@ +{ + "features": { + "accessLog": false, + "metrics": "", + "tracing": "" + }, + "http": { + "middlewares": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + }, + "tcp": { + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + } +} \ No newline at end of file diff --git a/pkg/api/testdata/overview-features.json b/pkg/api/testdata/overview-features.json new file mode 100644 index 000000000..91b0c1c45 --- /dev/null +++ b/pkg/api/testdata/overview-features.json @@ -0,0 +1,36 @@ +{ + "features": { + "accessLog": false, + "metrics": "Prometheus", + "tracing": "Jaeger" + }, + "http": { + "middlewares": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + }, + "tcp": { + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + } +} \ No newline at end of file diff --git a/pkg/api/testdata/overview-providers.json b/pkg/api/testdata/overview-providers.json new file mode 100644 index 000000000..516194468 --- /dev/null +++ b/pkg/api/testdata/overview-providers.json @@ -0,0 +1,45 @@ +{ + "features": { + "accessLog": false, + "metrics": "", + "tracing": "" + }, + "http": { + "middlewares": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + }, + "providers": [ + "Docker", + "File", + "Marathon", + "KubernetesIngress", + "KubernetesCRD", + "Rest", + "Rancher" + ], + "tcp": { + "routers": { + "errors": 0, + "total": 0, + "warnings": 0 + }, + "services": { + "errors": 0, + "total": 0, + "warnings": 0 + } + } +} \ No newline at end of file From 3f6ea04048239cae6fde10e6bce413e5bcfb72d5 Mon Sep 17 00:00:00 2001 From: Daniel Tomcej Date: Fri, 12 Jul 2019 03:46:04 -0600 Subject: [PATCH 10/49] Properly add response headers for CORS --- integration/fixtures/headers/basic.toml | 15 -- integration/fixtures/headers/cors.toml | 12 +- integration/headers_test.go | 76 ++++----- integration/resources/compose/headers.yml | 4 - integration/try/condition.go | 13 +- pkg/middlewares/headers/headers.go | 183 +++++++++++++--------- pkg/middlewares/headers/headers_test.go | 31 +++- pkg/responsemodifiers/headers.go | 2 +- 8 files changed, 198 insertions(+), 138 deletions(-) delete mode 100644 integration/resources/compose/headers.yml diff --git a/integration/fixtures/headers/basic.toml b/integration/fixtures/headers/basic.toml index 5ed0ab4ba..29b1eb79e 100644 --- a/integration/fixtures/headers/basic.toml +++ b/integration/fixtures/headers/basic.toml @@ -8,18 +8,3 @@ [entryPoints] [entryPoints.web] address = ":8000" - -[providers] - [providers.file] - -## dynamic configuration ## - -[http.routers] - [http.routers.router1] - rule = "Host(`test.localhost`)" - service = "service1" - -[http.services] - [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 7cc707cab..32b8d2995 100644 --- a/integration/fixtures/headers/cors.toml +++ b/integration/fixtures/headers/cors.toml @@ -17,6 +17,12 @@ [http.routers] [http.routers.router1] rule = "Host(`test.localhost`)" + middlewares = ["cors"] + service = "service1" + + [http.routers.router2] + rule = "Host(`test2.localhost`)" + middlewares = ["nocors"] service = "service1" [http.middlewares] @@ -26,7 +32,11 @@ accessControlMaxAge = 100 addVaryHeader = true + [http.middlewares.nocors.Headers] + [http.middlewares.nocors.Headers.CustomResponseHeaders] + X-Custom-Response-Header = "True" + [http.services] [http.services.service1.loadBalancer] [[http.services.service1.loadBalancer.servers]] - url = "http://172.17.0.2:80" + url = "http://127.0.0.1:9000" diff --git a/integration/headers_test.go b/integration/headers_test.go index 8ddc4f7a4..dd60a5876 100644 --- a/integration/headers_test.go +++ b/integration/headers_test.go @@ -12,12 +12,6 @@ import ( // Headers test suites type HeadersSuite struct{ BaseSuite } -func (s *HeadersSuite) SetUpSuite(c *check.C) { - s.createComposeProject(c, "headers") - - s.composeProject.Start(c) -} - func (s *HeadersSuite) TestSimpleConfiguration(c *check.C) { cmd, display := s.traefikCmd(withConfigFile("fixtures/headers/basic.toml")) defer display(c) @@ -38,10 +32,18 @@ func (s *HeadersSuite) TestCorsResponses(c *check.C) { c.Assert(err, checker.IsNil) defer cmd.Process.Kill() + backend := startTestServer("9000", http.StatusOK) + defer backend.Close() + + err = try.GetRequest(backend.URL, 500*time.Millisecond, try.StatusCodeIs(http.StatusOK)) + c.Assert(err, checker.IsNil) + testCase := []struct { desc string requestHeaders http.Header expected http.Header + reqHost string + method string }{ { desc: "simple access control allow origin", @@ -52,33 +54,9 @@ func (s *HeadersSuite) TestCorsResponses(c *check.C) { "Access-Control-Allow-Origin": {"https://foo.bar.org"}, "Vary": {"Origin"}, }, + reqHost: "test.localhost", + method: http.MethodGet, }, - } - - for _, test := range testCase { - req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/", nil) - c.Assert(err, checker.IsNil) - req.Host = "test.localhost" - req.Header = test.requestHeaders - - err = try.Request(req, 500*time.Millisecond, try.HasBody(), try.HasHeaderStruct(test.expected)) - c.Assert(err, checker.IsNil) - } -} - -func (s *HeadersSuite) TestCorsPreflightResponses(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/headers/cors.toml")) - defer display(c) - - err := cmd.Start() - c.Assert(err, checker.IsNil) - defer cmd.Process.Kill() - - testCase := []struct { - desc string - requestHeaders http.Header - expected http.Header - }{ { desc: "simple preflight request", requestHeaders: http.Header{ @@ -91,16 +69,44 @@ func (s *HeadersSuite) TestCorsPreflightResponses(c *check.C) { "Access-Control-Max-Age": {"100"}, "Access-Control-Allow-Methods": {"GET,OPTIONS,PUT"}, }, + reqHost: "test.localhost", + method: http.MethodOptions, + }, + { + desc: "preflight Options request with no cors configured", + requestHeaders: http.Header{ + "Access-Control-Request-Headers": {"origin"}, + "Access-Control-Request-Method": {"GET", "OPTIONS"}, + "Origin": {"https://foo.bar.org"}, + }, + expected: http.Header{ + "X-Custom-Response-Header": {"True"}, + }, + reqHost: "test2.localhost", + method: http.MethodOptions, + }, + { + desc: "preflight Get request with no cors configured", + requestHeaders: http.Header{ + "Access-Control-Request-Headers": {"origin"}, + "Access-Control-Request-Method": {"GET", "OPTIONS"}, + "Origin": {"https://foo.bar.org"}, + }, + expected: http.Header{ + "X-Custom-Response-Header": {"True"}, + }, + reqHost: "test2.localhost", + method: http.MethodGet, }, } for _, test := range testCase { - req, err := http.NewRequest(http.MethodOptions, "http://127.0.0.1:8000/", nil) + req, err := http.NewRequest(test.method, "http://127.0.0.1:8000/", nil) c.Assert(err, checker.IsNil) - req.Host = "test.localhost" + req.Host = test.reqHost req.Header = test.requestHeaders - err = try.Request(req, 500*time.Millisecond, try.HasBody(), try.HasHeaderStruct(test.expected)) + err = try.Request(req, 500*time.Millisecond, try.HasHeaderStruct(test.expected)) c.Assert(err, checker.IsNil) } } diff --git a/integration/resources/compose/headers.yml b/integration/resources/compose/headers.yml deleted file mode 100644 index fba4da55d..000000000 --- a/integration/resources/compose/headers.yml +++ /dev/null @@ -1,4 +0,0 @@ -whoami1: - image: containous/whoami - ports: - - "8881:80" diff --git a/integration/try/condition.go b/integration/try/condition.go index ce3db4ca2..d7d94c4ee 100644 --- a/integration/try/condition.go +++ b/integration/try/condition.go @@ -168,18 +168,17 @@ func HasHeaderValue(header, value string, exactMatch bool) ResponseCondition { func HasHeaderStruct(header http.Header) ResponseCondition { return func(res *http.Response) error { for key := range header { - if _, ok := res.Header[key]; ok { - // Header exists in the response, test it. - eq := reflect.DeepEqual(header[key], res.Header[key]) - if !eq { - return fmt.Errorf("for header %s got values %v, wanted %v", key, res.Header[key], header[key]) - } + if _, ok := res.Header[key]; !ok { + return fmt.Errorf("header %s not present in the response. Expected headers: %v Got response headers: %v", key, header, res.Header) + } + // Header exists in the response, test it. + if !reflect.DeepEqual(header[key], res.Header[key]) { + return fmt.Errorf("for header %s got values %v, wanted %v", key, res.Header[key], header[key]) } } return nil } - } // DoCondition is a retry condition function. diff --git a/pkg/middlewares/headers/headers.go b/pkg/middlewares/headers/headers.go index 526bc8b8e..a4d7de259 100644 --- a/pkg/middlewares/headers/headers.go +++ b/pkg/middlewares/headers/headers.go @@ -16,8 +16,7 @@ import ( ) const ( - typeName = "Headers" - originHeaderKey = "X-Request-Origin" + typeName = "Headers" ) type headers struct { @@ -107,29 +106,127 @@ func (s secureHeader) ServeHTTP(rw http.ResponseWriter, req *http.Request) { s.secure.HandlerFuncWithNextForRequestOnly(rw, req, s.next.ServeHTTP) } -// Header is a middleware that helps setup a few basic security features. A single headerOptions struct can be -// provided to configure which features should be enabled, and the ability to override a few of the default values. +// Header is a middleware that helps setup a few basic security features. +// A single headerOptions struct can be provided to configure which features should be enabled, +// and the ability to override a few of the default values. type Header struct { - next http.Handler - headers *dynamic.Headers + next http.Handler + hasCustomHeaders bool + hasCorsHeaders bool + headers *dynamic.Headers } // NewHeader constructs a new header instance from supplied frontend header struct. func NewHeader(next http.Handler, headers dynamic.Headers) *Header { + hasCustomHeaders := headers.HasCustomHeadersDefined() + hasCorsHeaders := headers.HasCorsHeadersDefined() + return &Header{ - next: next, - headers: &headers, + next: next, + headers: &headers, + hasCustomHeaders: hasCustomHeaders, + hasCorsHeaders: hasCorsHeaders, } } func (s *Header) ServeHTTP(rw http.ResponseWriter, req *http.Request) { + // Handle Cors headers and preflight if configured. + if isPreflight := s.processCorsHeaders(rw, req); isPreflight { + return + } + + if s.hasCustomHeaders { + s.modifyCustomRequestHeaders(req) + } + + // If there is a next, call it. + if s.next != nil { + s.next.ServeHTTP(rw, req) + } +} + +// modifyCustomRequestHeaders sets or deletes custom request headers. +func (s *Header) modifyCustomRequestHeaders(req *http.Request) { + // Loop through Custom request headers + for header, value := range s.headers.CustomRequestHeaders { + if value == "" { + req.Header.Del(header) + } else { + req.Header.Set(header, value) + } + } +} + +// preRequestModifyCorsResponseHeaders sets during request processing time, +// all the CORS response headers that we already know that are supposed to be set, +// and which do not depend on a later state of the response. +// One notable example of a header that can only be modified later on is "Vary", +// And this is set in the post-response response modifier method +func (s *Header) preRequestModifyCorsResponseHeaders(rw http.ResponseWriter, req *http.Request) { + originHeader := req.Header.Get("Origin") + allowOrigin := s.getAllowOrigin(originHeader) + + if allowOrigin != "" { + rw.Header().Set("Access-Control-Allow-Origin", allowOrigin) + } + + if s.headers.AccessControlAllowCredentials { + rw.Header().Set("Access-Control-Allow-Credentials", "true") + } + + if len(s.headers.AccessControlExposeHeaders) > 0 { + exposeHeaders := strings.Join(s.headers.AccessControlExposeHeaders, ",") + rw.Header().Set("Access-Control-Expose-Headers", exposeHeaders) + } +} + +// PostRequestModifyResponseHeaders set or delete response headers. +// This method is called AFTER the response is generated from the backend +// and can merge/override headers from the backend response. +func (s *Header) PostRequestModifyResponseHeaders(res *http.Response) error { + // Loop through Custom response headers + for header, value := range s.headers.CustomResponseHeaders { + if value == "" { + res.Header.Del(header) + } else { + res.Header.Set(header, value) + } + } + if !s.headers.AddVaryHeader { + return nil + } + + varyHeader := res.Header.Get("Vary") + if varyHeader == "Origin" { + return nil + } + + if varyHeader != "" { + varyHeader += "," + } + varyHeader += "Origin" + + res.Header.Set("Vary", varyHeader) + return nil +} + +// processCorsHeaders processes the incoming request, +// and returns if it is a preflight request. +// If not a preflight, it handles the preRequestModifyCorsResponseHeaders. +func (s *Header) processCorsHeaders(rw http.ResponseWriter, req *http.Request) bool { + if !s.hasCorsHeaders { + return false + } + reqAcMethod := req.Header.Get("Access-Control-Request-Method") reqAcHeaders := req.Header.Get("Access-Control-Request-Headers") originHeader := req.Header.Get("Origin") if reqAcMethod != "" && reqAcHeaders != "" && originHeader != "" && req.Method == http.MethodOptions { - // If the request is an OPTIONS request with an Access-Control-Request-Method header, and Access-Control-Request-Headers headers, - // and Origin headers, then it is a CORS preflight request, and we need to build a custom response: https://www.w3.org/TR/cors/#preflight-request + // If the request is an OPTIONS request with an Access-Control-Request-Method header, + // and Access-Control-Request-Headers headers, and Origin headers, + // then it is a CORS preflight request, + // and we need to build a custom response: https://www.w3.org/TR/cors/#preflight-request if s.headers.AccessControlAllowCredentials { rw.Header().Set("Access-Control-Allow-Credentials", "true") } @@ -151,71 +248,11 @@ func (s *Header) ServeHTTP(rw http.ResponseWriter, req *http.Request) { } rw.Header().Set("Access-Control-Max-Age", strconv.Itoa(int(s.headers.AccessControlMaxAge))) - - return + return true } - if len(originHeader) > 0 { - rw.Header().Set(originHeaderKey, originHeader) - } - - s.modifyRequestHeaders(req) - // If there is a next, call it. - if s.next != nil { - s.next.ServeHTTP(rw, req) - } -} - -// modifyRequestHeaders sets or deletes request headers. -func (s *Header) modifyRequestHeaders(req *http.Request) { - // Loop through Custom request headers - for header, value := range s.headers.CustomRequestHeaders { - if value == "" { - req.Header.Del(header) - } else { - req.Header.Set(header, value) - } - } -} - -// ModifyResponseHeaders set or delete response headers -func (s *Header) ModifyResponseHeaders(res *http.Response) error { - // Loop through Custom response headers - for header, value := range s.headers.CustomResponseHeaders { - if value == "" { - res.Header.Del(header) - } else { - res.Header.Set(header, value) - } - } - originHeader := res.Header.Get(originHeaderKey) - allowOrigin := s.getAllowOrigin(originHeader) - // Delete the origin header key, since it is only used to pass data from the request for response handling - res.Header.Del(originHeaderKey) - if allowOrigin != "" { - res.Header.Set("Access-Control-Allow-Origin", allowOrigin) - - if s.headers.AddVaryHeader { - varyHeader := res.Header.Get("Vary") - if varyHeader != "" { - varyHeader += "," - } - varyHeader += "Origin" - - res.Header.Set("Vary", varyHeader) - } - } - - if s.headers.AccessControlAllowCredentials { - res.Header.Set("Access-Control-Allow-Credentials", "true") - } - - exposeHeaders := strings.Join(s.headers.AccessControlExposeHeaders, ",") - if exposeHeaders != "" { - res.Header.Set("Access-Control-Expose-Headers", exposeHeaders) - } - - return nil + s.preRequestModifyCorsResponseHeaders(rw, req) + return false } func (s *Header) getAllowOrigin(header string) string { diff --git a/pkg/middlewares/headers/headers_test.go b/pkg/middlewares/headers/headers_test.go index 6f637a6c0..d4ec57e73 100644 --- a/pkg/middlewares/headers/headers_test.go +++ b/pkg/middlewares/headers/headers_test.go @@ -333,6 +333,7 @@ func TestGetTracingInformation(t *testing.T) { func TestCORSResponses(t *testing.T) { emptyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) nonEmptyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Vary", "Testing") }) + existingOriginHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Vary", "Origin") }) testCases := []struct { desc string @@ -436,6 +437,32 @@ func TestCORSResponses(t *testing.T) { "Vary": {"Testing,Origin"}, }, }, + { + desc: "Test Simple Request with Vary Headers and existing vary:origin response", + header: NewHeader(existingOriginHandler, dynamic.Headers{ + AccessControlAllowOrigin: "origin-list-or-null", + AddVaryHeader: true, + }), + requestHeaders: map[string][]string{ + "Origin": {"https://foo.bar.org"}, + }, + expected: map[string][]string{ + "Access-Control-Allow-Origin": {"https://foo.bar.org"}, + "Vary": {"Origin"}, + }, + }, + { + desc: "Test Simple CustomRequestHeaders Not Hijacked by CORS", + header: NewHeader(emptyHandler, dynamic.Headers{ + CustomRequestHeaders: map[string]string{"foo": "bar"}, + }), + requestHeaders: map[string][]string{ + "Access-Control-Request-Headers": {"origin"}, + "Access-Control-Request-Method": {"GET", "OPTIONS"}, + "Origin": {"https://foo.bar.org"}, + }, + expected: map[string][]string{}, + }, } for _, test := range testCases { @@ -445,7 +472,7 @@ func TestCORSResponses(t *testing.T) { rw := httptest.NewRecorder() test.header.ServeHTTP(rw, req) - err := test.header.ModifyResponseHeaders(rw.Result()) + err := test.header.PostRequestModifyResponseHeaders(rw.Result()) require.NoError(t, err) assert.Equal(t, test.expected, rw.Result().Header) }) @@ -492,7 +519,7 @@ func TestCustomResponseHeaders(t *testing.T) { req := testhelpers.MustNewRequest(http.MethodGet, "/foo", nil) rw := httptest.NewRecorder() test.header.ServeHTTP(rw, req) - err := test.header.ModifyResponseHeaders(rw.Result()) + err := test.header.PostRequestModifyResponseHeaders(rw.Result()) require.NoError(t, err) assert.Equal(t, test.expected, rw.Result().Header) }) diff --git a/pkg/responsemodifiers/headers.go b/pkg/responsemodifiers/headers.go index 5c104729a..aa209ad0a 100644 --- a/pkg/responsemodifiers/headers.go +++ b/pkg/responsemodifiers/headers.go @@ -34,7 +34,7 @@ func buildHeaders(hdrs *dynamic.Headers) func(*http.Response) error { return func(resp *http.Response) error { if hdrs.HasCustomHeadersDefined() || hdrs.HasCorsHeadersDefined() { - err := headers.NewHeader(nil, *hdrs).ModifyResponseHeaders(resp) + err := headers.NewHeader(nil, *hdrs).PostRequestModifyResponseHeaders(resp) if err != nil { return err } From 608ccb0ca1319e5d7acc9faef8f104f07a8ae982 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jul 2019 15:04:03 +0200 Subject: [PATCH 11/49] Update golangci-lint --- .golangci.toml | 3 +-- build.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.golangci.toml b/.golangci.toml index eeb123a15..bdbe5c3b0 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -36,8 +36,7 @@ "scopelint", "gochecknoinits", "gochecknoglobals", - # uncomment when the CI will be updated - # "bodyclose", # Too many false-positive and panics. + "bodyclose", # Too many false-positive and panics. ] [issues] diff --git a/build.Dockerfile b/build.Dockerfile index 77c3988ff..622cebb93 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -6,7 +6,7 @@ RUN apk --update upgrade \ && rm -rf /var/cache/apk/* # Download golangci-lint and misspell binary to bin folder in $GOPATH -RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0 \ +RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.17.1 \ && go get github.com/client9/misspell/cmd/misspell # Download goreleaser binary to bin folder in $GOPATH From 7a4b4c941c86e66fb8ac9da88eb03c8028036be0 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jul 2019 15:36:04 +0200 Subject: [PATCH 12/49] Update dep version --- build.Dockerfile | 2 +- docs/content/contributing/building-testing.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.Dockerfile b/build.Dockerfile index 622cebb93..0901ae3bf 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -14,7 +14,7 @@ RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh # Which docker version to test on ARG DOCKER_VERSION=17.03.2 -ARG DEP_VERSION=0.5.0 +ARG DEP_VERSION=0.5.4 # Download go-bindata binary to bin folder in $GOPATH RUN mkdir -p /usr/local/bin \ diff --git a/docs/content/contributing/building-testing.md b/docs/content/contributing/building-testing.md index 99976f964..e607511d9 100644 --- a/docs/content/contributing/building-testing.md +++ b/docs/content/contributing/building-testing.md @@ -123,7 +123,7 @@ If you happen to update the provider's templates (located in `/templates`), you The [dep](https://github.com/golang/dep) command is not required for building; however, it is necessary if you need to update the dependencies (i.e., add, update, or remove third-party packages). -You need [dep](https://github.com/golang/dep) >= 0.5.0. +You need [dep](https://github.com/golang/dep) >= 0.5.4. If you want to add a dependency, use `dep ensure -add` to have [dep](https://github.com/golang/dep) put it into the vendor folder and update the dep manifest/lock files (`Gopkg.toml` and `Gopkg.lock`, respectively). From 2c7cfd1c68453402a1035aa5bc695e98e8e6d2b5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou Date: Fri, 12 Jul 2019 17:50:04 +0200 Subject: [PATCH 13/49] Expand Client Auth Type configuration --- docs/content/https/tls.md | 28 ++-- docs/content/providers/kubernetes-crd.md | 2 +- .../reference/dynamic-configuration/file.toml | 12 +- .../reference/dynamic-configuration/file.yaml | 12 +- .../https/clientca/https_1ca1config.toml | 6 +- .../https/clientca/https_2ca1config.toml | 4 +- .../https/clientca/https_2ca2config.toml | 6 +- .../fixtures/https/https_tls_options.toml | 8 +- integration/fixtures/k8s/03-tlsoption.yml | 6 +- .../fixtures/tcp/multi-tls-options.toml | 4 +- .../fixtures/tlsclientheaders/simple.toml | 6 +- pkg/config/file/fixtures/sample.toml | 12 +- .../passtlsclientcert/pass_tls_client_cert.go | 4 +- .../crd/fixtures/tcp/with_bad_tls_options.yml | 12 +- .../crd/fixtures/tcp/with_tls_options.yml | 12 +- ...ith_tls_options_and_specific_namespace.yml | 12 +- .../fixtures/tcp/with_unknown_tls_options.yml | 2 +- .../with_unknown_tls_options_namespace.yml | 2 +- .../crd/fixtures/with_bad_tls_options.yml | 12 +- .../crd/fixtures/with_tls_options.yml | 12 +- ...ith_tls_options_and_specific_namespace.yml | 12 +- .../crd/fixtures/with_unknown_tls_options.yml | 2 +- .../with_unknown_tls_options_namespace.yml | 2 +- pkg/provider/kubernetes/crd/kubernetes.go | 8 +- .../kubernetes/crd/kubernetes_test.go | 36 ++--- .../crd/traefik/v1alpha1/tlsoption.go | 20 +-- .../traefik/v1alpha1/zz_generated.deepcopy.go | 10 +- pkg/tls/tls.go | 19 +-- pkg/tls/tlsmanager.go | 33 ++++- pkg/tls/tlsmanager_test.go | 125 ++++++++++++++++++ pkg/tls/zz_generated.deepcopy.go | 14 +- 31 files changed, 304 insertions(+), 151 deletions(-) diff --git a/docs/content/https/tls.md b/docs/content/https/tls.md index 84dacda11..4f3540de3 100644 --- a/docs/content/https/tls.md +++ b/docs/content/https/tls.md @@ -139,35 +139,39 @@ tls: minVersion: VersionTLS13 ``` -### Mutual Authentication +### Client Authentication (mTLS) -Traefik supports both optional and strict (which is the default) mutual authentication, though the `ClientCA.files` section. -If present, connections from clients without a certificate will be rejected. +Traefik supports mutual authentication, through the `ClientAuth` section. -For clients with a certificate, the `optional` option governs the behaviour as follows: +For authentication policies that require verification of the client certificate, the certificate authority for the certificate should be set in `ClientAuth.caFiles`. + +The `ClientAuth.clientAuthType` option governs the behaviour as follows: -- 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. +- `NoClientCert`: disregards any client certificate. +- `RequestClientCert`: asks for a certificate but proceeds anyway if none is provided. +- `RequireAnyClientCert`: requires a certificate but does not verify if it is signed by a CA listed in `ClientAuth.caFiles`. +- `VerifyClientCertIfGiven`: if a certificate is provided, verifies if it is signed by a CA listed in `ClientAuth.caFiles`. Otherwise proceeds without any certificate. +- `RequireAndVerifyClientCert`: requires a certificate, which must be signed by a CA listed in `ClientAuth.caFiles`. ```toml tab="TOML" [tls.options] [tls.options.default] - [tls.options.default.clientCA] + [tls.options.default.clientAuth] # in PEM format. each file can contain multiple CAs. - files = ["tests/clientca1.crt", "tests/clientca2.crt"] - optional = false + caFiles = ["tests/clientca1.crt", "tests/clientca2.crt"] + clientAuthType = "RequireAndVerifyClientCert" ``` ```yaml tab="YAML" tls: options: default: - clientCA: + clientAuth: # in PEM format. each file can contain multiple CAs. - files: + caFiles: - tests/clientca1.crt - tests/clientca2.crt - optional: false + clientAuthType: RequireAndVerifyClientCert ``` ### Cipher Suites diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index cf6c0b79c..d074d41dc 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -296,7 +296,7 @@ metadata: namespace: default spec: - minversion: VersionTLS12 + minVersion: VersionTLS12 --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/docs/content/reference/dynamic-configuration/file.toml b/docs/content/reference/dynamic-configuration/file.toml index 9c378e0ef..bf59ba1e1 100644 --- a/docs/content/reference/dynamic-configuration/file.toml +++ b/docs/content/reference/dynamic-configuration/file.toml @@ -275,16 +275,16 @@ minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.Options0.clientCA] - files = ["foobar", "foobar"] - optional = true + [tls.options.Options0.clientAuth] + caFiles = ["foobar", "foobar"] + clientAuthType = "VerifyClientCertIfGiven" [tls.options.Options1] minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.Options1.clientCA] - files = ["foobar", "foobar"] - optional = true + [tls.options.Options1.clientAuth] + caFiles = ["foobar", "foobar"] + clientAuthType = "VerifyClientCertIfGiven" [tls.stores] [tls.stores.Store0] [tls.stores.Store0.defaultCertificate] diff --git a/docs/content/reference/dynamic-configuration/file.yaml b/docs/content/reference/dynamic-configuration/file.yaml index 0ea19a867..083b79c7c 100644 --- a/docs/content/reference/dynamic-configuration/file.yaml +++ b/docs/content/reference/dynamic-configuration/file.yaml @@ -303,22 +303,22 @@ tls: cipherSuites: - foobar - foobar - clientCA: - files: + clientAuth: + caFiles: - foobar - foobar - optional: true + clientAuthType: VerifyClientCertIfGiven sniStrict: true Options1: minVersion: foobar cipherSuites: - foobar - foobar - clientCA: - files: + clientAuth: + caFiles: - foobar - foobar - optional: true + clientAuthType: VerifyClientCertIfGiven sniStrict: true stores: Store0: diff --git a/integration/fixtures/https/clientca/https_1ca1config.toml b/integration/fixtures/https/clientca/https_1ca1config.toml index ba62c4fd0..e149185b3 100644 --- a/integration/fixtures/https/clientca/https_1ca1config.toml +++ b/integration/fixtures/https/clientca/https_1ca1config.toml @@ -47,6 +47,6 @@ keyFile = "fixtures/https/snitest.org.key" [tls.options] - [tls.options.default.ClientCA] - files = ["fixtures/https/clientca/ca1.crt"] - optional = true + [tls.options.default.clientAuth] + caFiles = ["fixtures/https/clientca/ca1.crt"] + clientAuthType = "VerifyClientCertIfGiven" diff --git a/integration/fixtures/https/clientca/https_2ca1config.toml b/integration/fixtures/https/clientca/https_2ca1config.toml index 848b4ace9..d12915e85 100644 --- a/integration/fixtures/https/clientca/https_2ca1config.toml +++ b/integration/fixtures/https/clientca/https_2ca1config.toml @@ -47,5 +47,5 @@ keyFile = "fixtures/https/snitest.org.key" [tls.options] - [tls.options.default.clientCA] - files = ["fixtures/https/clientca/ca1and2.crt"] \ No newline at end of file + [tls.options.default.clientAuth] + caFiles = ["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 6340cac13..5a15e574f 100644 --- a/integration/fixtures/https/clientca/https_2ca2config.toml +++ b/integration/fixtures/https/clientca/https_2ca2config.toml @@ -46,6 +46,6 @@ keyFile = "fixtures/https/snitest.org.key" [tls.options] - [tls.options.default.clientCA] - files = ["fixtures/https/clientca/ca1.crt", "fixtures/https/clientca/ca2.crt"] - optional = false + [tls.options.default.clientAuth] + caFiles = ["fixtures/https/clientca/ca1.crt", "fixtures/https/clientca/ca2.crt"] + clientAuthType = "RequireAndVerifyClientCert" diff --git a/integration/fixtures/https/https_tls_options.toml b/integration/fixtures/https/https_tls_options.toml index 10bf6cadf..d81ac1a65 100644 --- a/integration/fixtures/https/https_tls_options.toml +++ b/integration/fixtures/https/https_tls_options.toml @@ -69,13 +69,13 @@ [tls.options] [tls.options.foo] - minversion = "VersionTLS11" + minVersion = "VersionTLS11" [tls.options.baz] - minversion = "VersionTLS11" + minVersion = "VersionTLS11" [tls.options.bar] - minversion = "VersionTLS12" + minVersion = "VersionTLS12" [tls.options.default] - minversion = "VersionTLS12" + minVersion = "VersionTLS12" diff --git a/integration/fixtures/k8s/03-tlsoption.yml b/integration/fixtures/k8s/03-tlsoption.yml index dea75d7e9..5c00a3973 100644 --- a/integration/fixtures/k8s/03-tlsoption.yml +++ b/integration/fixtures/k8s/03-tlsoption.yml @@ -5,8 +5,8 @@ metadata: namespace: default spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 diff --git a/integration/fixtures/tcp/multi-tls-options.toml b/integration/fixtures/tcp/multi-tls-options.toml index 517fdeddc..884924365 100644 --- a/integration/fixtures/tcp/multi-tls-options.toml +++ b/integration/fixtures/tcp/multi-tls-options.toml @@ -40,7 +40,7 @@ [tls.options] [tls.options.foo] - minversion = "VersionTLS11" + minVersion = "VersionTLS11" [tls.options.bar] - minversion = "VersionTLS12" + minVersion = "VersionTLS12" diff --git a/integration/fixtures/tlsclientheaders/simple.toml b/integration/fixtures/tlsclientheaders/simple.toml index 90fed2166..9469bb91f 100644 --- a/integration/fixtures/tlsclientheaders/simple.toml +++ b/integration/fixtures/tlsclientheaders/simple.toml @@ -23,9 +23,9 @@ ## dynamic configuration ## [tls.options] - [tls.options.default.clientCA] - files = [ """{{ .RootCertContent }}""" ] - optional = false + [tls.options.default.clientAuth] + caFiles = [ """{{ .RootCertContent }}""" ] + clientAuthType = "RequireAndVerifyClientCert" [tls.stores] [tls.stores.default.defaultCertificate] diff --git a/pkg/config/file/fixtures/sample.toml b/pkg/config/file/fixtures/sample.toml index 0a288c010..4459c506a 100644 --- a/pkg/config/file/fixtures/sample.toml +++ b/pkg/config/file/fixtures/sample.toml @@ -460,16 +460,16 @@ minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.TLS0.clientCA] - files = ["foobar", "foobar"] - optional = true + [tls.options.TLS0.clientAuth] + caFiles = ["foobar", "foobar"] + clientAuthType = "VerifyClientCertIfGiven" [tls.options.TLS1] minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true - [tls.options.TLS1.clientCA] - files = ["foobar", "foobar"] - optional = true + [tls.options.TLS1.clientAuth] + caFiles = ["foobar", "foobar"] + clientAuthType = "VerifyClientCertIfGiven" [tls.stores] [tls.stores.Store0] [tls.stores.Store0.defaultCertificate] diff --git a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go index 9512854ef..22002ef26 100644 --- a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go +++ b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert.go @@ -222,7 +222,7 @@ func (p *passTLSClientCert) modifyRequestHeaders(logger logrus.FieldLogger, r *h if r.TLS != nil && len(r.TLS.PeerCertificates) > 0 { r.Header.Set(xForwardedTLSClientCert, getXForwardedTLSClientCert(logger, r.TLS.PeerCertificates)) } else { - logger.Warn("Try to extract certificate on a request without TLS") + logger.Warn("Tried to extract a certificate on a request without mutual TLS") } } @@ -231,7 +231,7 @@ func (p *passTLSClientCert) modifyRequestHeaders(logger logrus.FieldLogger, r *h headerContent := p.getXForwardedTLSClientCertInfo(r.TLS.PeerCertificates) r.Header.Set(xForwardedTLSClientCertInfo, url.QueryEscape(headerContent)) } else { - logger.Warn("Try to extract certificate on a request without TLS") + logger.Warn("Tried to extract a certificate on a request without mutual TLS") } } } diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml index 27915bb20..9c2a82f42 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_bad_tls_options.yml @@ -25,17 +25,17 @@ metadata: namespace: default spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretUnknown - emptySecret - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: v1 diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml index 5788e2f6b..c68d3900a 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options.yml @@ -25,16 +25,16 @@ metadata: namespace: default spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretCA2 - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: v1 diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml index 4c5ba7844..518d8e1b8 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_tls_options_and_specific_namespace.yml @@ -25,16 +25,16 @@ metadata: namespace: myns spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretCA2 - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: v1 diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml index 6c8e2491e..5798a0719 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options.yml @@ -6,7 +6,7 @@ metadata: namespace: default spec: - minversion: VersionTLS12 + minVersion: VersionTLS12 --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml index bd444c505..ed34abdf6 100644 --- a/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/tcp/with_unknown_tls_options_namespace.yml @@ -6,7 +6,7 @@ metadata: namespace: default spec: - minversion: VersionTLS12 + minVersion: VersionTLS12 --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml index 0a51178ca..94ea22e5f 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_bad_tls_options.yml @@ -25,17 +25,17 @@ metadata: namespace: default spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretUnknown - emptySecret - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml index 5d9bd31a7..93ec20239 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls_options.yml @@ -25,16 +25,16 @@ metadata: namespace: default spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretCA2 - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml index 2fd7aa390..b870b3389 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_tls_options_and_specific_namespace.yml @@ -25,16 +25,16 @@ metadata: namespace: myns spec: - minversion: VersionTLS12 - snistrict: true - ciphersuites: + minVersion: VersionTLS12 + sniStrict: true + cipherSuites: - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - TLS_RSA_WITH_AES_256_GCM_SHA384 - clientca: - secretnames: + clientAuth: + secretNames: - secretCA1 - secretCA2 - optional: true + clientAuthType: VerifyClientCertIfGiven --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml index 1ef9d2344..543851e37 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options.yml @@ -5,7 +5,7 @@ metadata: namespace: default spec: - minversion: VersionTLS12 + minVersion: VersionTLS12 --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml index 022b88c98..69606c2db 100644 --- a/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml +++ b/pkg/provider/kubernetes/crd/fixtures/with_unknown_tls_options_namespace.yml @@ -5,7 +5,7 @@ metadata: namespace: default spec: - minversion: VersionTLS12 + minVersion: VersionTLS12 --- apiVersion: traefik.containo.us/v1alpha1 diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 9de6cdf9c..8f4a463d8 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -313,7 +313,7 @@ func buildTLSOptions(ctx context.Context, client Client) map[string]tls.Options logger := log.FromContext(log.With(ctx, log.Str("tlsOption", tlsOption.Name), log.Str("namespace", tlsOption.Namespace))) var clientCAs []tls.FileOrContent - for _, secretName := range tlsOption.Spec.ClientCA.SecretNames { + for _, secretName := range tlsOption.Spec.ClientAuth.SecretNames { secret, exists, err := client.GetSecret(tlsOption.Namespace, secretName) if err != nil { logger.Errorf("Failed to fetch secret %s/%s: %v", tlsOption.Namespace, secretName, err) @@ -337,9 +337,9 @@ func buildTLSOptions(ctx context.Context, client Client) map[string]tls.Options tlsOptions[makeID(tlsOption.Namespace, tlsOption.Name)] = tls.Options{ MinVersion: tlsOption.Spec.MinVersion, CipherSuites: tlsOption.Spec.CipherSuites, - ClientCA: tls.ClientCA{ - Files: clientCAs, - Optional: tlsOption.Spec.ClientCA.Optional, + ClientAuth: tls.ClientAuth{ + CAFiles: clientCAs, + ClientAuthType: tlsOption.Spec.ClientAuth.ClientAuthType, }, SniStrict: tlsOption.Spec.SniStrict, } diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go index 9ece08d30..25557beb1 100644 --- a/pkg/provider/kubernetes/crd/kubernetes_test.go +++ b/pkg/provider/kubernetes/crd/kubernetes_test.go @@ -319,12 +319,12 @@ func TestLoadIngressRouteTCPs(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, @@ -377,12 +377,12 @@ func TestLoadIngressRouteTCPs(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, @@ -435,11 +435,11 @@ func TestLoadIngressRouteTCPs(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, @@ -1009,12 +1009,12 @@ func TestLoadIngressRoutes(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, @@ -1067,12 +1067,12 @@ func TestLoadIngressRoutes(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, @@ -1125,11 +1125,11 @@ func TestLoadIngressRoutes(t *testing.T) { "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_AES_256_GCM_SHA384", }, - ClientCA: tls.ClientCA{ - Files: []tls.FileOrContent{ + ClientAuth: tls.ClientAuth{ + CAFiles: []tls.FileOrContent{ tls.FileOrContent("-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"), }, - Optional: true, + ClientAuthType: "VerifyClientCertIfGiven", }, SniStrict: true, }, diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/tlsoption.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/tlsoption.go index 22e04e3e5..e06fdeead 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/tlsoption.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/tlsoption.go @@ -19,22 +19,22 @@ type TLSOption struct { // TLSOptionSpec configures TLS for an entry point type TLSOptionSpec struct { - MinVersion string `json:"minversion"` - CipherSuites []string `json:"ciphersuites"` - ClientCA ClientCA `json:"clientca"` - SniStrict bool `json:"snistrict"` + MinVersion string `json:"minVersion,omitempty"` + CipherSuites []string `json:"cipherSuites,omitempty"` + ClientAuth ClientAuth `json:"clientAuth,omitempty"` + SniStrict bool `json:"sniStrict,omitempty"` } // +k8s:deepcopy-gen=true -// ClientCA defines traefik CA files for an entryPoint -// and it indicates if they are mandatory or have just to be analyzed if provided -type ClientCA struct { +// ClientAuth defines the parameters of the client authentication part of the TLS connection, if any. +type ClientAuth struct { // SecretName is the name of the referenced Kubernetes Secret to specify the // certificate details. - SecretNames []string `json:"secretnames"` - // Optional indicates if ClientCA are mandatory or have just to be analyzed if provided - Optional bool `json:"optional"` + SecretNames []string `json:"secretNames"` + // ClientAuthType defines the client authentication type to apply. + // The available values are: "NoClientCert", "RequestClientCert", "VerifyClientCertIfGiven" and "RequireAndVerifyClientCert". + ClientAuthType string `json:"clientAuthType"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/zz_generated.deepcopy.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/zz_generated.deepcopy.go index e1d756c35..0d603a047 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/zz_generated.deepcopy.go @@ -33,7 +33,7 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClientCA) DeepCopyInto(out *ClientCA) { +func (in *ClientAuth) DeepCopyInto(out *ClientAuth) { *out = *in if in.SecretNames != nil { in, out := &in.SecretNames, &out.SecretNames @@ -43,12 +43,12 @@ func (in *ClientCA) DeepCopyInto(out *ClientCA) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientCA. -func (in *ClientCA) DeepCopy() *ClientCA { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientAuth. +func (in *ClientAuth) DeepCopy() *ClientAuth { if in == nil { return nil } - out := new(ClientCA) + out := new(ClientAuth) in.DeepCopyInto(out) return out } @@ -529,7 +529,7 @@ func (in *TLSOptionSpec) DeepCopyInto(out *TLSOptionSpec) { *out = make([]string, len(*in)) copy(*out, *in) } - in.ClientCA.DeepCopyInto(&out.ClientCA) + in.ClientAuth.DeepCopyInto(&out.ClientAuth) return } diff --git a/pkg/tls/tls.go b/pkg/tls/tls.go index 7193a5220..49d18176f 100644 --- a/pkg/tls/tls.go +++ b/pkg/tls/tls.go @@ -4,21 +4,22 @@ const certificateHeader = "-----BEGIN CERTIFICATE-----\n" // +k8s:deepcopy-gen=true -// 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 `json:"files,omitempty" toml:"files,omitempty" yaml:"files,omitempty"` - Optional bool `json:"optional,omitempty" toml:"optional,omitempty" yaml:"optional,omitempty"` +// ClientAuth defines the parameters of the client authentication part of the TLS connection, if any. +type ClientAuth struct { + CAFiles []FileOrContent `json:"caFiles,omitempty" toml:"caFiles,omitempty" yaml:"caFiles,omitempty"` + // ClientAuthType defines the client authentication type to apply. + // The available values are: "NoClientCert", "RequestClientCert", "VerifyClientCertIfGiven" and "RequireAndVerifyClientCert". + ClientAuthType string `json:"clientAuthType,omitempty" toml:"clientAuthType,omitempty" yaml:"clientAuthType,omitempty"` } // +k8s:deepcopy-gen=true // Options configures TLS for an entry point type Options struct { - 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"` + MinVersion string `json:"minVersion,omitempty" toml:"minVersion,omitempty" yaml:"minVersion,omitempty" export:"true"` + CipherSuites []string `json:"cipherSuites,omitempty" toml:"cipherSuites,omitempty" yaml:"cipherSuites,omitempty"` + ClientAuth ClientAuth `json:"clientAuth,omitempty" toml:"clientAuth,omitempty" yaml:"clientAuth,omitempty"` + SniStrict bool `json:"sniStrict,omitempty" toml:"sniStrict,omitempty" yaml:"sniStrict,omitempty" export:"true"` } // +k8s:deepcopy-gen=true diff --git a/pkg/tls/tlsmanager.go b/pkg/tls/tlsmanager.go index c1599b7d8..1873cfe58 100644 --- a/pkg/tls/tlsmanager.go +++ b/pkg/tls/tlsmanager.go @@ -3,6 +3,7 @@ package tls import ( "crypto/tls" "crypto/x509" + "errors" "fmt" "sync" @@ -159,23 +160,45 @@ func buildTLSConfig(tlsOption Options) (*tls.Config, error) { // ensure http2 enabled conf.NextProtos = []string{"h2", "http/1.1", tlsalpn01.ACMETLS1Protocol} - if len(tlsOption.ClientCA.Files) > 0 { + if len(tlsOption.ClientAuth.CAFiles) > 0 { pool := x509.NewCertPool() - for _, caFile := range tlsOption.ClientCA.Files { + for _, caFile := range tlsOption.ClientAuth.CAFiles { data, err := caFile.Read() if err != nil { return nil, err } ok := pool.AppendCertsFromPEM(data) if !ok { - return nil, fmt.Errorf("invalid certificate(s) in %s", caFile) + if caFile.IsPath() { + return nil, fmt.Errorf("invalid certificate(s) in %s", caFile) + } + return nil, errors.New("invalid certificate(s) content") } } conf.ClientCAs = pool - if tlsOption.ClientCA.Optional { + conf.ClientAuth = tls.RequireAndVerifyClientCert + } + + clientAuthType := tlsOption.ClientAuth.ClientAuthType + if len(clientAuthType) > 0 { + if conf.ClientCAs == nil && (clientAuthType == "VerifyClientCertIfGiven" || + clientAuthType == "RequireAndVerifyClientCert") { + return nil, fmt.Errorf("invalid clientAuthType: %s, CAFiles is required", clientAuthType) + } + + switch clientAuthType { + case "NoClientCert": + conf.ClientAuth = tls.NoClientCert + case "RequestClientCert": + conf.ClientAuth = tls.RequestClientCert + case "RequireAnyClientCert": + conf.ClientAuth = tls.RequireAnyClientCert + case "VerifyClientCertIfGiven": conf.ClientAuth = tls.VerifyClientCertIfGiven - } else { + case "RequireAndVerifyClientCert": conf.ClientAuth = tls.RequireAndVerifyClientCert + default: + return nil, fmt.Errorf("unknown client auth type %q", clientAuthType) } } diff --git a/pkg/tls/tlsmanager_test.go b/pkg/tls/tlsmanager_test.go index 963f548ee..a176bfe11 100644 --- a/pkg/tls/tlsmanager_test.go +++ b/pkg/tls/tlsmanager_test.go @@ -2,9 +2,12 @@ package tls import ( "crypto/tls" + "crypto/x509" + "encoding/pem" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // LocalhostCert is a PEM-encoded TLS cert with SAN IPs @@ -146,3 +149,125 @@ func TestManager_Get(t *testing.T) { }) } } + +func TestClientAuth(t *testing.T) { + tlsConfigs := map[string]Options{ + "eca": {ClientAuth: ClientAuth{}}, + "ecat": {ClientAuth: ClientAuth{ClientAuthType: ""}}, + "ncc": {ClientAuth: ClientAuth{ClientAuthType: "NoClientCert"}}, + "rcc": {ClientAuth: ClientAuth{ClientAuthType: "RequestClientCert"}}, + "racc": {ClientAuth: ClientAuth{ClientAuthType: "RequireAnyClientCert"}}, + "vccig": { + ClientAuth: ClientAuth{ + CAFiles: []FileOrContent{localhostCert}, + ClientAuthType: "VerifyClientCertIfGiven", + }, + }, + "vccigwca": { + ClientAuth: ClientAuth{ClientAuthType: "VerifyClientCertIfGiven"}, + }, + "ravcc": {ClientAuth: ClientAuth{ClientAuthType: "RequireAndVerifyClientCert"}}, + "ravccwca": { + ClientAuth: ClientAuth{ + CAFiles: []FileOrContent{localhostCert}, + ClientAuthType: "RequireAndVerifyClientCert", + }, + }, + "ravccwbca": { + ClientAuth: ClientAuth{ + CAFiles: []FileOrContent{"Bad content"}, + ClientAuthType: "RequireAndVerifyClientCert", + }, + }, + "ucat": {ClientAuth: ClientAuth{ClientAuthType: "Unknown"}}, + } + + block, _ := pem.Decode([]byte(localhostCert)) + cert, err := x509.ParseCertificate(block.Bytes) + require.NoError(t, err) + + testCases := []struct { + desc string + tlsOptionsName string + expectedClientAuth tls.ClientAuthType + expectedRawSubject []byte + }{ + { + desc: "Empty ClientAuth option should get a tls.NoClientCert (default value)", + tlsOptionsName: "eca", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "Empty ClientAuthType option should get a tls.NoClientCert (default value)", + tlsOptionsName: "ecat", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "NoClientCert option should get a tls.NoClientCert as ClientAuthType", + tlsOptionsName: "ncc", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "RequestClientCert option should get a tls.RequestClientCert as ClientAuthType", + tlsOptionsName: "rcc", + expectedClientAuth: tls.RequestClientCert, + }, + { + desc: "RequireAnyClientCert option should get a tls.RequireAnyClientCert as ClientAuthType", + tlsOptionsName: "racc", + expectedClientAuth: tls.RequireAnyClientCert, + }, + { + desc: "VerifyClientCertIfGiven option should get a tls.VerifyClientCertIfGiven as ClientAuthType", + tlsOptionsName: "vccig", + expectedClientAuth: tls.VerifyClientCertIfGiven, + }, + { + desc: "VerifyClientCertIfGiven option without CAFiles yields a default ClientAuthType (NoClientCert)", + tlsOptionsName: "vccigwca", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "RequireAndVerifyClientCert option without CAFiles yields a default ClientAuthType (NoClientCert)", + tlsOptionsName: "ravcc", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "RequireAndVerifyClientCert option should get a tls.RequireAndVerifyClientCert as ClientAuthType with CA files", + tlsOptionsName: "ravccwca", + expectedClientAuth: tls.RequireAndVerifyClientCert, + expectedRawSubject: cert.RawSubject, + }, + { + desc: "Unknown option yields a default ClientAuthType (NoClientCert)", + tlsOptionsName: "ucat", + expectedClientAuth: tls.NoClientCert, + }, + { + desc: "Bad CA certificate content yields a default ClientAuthType (NoClientCert)", + tlsOptionsName: "ravccwbca", + expectedClientAuth: tls.NoClientCert, + }, + } + + tlsManager := NewManager() + tlsManager.UpdateConfigs(nil, tlsConfigs, nil) + + for _, test := range testCases { + test := test + t.Run(test.desc, func(t *testing.T) { + t.Parallel() + + config, err := tlsManager.Get("default", test.tlsOptionsName) + assert.NoError(t, err) + + if test.expectedRawSubject != nil { + subjects := config.ClientCAs.Subjects() + assert.Len(t, subjects, 1) + assert.Equal(t, subjects[0], test.expectedRawSubject) + } + + assert.Equal(t, config.ClientAuth, test.expectedClientAuth) + }) + } +} diff --git a/pkg/tls/zz_generated.deepcopy.go b/pkg/tls/zz_generated.deepcopy.go index 9823a1354..e259da2ca 100644 --- a/pkg/tls/zz_generated.deepcopy.go +++ b/pkg/tls/zz_generated.deepcopy.go @@ -51,22 +51,22 @@ func (in *CertAndStores) DeepCopy() *CertAndStores { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClientCA) DeepCopyInto(out *ClientCA) { +func (in *ClientAuth) DeepCopyInto(out *ClientAuth) { *out = *in - if in.Files != nil { - in, out := &in.Files, &out.Files + if in.CAFiles != nil { + in, out := &in.CAFiles, &out.CAFiles *out = make([]FileOrContent, len(*in)) copy(*out, *in) } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientCA. -func (in *ClientCA) DeepCopy() *ClientCA { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientAuth. +func (in *ClientAuth) DeepCopy() *ClientAuth { if in == nil { return nil } - out := new(ClientCA) + out := new(ClientAuth) in.DeepCopyInto(out) return out } @@ -79,7 +79,7 @@ func (in *Options) DeepCopyInto(out *Options) { *out = make([]string, len(*in)) copy(*out, *in) } - in.ClientCA.DeepCopyInto(&out.ClientCA) + in.ClientAuth.DeepCopyInto(&out.ClientAuth) return } From 48d98dcf45896cabb5d135f5ee2a626c08d66295 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 Jul 2019 21:14:03 +0200 Subject: [PATCH 14/49] Update docker version for build --- .semaphoreci/setup.sh | 2 +- build.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.semaphoreci/setup.sh b/.semaphoreci/setup.sh index 49ff70463..574ef37a2 100755 --- a/.semaphoreci/setup.sh +++ b/.semaphoreci/setup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -export DOCKER_VERSION=17.03.1 +export DOCKER_VERSION=18.09.7 # shellcheck source=/dev/null source .semaphoreci/vars diff --git a/build.Dockerfile b/build.Dockerfile index 0901ae3bf..082b2595b 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -13,7 +13,7 @@ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.s RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh # Which docker version to test on -ARG DOCKER_VERSION=17.03.2 +ARG DOCKER_VERSION=18.09.7 ARG DEP_VERSION=0.5.4 # Download go-bindata binary to bin folder in $GOPATH From 51486b18fa8f0e06f05c1d32f8272cc0dcdd6d38 Mon Sep 17 00:00:00 2001 From: Daniel Tomcej Date: Fri, 12 Jul 2019 17:24:03 -0600 Subject: [PATCH 15/49] Enhance REST provider --- integration/rest_test.go | 92 +++++++++++++++++++++--------- integration/simple_test.go | 16 +++--- pkg/config/dynamic/config.go | 2 +- pkg/provider/rest/rest.go | 6 +- pkg/server/server_configuration.go | 18 +++++- 5 files changed, 94 insertions(+), 40 deletions(-) diff --git a/integration/rest_test.go b/integration/rest_test.go index 1cb330cf2..a5da9df05 100644 --- a/integration/rest_test.go +++ b/integration/rest_test.go @@ -32,41 +32,81 @@ func (s *RestSuite) TestSimpleConfiguration(c *check.C) { err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusNotFound)) c.Assert(err, checker.IsNil) - config := dynamic.HTTPConfiguration{ - Routers: map[string]*dynamic.Router{ - "router1": { - EntryPoints: []string{"web"}, - Middlewares: []string{}, - Service: "service1", - Rule: "PathPrefix(`/`)", - }, - }, - Services: map[string]*dynamic.Service{ - "service1": { - LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://" + s.composeProject.Container(c, "whoami1").NetworkSettings.IPAddress + ":80", + testCase := []struct { + desc string + config *dynamic.Configuration + ruleMatch string + }{ + { + desc: "deploy http configuration", + config: &dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ + "router1": { + EntryPoints: []string{"web"}, + Middlewares: []string{}, + Service: "service1", + Rule: "PathPrefix(`/`)", + }, + }, + Services: map[string]*dynamic.Service{ + "service1": { + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{ + { + URL: "http://" + s.composeProject.Container(c, "whoami1").NetworkSettings.IPAddress + ":80", + }, + }, + }, }, }, }, }, + ruleMatch: "PathPrefix(`/`)", + }, + { + desc: "deploy tcp configuration", + config: &dynamic.Configuration{ + TCP: &dynamic.TCPConfiguration{ + Routers: map[string]*dynamic.TCPRouter{ + "router1": { + EntryPoints: []string{"web"}, + Service: "service1", + Rule: "HostSNI(`*`)", + }, + }, + Services: map[string]*dynamic.TCPService{ + "service1": { + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: s.composeProject.Container(c, "whoami1").NetworkSettings.IPAddress + ":80", + }, + }, + }, + }, + }, + }, + }, + ruleMatch: "HostSNI(`*`)", }, } - json, err := json.Marshal(config) - c.Assert(err, checker.IsNil) + for _, test := range testCase { + json, err := json.Marshal(test.config) + c.Assert(err, checker.IsNil) - request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(json)) - c.Assert(err, checker.IsNil) + request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(json)) + c.Assert(err, checker.IsNil) - response, err := http.DefaultClient.Do(request) - c.Assert(err, checker.IsNil) - c.Assert(response.StatusCode, checker.Equals, http.StatusOK) + response, err := http.DefaultClient.Do(request) + c.Assert(err, checker.IsNil) + c.Assert(response.StatusCode, checker.Equals, http.StatusOK) - err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1000*time.Millisecond, try.BodyContains("PathPrefix(`/`)")) - c.Assert(err, checker.IsNil) + err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1000*time.Millisecond, try.BodyContains(test.ruleMatch)) + c.Assert(err, checker.IsNil) - err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusOK)) - c.Assert(err, checker.IsNil) + err = try.GetRequest("http://127.0.0.1:8000/", 1000*time.Millisecond, try.StatusCodeIs(http.StatusOK)) + c.Assert(err, checker.IsNil) + } } diff --git a/integration/simple_test.go b/integration/simple_test.go index a6c8a3ea5..2b09080bd 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -440,13 +440,15 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) { err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1000*time.Millisecond, try.BodyContains("service")) c.Assert(err, checker.IsNil) - config := dynamic.HTTPConfiguration{ - Routers: map[string]*dynamic.Router{ - "router1": { - EntryPoints: []string{"web"}, - Middlewares: []string{"customheader@file"}, - Service: "service@file", - Rule: "PathPrefix(`/`)", + config := dynamic.Configuration{ + HTTP: &dynamic.HTTPConfiguration{ + Routers: map[string]*dynamic.Router{ + "router1": { + EntryPoints: []string{"web"}, + Middlewares: []string{"customheader@file"}, + Service: "service@file", + Rule: "PathPrefix(`/`)", + }, }, }, } diff --git a/pkg/config/dynamic/config.go b/pkg/config/dynamic/config.go index 07845ca97..225cd12f1 100644 --- a/pkg/config/dynamic/config.go +++ b/pkg/config/dynamic/config.go @@ -30,7 +30,7 @@ type Configuration struct { // TLSConfiguration contains all the configuration parameters of a TLS connection. type TLSConfiguration struct { - Certificates []*tls.CertAndStores `json:"-" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"` + Certificates []*tls.CertAndStores `json:"certificates,omitempty" toml:"certificates,omitempty" yaml:"certificates,omitempty" label:"-"` Options map[string]tls.Options `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` Stores map[string]tls.Store `json:"stores,omitempty" toml:"stores,omitempty" yaml:"stores,omitempty"` } diff --git a/pkg/provider/rest/rest.go b/pkg/provider/rest/rest.go index 45cf025bf..8e3028286 100644 --- a/pkg/provider/rest/rest.go +++ b/pkg/provider/rest/rest.go @@ -48,7 +48,7 @@ func (p *Provider) Append(systemRouter *mux.Router) { return } - configuration := new(dynamic.HTTPConfiguration) + configuration := new(dynamic.Configuration) body, _ := ioutil.ReadAll(request.Body) if err := json.Unmarshal(body, configuration); err != nil { @@ -57,9 +57,7 @@ func (p *Provider) Append(systemRouter *mux.Router) { return } - p.configurationChan <- dynamic.Message{ProviderName: "rest", Configuration: &dynamic.Configuration{ - HTTP: configuration, - }} + p.configurationChan <- dynamic.Message{ProviderName: "rest", Configuration: configuration} if err := templatesRenderer.JSON(response, http.StatusOK, configuration); err != nil { log.WithoutContext().Error(err) } diff --git a/pkg/server/server_configuration.go b/pkg/server/server_configuration.go index c0aa203ac..1a184274e 100644 --- a/pkg/server/server_configuration.go +++ b/pkg/server/server_configuration.go @@ -175,8 +175,22 @@ func (s *Server) preLoadConfiguration(configMsg dynamic.Message) { logger := log.WithoutContext().WithField(log.ProviderName, configMsg.ProviderName) if log.GetLevel() == logrus.DebugLevel { - jsonConf, _ := json.Marshal(configMsg.Configuration) - logger.Debugf("Configuration received from provider %s: %s", configMsg.ProviderName, string(jsonConf)) + copyConf := configMsg.Configuration.DeepCopy() + if copyConf.TLS != nil { + copyConf.TLS.Certificates = nil + + for _, v := range copyConf.TLS.Stores { + v.DefaultCertificate = nil + } + } + + jsonConf, err := json.Marshal(copyConf) + if err != nil { + logger.Errorf("Could not marshal dynamic configuration: %v", err) + logger.Debugf("Configuration received from provider %s: [struct] %#v", configMsg.ProviderName, copyConf) + } else { + logger.Debugf("Configuration received from provider %s: %s", configMsg.ProviderName, string(jsonConf)) + } } if isEmptyConfiguration(configMsg.Configuration) { From e478dbeb859f6b7e061103b2e0afb8c38c596187 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 15 Jul 2019 07:06:03 +0200 Subject: [PATCH 16/49] Docker URL --- .semaphoreci/setup.sh | 29 +++++++++++++++++------------ build.Dockerfile | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.semaphoreci/setup.sh b/.semaphoreci/setup.sh index 574ef37a2..af0878c0e 100755 --- a/.semaphoreci/setup.sh +++ b/.semaphoreci/setup.sh @@ -1,17 +1,22 @@ #!/usr/bin/env bash set -e -export DOCKER_VERSION=18.09.7 - -# shellcheck source=/dev/null +for s in apache2 cassandra elasticsearch memcached mysql mongod postgresql sphinxsearch rethinkdb rabbitmq-server redis-server; do sudo service $s stop; done +sudo swapoff -a +sudo dd if=/dev/zero of=/swapfile bs=1M count=3072 +sudo mkswap /swapfile +sudo swapon /swapfile +sudo rm -rf /home/runner/.rbenv +#export DOCKER_VERSION=18.06.3 source .semaphoreci/vars - -if [ -z "${PULL_REQUEST_NUMBER}" ]; then SHOULD_TEST="-*-"; else TEMP_STORAGE=$(curl --silent https://patch-diff.githubusercontent.com/raw/containous/traefik/pull/"${PULL_REQUEST_NUMBER}".diff | patch --dry-run -p1 -R); fi - +if [ -z "${PULL_REQUEST_NUMBER}" ]; then SHOULD_TEST="-*-"; else TEMP_STORAGE=$(curl --silent https://patch-diff.githubusercontent.com/raw/containous/traefik/pull/${PULL_REQUEST_NUMBER}.diff | patch --dry-run -p1 -R || true); fi +echo ${SHOULD_TEST} if [ -n "$TEMP_STORAGE" ]; then SHOULD_TEST=$(echo "$TEMP_STORAGE" | grep -Ev '(.md|.yaml|.yml)' || :); fi - -if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq update; fi - -if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*; fi - -if [ -n "$SHOULD_TEST" ]; then docker version; fi +echo ${TEMP_STORAGE} +echo ${SHOULD_TEST} +#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq update; fi +#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*; fi +if [ -n "$SHOULD_TEST" ]; then docker version; fi +if [ -f "./.semaphoreci/golang.sh" ]; then ./.semaphoreci/golang.sh; fi +if [ -f "./.semaphoreci/golang.sh" ]; then export GOROOT="/usr/local/golang/1.12/go"; fi +if [ -f "./.semaphoreci/golang.sh" ]; then export GOTOOLDIR="/usr/local/golang/1.12/go/pkg/tool/linux_amd64"; fi diff --git a/build.Dockerfile b/build.Dockerfile index 082b2595b..c3ff44b5f 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -28,7 +28,7 @@ RUN mkdir -p /usr/local/bin \ # Download docker RUN mkdir -p /usr/local/bin \ - && curl -fL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}-ce.tgz \ + && curl -fL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \ | tar -xzC /usr/local/bin --transform 's#^.+/##x' WORKDIR /go/src/github.com/containous/traefik From f49800e56a6fd7d0d56fb64a54f757447932367e Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 15 Jul 2019 10:00:06 +0200 Subject: [PATCH 17/49] user guide: fix a mistake in the deployment definition --- docs/content/user-guides/crd-acme/03-deployments.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/content/user-guides/crd-acme/03-deployments.yml b/docs/content/user-guides/crd-acme/03-deployments.yml index 52b70d47c..822d2bf41 100644 --- a/docs/content/user-guides/crd-acme/03-deployments.yml +++ b/docs/content/user-guides/crd-acme/03-deployments.yml @@ -33,7 +33,6 @@ spec: - --entrypoints.web.Address=:8000 - --entrypoints.websecure.Address=:4443 - --providers.kubernetescrd - - --providers.kubernetescrd.trace - --acme - --acme.acmelogging - --acme.tlschallenge From 093658836e17f0e3678cd529df7e5ccb66b05b3a Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 15 Jul 2019 10:22:03 +0200 Subject: [PATCH 18/49] Restrict traefik.toml to static configuration. --- cmd/healthcheck/healthcheck.go | 2 +- cmd/traefik/traefik.go | 6 +- docs/content/middlewares/overview.md | 6 -- docs/content/providers/file.md | 46 +++++++--- .../reference/static-configuration/cli-ref.md | 3 - .../reference/static-configuration/env-ref.md | 3 - docs/content/routing/overview.md | 16 ++-- docs/content/user-guides/grpc.md | 92 ++++++++++++------- integration/file_test.go | 6 +- integration/fixtures/acme/acme_base.toml | 4 +- integration/fixtures/acme/acme_tls.toml | 4 +- integration/fixtures/error_pages/error.toml | 4 +- integration/fixtures/error_pages/simple.toml | 4 +- .../fixtures/file/56-simple-panic.toml | 4 +- integration/fixtures/file/simple-hosts.toml | 4 +- integration/fixtures/file/simple.toml | 4 +- integration/fixtures/grpc/config.toml | 4 +- integration/fixtures/grpc/config_h2c.toml | 4 +- .../fixtures/grpc/config_h2c_termination.toml | 4 +- .../fixtures/grpc/config_insecure.toml | 4 +- integration/fixtures/grpc/config_retry.toml | 4 +- integration/fixtures/headers/cors.toml | 4 +- .../healthcheck/multiple-entrypoints.toml | 4 +- .../fixtures/healthcheck/port_overload.toml | 4 +- integration/fixtures/healthcheck/simple.toml | 4 +- .../https/clientca/https_1ca1config.toml | 4 +- .../https/clientca/https_2ca1config.toml | 4 +- .../https/clientca/https_2ca2config.toml | 4 +- .../https/dynamic_https_sni_default_cert.toml | 4 +- .../fixtures/https/https_redirect.toml | 4 +- integration/fixtures/https/https_sni.toml | 4 +- .../https_sni_case_insensitive_dynamic.toml | 4 +- .../https/https_sni_default_cert.toml | 4 +- .../fixtures/https/https_sni_strict.toml | 4 +- .../fixtures/https/https_tls_options.toml | 4 +- integration/fixtures/https/rootcas/https.toml | 4 +- .../https/rootcas/https_with_file.toml | 4 +- integration/fixtures/log_rotation_config.toml | 36 -------- integration/fixtures/multiple_provider.toml | 1 + integration/fixtures/multiprovider.toml | 1 + integration/fixtures/proxy-protocol/with.toml | 4 +- .../fixtures/proxy-protocol/without.toml | 4 +- integration/fixtures/ratelimit/simple.toml | 4 +- integration/fixtures/reqacceptgrace.toml | 6 +- integration/fixtures/retry/simple.toml | 4 +- integration/fixtures/simple_auth.toml | 3 + integration/fixtures/simple_stats.toml | 1 + .../tcp/catch-all-no-tls-with-https.toml | 1 + .../fixtures/tcp/catch-all-no-tls.toml | 1 + integration/fixtures/tcp/mixed.toml | 1 + .../fixtures/tcp/multi-tls-options.toml | 1 + .../fixtures/tcp/non-tls-fallback.toml | 3 + integration/fixtures/tcp/non-tls.toml | 1 + .../fixtures/timeout/forwarding_timeouts.toml | 4 +- integration/fixtures/timeout/keepalive.toml | 4 +- .../fixtures/tlsclientheaders/simple.toml | 1 + .../fixtures/tracing/simple-jaeger.toml | 4 +- .../fixtures/tracing/simple-zipkin.toml | 4 +- integration/fixtures/websocket/config.toml | 4 +- .../fixtures/websocket/config_https.toml | 4 +- integration/headers_test.go | 5 +- integration/https_test.go | 64 +++++++++---- integration/integration_test.go | 6 +- integration/simple_test.go | 17 ++-- pkg/anonymize/anonymize_config_test.go | 1 - pkg/cli/loader.go | 14 --- pkg/config/dynamic/fixtures/sample.toml | 1 - pkg/config/file/file_node_test.go | 2 - pkg/config/file/fixtures/sample.toml | 1 - pkg/config/file/fixtures/sample.yml | 1 - pkg/config/static/static_config.go | 8 +- pkg/provider/file/file.go | 22 +---- pkg/provider/file/file_test.go | 58 ------------ .../fixtures/toml/simple_traefik_file_01.toml | 2 - .../fixtures/toml/simple_traefik_file_02.toml | 44 --------- .../simple_traefik_file_with_templating.toml | 45 --------- .../fixtures/yaml/simple_traefik_file_01.yml | 2 - .../fixtures/yaml/simple_traefik_file_02.yml | 32 ------- 78 files changed, 274 insertions(+), 440 deletions(-) delete mode 100644 integration/fixtures/log_rotation_config.toml delete mode 100644 pkg/provider/file/fixtures/toml/simple_traefik_file_01.toml delete mode 100644 pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml delete mode 100644 pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml delete mode 100644 pkg/provider/file/fixtures/yaml/simple_traefik_file_01.yml delete mode 100644 pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml diff --git a/cmd/healthcheck/healthcheck.go b/cmd/healthcheck/healthcheck.go index 8784f5d60..5bbc09eb0 100644 --- a/cmd/healthcheck/healthcheck.go +++ b/cmd/healthcheck/healthcheck.go @@ -24,7 +24,7 @@ func NewCmd(traefikConfiguration *static.Configuration, loaders []cli.ResourceLo func runCmd(traefikConfiguration *static.Configuration) func(_ []string) error { return func(_ []string) error { - traefikConfiguration.SetEffectiveConfiguration("") + traefikConfiguration.SetEffectiveConfiguration() resp, errPing := Do(*traefikConfiguration) if resp != nil { diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index d7f346593..1c4410681 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -53,7 +53,7 @@ Complete documentation is available at https://traefik.io`, Configuration: tConfig, Resources: loaders, Run: func(_ []string) error { - return runCmd(&tConfig.Configuration, cli.GetConfigFile(loaders)) + return runCmd(&tConfig.Configuration) }, } @@ -78,7 +78,7 @@ Complete documentation is available at https://traefik.io`, os.Exit(0) } -func runCmd(staticConfiguration *static.Configuration, configFile string) error { +func runCmd(staticConfiguration *static.Configuration) error { configureLogging(staticConfiguration) http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment @@ -87,7 +87,7 @@ func runCmd(staticConfiguration *static.Configuration, configFile string) error log.WithoutContext().Errorf("Could not set roundrobin default weight: %v", err) } - staticConfiguration.SetEffectiveConfiguration(configFile) + staticConfiguration.SetEffectiveConfiguration() staticConfiguration.ValidateConfiguration() log.WithoutContext().Infof("Traefik version %s built on %s", version.Version, version.BuildDate) diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index 102f10d03..9b21ecd3e 100644 --- a/docs/content/middlewares/overview.md +++ b/docs/content/middlewares/overview.md @@ -81,9 +81,6 @@ labels: ```toml tab="File" # As Toml Configuration File -[providers] - [providers.file] - [http.routers] [http.routers.router1] service = "myService" @@ -128,9 +125,6 @@ and therefore this specification would be ignored even if present. Declaring the add-foo-prefix in the file provider. ```toml - [providers] - [providers.file] - [http.middlewares] [http.middlewares.add-foo-prefix.addPrefix] prefix = "/foo" diff --git a/docs/content/providers/file.md b/docs/content/providers/file.md index 689238e05..48f9a62a0 100644 --- a/docs/content/providers/file.md +++ b/docs/content/providers/file.md @@ -6,7 +6,6 @@ Good Old Configuration File The file provider lets you define the [dynamic configuration](./overview.md) in a TOML or YAML file. You can write these configuration elements: -* At the end of the main Traefik configuration file (by default: `traefik.toml`/`traefik.yml`/`traefik.yaml`). * In [a dedicated file](#filename) * In [several dedicated files](#directory) @@ -22,13 +21,19 @@ You can write these configuration elements: Enabling the file provider: - ```toml tab="TOML" + ```toml tab="File (TOML)" [providers.file] + filename = "/my/path/to/dynamic-conf.toml" ``` - ```yaml tab="YAML" + ```yaml tab="File (YAML)" providers: - file: {} + file: + filename: "/my/path/to/dynamic-conf.yml" + ``` + + ```bash tab="CLI" + --providers.file.filename=/my/path/to/dynamic_conf.toml ``` Declaring Routers, Middlewares & Services: @@ -102,16 +107,20 @@ _Optional_ Defines the path of the configuration file. -```toml tab="TOML" +```toml tab="File (TOML)" [providers] [providers.file] - filename = "rules.toml" + filename = "dynamic_conf.toml" ``` -```yaml tab="YAML" +```yaml tab="File (YAML)" providers: file: - filename: rules.yaml + filename: dynamic_conf.yml +``` + +```bash tab="CLI" +--providers.file.filename=dynamic_conf.toml ``` ### `directory` @@ -120,18 +129,22 @@ _Optional_ Defines the directory that contains the configuration files. -```toml tab="TOML" +```toml tab="File (TOML)" [providers] [providers.file] directory = "/path/to/config" ``` -```yaml tab="YAML" +```yaml tab="File (YAML)" providers: file: directory: /path/to/config ``` +```bash tab="CLI" +--providers.file.directory=/path/to/config +``` + ### `watch` _Optional_ @@ -139,20 +152,25 @@ _Optional_ Set the `watch` option to `true` to allow Traefik to automatically watch for file changes. It works with both the `filename` and the `directory` options. -```toml tab="TOML" +```toml tab="File (TOML)" [providers] [providers.file] - filename = "rules.toml" + filename = "dynamic_conf.toml" watch = true ``` -```yaml tab="YAML" +```yaml tab="File (YAML)" providers: file: - filename: rules.yml + filename: dynamic_conf.yml watch: true ``` +```bash tab="CLI" +--providers.file.filename=dynamic_conf.toml +--providers.file.watch=true +``` + ### Go Templating !!! warning diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index e7c9d66d0..8f167ade0 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -285,9 +285,6 @@ Use the ip address from the bound port, rather than from the inner network. (Def `--providers.docker.watch`: Watch provider. (Default: ```true```) -`--providers.file`: -Enable File backend with default settings. (Default: ```false```) - `--providers.file.debugloggeneratedtemplate`: Enable debug logging of generated configuration template. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index c8021d8c3..ed0b45b3b 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -285,9 +285,6 @@ Use the ip address from the bound port, rather than from the inner network. (Def `TRAEFIK_PROVIDERS_DOCKER_WATCH`: Watch provider. (Default: ```true```) -`TRAEFIK_PROVIDERS_FILE`: -Enable File backend with default settings. (Default: ```false```) - `TRAEFIK_PROVIDERS_FILE_DEBUGLOGGENERATEDTEMPLATE`: Enable debug logging of generated configuration template. (Default: ```false```) diff --git a/docs/content/routing/overview.md b/docs/content/routing/overview.md index d7bd5978e..5086b8ca1 100644 --- a/docs/content/routing/overview.md +++ b/docs/content/routing/overview.md @@ -35,6 +35,7 @@ Static configuration: [providers] # Enable the file provider to define routers / middlewares / services in a file [providers.file] + filename = "dynamic_conf.toml" ``` ```yaml tab="File (YAML)" @@ -45,7 +46,8 @@ entryPoints: providers: # Enable the file provider to define routers / middlewares / services in a file - file: {} + file: + filename: dynamic_conf.yml ``` ```bash tab="CLI" @@ -53,7 +55,7 @@ providers: --entryPoints.web.address=:8081 # Enable the file provider to define routers / middlewares / services in a file ---providers.file +--providers.file.filename=dynamic_conf.toml ``` Dynamic configuration: @@ -124,7 +126,7 @@ http: Static configuration: - ```toml tab="TOML" + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] # Listen on port 8081 for incoming requests @@ -133,16 +135,18 @@ http: [providers] # Enable the file provider to define routers / middlewares / services in a file [providers.file] + filename = "dynamic_conf.toml" ``` - ```yaml tab="YAML" + ```yaml tab="File (YAML)" 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: {} + file: + filename: dynamic_conf.yml ``` ```bash tab="CLI" @@ -150,7 +154,7 @@ http: --entryPoints.web.address=":8081" # Enable the file provider to define routers / middlewares / services in a file - --providers.file + --providers.file.filename=dynamic_conf.toml ``` Dynamic configuration: diff --git a/docs/content/user-guides/grpc.md b/docs/content/user-guides/grpc.md index 9f8d586f6..9012add8e 100644 --- a/docs/content/user-guides/grpc.md +++ b/docs/content/user-guides/grpc.md @@ -6,17 +6,40 @@ This section explains how to use Traefik as reverse proxy for gRPC application. ### Traefik Configuration -```toml tab="TOML" -## static configuration ## +Static configuration: +```toml tab="File (TOML)" [entryPoints] - [entryPoints.http] + [entryPoints.web] address = ":80" [api] [providers.file] + filename = "dynamic_conf.toml" +``` +```yaml tab="File (YAML)" +entryPoints: + web: + address: :80 + +providers: + file: + filename: dynamic_conf.yml + +api: {} +``` + +```yaml tab="CLI" +--entryPoints.web.address=":80" +--providers.file.filename=dynamic_conf.toml +--api +``` + +`dynamic_conf.{toml,yml}`: + +```toml tab="TOML" ## dynamic configuration ## [http] @@ -34,17 +57,6 @@ This section explains how to use Traefik as reverse proxy for gRPC application. ``` ```yaml tab="YAML" -## static configuration ## - -entryPoints: - http: - address: :80 - -providers: - file: {} - -api: {} - ## dynamic configuration ## http: @@ -105,11 +117,11 @@ Common Name (e.g. server FQDN or YOUR name) []: frontend.local At last, we configure our Traefik instance to use both self-signed certificates. -```toml tab="TOML" -## static configuration ## +Static configuration: +```toml tab="File (TOML)" [entryPoints] - [entryPoints.https] + [entryPoints.websecure] address = ":4443" @@ -120,7 +132,37 @@ At last, we configure our Traefik instance to use both self-signed certificates. [api] [provider.file] + filename = "dynamic_conf.toml" +``` +```yaml tab="File (YAML)" +entryPoints: + websecure: + address: :4443 + +serversTransport: + # For secure connection on backend.local + rootCAs: + - ./backend.cert + +providers: + file: + filename: dynamic_conf.yml + +api: {} +``` + +```yaml tab="CLI" +--entryPoints.websecure.address=":4443" +# For secure connection on backend.local +--serversTransport.rootCAs=./backend.cert +--providers.file.filename=dynamic_conf.toml +--api +``` + +`dynamic_conf.{toml,yml}`: + +```toml tab="TOML" ## dynamic configuration ## [http] @@ -146,22 +188,6 @@ At last, we configure our Traefik instance to use both self-signed certificates. ``` ```yaml tab="YAML" -## static configuration ## - -entryPoints: - https: - address: :4443 - -serversTransport: - # For secure connection on backend.local - rootCAs: - - ./backend.cert - -providers: - file: {} - -api: {} - ## dynamic configuration ## http: diff --git a/integration/file_test.go b/integration/file_test.go index df43b1b61..0a9db2266 100644 --- a/integration/file_test.go +++ b/integration/file_test.go @@ -2,6 +2,7 @@ package integration import ( "net/http" + "os" "time" "github.com/containous/traefik/integration/try" @@ -14,12 +15,13 @@ type FileSuite struct{ BaseSuite } func (s *FileSuite) SetUpSuite(c *check.C) { s.createComposeProject(c, "file") - s.composeProject.Start(c) } func (s *FileSuite) TestSimpleConfiguration(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/file/simple.toml")) + file := s.adaptFile(c, "fixtures/file/simple.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) diff --git a/integration/fixtures/acme/acme_base.toml b/integration/fixtures/acme/acme_base.toml index 0628cc57b..ee2755545 100644 --- a/integration/fixtures/acme/acme_base.toml +++ b/integration/fixtures/acme/acme_base.toml @@ -39,8 +39,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/acme/acme_tls.toml b/integration/fixtures/acme/acme_tls.toml index a977c21ac..7addd0731 100644 --- a/integration/fixtures/acme/acme_tls.toml +++ b/integration/fixtures/acme/acme_tls.toml @@ -39,8 +39,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/error_pages/error.toml b/integration/fixtures/error_pages/error.toml index 801b28152..12b38bca8 100644 --- a/integration/fixtures/error_pages/error.toml +++ b/integration/fixtures/error_pages/error.toml @@ -9,8 +9,8 @@ [entryPoints.web] address = ":8080" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/error_pages/simple.toml b/integration/fixtures/error_pages/simple.toml index 284ad1779..a734098b9 100644 --- a/integration/fixtures/error_pages/simple.toml +++ b/integration/fixtures/error_pages/simple.toml @@ -9,8 +9,8 @@ [entryPoints.web] address = ":8080" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/file/56-simple-panic.toml b/integration/fixtures/file/56-simple-panic.toml index a890ef539..09aadf0a1 100644 --- a/integration/fixtures/file/56-simple-panic.toml +++ b/integration/fixtures/file/56-simple-panic.toml @@ -9,5 +9,5 @@ [entryPoints.web] address = ":8000" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" diff --git a/integration/fixtures/file/simple-hosts.toml b/integration/fixtures/file/simple-hosts.toml index 91d379c01..e2f5485a1 100644 --- a/integration/fixtures/file/simple-hosts.toml +++ b/integration/fixtures/file/simple-hosts.toml @@ -9,8 +9,8 @@ [entryPoints.web] address = ":8000" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/file/simple.toml b/integration/fixtures/file/simple.toml index 96a6dea17..736eb4f2b 100644 --- a/integration/fixtures/file/simple.toml +++ b/integration/fixtures/file/simple.toml @@ -9,8 +9,8 @@ [entryPoints.web] address = ":8000" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/grpc/config.toml b/integration/fixtures/grpc/config.toml index 7e8277d8a..5ebf5e946 100644 --- a/integration/fixtures/grpc/config.toml +++ b/integration/fixtures/grpc/config.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/grpc/config_h2c.toml b/integration/fixtures/grpc/config_h2c.toml index 096a20e78..8dfcc99da 100644 --- a/integration/fixtures/grpc/config_h2c.toml +++ b/integration/fixtures/grpc/config_h2c.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/grpc/config_h2c_termination.toml b/integration/fixtures/grpc/config_h2c_termination.toml index ee48c3334..10fbdaeaa 100644 --- a/integration/fixtures/grpc/config_h2c_termination.toml +++ b/integration/fixtures/grpc/config_h2c_termination.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/grpc/config_insecure.toml b/integration/fixtures/grpc/config_insecure.toml index 053cc4b63..417ebdd22 100644 --- a/integration/fixtures/grpc/config_insecure.toml +++ b/integration/fixtures/grpc/config_insecure.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/grpc/config_retry.toml b/integration/fixtures/grpc/config_retry.toml index 72f5b5e09..dfd316ea5 100644 --- a/integration/fixtures/grpc/config_retry.toml +++ b/integration/fixtures/grpc/config_retry.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/headers/cors.toml b/integration/fixtures/headers/cors.toml index 32b8d2995..263966e39 100644 --- a/integration/fixtures/headers/cors.toml +++ b/integration/fixtures/headers/cors.toml @@ -9,8 +9,8 @@ [entryPoints.web] address = ":8000" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/healthcheck/multiple-entrypoints.toml b/integration/fixtures/healthcheck/multiple-entrypoints.toml index 12e543186..3c1d60f3c 100644 --- a/integration/fixtures/healthcheck/multiple-entrypoints.toml +++ b/integration/fixtures/healthcheck/multiple-entrypoints.toml @@ -13,8 +13,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/healthcheck/port_overload.toml b/integration/fixtures/healthcheck/port_overload.toml index 892e5b463..40b24391b 100644 --- a/integration/fixtures/healthcheck/port_overload.toml +++ b/integration/fixtures/healthcheck/port_overload.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/healthcheck/simple.toml b/integration/fixtures/healthcheck/simple.toml index 0109337fc..92bc1e4d7 100644 --- a/integration/fixtures/healthcheck/simple.toml +++ b/integration/fixtures/healthcheck/simple.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/clientca/https_1ca1config.toml b/integration/fixtures/https/clientca/https_1ca1config.toml index e149185b3..f52896e55 100644 --- a/integration/fixtures/https/clientca/https_1ca1config.toml +++ b/integration/fixtures/https/clientca/https_1ca1config.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/clientca/https_2ca1config.toml b/integration/fixtures/https/clientca/https_2ca1config.toml index d12915e85..34ea565e9 100644 --- a/integration/fixtures/https/clientca/https_2ca1config.toml +++ b/integration/fixtures/https/clientca/https_2ca1config.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/clientca/https_2ca2config.toml b/integration/fixtures/https/clientca/https_2ca2config.toml index 5a15e574f..bec6abde7 100644 --- a/integration/fixtures/https/clientca/https_2ca2config.toml +++ b/integration/fixtures/https/clientca/https_2ca2config.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/dynamic_https_sni_default_cert.toml b/integration/fixtures/https/dynamic_https_sni_default_cert.toml index e45d40076..05f3c1b6d 100644 --- a/integration/fixtures/https/dynamic_https_sni_default_cert.toml +++ b/integration/fixtures/https/dynamic_https_sni_default_cert.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_redirect.toml b/integration/fixtures/https/https_redirect.toml index eed285020..e9e9f78bc 100644 --- a/integration/fixtures/https/https_redirect.toml +++ b/integration/fixtures/https/https_redirect.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_sni.toml b/integration/fixtures/https/https_sni.toml index 561d5f3b5..c5212af6a 100644 --- a/integration/fixtures/https/https_sni.toml +++ b/integration/fixtures/https/https_sni.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml b/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml index 28b22f45a..614a54ee1 100644 --- a/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml +++ b/integration/fixtures/https/https_sni_case_insensitive_dynamic.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_sni_default_cert.toml b/integration/fixtures/https/https_sni_default_cert.toml index e45d40076..05f3c1b6d 100644 --- a/integration/fixtures/https/https_sni_default_cert.toml +++ b/integration/fixtures/https/https_sni_default_cert.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_sni_strict.toml b/integration/fixtures/https/https_sni_strict.toml index 1f15bd6cc..9ada0a5e6 100644 --- a/integration/fixtures/https/https_sni_strict.toml +++ b/integration/fixtures/https/https_sni_strict.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/https_tls_options.toml b/integration/fixtures/https/https_tls_options.toml index d81ac1a65..4e7dfde43 100644 --- a/integration/fixtures/https/https_tls_options.toml +++ b/integration/fixtures/https/https_tls_options.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/rootcas/https.toml b/integration/fixtures/https/rootcas/https.toml index ae85cfaeb..54b502faa 100644 --- a/integration/fixtures/https/rootcas/https.toml +++ b/integration/fixtures/https/rootcas/https.toml @@ -30,8 +30,8 @@ fblo6RBxUQ== [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/https/rootcas/https_with_file.toml b/integration/fixtures/https/rootcas/https_with_file.toml index a37b8544c..21e957df8 100644 --- a/integration/fixtures/https/rootcas/https_with_file.toml +++ b/integration/fixtures/https/rootcas/https_with_file.toml @@ -15,8 +15,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/log_rotation_config.toml b/integration/fixtures/log_rotation_config.toml deleted file mode 100644 index e96a0c7c0..000000000 --- a/integration/fixtures/log_rotation_config.toml +++ /dev/null @@ -1,36 +0,0 @@ -[global] - checkNewVersion = false - sendAnonymousUsage = false - -[log] - filePath = "traefik.log" - level = "ERROR" - -[accessLog] - filePath = "access.log" - -[entryPoints] - [entryPoints.web] - address = ":8000" - [entryPoints.api] - address = ":7888" - -[api] - entryPoint = "api" - -[providers] - [providers.file] - -## dynamic configuration ## - -[http.routers] - [http.routers.router1] - Service = "service1" - rule = "Path(`/test1`)" - -[http.services] - [http.services.service1] - [http.services.service1.loadBalancer] - - [[http.services.service1.loadBalancer.servers]] - url = "http://127.0.0.1:8081" diff --git a/integration/fixtures/multiple_provider.toml b/integration/fixtures/multiple_provider.toml index 6703950f0..0ac809de2 100644 --- a/integration/fixtures/multiple_provider.toml +++ b/integration/fixtures/multiple_provider.toml @@ -17,6 +17,7 @@ exposedByDefault = false [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/multiprovider.toml b/integration/fixtures/multiprovider.toml index 4a2621455..23c0161ae 100644 --- a/integration/fixtures/multiprovider.toml +++ b/integration/fixtures/multiprovider.toml @@ -15,6 +15,7 @@ [providers.rest] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/proxy-protocol/with.toml b/integration/fixtures/proxy-protocol/with.toml index d7a630a1f..f16361986 100644 --- a/integration/fixtures/proxy-protocol/with.toml +++ b/integration/fixtures/proxy-protocol/with.toml @@ -13,8 +13,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/proxy-protocol/without.toml b/integration/fixtures/proxy-protocol/without.toml index edd4597b2..ef95ca5c7 100644 --- a/integration/fixtures/proxy-protocol/without.toml +++ b/integration/fixtures/proxy-protocol/without.toml @@ -13,8 +13,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/ratelimit/simple.toml b/integration/fixtures/ratelimit/simple.toml index ce04a31f1..9a1a18c24 100644 --- a/integration/fixtures/ratelimit/simple.toml +++ b/integration/fixtures/ratelimit/simple.toml @@ -15,8 +15,8 @@ [entryPoints.api] address = ":8080" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/reqacceptgrace.toml b/integration/fixtures/reqacceptgrace.toml index ab5a9cedd..945a7d168 100644 --- a/integration/fixtures/reqacceptgrace.toml +++ b/integration/fixtures/reqacceptgrace.toml @@ -19,8 +19,8 @@ [ping] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## @@ -32,5 +32,5 @@ [http.services] [http.services.service.loadBalancer] [[http.services.service.loadBalancer.servers]] - url = "{{.Server}}" + url = "{{ .Server }}" diff --git a/integration/fixtures/retry/simple.toml b/integration/fixtures/retry/simple.toml index 30cb722d0..fea2a4a60 100644 --- a/integration/fixtures/retry/simple.toml +++ b/integration/fixtures/retry/simple.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/simple_auth.toml b/integration/fixtures/simple_auth.toml index f17b5c88e..51476e428 100644 --- a/integration/fixtures/simple_auth.toml +++ b/integration/fixtures/simple_auth.toml @@ -18,6 +18,9 @@ [ping] [providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## [http.middlewares] [http.middlewares.authentication.basicAuth] diff --git a/integration/fixtures/simple_stats.toml b/integration/fixtures/simple_stats.toml index bb9da6f3f..4283299db 100644 --- a/integration/fixtures/simple_stats.toml +++ b/integration/fixtures/simple_stats.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## 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 5f4c79900..cc65bda34 100644 --- a/integration/fixtures/tcp/catch-all-no-tls-with-https.toml +++ b/integration/fixtures/tcp/catch-all-no-tls-with-https.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tcp/catch-all-no-tls.toml b/integration/fixtures/tcp/catch-all-no-tls.toml index efca7631d..0132822ee 100644 --- a/integration/fixtures/tcp/catch-all-no-tls.toml +++ b/integration/fixtures/tcp/catch-all-no-tls.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tcp/mixed.toml b/integration/fixtures/tcp/mixed.toml index 9bca88eaf..e673276ad 100644 --- a/integration/fixtures/tcp/mixed.toml +++ b/integration/fixtures/tcp/mixed.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tcp/multi-tls-options.toml b/integration/fixtures/tcp/multi-tls-options.toml index 884924365..9aca38006 100644 --- a/integration/fixtures/tcp/multi-tls-options.toml +++ b/integration/fixtures/tcp/multi-tls-options.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tcp/non-tls-fallback.toml b/integration/fixtures/tcp/non-tls-fallback.toml index 173086e1b..45ff3caa7 100644 --- a/integration/fixtures/tcp/non-tls-fallback.toml +++ b/integration/fixtures/tcp/non-tls-fallback.toml @@ -12,6 +12,9 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## [tcp] [tcp.routers] diff --git a/integration/fixtures/tcp/non-tls.toml b/integration/fixtures/tcp/non-tls.toml index c7ba8297f..6c7acf6df 100644 --- a/integration/fixtures/tcp/non-tls.toml +++ b/integration/fixtures/tcp/non-tls.toml @@ -12,6 +12,7 @@ [api] [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/timeout/forwarding_timeouts.toml b/integration/fixtures/timeout/forwarding_timeouts.toml index 5d123d18d..9df89a175 100644 --- a/integration/fixtures/timeout/forwarding_timeouts.toml +++ b/integration/fixtures/timeout/forwarding_timeouts.toml @@ -18,8 +18,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/timeout/keepalive.toml b/integration/fixtures/timeout/keepalive.toml index d79e04786..4a8924362 100644 --- a/integration/fixtures/timeout/keepalive.toml +++ b/integration/fixtures/timeout/keepalive.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tlsclientheaders/simple.toml b/integration/fixtures/tlsclientheaders/simple.toml index 9469bb91f..5e6af461d 100644 --- a/integration/fixtures/tlsclientheaders/simple.toml +++ b/integration/fixtures/tlsclientheaders/simple.toml @@ -19,6 +19,7 @@ watch = true [providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tracing/simple-jaeger.toml b/integration/fixtures/tracing/simple-jaeger.toml index 53435ad88..3bc8a08d3 100644 --- a/integration/fixtures/tracing/simple-jaeger.toml +++ b/integration/fixtures/tracing/simple-jaeger.toml @@ -19,8 +19,8 @@ samplingServerURL = "http://{{.IP}}:5778/sampling" localAgentHostPort = "{{.IP}}:6831" -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/tracing/simple-zipkin.toml b/integration/fixtures/tracing/simple-zipkin.toml index b1f14bf37..46f8ff697 100644 --- a/integration/fixtures/tracing/simple-zipkin.toml +++ b/integration/fixtures/tracing/simple-zipkin.toml @@ -17,8 +17,8 @@ httpEndpoint = "http://{{.IP}}:9411/api/v1/spans" debug = true -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/websocket/config.toml b/integration/fixtures/websocket/config.toml index 066155d9b..3e357c057 100644 --- a/integration/fixtures/websocket/config.toml +++ b/integration/fixtures/websocket/config.toml @@ -11,8 +11,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/fixtures/websocket/config_https.toml b/integration/fixtures/websocket/config_https.toml index f020fa71d..c878e1ef3 100644 --- a/integration/fixtures/websocket/config_https.toml +++ b/integration/fixtures/websocket/config_https.toml @@ -14,8 +14,8 @@ [api] -[providers] - [providers.file] +[providers.file] + filename = "{{ .SelfFilename }}" ## dynamic configuration ## diff --git a/integration/headers_test.go b/integration/headers_test.go index dd60a5876..aa4fd2653 100644 --- a/integration/headers_test.go +++ b/integration/headers_test.go @@ -2,6 +2,7 @@ package integration import ( "net/http" + "os" "time" "github.com/containous/traefik/integration/try" @@ -25,7 +26,9 @@ func (s *HeadersSuite) TestSimpleConfiguration(c *check.C) { } func (s *HeadersSuite) TestCorsResponses(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/headers/cors.toml")) + file := s.adaptFile(c, "fixtures/headers/cors.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() diff --git a/integration/https_test.go b/integration/https_test.go index d589f216d..07c74f229 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -25,7 +25,9 @@ type HTTPSSuite struct{ BaseSuite } // "snitest.com", which happens to match the CN of 'snitest.com.crt'. The test // verifies that traefik presents the correct certificate. func (s *HTTPSSuite) TestWithSNIConfigHandshake(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -59,7 +61,9 @@ func (s *HTTPSSuite) TestWithSNIConfigHandshake(c *check.C) { // SNI hostnames of "snitest.org" and "snitest.com". The test verifies // that traefik routes the requests to the expected backends. func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -113,7 +117,9 @@ func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) { // TestWithTLSOptions verifies that traefik routes the requests with the associated tls options. func (s *HTTPSSuite) TestWithTLSOptions(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_tls_options.toml")) + file := s.adaptFile(c, "fixtures/https/https_tls_options.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -197,7 +203,9 @@ func (s *HTTPSSuite) TestWithTLSOptions(c *check.C) { // TestWithConflictingTLSOptions checks that routers with same SNI but different TLS options get fallbacked to the default TLS options. func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_tls_options.toml")) + file := s.adaptFile(c, "fixtures/https/https_tls_options.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -265,7 +273,9 @@ func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) { // "snitest.org", which does not match the CN of 'snitest.com.crt'. The test // verifies that traefik closes the connection. func (s *HTTPSSuite) TestWithSNIStrictNotMatchedRequest(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_strict.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni_strict.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -289,7 +299,9 @@ func (s *HTTPSSuite) TestWithSNIStrictNotMatchedRequest(c *check.C) { // "snitest.org", which does not match the CN of 'snitest.com.crt'. The test // verifies that traefik returns the default certificate. func (s *HTTPSSuite) TestWithDefaultCertificate(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -323,7 +335,9 @@ func (s *HTTPSSuite) TestWithDefaultCertificate(c *check.C) { // which does not match the CN of 'snitest.com.crt'. The test // verifies that traefik returns the default certificate. func (s *HTTPSSuite) TestWithDefaultCertificateNoSNI(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -357,7 +371,9 @@ func (s *HTTPSSuite) TestWithDefaultCertificateNoSNI(c *check.C) { // 'wildcard.snitest.com.crt', and `www.snitest.com.crt`. The test // verifies that traefik returns the non-wildcard certificate. func (s *HTTPSSuite) TestWithOverlappingStaticCertificate(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_default_cert.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni_default_cert.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -392,7 +408,9 @@ func (s *HTTPSSuite) TestWithOverlappingStaticCertificate(c *check.C) { // 'wildcard.snitest.com.crt', and `www.snitest.com.crt`. The test // verifies that traefik returns the non-wildcard certificate. func (s *HTTPSSuite) TestWithOverlappingDynamicCertificate(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/dynamic_https_sni_default_cert.toml")) + file := s.adaptFile(c, "fixtures/https/dynamic_https_sni_default_cert.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -425,7 +443,9 @@ func (s *HTTPSSuite) TestWithOverlappingDynamicCertificate(c *check.C) { // TestWithClientCertificateAuthentication // The client can send a certificate signed by a CA trusted by the server but it's optional func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_1ca1config.toml")) + file := s.adaptFile(c, "fixtures/https/clientca/https_1ca1config.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -481,7 +501,9 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) { // TestWithClientCertificateAuthentication // Use two CA:s and test that clients with client signed by either of them can connect func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca1config.toml")) + file := s.adaptFile(c, "fixtures/https/clientca/https_2ca1config.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -542,7 +564,9 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check // TestWithClientCertificateAuthentication // Use two CA:s in two different files and test that clients with client signed by either of them can connect func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/clientca/https_2ca2config.toml")) + file := s.adaptFile(c, "fixtures/https/clientca/https_2ca2config.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -777,7 +801,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithChange(c *check.C) { c.Assert(err, checker.IsNil) // Change certificates configuration file content - modifyCertificateConfFileContent(c, tr1.TLSClientConfig.ServerName, dynamicConfFileName, "https") + modifyCertificateConfFileContent(c, tr1.TLSClientConfig.ServerName, dynamicConfFileName) req, err := http.NewRequest(http.MethodGet, "https://127.0.0.1:4443/", nil) c.Assert(err, checker.IsNil) @@ -846,14 +870,14 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion(c c.Assert(err, checker.IsNil) // Change certificates configuration file content - modifyCertificateConfFileContent(c, "", dynamicConfFileName, "https02") + modifyCertificateConfFileContent(c, "", dynamicConfFileName) err = try.RequestWithTransport(req, 30*time.Second, tr2, try.HasCn("TRAEFIK DEFAULT CERT"), try.StatusCodeIs(http.StatusNotFound)) c.Assert(err, checker.IsNil) } // modifyCertificateConfFileContent replaces the content of a HTTPS configuration file. -func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, entryPoint string) { +func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName string) { file, err := os.OpenFile("./"+confFileName, os.O_WRONLY, os.ModeExclusive) c.Assert(err, checker.IsNil) defer func() { @@ -884,8 +908,10 @@ func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, en } } -func (s *HTTPSSuite) TestEntrypointHttpsRedirectAndPathModification(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_redirect.toml")) +func (s *HTTPSSuite) TestEntryPointHttpsRedirectAndPathModification(c *check.C) { + file := s.adaptFile(c, "fixtures/https/https_redirect.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) @@ -986,7 +1012,9 @@ func (s *HTTPSSuite) TestEntrypointHttpsRedirectAndPathModification(c *check.C) // "bar.www.snitest.com", which matches the DNS SAN of '*.WWW.SNITEST.COM'. The test // verifies that traefik presents the correct certificate. func (s *HTTPSSuite) TestWithSNIDynamicCaseInsensitive(c *check.C) { - cmd, display := s.traefikCmd(withConfigFile("fixtures/https/https_sni_case_insensitive_dynamic.toml")) + file := s.adaptFile(c, "fixtures/https/https_sni_case_insensitive_dynamic.toml", struct{}{}) + defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() c.Assert(err, checker.IsNil) diff --git a/integration/integration_test.go b/integration/integration_test.go index 150638c2b..3d0779f82 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -15,6 +15,7 @@ import ( "text/template" "github.com/containous/traefik/pkg/log" + "github.com/fatih/structs" "github.com/go-check/check" compose "github.com/libkermit/compose/check" checker "github.com/vdemeester/shakers" @@ -150,7 +151,10 @@ func (s *BaseSuite) adaptFile(c *check.C, path string, tempObjects interface{}) c.Assert(err, checker.IsNil) defer tmpFile.Close() - err = tmpl.ExecuteTemplate(tmpFile, prefix, tempObjects) + model := structs.Map(tempObjects) + model["SelfFilename"] = tmpFile.Name() + + err = tmpl.ExecuteTemplate(tmpFile, prefix, model) c.Assert(err, checker.IsNil) err = tmpFile.Sync() diff --git a/integration/simple_test.go b/integration/simple_test.go index 2b09080bd..ef4baa451 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -98,6 +98,7 @@ func (s *SimpleSuite) TestRequestAcceptGraceTimeout(c *check.C) { Server string }{whoami}) defer os.Remove(file) + cmd, display := s.traefikCmd(withConfigFile(file)) defer display(c) err := cmd.Start() @@ -223,7 +224,9 @@ func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) { s.createComposeProject(c, "base") s.composeProject.Start(c) - cmd, output := s.traefikCmd(withConfigFile("./fixtures/simple_auth.toml")) + file := s.adaptFile(c, "./fixtures/simple_auth.toml", struct{}{}) + defer os.Remove(file) + cmd, output := s.traefikCmd(withConfigFile(file)) defer output(c) err := cmd.Start() @@ -237,7 +240,7 @@ func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) { c.Assert(err, checker.IsNil) } -func (s *SimpleSuite) TestDefaultEntrypointHTTP(c *check.C) { +func (s *SimpleSuite) TestDefaultEntryPointHTTP(c *check.C) { s.createComposeProject(c, "base") s.composeProject.Start(c) @@ -255,7 +258,7 @@ func (s *SimpleSuite) TestDefaultEntrypointHTTP(c *check.C) { c.Assert(err, checker.IsNil) } -func (s *SimpleSuite) TestWithUnexistingEntrypoint(c *check.C) { +func (s *SimpleSuite) TestWithNonExistingEntryPoint(c *check.C) { s.createComposeProject(c, "base") s.composeProject.Start(c) @@ -273,7 +276,7 @@ func (s *SimpleSuite) TestWithUnexistingEntrypoint(c *check.C) { c.Assert(err, checker.IsNil) } -func (s *SimpleSuite) TestMetricsPrometheusDefaultEntrypoint(c *check.C) { +func (s *SimpleSuite) TestMetricsPrometheusDefaultEntryPoint(c *check.C) { s.createComposeProject(c, "base") s.composeProject.Start(c) @@ -419,7 +422,7 @@ func (s *SimpleSuite) TestXForwardedHeaders(c *check.C) { c.Assert(err, checker.IsNil) } -func (s *SimpleSuite) TestMultiprovider(c *check.C) { +func (s *SimpleSuite) TestMultiProvider(c *check.C) { s.createComposeProject(c, "base") s.composeProject.Start(c) @@ -453,10 +456,10 @@ func (s *SimpleSuite) TestMultiprovider(c *check.C) { }, } - json, err := json.Marshal(config) + jsonContent, err := json.Marshal(config) c.Assert(err, checker.IsNil) - request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(json)) + request, err := http.NewRequest(http.MethodPut, "http://127.0.0.1:8080/api/providers/rest", bytes.NewReader(jsonContent)) c.Assert(err, checker.IsNil) response, err := http.DefaultClient.Do(request) diff --git a/pkg/anonymize/anonymize_config_test.go b/pkg/anonymize/anonymize_config_test.go index d71afc806..14b61dbd7 100644 --- a/pkg/anonymize/anonymize_config_test.go +++ b/pkg/anonymize/anonymize_config_test.go @@ -149,7 +149,6 @@ func TestDo_globalConfiguration(t *testing.T) { Watch: true, Filename: "file Filename", DebugLogGeneratedTemplate: true, - TraefikFile: "", } config.Providers.Docker = &docker.Provider{ diff --git a/pkg/cli/loader.go b/pkg/cli/loader.go index 90065910f..84f08d68d 100644 --- a/pkg/cli/loader.go +++ b/pkg/cli/loader.go @@ -5,17 +5,3 @@ type ResourceLoader interface { // Load populates cmd.Configuration, optionally using args to do so. Load(args []string, cmd *Command) (bool, error) } - -type filenameGetter interface { - GetFilename() string -} - -// GetConfigFile returns the configuration file corresponding to the first configuration file loader found in ResourceLoader, if any. -func GetConfigFile(loaders []ResourceLoader) string { - for _, loader := range loaders { - if v, ok := loader.(filenameGetter); ok { - return v.GetFilename() - } - } - return "" -} diff --git a/pkg/config/dynamic/fixtures/sample.toml b/pkg/config/dynamic/fixtures/sample.toml index 0a288c010..89e9672f7 100644 --- a/pkg/config/dynamic/fixtures/sample.toml +++ b/pkg/config/dynamic/fixtures/sample.toml @@ -52,7 +52,6 @@ watch = true filename = "foobar" debugLogGeneratedTemplate = true - traefikFile = "foobar" [providers.marathon] constraints = "foobar" trace = true diff --git a/pkg/config/file/file_node_test.go b/pkg/config/file/file_node_test.go index 6ed2ba1c0..086af94c1 100644 --- a/pkg/config/file/file_node_test.go +++ b/pkg/config/file/file_node_test.go @@ -192,7 +192,6 @@ func Test_decodeFileToNode_Toml(t *testing.T) { {Name: "debugLogGeneratedTemplate", Value: "true"}, {Name: "directory", Value: "foobar"}, {Name: "filename", Value: "foobar"}, - {Name: "traefikFile", Value: "foobar"}, {Name: "watch", Value: "true"}}}, {Name: "kubernetesCRD", Children: []*parser.Node{ @@ -435,7 +434,6 @@ func Test_decodeFileToNode_Yaml(t *testing.T) { {Name: "debugLogGeneratedTemplate", Value: "true"}, {Name: "directory", Value: "foobar"}, {Name: "filename", Value: "foobar"}, - {Name: "traefikFile", Value: "foobar"}, {Name: "watch", Value: "true"}}}, {Name: "kubernetesCRD", Children: []*parser.Node{ diff --git a/pkg/config/file/fixtures/sample.toml b/pkg/config/file/fixtures/sample.toml index 4459c506a..e964e12ca 100644 --- a/pkg/config/file/fixtures/sample.toml +++ b/pkg/config/file/fixtures/sample.toml @@ -52,7 +52,6 @@ watch = true filename = "foobar" debugLogGeneratedTemplate = true - traefikFile = "foobar" [providers.marathon] constraints = "foobar" trace = true diff --git a/pkg/config/file/fixtures/sample.yml b/pkg/config/file/fixtures/sample.yml index f66fb2c93..40a8c55da 100644 --- a/pkg/config/file/fixtures/sample.yml +++ b/pkg/config/file/fixtures/sample.yml @@ -55,7 +55,6 @@ providers: watch: true filename: foobar debugLogGeneratedTemplate: true - traefikFile: foobar marathon: constraints: foobar trace: true diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index b2290f8d6..e284e1337 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -149,7 +149,7 @@ func (t *Tracing) SetDefaults() { 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." 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"` + File *file.Provider `description:"Enable File backend with default settings." json:"file,omitempty" toml:"file,omitempty" yaml:"file,omitempty" export:"true"` Marathon *marathon.Provider `description:"Enable Marathon backend with default settings." json:"marathon,omitempty" toml:"marathon,omitempty" yaml:"marathon,omitempty" export:"true" label:"allowEmpty"` KubernetesIngress *ingress.Provider `description:"Enable Kubernetes backend with default settings." json:"kubernetesIngress,omitempty" toml:"kubernetesIngress,omitempty" yaml:"kubernetesIngress,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"` @@ -159,7 +159,7 @@ type Providers struct { // SetEffectiveConfiguration adds missing configuration parameters derived from existing ones. // It also takes care of maintaining backwards compatibility. -func (c *Configuration) SetEffectiveConfiguration(configFile string) { +func (c *Configuration) SetEffectiveConfiguration() { if len(c.EntryPoints) == 0 { ep := &EntryPoint{Address: ":80"} ep.SetDefaults() @@ -185,10 +185,6 @@ func (c *Configuration) SetEffectiveConfiguration(configFile string) { } } - if c.Providers.File != nil { - c.Providers.File.TraefikFile = configFile - } - if c.Providers.Rancher != nil { if c.Providers.Rancher.RefreshSeconds <= 0 { c.Providers.Rancher.RefreshSeconds = 15 diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index c89bc0be0..b70475c70 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -32,7 +32,6 @@ type Provider struct { 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:"-" yaml:"-"` } // SetDefaults sets the default values. @@ -64,7 +63,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. case len(p.Filename) > 0: watchItem = filepath.Dir(p.Filename) default: - watchItem = filepath.Dir(p.TraefikFile) + return errors.New("error using file configuration provider, neither filename or directory defined") } if err := p.addWatcher(pool, watchItem, configurationChan, p.watcherCallback); err != nil { @@ -89,11 +88,7 @@ func (p *Provider) BuildConfiguration() (*dynamic.Configuration, error) { return p.loadFileConfig(p.Filename, true) } - if len(p.TraefikFile) > 0 { - return p.loadFileConfig(p.TraefikFile, false) - } - - return nil, errors.New("error using file configuration backend, no filename defined") + return nil, errors.New("error using file configuration provider, neither filename or directory defined") } func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationChan chan<- dynamic.Message, callback func(chan<- dynamic.Message, fsnotify.Event)) error { @@ -116,15 +111,8 @@ func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationCh return case evt := <-watcher.Events: if p.Directory == "" { - var filename string - if len(p.Filename) > 0 { - filename = p.Filename - } else { - filename = p.TraefikFile - } - _, evtFileName := filepath.Split(evt.Name) - _, confFileName := filepath.Split(filename) + _, confFileName := filepath.Split(p.Filename) if evtFileName == confFileName { callback(configurationChan, evt) } @@ -140,11 +128,9 @@ func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationCh } func (p *Provider) watcherCallback(configurationChan chan<- dynamic.Message, event fsnotify.Event) { - watchItem := p.TraefikFile + watchItem := p.Filename if len(p.Directory) > 0 { watchItem = p.Directory - } else if len(p.Filename) > 0 { - watchItem = p.Filename } logger := log.WithoutContext().WithField(log.ProviderName, providerName) diff --git a/pkg/provider/file/file_test.go b/pkg/provider/file/file_test.go index 3907b6e9e..8307d8a10 100644 --- a/pkg/provider/file/file_test.go +++ b/pkg/provider/file/file_test.go @@ -20,7 +20,6 @@ type ProvideTestCase struct { desc string directoryPaths []string filePath string - traefikFilePath string expectedNumRouter int expectedNumService int expectedNumTLSConf int @@ -131,11 +130,6 @@ func TestProvideWithWatch(t *testing.T) { require.NoError(t, err) } - if len(test.traefikFilePath) > 0 { - err := copyFile(test.traefikFilePath, provider.TraefikFile) - require.NoError(t, err) - } - if len(test.directoryPaths) > 0 { for i, filePath := range test.directoryPaths { err := copyFile(filePath, filepath.Join(provider.Directory, strconv.Itoa(i)+filepath.Ext(filePath))) @@ -181,36 +175,6 @@ func getTestCases() []ProvideTestCase { expectedNumService: 6, expectedNumTLSConf: 5, }, - { - desc: "simple file and a traefik file", - filePath: "./fixtures/toml/simple_file_02.toml", - traefikFilePath: "./fixtures/toml/simple_traefik_file_01.toml", - expectedNumRouter: 4, - expectedNumService: 8, - expectedNumTLSConf: 4, - }, - { - desc: "simple file and a traefik file yaml", - filePath: "./fixtures/yaml/simple_file_02.yml", - traefikFilePath: "./fixtures/yaml/simple_traefik_file_01.yml", - expectedNumRouter: 4, - expectedNumService: 8, - expectedNumTLSConf: 4, - }, - { - desc: "simple traefik file", - traefikFilePath: "./fixtures/toml/simple_traefik_file_02.toml", - expectedNumRouter: 2, - expectedNumService: 3, - expectedNumTLSConf: 4, - }, - { - desc: "simple traefik file yaml", - traefikFilePath: "./fixtures/yaml/simple_traefik_file_02.yml", - expectedNumRouter: 2, - expectedNumService: 3, - expectedNumTLSConf: 4, - }, { desc: "template file", filePath: "./fixtures/toml/template_file.toml", @@ -221,13 +185,6 @@ func getTestCases() []ProvideTestCase { filePath: "./fixtures/yaml/template_file.yml", expectedNumRouter: 20, }, - { - desc: "simple traefik file with templating", - traefikFilePath: "./fixtures/toml/simple_traefik_file_with_templating.toml", - expectedNumRouter: 2, - expectedNumService: 3, - expectedNumTLSConf: 4, - }, { desc: "simple directory", directoryPaths: []string{ @@ -304,21 +261,6 @@ func createProvider(t *testing.T, test ProvideTestCase, watch bool) (*Provider, provider.Filename = file.Name() } - if len(test.traefikFilePath) > 0 { - var file *os.File - if watch { - var err error - file, err = ioutil.TempFile(tempDir, "temp*"+filepath.Ext(test.traefikFilePath)) - require.NoError(t, err) - } else { - var err error - file, err = createTempFile(test.traefikFilePath, tempDir) - require.NoError(t, err) - } - - provider.TraefikFile = file.Name() - } - return provider, func() { os.RemoveAll(tempDir) } diff --git a/pkg/provider/file/fixtures/toml/simple_traefik_file_01.toml b/pkg/provider/file/fixtures/toml/simple_traefik_file_01.toml deleted file mode 100644 index db2d68bfc..000000000 --- a/pkg/provider/file/fixtures/toml/simple_traefik_file_01.toml +++ /dev/null @@ -1,2 +0,0 @@ -[log] - level = "DEBUG" diff --git a/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml b/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml deleted file mode 100644 index 023ca4109..000000000 --- a/pkg/provider/file/fixtures/toml/simple_traefik_file_02.toml +++ /dev/null @@ -1,44 +0,0 @@ -[providers.file] - -## dynamic configuration ## - -[http.routers] - - [http.routers."router1"] - service = "application-1" - - [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-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" - -[tls] - -[[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/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" 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 deleted file mode 100644 index c99dc5610..000000000 --- a/pkg/provider/file/fixtures/toml/simple_traefik_file_with_templating.toml +++ /dev/null @@ -1,45 +0,0 @@ -temp="{{ getTag \"test\" }}" - -[providers.file] - -## dynamic configuration ## - -[http.routers] - -[http.routers."router1"] - service = "application-1" - -[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-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" - -[tls] - -[[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/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" diff --git a/pkg/provider/file/fixtures/yaml/simple_traefik_file_01.yml b/pkg/provider/file/fixtures/yaml/simple_traefik_file_01.yml deleted file mode 100644 index b0e9cab54..000000000 --- a/pkg/provider/file/fixtures/yaml/simple_traefik_file_01.yml +++ /dev/null @@ -1,2 +0,0 @@ -log: - level: DEBUG diff --git a/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml b/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml deleted file mode 100644 index 1d9979eb9..000000000 --- a/pkg/provider/file/fixtures/yaml/simple_traefik_file_02.yml +++ /dev/null @@ -1,32 +0,0 @@ -providers: - file: {} -http: - routers: - router1: - service: application-1 - router2: - service: application-2 - services: - application-1: - loadBalancer: - servers: - - url: 'http://172.17.0.1:80' - application-2: - loadBalancer: - servers: - - url: 'http://172.17.0.2:80' - 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 - - 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 From 1bccbf061ba23452124cb24d181b86cd90cbd3c0 Mon Sep 17 00:00:00 2001 From: Antoine Caron Date: Mon, 15 Jul 2019 10:58:03 +0200 Subject: [PATCH 19/49] refactor(webui): use @vue/cli to bootstrap new ui --- Makefile | 2 +- webui/.browserslistrc | 2 + webui/.editorconfig | 13 - webui/.eslintrc.js | 14 + webui/.gitignore | 63 +- webui/.prettierrc | 3 - webui/Dockerfile | 1 - webui/angular.json | 138 - webui/babel.config.js | 3 + webui/jest.config.js | 22 + webui/karma.conf.js | 31 - webui/package.json | 82 +- webui/postcss.config.js | 5 + webui/protractor.conf.js | 28 - webui/proxy.conf.json | 10 - webui/public/index.html | 17 + .../assets/images => public}/traefik.icon.png | Bin webui/readme.md | 4 +- webui/src/App.vue | 16 + webui/src/app.sass | 37 - webui/src/app/app.component.ts | 36 - webui/src/app/app.module.ts | 13 - webui/src/environments/environment.prod.ts | 3 - webui/src/environments/environment.ts | 8 - webui/src/favicon.ico | Bin 5430 -> 0 bytes webui/src/index.html | 17 - webui/src/main.js | 12 + webui/src/main.ts | 13 - webui/src/polyfills.ts | 29 - webui/src/router.js | 15 + webui/src/store.js | 10 + webui/src/styles/charts.sass | 48 - webui/src/styles/content.sass | 107 - webui/src/styles/helper.sass | 2 - webui/src/styles/message.sass | 65 - webui/src/styles/nav.sass | 12 - webui/src/styles/variables.sass | 1 - webui/src/test.ts | 20 - webui/src/tsconfig.app.json | 13 - webui/src/tsconfig.spec.json | 20 - webui/src/typings.d.ts | 5 - webui/src/views/WIP.vue | 39 + webui/tests/unit/.eslintrc.js | 5 + webui/tsconfig.json | 22 - webui/tslint.json | 145 - webui/vue.config.js | 3 + webui/yarn.lock | 8988 +++++++++++------ 47 files changed, 5851 insertions(+), 4291 deletions(-) create mode 100644 webui/.browserslistrc delete mode 100644 webui/.editorconfig create mode 100644 webui/.eslintrc.js delete mode 100644 webui/.prettierrc delete mode 100644 webui/angular.json create mode 100644 webui/babel.config.js create mode 100644 webui/jest.config.js delete mode 100644 webui/karma.conf.js create mode 100644 webui/postcss.config.js delete mode 100644 webui/protractor.conf.js delete mode 100644 webui/proxy.conf.json create mode 100644 webui/public/index.html rename webui/{src/assets/images => public}/traefik.icon.png (100%) create mode 100644 webui/src/App.vue delete mode 100644 webui/src/app.sass delete mode 100644 webui/src/app/app.component.ts delete mode 100644 webui/src/app/app.module.ts delete mode 100644 webui/src/environments/environment.prod.ts delete mode 100644 webui/src/environments/environment.ts delete mode 100644 webui/src/favicon.ico delete mode 100644 webui/src/index.html create mode 100644 webui/src/main.js delete mode 100644 webui/src/main.ts delete mode 100644 webui/src/polyfills.ts create mode 100644 webui/src/router.js create mode 100644 webui/src/store.js delete mode 100644 webui/src/styles/charts.sass delete mode 100644 webui/src/styles/content.sass delete mode 100644 webui/src/styles/helper.sass delete mode 100644 webui/src/styles/message.sass delete mode 100644 webui/src/styles/nav.sass delete mode 100644 webui/src/styles/variables.sass delete mode 100644 webui/src/test.ts delete mode 100644 webui/src/tsconfig.app.json delete mode 100644 webui/src/tsconfig.spec.json delete mode 100644 webui/src/typings.d.ts create mode 100644 webui/src/views/WIP.vue create mode 100644 webui/tests/unit/.eslintrc.js delete mode 100644 webui/tsconfig.json delete mode 100644 webui/tslint.json create mode 100644 webui/vue.config.js diff --git a/Makefile b/Makefile index 83bed6228..08d1abeb4 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ build-webui-image: generate-webui: build-webui-image if [ ! -d "static" ]; then \ mkdir -p static; \ - docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build; \ + docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build:nc; \ docker run --rm -v "$$PWD/static":'/src/static' traefik-webui chown -R $(shell id -u):$(shell id -g) ../static; \ echo 'For more informations show `webui/readme.md`' > $$PWD/static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md; \ fi diff --git a/webui/.browserslistrc b/webui/.browserslistrc new file mode 100644 index 000000000..d6471a38c --- /dev/null +++ b/webui/.browserslistrc @@ -0,0 +1,2 @@ +> 1% +last 2 versions diff --git a/webui/.editorconfig b/webui/.editorconfig deleted file mode 100644 index 6e87a003d..000000000 --- a/webui/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# Editor configuration, see http://editorconfig.org -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -max_line_length = off -trim_trailing_whitespace = false diff --git a/webui/.eslintrc.js b/webui/.eslintrc.js new file mode 100644 index 000000000..3f3df4f72 --- /dev/null +++ b/webui/.eslintrc.js @@ -0,0 +1,14 @@ +module.exports = { + root: true, + env: { + node: true + }, + extends: ["plugin:vue/essential", "@vue/prettier"], + rules: { + "no-console": process.env.NODE_ENV === "production" ? "error" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off" + }, + parserOptions: { + parser: "babel-eslint" + } +}; diff --git a/webui/.gitignore b/webui/.gitignore index eabf65e51..a0dddc6fb 100644 --- a/webui/.gitignore +++ b/webui/.gitignore @@ -1,44 +1,21 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist -/dist-server -/tmp -/out-tsc - -# dependencies -/node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -yarn-error.log -testem.log -/typings - -# e2e -/e2e/*.js -/e2e/*.map - -# System Files .DS_Store -Thumbs.db +node_modules +/dist + +# local env files +.env.local +.env.*.local + +# Log files +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Editor directories and files +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/webui/.prettierrc b/webui/.prettierrc deleted file mode 100644 index 544138be4..000000000 --- a/webui/.prettierrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "singleQuote": true -} diff --git a/webui/Dockerfile b/webui/Dockerfile index 668318634..0a1cf28d4 100644 --- a/webui/Dockerfile +++ b/webui/Dockerfile @@ -14,4 +14,3 @@ COPY . $WEBUI_DIR/ EXPOSE 8080 RUN yarn lint -RUN yarn format --check diff --git a/webui/angular.json b/webui/angular.json deleted file mode 100644 index 4e362e33a..000000000 --- a/webui/angular.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "webui": { - "root": "", - "sourceRoot": "src", - "projectType": "application", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist", - "index": "src/index.html", - "main": "src/main.ts", - "tsConfig": "src/tsconfig.app.json", - "polyfills": "src/polyfills.ts", - "assets": [ - "src/assets/images", - "src/favicon.ico" - ], - "styles": [ - "src/app.sass" - ], - "scripts": [ - "node_modules/@fortawesome/fontawesome/index.js", - "node_modules/@fortawesome/fontawesome-free-solid/index.js" - ] - }, - "configurations": { - "production": { - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "extractCss": true, - "namedChunks": false, - "aot": true, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" - } - ] - } - } - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "webui:build" - }, - "configurations": { - "production": { - "browserTarget": "webui:build:production" - } - } - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "webui:build" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "src/test.ts", - "karmaConfig": "./karma.conf.js", - "polyfills": "src/polyfills.ts", - "tsConfig": "src/tsconfig.spec.json", - "scripts": [ - "node_modules/@fortawesome/fontawesome/index.js", - "node_modules/@fortawesome/fontawesome-free-solid/index.js" - ], - "styles": [ - "src/app.sass" - ], - "assets": [ - "src/assets/images", - "src/favicon.ico" - ] - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "src/tsconfig.app.json", - "src/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - } - } - }, - "webui-e2e": { - "root": "e2e", - "sourceRoot": "e2e", - "projectType": "application", - "architect": { - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "./protractor.conf.js", - "devServerTarget": "webui:serve" - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "src/tsconfig.spec.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - } - } - } - }, - "defaultProject": "webui", - "schematics": { - "@schematics/angular:component": { - "prefix": "app", - "styleext": "sass" - }, - "@schematics/angular:directive": { - "prefix": "app" - } - } -} diff --git a/webui/babel.config.js b/webui/babel.config.js new file mode 100644 index 000000000..3ecebf1a5 --- /dev/null +++ b/webui/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ["@vue/app"] +}; diff --git a/webui/jest.config.js b/webui/jest.config.js new file mode 100644 index 000000000..e78764482 --- /dev/null +++ b/webui/jest.config.js @@ -0,0 +1,22 @@ +module.exports = { + moduleFileExtensions: ["js", "jsx", "json", "vue"], + transform: { + "^.+\\.vue$": "vue-jest", + ".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$": + "jest-transform-stub", + "^.+\\.jsx?$": "babel-jest" + }, + transformIgnorePatterns: ["/node_modules/"], + moduleNameMapper: { + "^@/(.*)$": "/src/$1" + }, + snapshotSerializers: ["jest-serializer-vue"], + testMatch: [ + "**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)" + ], + testURL: "http://localhost/", + watchPlugins: [ + "jest-watch-typeahead/filename", + "jest-watch-typeahead/testname" + ] +}; diff --git a/webui/karma.conf.js b/webui/karma.conf.js deleted file mode 100644 index 0840f6ca5..000000000 --- a/webui/karma.conf.js +++ /dev/null @@ -1,31 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client:{ - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], - fixWebpackSourcePaths: true - }, - - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false - }); -}; diff --git a/webui/package.json b/webui/package.json index da6abcfaa..eaf4b2ac4 100644 --- a/webui/package.json +++ b/webui/package.json @@ -1,64 +1,34 @@ { - "name": "traefik", - "version": "3.0.0", - "authors": [ - "Fernandez Ludovic ", - "Micaël Mbagira ", - "Jan Kuri " - ], - "license": "MIT", + "name": "webui-v2", + "version": "0.1.0", + "private": true, "scripts": { - "ng": "ng", - "start": "ng serve --proxy-config proxy.conf.json", - "build": "ng build --prod --no-delete-output-path --output-path ../static/", - "test": "ng test", - "lint": "ng lint", - "format": "yarn prettier 'src/**/*.{js,ts,html}' '*.md'", - "e2e": "ng e2e" + "serve": "vue-cli-service serve", + "build": "vue-cli-service build --dest ../static", + "build:nc": "vue-cli-service build --no-clean --dest ../static", + "lint": "vue-cli-service lint", + "test:unit": "vue-cli-service test:unit" }, "dependencies": { - "@angular/animations": "^7.2.3", - "@angular/common": "^7.2.3", - "@angular/compiler": "^7.2.3", - "@angular/core": "^7.2.3", - "@angular/forms": "^7.2.3", - "@angular/http": "^7.2.3", - "@angular/platform-browser": "^7.2.3", - "@angular/platform-browser-dynamic": "^7.2.3", - "@angular/router": "^7.2.3", - "@fortawesome/fontawesome": "^1.1.5", - "@fortawesome/fontawesome-free-solid": "^5.0.10", - "bulma": "^0.7.0", - "core-js": "^2.4.1", - "d3": "^5.8.0", - "d3-format": "^1.3.0", - "date-fns": "^1.29.0", - "lodash": "^4.17.5", - "rxjs": "^6.4.0", - "tslib": "^1.9.0", - "zone.js": "^0.8.19" + "core-js": "^2.6.5", + "vue": "^2.6.10", + "vue-router": "^3.0.3", + "vuex": "^3.0.1" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.13.0", - "@angular/cli": "~7.3.0", - "@angular/compiler-cli": "^7.2.3", - "@angular/language-service": "^7.2.3", - "@types/jasmine": "~3.3.8", - "@types/jasminewd2": "~2.0.2", - "@types/node": "~10.12.20", - "codelyzer": "^4.0.1", - "jasmine-core": "~3.3.0", - "jasmine-spec-reporter": "~4.2.1", - "karma": "~4.0.0", - "karma-chrome-launcher": "~2.2.0", - "karma-coverage-istanbul-reporter": "^2.0.4", - "karma-jasmine": "~2.0.1", - "karma-jasmine-html-reporter": "^1.4.0", - "prettier": "^1.16.4", - "protractor": "~5.4.2", - "ts-node": "~8.0.2", - "tslint": "~5.12.1", - "tslint-config-prettier": "^1.18.0", - "typescript": "~3.2.4" + "@vue/cli-plugin-babel": "^3.9.0", + "@vue/cli-plugin-eslint": "^3.9.0", + "@vue/cli-plugin-unit-jest": "^3.9.0", + "@vue/cli-service": "^3.9.0", + "@vue/eslint-config-prettier": "^4.0.1", + "@vue/test-utils": "1.0.0-beta.29", + "babel-core": "7.0.0-bridge.0", + "babel-eslint": "^10.0.1", + "babel-jest": "^23.6.0", + "eslint": "^5.16.0", + "eslint-plugin-vue": "^5.0.0", + "node-sass": "^4.9.0", + "sass-loader": "^7.1.0", + "vue-template-compiler": "^2.6.10" } } diff --git a/webui/postcss.config.js b/webui/postcss.config.js new file mode 100644 index 000000000..5bfb8f628 --- /dev/null +++ b/webui/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: { + autoprefixer: {} + } +}; diff --git a/webui/protractor.conf.js b/webui/protractor.conf.js deleted file mode 100644 index 7ee3b5ee8..000000000 --- a/webui/protractor.conf.js +++ /dev/null @@ -1,28 +0,0 @@ -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const { SpecReporter } = require('jasmine-spec-reporter'); - -exports.config = { - allScriptsTimeout: 11000, - specs: [ - './e2e/**/*.e2e-spec.ts' - ], - capabilities: { - 'browserName': 'chrome' - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function() {} - }, - onPrepare() { - require('ts-node').register({ - project: 'e2e/tsconfig.e2e.json' - }); - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - } -}; diff --git a/webui/proxy.conf.json b/webui/proxy.conf.json deleted file mode 100644 index 5d61d307e..000000000 --- a/webui/proxy.conf.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "/api": { - "target": "http://localhost:8080", - "secure": false - }, - "/health": { - "target": "http://localhost:8080", - "secure": false - } -} diff --git a/webui/public/index.html b/webui/public/index.html new file mode 100644 index 000000000..be21bb6fb --- /dev/null +++ b/webui/public/index.html @@ -0,0 +1,17 @@ + + + + + Traefik + + + + + + +
+ + + diff --git a/webui/src/assets/images/traefik.icon.png b/webui/public/traefik.icon.png similarity index 100% rename from webui/src/assets/images/traefik.icon.png rename to webui/public/traefik.icon.png diff --git a/webui/readme.md b/webui/readme.md index aafd5f55c..606711f32 100644 --- a/webui/readme.md +++ b/webui/readme.md @@ -54,14 +54,14 @@ make generate-webui # Generate static contents in `traefik/static/` folder. - Go to the directory `webui` - Edit files in `webui/src` - Run in development mode : - - `yarn start` + - `yarn serve` ## Libraries - [Node](https://nodejs.org) - [Yarn](https://yarnpkg.com/) - [Webpack](https://github.com/webpack/webpack) -- [Angular](https://angular.io) +- [Vue](https://vuejs.org/) - [Bulma](https://bulma.io) - [D3](https://d3js.org) - [D3 - Documentation](https://github.com/mbostock/d3/wiki) diff --git a/webui/src/App.vue b/webui/src/App.vue new file mode 100644 index 000000000..5e51fbb7d --- /dev/null +++ b/webui/src/App.vue @@ -0,0 +1,16 @@ + + + diff --git a/webui/src/app.sass b/webui/src/app.sass deleted file mode 100644 index 7d97267d6..000000000 --- a/webui/src/app.sass +++ /dev/null @@ -1,37 +0,0 @@ -@charset "utf-8" - -@import 'styles/typography' -@import 'styles/variables' -@import 'styles/colors' -@import '~bulma/sass/utilities/all' -@import '~bulma/sass/base/all' -@import '~bulma/sass/grid/all' -@import '~bulma/sass/elements/container' -@import '~bulma/sass/elements/tag' -@import '~bulma/sass/elements/other' -@import '~bulma/sass/elements/box' -@import '~bulma/sass/elements/form' -@import '~bulma/sass/elements/table' -@import '~bulma/sass/components/navbar' -@import '~bulma/sass/components/tabs' -@import '~bulma/sass/elements/notification' -@import 'styles/nav' -@import 'styles/content' -@import 'styles/message' -@import 'styles/charts' -@import 'styles/helper' - -html - font-family: $open-sans - height: 100% - background: $background - -.wip - display: flex - flex-direction: column - align-items: center - justify-content: center - height: 80vh - - .title - font-size: 4em diff --git a/webui/src/app/app.component.ts b/webui/src/app/app.component.ts deleted file mode 100644 index abed5b68c..000000000 --- a/webui/src/app/app.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { DOCUMENT } from '@angular/common'; - -@Component({ - selector: 'app-root', - template: ` -
- logo -
-

- - Work in progress... -

-

- In the meantime, you can review your current configuration by using - the - {{ href }}/api/rawdata endpoint -

- Also, please keep your on our - documentation - to stay informed -

-

-
-
- ` -}) -export class AppComponent { - public href: string; - - constructor(@Inject(DOCUMENT) private document: Document) { - this.href = this.document.location.origin; - } -} diff --git a/webui/src/app/app.module.ts b/webui/src/app/app.module.ts deleted file mode 100644 index 4bc979bfd..000000000 --- a/webui/src/app/app.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { HttpClientModule } from '@angular/common/http'; -import { NgModule } from '@angular/core'; -import { FormsModule } from '@angular/forms'; -import { BrowserModule } from '@angular/platform-browser'; -import { AppComponent } from './app.component'; - -@NgModule({ - declarations: [AppComponent], - imports: [BrowserModule, CommonModule, HttpClientModule, FormsModule], - bootstrap: [AppComponent] -}) -export class AppModule {} diff --git a/webui/src/environments/environment.prod.ts b/webui/src/environments/environment.prod.ts deleted file mode 100644 index 3612073bc..000000000 --- a/webui/src/environments/environment.prod.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const environment = { - production: true -}; diff --git a/webui/src/environments/environment.ts b/webui/src/environments/environment.ts deleted file mode 100644 index b7f639aec..000000000 --- a/webui/src/environments/environment.ts +++ /dev/null @@ -1,8 +0,0 @@ -// The file contents for the current environment will overwrite these during build. -// The build system defaults to the dev environment which uses `environment.ts`, but if you do -// `ng build --env=prod` then `environment.prod.ts` will be used instead. -// The list of which env maps to which file can be found in `.angular-cli.json`. - -export const environment = { - production: false -}; diff --git a/webui/src/favicon.ico b/webui/src/favicon.ico deleted file mode 100644 index 8081c7ceaf2be08bf59010158c586170d9d2d517..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc- - - - - Traefik - - - - - - - - diff --git a/webui/src/main.js b/webui/src/main.js new file mode 100644 index 000000000..3a47006f0 --- /dev/null +++ b/webui/src/main.js @@ -0,0 +1,12 @@ +import Vue from "vue"; +import App from "./App.vue"; +import router from "./router"; +import store from "./store"; + +Vue.config.productionTip = false; + +new Vue({ + router, + store, + render: h => h(App) +}).$mount("#app"); diff --git a/webui/src/main.ts b/webui/src/main.ts deleted file mode 100644 index 5aa3bf02e..000000000 --- a/webui/src/main.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { enableProdMode } from '@angular/core'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - -import { AppModule } from './app/app.module'; -import { environment } from './environments/environment'; - -if (environment.production) { - enableProdMode(); -} - -platformBrowserDynamic() - .bootstrapModule(AppModule) - .catch(err => console.log(err)); diff --git a/webui/src/polyfills.ts b/webui/src/polyfills.ts deleted file mode 100644 index 56d897e3c..000000000 --- a/webui/src/polyfills.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Required to support Web Animations `@angular/platform-browser/animations`. - * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation - **/ -// import 'web-animations-js'; // Run `npm install --save web-animations-js`. - -/** - * By default, zone.js will patch all possible macroTask and DomEvents - * user can disable parts of macroTask/DomEvents patch by setting following flags - */ - -// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame -// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick -// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames - -/* - * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js - * with the following flag, it will bypass `zone.js` patch for IE/Edge - */ -// (window as any).__Zone_enable_cross_context_check = true; - -/*************************************************************************************************** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. - -/*************************************************************************************************** - * APPLICATION IMPORTS - */ diff --git a/webui/src/router.js b/webui/src/router.js new file mode 100644 index 000000000..b6c6f53a0 --- /dev/null +++ b/webui/src/router.js @@ -0,0 +1,15 @@ +import Vue from "vue"; +import Router from "vue-router"; +import WIP from "./views/WIP.vue"; + +Vue.use(Router); + +export default new Router({ + routes: [ + { + path: "/", + name: "home", + component: WIP + } + ] +}); diff --git a/webui/src/store.js b/webui/src/store.js new file mode 100644 index 000000000..bb02ce2d2 --- /dev/null +++ b/webui/src/store.js @@ -0,0 +1,10 @@ +import Vue from "vue"; +import Vuex from "vuex"; + +Vue.use(Vuex); + +export default new Vuex.Store({ + state: {}, + mutations: {}, + actions: {} +}); diff --git a/webui/src/styles/charts.sass b/webui/src/styles/charts.sass deleted file mode 100644 index 4f201f286..000000000 --- a/webui/src/styles/charts.sass +++ /dev/null @@ -1,48 +0,0 @@ -.line-chart - width: 100% - height: 320px - background-color: $white - - svg - font: 10px sans-serif - - .line - fill: none - stroke: $blue - stroke-width: 3px - shape-rendering: geometricPrecision - - .axis line, .axis path - stroke: $text - opacity: .2 - shape-rendering: crispEdges - fill: none - - .axis path - display: none - - .axis text - fill: $text - - -.bar-chart - width: 100% - height: 320px - background-color: $white - - .axis text - fill: $text - font: 10px sans-serif - - .axis line, .axis path - fill: none - opacity: .2 - stroke: $text - - .axis--x - - text - font: 12px sans-serif - - path - display: none diff --git a/webui/src/styles/content.sass b/webui/src/styles/content.sass deleted file mode 100644 index 29b8768c9..000000000 --- a/webui/src/styles/content.sass +++ /dev/null @@ -1,107 +0,0 @@ -.content - background: transparent - margin: 2rem 0 - - .subtitle - color: $black - font-size: 0.9rem - font-weight: $weight-bold - text-transform: uppercase - - .subtitle-name - padding-left: 0.5rem - -.content-item - background: $white - border: 1px solid $border-secondary - margin: 10px 0 - border-radius: $traefik-border-radius - box-shadow: 1px 2px 5px rgba($border, 0.4) - - h2 - color: $text-dark - font-size: 14px - padding: 20px 20px 0 20px - font-weight: $weight-semibold - - .content-item-data - padding: 10px 20px - - .item-data - display: flex - align-items: center - justify-content: space-between - padding: 5px 10px - - &.border-right - border-right: 1px solid #DFE3E9 - - .data-blue - color: $blue - font-size: 22px - font-weight: $weight-semibold - - .data-grey - color: $grey - font-size: 12px - font-weight: $weight-light - - .widget-item - min-height: 80px - padding: 20px - - h1 - color: $text-dark - font-size: 18px - font-weight: $weight-light - - img - width: 40px - height: 40px - display: block - float: left - margin-right: 10px - - span - font-size: 13px - display: block - - &.mtop12 - margin-top: 12px - -.loading-text - height: 320px - display: flex - align-items: center - justify-content: center - - .main-loader - width: 70px - display: block - margin: 15px auto - -.search-container - background: $white - color: $black - display: flex - align-items: center - border-radius: $traefik-border-radius - box-shadow: 1px 2px 5px rgba($border, 0.4) - border: 1px solid $border-secondary - position: relative - height: 3rem - - .search-button - position: absolute - left: 1rem - top: 0.8rem - - input - color: $text - border: none - border-radius: $traefik-border-radius - outline: none - font-size: 1rem - font-weight: $weight-light - width: 100% - padding-left: 2.8rem diff --git a/webui/src/styles/helper.sass b/webui/src/styles/helper.sass deleted file mode 100644 index eebc1b9dd..000000000 --- a/webui/src/styles/helper.sass +++ /dev/null @@ -1,2 +0,0 @@ -.padding-5-10 - padding: 5px 10px diff --git a/webui/src/styles/message.sass b/webui/src/styles/message.sass deleted file mode 100644 index f838ab4a4..000000000 --- a/webui/src/styles/message.sass +++ /dev/null @@ -1,65 +0,0 @@ -.message - display: block - font-size: 0.8rem - margin: 1rem 0 1.5rem 0 - padding-bottom: 0.3rem - border: 1px solid $border - background: $white - border-radius: $traefik-border-radius - box-shadow: 1px 2px 5px rgba($border, 0.4) - - .message-header - color: $color-secondary - border-bottom: 1px solid $border-secondary - padding: 0.6rem - border-top-left-radius: $traefik-border-radius - border-top-right-radius: $traefik-border-radius - - .icon - display: block - float: left - width: 1.4rem - height: 1.4rem - margin-right: 0.5rem - - h2 - display: flex - - img - margin-right: 15px - - .message-body - - .tabs - margin-bottom: 0.5rem - - .section-container - padding: 0.3em 0 0 0 - - .section-line - padding: 0 0.75em - - .section-line-header - padding: 0.2em 0 0 0 - - // required for small screen (without -> table overlapping) - .table-fixed - table-layout: fixed - - // required for small screen (without -> table overlapping) - .table-fixed-break - table-layout: fixed - word-wrap: break-word - - .table-cell-limited - overflow: hidden - text-overflow: ellipsis - - .table-col-75 - width: 75% - - h2 - color: $black - - hr - margin: 5px 0 diff --git a/webui/src/styles/nav.sass b/webui/src/styles/nav.sass deleted file mode 100644 index 28d5c1106..000000000 --- a/webui/src/styles/nav.sass +++ /dev/null @@ -1,12 +0,0 @@ -.navbar - border-bottom: 1px solid $border - box-shadow: 1px 2px 5px rgba($border, 0.4) - - .navbar-item - font-size: 0.8rem - text-transform: uppercase - font-weight: $weight-semibold - - .navbar-logo - width: 40px - min-height: 40px diff --git a/webui/src/styles/variables.sass b/webui/src/styles/variables.sass deleted file mode 100644 index 7241a6636..000000000 --- a/webui/src/styles/variables.sass +++ /dev/null @@ -1 +0,0 @@ -$traefik-border-radius: 4px diff --git a/webui/src/test.ts b/webui/src/test.ts deleted file mode 100644 index 42e98be81..000000000 --- a/webui/src/test.ts +++ /dev/null @@ -1,20 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; -import 'zone.js/dist/zone-testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/webui/src/tsconfig.app.json b/webui/src/tsconfig.app.json deleted file mode 100644 index 39ba8dbac..000000000 --- a/webui/src/tsconfig.app.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/app", - "baseUrl": "./", - "module": "es2015", - "types": [] - }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ] -} diff --git a/webui/src/tsconfig.spec.json b/webui/src/tsconfig.spec.json deleted file mode 100644 index 1a18e6d00..000000000 --- a/webui/src/tsconfig.spec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/spec", - "baseUrl": "./", - "module": "commonjs", - "types": [ - "jasmine", - "node" - ] - }, - "files": [ - "test.ts", - "polyfills.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] -} diff --git a/webui/src/typings.d.ts b/webui/src/typings.d.ts deleted file mode 100644 index ef5c7bd62..000000000 --- a/webui/src/typings.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* SystemJS module definition */ -declare var module: NodeModule; -interface NodeModule { - id: string; -} diff --git a/webui/src/views/WIP.vue b/webui/src/views/WIP.vue new file mode 100644 index 000000000..763a267d8 --- /dev/null +++ b/webui/src/views/WIP.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/webui/tests/unit/.eslintrc.js b/webui/tests/unit/.eslintrc.js new file mode 100644 index 000000000..360045186 --- /dev/null +++ b/webui/tests/unit/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + jest: true + } +}; diff --git a/webui/tsconfig.json b/webui/tsconfig.json deleted file mode 100644 index 8cd9a30b0..000000000 --- a/webui/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "importHelpers": true, - "outDir": "./dist/out-tsc", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2017", - "dom" - ], - "module": "es2015", - "baseUrl": "./" - } -} \ No newline at end of file diff --git a/webui/tslint.json b/webui/tslint.json deleted file mode 100644 index 1ae862f2a..000000000 --- a/webui/tslint.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "rulesDirectory": [ - "node_modules/codelyzer" - ], - "rules": { - "arrow-return-shorthand": true, - "callable-types": true, - "class-name": true, - "comment-format": [ - true, - "check-space" - ], - "curly": true, - "deprecation": { - "severity": "warn" - }, - "eofline": true, - "forin": true, - "import-blacklist": [ - true, - "rxjs/Rx" - ], - "import-spacing": true, - "indent": [ - true, - "spaces" - ], - "interface-over-type-literal": true, - "label-position": true, - "max-line-length": [ - true, - 140 - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-empty": false, - "no-empty-interface": true, - "no-eval": true, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-misused-new": true, - "no-non-null-assertion": true, - "no-shadowed-variable": true, - "no-string-literal": false, - "no-string-throw": true, - "no-switch-case-fall-through": true, - "no-trailing-whitespace": true, - "no-unnecessary-initializer": true, - "no-unused-expression": true, - "no-use-before-declare": true, - "no-var-keyword": true, - "object-literal-sort-keys": false, - "one-line": [ - true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "prefer-const": true, - "quotemark": [ - true, - "single" - ], - "radix": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": [ - true, - "allow-null-check" - ], - "typedef-whitespace": [ - true, - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - } - ], - "unified-signatures": true, - "variable-name": false, - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ], - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "no-output-on-prefix": true, - "use-input-property-decorator": true, - "use-output-property-decorator": true, - "use-host-property-decorator": true, - "no-input-rename": true, - "no-output-rename": true, - "use-life-cycle-interface": true, - "use-pipe-transform-interface": true, - "component-class-suffix": true, - "directive-class-suffix": true - }, - "extends": [ - "tslint-config-prettier" - ] -} diff --git a/webui/vue.config.js b/webui/vue.config.js new file mode 100644 index 000000000..91f4b42e9 --- /dev/null +++ b/webui/vue.config.js @@ -0,0 +1,3 @@ +module.exports = { + publicPath: "/dashboard" +}; diff --git a/webui/yarn.lock b/webui/yarn.lock index e568d6c91..3c2daf252 100644 --- a/webui/yarn.lock +++ b/webui/yarn.lock @@ -2,227 +2,97 @@ # yarn lockfile v1 -"@angular-devkit/architect@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/architect/-/architect-0.13.0.tgz#47a9c76ca4c01c357a8670810f29a45e906447cd" - integrity sha512-oDBrWlfKh/0t2ag4T8gz9xzPMItxfctinlsHxhw7dPQ+etq1mIcWgQkiKiDrz4l46YiGipBRlC55j+6f37omAA== - dependencies: - "@angular-devkit/core" "7.3.0" - rxjs "6.3.3" - -"@angular-devkit/build-angular@~0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-0.13.0.tgz#b41cd80772b7d0dc71081353a799fdd534bfc885" - integrity sha512-JjoSXbmwOsuDJxngyChr6aOSZ2qsrvSL1MHwqgXhZswmC/KghBF0aZ7y8Wzr27zDCQ174Axts7+IAk6b+aWIqw== - dependencies: - "@angular-devkit/architect" "0.13.0" - "@angular-devkit/build-optimizer" "0.13.0" - "@angular-devkit/build-webpack" "0.13.0" - "@angular-devkit/core" "7.3.0" - "@ngtools/webpack" "7.3.0" - ajv "6.7.0" - autoprefixer "9.4.6" - circular-dependency-plugin "5.0.2" - clean-css "4.2.1" - copy-webpack-plugin "4.6.0" - file-loader "3.0.1" - glob "7.1.3" - istanbul "0.4.5" - istanbul-instrumenter-loader "3.0.1" - karma-source-map-support "1.3.0" - less "3.9.0" - less-loader "4.1.0" - license-webpack-plugin "2.1.0" - loader-utils "1.2.3" - mini-css-extract-plugin "0.5.0" - minimatch "3.0.4" - opn "5.4.0" - parse5 "4.0.0" - postcss "7.0.14" - postcss-import "12.0.1" - postcss-loader "3.0.0" - raw-loader "1.0.0" - rxjs "6.3.3" - sass-loader "7.1.0" - semver "5.6.0" - source-map-loader "0.2.4" - source-map-support "0.5.10" - speed-measure-webpack-plugin "1.3.0" - stats-webpack-plugin "0.7.0" - style-loader "0.23.1" - stylus "0.54.5" - stylus-loader "3.0.2" - terser-webpack-plugin "1.2.1" - tree-kill "1.2.1" - webpack "4.29.0" - webpack-dev-middleware "3.5.1" - webpack-dev-server "3.1.14" - webpack-merge "4.2.1" - webpack-sources "1.3.0" - webpack-subresource-integrity "1.1.0-rc.6" - optionalDependencies: - node-sass "4.11.0" - -"@angular-devkit/build-optimizer@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-optimizer/-/build-optimizer-0.13.0.tgz#e60a43076aee910f006393e3718d558d5c6b217d" - integrity sha512-fhWuzbMVV/UNYE7rHSKutrWTCZle34N5cdtFz6qhK1k/wn7Vmtg9cFOwzx0SPdIlOEn576NB4DS/4UG3B5WCUQ== - dependencies: - loader-utils "1.2.3" - source-map "0.5.6" - typescript "3.2.4" - webpack-sources "1.3.0" - -"@angular-devkit/build-webpack@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/build-webpack/-/build-webpack-0.13.0.tgz#ed480dc867aac8a341d38e19f3558394f180fe40" - integrity sha512-idtFoSbQ3Y3WqXlDlU7oTPV9TIU1kjLqce0nK1Kst+t40GTc+Q4iUJJ7KsKE3nV6TPyrL1N/IvIF7+hSJnYm8A== - dependencies: - "@angular-devkit/architect" "0.13.0" - "@angular-devkit/core" "7.3.0" - rxjs "6.3.3" - -"@angular-devkit/core@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-7.3.0.tgz#fc272e39b4c307833e9a7db77007418a246f5410" - integrity sha512-b0qtAUpgqLpWY8W6vWRv1aj6bXkZCP1rvywl8i8TbGMY67CWRcy5J3fNAMmjiZS+LJixFlIXYf4iOydglyJMfg== - dependencies: - ajv "6.7.0" - chokidar "2.0.4" - fast-json-stable-stringify "2.0.0" - rxjs "6.3.3" - source-map "0.7.3" - -"@angular-devkit/schematics@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-7.3.0.tgz#112c1f59ff2778157aff6fb7484a6c132d4156ac" - integrity sha512-glOduymftH0LmJhITWgWUJK8QCDUltgTZ943/OyArIvLXTLL/8zCb+G6xL+3k33EQjwJicgQ3WIjonJmeTK/Ww== - dependencies: - "@angular-devkit/core" "7.3.0" - rxjs "6.3.3" - -"@angular/animations@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-7.2.3.tgz#4999bdc32962191d0d826a09d9f0f0bae7b37a62" - integrity sha512-5WoiDnVS2OhGgJ1oepFNF2UcfR4sJj97KRnTmLWQ0S4N4WpXX83CoOQVXvXwfotyb8uNtl4zRi2NuvN/MIuFuA== - dependencies: - tslib "^1.9.0" - -"@angular/cli@~7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-7.3.0.tgz#8f9301aa7a942385258b35bf86806267073fce17" - integrity sha512-6+NoHsW1MYG7GBHUg71zaWIFeIRps/SVksCmRFCpW0RXqErCQmzf0GZuDTZZ2Yo4RzU01150sVp1R8wEvEZfZQ== - dependencies: - "@angular-devkit/architect" "0.13.0" - "@angular-devkit/core" "7.3.0" - "@angular-devkit/schematics" "7.3.0" - "@schematics/angular" "7.3.0" - "@schematics/update" "0.13.0" - "@yarnpkg/lockfile" "1.1.0" - ini "1.3.5" - inquirer "6.2.1" - npm-package-arg "6.1.0" - opn "5.4.0" - pacote "9.4.0" - semver "5.6.0" - symbol-observable "1.2.0" - -"@angular/common@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-7.2.3.tgz#0a500843c4c859805f36fb1364b1fe97b32e4816" - integrity sha512-VZOTZdvkitaKEhkxL6daHxPcKqAFwNJm0U4NFB4LRP9KspsFTE60QFVB63o129PTIH9iOQ2D3HRKSRl4o78ZKg== - dependencies: - tslib "^1.9.0" - -"@angular/compiler-cli@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-7.2.3.tgz#eadc7697df5210c2e48159efde64adeab06e72eb" - integrity sha512-31hcfTrU2GW66cvvaS629dNVPfiUrUWPncI28optvmKHBaH0mFqkdYNgabuslsXZV5AeidKMUJvR7GITjtvkQA== - dependencies: - canonical-path "1.0.0" - chokidar "^1.4.2" - convert-source-map "^1.5.1" - dependency-graph "^0.7.2" - magic-string "^0.25.0" - minimist "^1.2.0" - reflect-metadata "^0.1.2" - shelljs "^0.8.1" - source-map "^0.6.1" - tslib "^1.9.0" - yargs "9.0.1" - -"@angular/compiler@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-7.2.3.tgz#ffa89911750342c5e4f0359d6e9402479dd6e7bd" - integrity sha512-UM6n4MyZkR5+VVjlwhLH8IfqdWBkdFcF5at4ckJXOJ/gkIUq97irbis9pGj1b0TO7MAl8uhF4b68xe5lk8b49g== - dependencies: - tslib "^1.9.0" - -"@angular/core@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-7.2.3.tgz#fa0dd626656e8a2da9b70bde2dda569a419852a5" - integrity sha512-6Ql+sJJnrsxh8O0/IgIP1GgT4eLOHk+dlBs7zBbjstmLuhaQdY+awO9WKoQow+TiD1Go7FW1J3vZ2PTWXKxqjQ== - dependencies: - tslib "^1.9.0" - -"@angular/forms@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-7.2.3.tgz#95fc9b7b70e853758fad3b2defb4d889eb0154d5" - integrity sha512-mZpyonfSmRwSvM6efvwFwkLJkK6wHQrm7X4OhVVu3s9i7BI253eLDY7WIRXFvoxJ/5jWIIarVnd/9UA7GINZGw== - dependencies: - tslib "^1.9.0" - -"@angular/http@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/http/-/http-7.2.3.tgz#584337a92050107abf98f77df21158b0e12bd248" - integrity sha512-wzvBKbO/TcSR3U8AQbsGftH8x1OdAgVGHlfXQPmZL1KjIDHrM1VpnkSvgqIt8coG+4OPfWcNklUCrTdEGwqMqw== - dependencies: - tslib "^1.9.0" - -"@angular/language-service@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-7.2.3.tgz#841f3f66a29358f8d702fb269dff4d075b107190" - integrity sha512-9FBVYbKaNx4Ap+Suz/2ZFBPca1voinZMOCN8LjXRYnfS2MHLQASQlTlK4qeZcomyRfy0FxWmO9R02S7YJ06cnw== - -"@angular/platform-browser-dynamic@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-7.2.3.tgz#490c297058322727a02a4a4fc1d51ef24fd6ff9e" - integrity sha512-M8Kiz5FUhnFybJuk/mgOhBjVbRgKDC4bGWKWH9Z9SXBR2dS/FL3QOJsLIthQcWlHOzSoJdEoPBRhn0R4pyLBSw== - dependencies: - tslib "^1.9.0" - -"@angular/platform-browser@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-7.2.3.tgz#59363d87f36bfae05cae90927c73c68ac4707da9" - integrity sha512-DH0Y2lgEgcrP1I/DUQB/krL7Ob7yL685fu4sRapW17SndTQa2pqSFMBVf+mN3FupTXp7nJHSvlIktzedIk04+g== - dependencies: - tslib "^1.9.0" - -"@angular/router@^7.2.3": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-7.2.3.tgz#a64fbfaec8fd4ee37924f1464a153c34d603feed" - integrity sha512-SH7H2I9WTj1puei4m4g5n0/Cp28HS14q4r8lOgW0gLWuT6Ls7MqH/nDjOMiW924iRR6zjQQs7G+WbhL1jmZc2A== - dependencies: - tslib "^1.9.0" - -"@babel/code-frame@^7.0.0": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.0.0-beta.35": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA== dependencies: "@babel/highlight" "^7.0.0" -"@babel/generator@^7.0.0", "@babel/generator@^7.2.2": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.3.0.tgz#f663838cd7b542366de3aa608a657b8ccb2a99eb" - integrity sha512-dZTwMvTgWfhmibq4V9X+LMf6Bgl7zAodRn9PvcPdhlzFMbvUutx74dbEv7Atz3ToeEpevYEJtAwfxq/bDCzHWg== +"@babel/core@^7.0.0": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.4.tgz#4c32df7ad5a58e9ea27ad025c11276324e0b4ddd" + integrity sha512-+DaeBEpYq6b2+ZmHx3tHspC+ZRflrvLqwfv8E3hNr5LVQoyBnL8RPKSBCg+rK2W2My9PWlujBiqd0ZPsR9Q6zQ== dependencies: - "@babel/types" "^7.3.0" + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.5.0" + "@babel/helpers" "^7.5.4" + "@babel/parser" "^7.5.0" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.0" + "@babel/types" "^7.5.0" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.11" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.0.tgz#f20e4b7a91750ee8b63656073d843d2a736dca4a" + integrity sha512-1TTVrt7J9rcG5PMjvO7VEG3FrEoEJNHxumRq66GemPmzboLWtIjjcJgk8rokuAS7IiRSpgVSu5Vb9lc99iJkOA== + dependencies: + "@babel/types" "^7.5.0" jsesc "^2.5.1" - lodash "^4.17.10" + lodash "^4.17.11" source-map "^0.5.0" trim-right "^1.0.1" +"@babel/helper-annotate-as-pure@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" + integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" + integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== + dependencies: + "@babel/helper-explode-assignable-expression" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-call-delegate@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" + integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/helper-create-class-features-plugin@^7.4.4", "@babel/helper-create-class-features-plugin@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.0.tgz#02edb97f512d44ba23b3227f1bf2ed43454edac5" + integrity sha512-EAoMc3hE5vE5LNhMqDOwB1usHvmRjCDAnH8CD4PVkX9/Yr3W/tcz8xE8QvdZxfsFBDICwZnF2UTHIqslRpvxmA== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.4.4" + "@babel/helper-split-export-declaration" "^7.4.4" + +"@babel/helper-define-map@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.4.tgz#6969d1f570b46bdc900d1eba8e5d59c48ba2c12a" + integrity sha512-IX3Ln8gLhZpSuqHJSnTNBWGDE9kdkTEWl21A/K7PQ00tseBwbqCHTvNLHSBd9M0R5rER4h5Rsvj9vw0R5SieBg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/types" "^7.4.4" + lodash "^4.17.11" + +"@babel/helper-explode-assignable-expression@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" + integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== + dependencies: + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + "@babel/helper-function-name@^7.1.0": version "7.1.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz#a0ceb01685f73355d4360c1247f582bfafc8ff53" @@ -239,152 +109,928 @@ dependencies: "@babel/types" "^7.0.0" -"@babel/helper-split-export-declaration@^7.0.0": +"@babel/helper-hoist-variables@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" + integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-member-expression-to-functions@^7.0.0": version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" - integrity sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag== + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz#8cd14b0a0df7ff00f009e7d7a436945f47c7a16f" + integrity sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg== dependencies: "@babel/types" "^7.0.0" -"@babel/highlight@^7.0.0": +"@babel/helper-module-imports@^7.0.0": version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" - integrity sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw== + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" + integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-module-transforms@^7.1.0", "@babel/helper-module-transforms@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.4.4.tgz#96115ea42a2f139e619e98ed46df6019b94414b8" + integrity sha512-3Z1yp8TVQf+B4ynN7WoHPKS8EkdTbgAEy0nU0rs/1Kw4pDgmvYH3rz3aI11KgxKCba2cn7N+tqzV1mY2HMN96w== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/template" "^7.4.4" + "@babel/types" "^7.4.4" + lodash "^4.17.11" + +"@babel/helper-optimise-call-expression@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" + integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-plugin-utils@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" + integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== + +"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.4.4.tgz#a47e02bc91fb259d2e6727c2a30013e3ac13c4a2" + integrity sha512-Y5nuB/kESmR3tKjU8Nkn1wMGEx1tjJX076HBMeL3XLQCu6vA/YRzuTW0bbb+qRnXvQGn+d6Rx953yffl8vEy7Q== + dependencies: + lodash "^4.17.11" + +"@babel/helper-remap-async-to-generator@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.1.0.tgz#361d80821b6f38da75bd3f0785ece20a88c5fe7f" + integrity sha512-3fOK0L+Fdlg8S5al8u/hWE6vhufGSn0bN09xm2LXMy//REAF8kDCrYoOBKYmA8m5Nom+sV9LyLCwrFynA8/slg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-wrap-function" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-replace-supers@^7.1.0", "@babel/helper-replace-supers@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.4.4.tgz#aee41783ebe4f2d3ab3ae775e1cc6f1a90cefa27" + integrity sha512-04xGEnd+s01nY1l15EuMS1rfKktNF+1CkKmHoErDppjAAZL+IUBZpzT748x262HF7fibaQPhbvWUl5HeSt1EXg== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.0.0" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/traverse" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/helper-simple-access@^7.1.0": + version "7.1.0" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" + integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== + dependencies: + "@babel/template" "^7.1.0" + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677" + integrity sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q== + dependencies: + "@babel/types" "^7.4.4" + +"@babel/helper-wrap-function@^7.1.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.2.0.tgz#c4e0012445769e2815b55296ead43a958549f6fa" + integrity sha512-o9fP1BZLLSrYlxYEYyl2aS+Flun5gtjTIG8iln+XuEzQTs0PLagAGSXUcqruJwD5fM48jzIEggCKpIfWTcR7pQ== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/template" "^7.1.0" + "@babel/traverse" "^7.1.0" + "@babel/types" "^7.2.0" + +"@babel/helpers@^7.5.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.4.tgz#2f00608aa10d460bde0ccf665d6dcf8477357cf0" + integrity sha512-6LJ6xwUEJP51w0sIgKyfvFMJvIb9mWAfohJp0+m6eHJigkFdcH8duZ1sfhn0ltJRzwUIT/yqqhdSfRpCpL7oow== + dependencies: + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.0" + "@babel/types" "^7.5.0" + +"@babel/highlight@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" + integrity sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ== dependencies: chalk "^2.0.0" esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.2.2", "@babel/parser@^7.2.3": - version "7.3.1" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.1.tgz#8f4ffd45f779e6132780835ffa7a215fa0b2d181" - integrity sha512-ATz6yX/L8LEnC3dtLQnIx4ydcPxhLcoy9Vl6re00zb2w5lG6itY6Vhnr1KFRPq/FHNsgl/gh2mjNN20f9iJTTA== +"@babel/parser@^7.0.0", "@babel/parser@^7.4.4", "@babel/parser@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.0.tgz#3e0713dff89ad6ae37faec3b29dcfc5c979770b7" + integrity sha512-I5nW8AhGpOXGCCNYGc+p7ExQIBxRFnS2fd/d862bNOKvmoEPjYPcfIjsfdy0ujagYOIYPczKgD9l3FsgTkAzKA== -"@babel/template@^7.0.0", "@babel/template@^7.1.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907" - integrity sha512-zRL0IMM02AUDwghf5LMSSDEz7sBCO2YnNmpg3uWTZj/v1rcG2BmQUvaGU8GhU8BvfMh1k2KIAYZ7Ji9KXPUg7g== +"@babel/plugin-proposal-async-generator-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" + integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.2.2" - "@babel/types" "^7.2.2" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" -"@babel/traverse@^7.0.0": - version "7.2.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.2.3.tgz#7ff50cefa9c7c0bd2d81231fdac122f3957748d8" - integrity sha512-Z31oUD/fJvEWVR0lNZtfgvVt512ForCTNKYcJBGbPb1QZfve4WGH8Wsy7+Mev33/45fhP/hwQtvgusNdcCMgSw== +"@babel/plugin-proposal-class-properties@^7.0.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.0.tgz#5bc6a0537d286fcb4fd4e89975adbca334987007" + integrity sha512-9L/JfPCT+kShiiTTzcnBJ8cOwdKVmlC1RcCf9F0F9tERVrM4iWtWnXtjWCRqNm2la2BxO1MPArWNsU9zsSJWSQ== dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/generator" "^7.2.2" + "@babel/helper-create-class-features-plugin" "^7.5.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-proposal-decorators@^7.1.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.4.tgz#de9b2a1a8ab0196f378e2a82f10b6e2a36f21cc0" + integrity sha512-z7MpQz3XC/iQJWXH9y+MaWcLPNSMY9RQSthrLzak8R8hCj0fuyNk+Dzi9kfNe/JxxlWQ2g7wkABbgWjW36MTcw== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-decorators" "^7.2.0" + +"@babel/plugin-proposal-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" + integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + +"@babel/plugin-proposal-object-rest-spread@^7.3.4": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.4.tgz#250de35d867ce8260a31b1fdac6c4fc1baa99331" + integrity sha512-KCx0z3y7y8ipZUMAEEJOyNi11lMb/FOPUjjB113tfowgw0c16EGYos7worCKBcUAh2oG+OBnoUhsnTSoLpV9uA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + +"@babel/plugin-proposal-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" + integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + +"@babel/plugin-proposal-unicode-property-regex@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" + integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + +"@babel/plugin-syntax-async-generators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" + integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-decorators@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz#c50b1b957dcc69e4b1127b65e1c33eef61570c1b" + integrity sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-dynamic-import@^7.0.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" + integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-json-strings@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" + integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz#0b85a3b4bc7cdf4cc4b8bf236335b907ca22e7c7" + integrity sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-object-rest-spread@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-syntax-optional-catch-binding@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" + integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-arrow-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" + integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-async-to-generator@^7.3.4": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.5.0.tgz#89a3848a0166623b5bc481164b5936ab947e887e" + integrity sha512-mqvkzwIGkq0bEF1zLRRiTdjfomZJDV33AH3oQzHVGkI2VzEmXLpKKOBvEVaFZBJdN0XTyH38s9j/Kiqr68dggg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-remap-async-to-generator" "^7.1.0" + +"@babel/plugin-transform-block-scoped-functions@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" + integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-block-scoping@^7.3.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.4.tgz#c13279fabf6b916661531841a23c4b7dae29646d" + integrity sha512-jkTUyWZcTrwxu5DD4rWz6rDB5Cjdmgz6z7M7RLXOJyCUkFBawssDGcGh8M/0FTSB87avyJI1HsTwUXp9nKA1PA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.11" + +"@babel/plugin-transform-classes@^7.3.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.4.tgz#0ce4094cdafd709721076d3b9c38ad31ca715eb6" + integrity sha512-/e44eFLImEGIpL9qPxSRat13I5QNRgBLu2hOQJCF7VLy/otSM/sypV1+XaIw5+502RX/+6YaSAPmldk+nhHDPw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-define-map" "^7.4.4" "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.0.0" - "@babel/parser" "^7.2.3" - "@babel/types" "^7.2.2" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.4.4" + "@babel/helper-split-export-declaration" "^7.4.4" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" + integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@^7.2.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" + integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-dotall-regex@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" + integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + +"@babel/plugin-transform-duplicate-keys@^7.2.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" + integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-exponentiation-operator@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" + integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== + dependencies: + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-for-of@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" + integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-function-name@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.4.4.tgz#e1436116abb0610c2259094848754ac5230922ad" + integrity sha512-iU9pv7U+2jC9ANQkKeNF6DrPy4GBa4NWQtl6dHB4Pb3izX2JOEvDTFarlNsBj/63ZEzNNIAMs3Qw4fNCcSOXJA== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-literals@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" + integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-modules-amd@^7.2.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" + integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-commonjs@^7.2.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" + integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-systemjs@^7.3.4": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.5.0.tgz#e75266a13ef94202db2a0620977756f51d52d249" + integrity sha512-Q2m56tyoQWmuNGxEtUyeEkm6qJYFqs4c+XyXH5RAuYxObRNz9Zgj/1g2GMnjYp2EUyEy7YTrxliGCXzecl/vJg== + dependencies: + "@babel/helper-hoist-variables" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-umd@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" + integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== + dependencies: + "@babel/helper-module-transforms" "^7.1.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.3.0": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" + integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== + dependencies: + regexp-tree "^0.1.6" + +"@babel/plugin-transform-new-target@^7.0.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" + integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-object-super@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598" + integrity sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.1.0" + +"@babel/plugin-transform-parameters@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" + integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== + dependencies: + "@babel/helper-call-delegate" "^7.4.4" + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-regenerator@^7.3.4": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.5.tgz#629dc82512c55cee01341fb27bdfcb210354680f" + integrity sha512-gBKRh5qAaCWntnd09S8QC7r3auLCqq5DI6O0DlfoyDjslSBVqBibrMdsqO+Uhmx3+BlOmE/Kw1HFxmGbv0N9dA== + dependencies: + regenerator-transform "^0.14.0" + +"@babel/plugin-transform-runtime@^7.4.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.5.0.tgz#45242c2c9281158c5f06d25beebac63e498a284e" + integrity sha512-LmPIZOAgTLl+86gR9KjLXex6P/lRz1fWEjTz6V6QZMmKie51ja3tvzdwORqhHc4RWR8TcZ5pClpRWs0mlaA2ng== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + resolve "^1.8.1" + semver "^5.5.1" + +"@babel/plugin-transform-shorthand-properties@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" + integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-spread@^7.2.0": + version "7.2.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" + integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-sticky-regex@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" + integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.0.0" + +"@babel/plugin-transform-template-literals@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" + integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== + dependencies: + "@babel/helper-annotate-as-pure" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-typeof-symbol@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" + integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-unicode-regex@^7.2.0": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" + integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.5.4" + +"@babel/preset-env@^7.0.0 < 7.4.0": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.4.tgz#887cf38b6d23c82f19b5135298bdb160062e33e1" + integrity sha512-2mwqfYMK8weA0g0uBKOt4FE3iEodiHy9/CW0b+nWXcbL+pGzLx8ESYc+j9IIxr6LTDHWKgPm71i9smo02bw+gA== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.3.4" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.2.0" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.3.4" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.3.4" + "@babel/plugin-transform-classes" "^7.3.4" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.2.0" + "@babel/plugin-transform-dotall-regex" "^7.2.0" + "@babel/plugin-transform-duplicate-keys" "^7.2.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.2.0" + "@babel/plugin-transform-function-name" "^7.2.0" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.2.0" + "@babel/plugin-transform-modules-commonjs" "^7.2.0" + "@babel/plugin-transform-modules-systemjs" "^7.3.4" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.3.0" + "@babel/plugin-transform-new-target" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.2.0" + "@babel/plugin-transform-parameters" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.3.4" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.2.0" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.2.0" + browserslist "^4.3.4" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.3.0" + +"@babel/runtime-corejs2@^7.2.0": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.5.4.tgz#7111dbb344acce1f7dd601786cff40d516b27a96" + integrity sha512-sHv74OzyZ18d6tjHU0HmlVES3+l+lydkOMTiKsJSTGWcTBpIMfXLEgduahlJrQjknW9RCQAqLIEdLOHjBmq/hg== + dependencies: + core-js "^2.6.5" + regenerator-runtime "^0.13.2" + +"@babel/runtime@^7.0.0": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.4.tgz#cb7d1ad7c6d65676e66b47186577930465b5271b" + integrity sha512-Na84uwyImZZc3FKf4aUF1tysApzwf3p2yuFBIyBfbzT5glzKTdvYI4KVW4kcgjrzoGUjC7w3YyCHcJKaRxsr2Q== + dependencies: + regenerator-runtime "^0.13.2" + +"@babel/template@^7.1.0", "@babel/template@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.0.tgz#4216d6586854ef5c3c4592dab56ec7eb78485485" + integrity sha512-SnA9aLbyOCcnnbQEGwdfBggnc142h/rbqqsXcaATj2hZcegCl903pUD/lfpsNBlBSuWow/YDfRyJuWi2EPR5cg== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.5.0" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.5.0" + "@babel/types" "^7.5.0" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.10" + lodash "^4.17.11" -"@babel/types@^7.0.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.3.0.tgz#61dc0b336a93badc02bf5f69c4cd8e1353f2ffc0" - integrity sha512-QkFPw68QqWU1/RVPyBe8SO7lXbPfjtqAxRYQKpFpaB8yMq7X2qAqfwK5LKoQufEkSmO5NQ70O6Kc3Afk03RwXw== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.4.4", "@babel/types@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.0.tgz#e47d43840c2e7f9105bc4d3a2c371b4d0c7832ab" + integrity sha512-UFpDVqRABKsW01bvw7/wSUe56uy6RXM5+VJibVVAybDGxEW25jdwiFJEf7ASvSaC7sN7rbE/l3cLp2izav+CtQ== dependencies: esutils "^2.0.2" - lodash "^4.17.10" + lodash "^4.17.11" to-fast-properties "^2.0.0" -"@fortawesome/fontawesome-common-types@^0.1.3", "@fortawesome/fontawesome-common-types@^0.1.4": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.1.4.tgz#1fbc66f0223646f23c5550c2c12e341078e2c262" +"@hapi/address@2.x.x": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.0.0.tgz#9f05469c88cb2fd3dcd624776b54ee95c312126a" + integrity sha512-mV6T0IYqb0xL1UALPFplXYQmR0twnXG0M6jUswpquqT2sD12BOiCiLy3EvMp/Fy7s3DZElC4/aPjEjo2jeZpvw== -"@fortawesome/fontawesome-free-solid@^5.0.10": - version "5.0.10" - resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free-solid/-/fontawesome-free-solid-5.0.10.tgz#b54c87d3ce4ffd0546b60d12e898e87b59776c30" +"@hapi/hoek@6.x.x": + version "6.2.4" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-6.2.4.tgz#4b95fbaccbfba90185690890bdf1a2fbbda10595" + integrity sha512-HOJ20Kc93DkDVvjwHyHawPwPkX44sIrbXazAUDiUXaY2R9JwQGo2PhFfnQtdrsIe4igjG2fPgMra7NYw7qhy0A== + +"@hapi/hoek@8.x.x": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.0.2.tgz#f63a5ff00e891a4e7aa98f11119f9515c6672032" + integrity sha512-O6o6mrV4P65vVccxymuruucb+GhP2zl9NLCG8OdoFRS8BEGw3vwpPp20wpAtpbQQxz1CEUtmxJGgWhjq1XA3qw== + +"@hapi/joi@^15.0.1": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.1.0.tgz#940cb749b5c55c26ab3b34ce362e82b6162c8e7a" + integrity sha512-n6kaRQO8S+kepUTbXL9O/UOL788Odqs38/VOfoCrATDtTvyfiO3fgjlSRaNkHabpTLgM7qru9ifqXlXbXk8SeQ== dependencies: - "@fortawesome/fontawesome-common-types" "^0.1.4" + "@hapi/address" "2.x.x" + "@hapi/hoek" "6.x.x" + "@hapi/marker" "1.x.x" + "@hapi/topo" "3.x.x" -"@fortawesome/fontawesome@^1.1.5": - version "1.1.5" - resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome/-/fontawesome-1.1.5.tgz#c7cfafdd3364245626293cc670357f9fb8487170" +"@hapi/marker@1.x.x": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@hapi/marker/-/marker-1.0.0.tgz#65b0b2b01d1be06304886ce9b4b77b1bfb21a769" + integrity sha512-JOfdekTXnJexfE8PyhZFyHvHjt81rBFSAbTIRAhF2vv/2Y1JzoKsGqxH/GpZJoF7aEfYok8JVcAHmSz1gkBieA== + +"@hapi/topo@3.x.x": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-3.1.2.tgz#57cc1317be1a8c5f47c124f9b0e3c49cd78424d2" + integrity sha512-r+aumOqJ5QbD6aLPJWqVjMAPsx5pZKz+F5yPqXZ/WWG9JTtHbQqlzrJoknJ0iJxLj9vlXtmpSdjlkszseeG8OA== dependencies: - "@fortawesome/fontawesome-common-types" "^0.1.3" + "@hapi/hoek" "8.x.x" -"@ngtools/webpack@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@ngtools/webpack/-/webpack-7.3.0.tgz#ed6bfb0c7c02db2fdfaf0fdecd4c2b1bb80af7a5" - integrity sha512-U/By0Jlwy7nYwrGNtFirTg1aAsEHBL/9DhfFxPI0iu27FWiMttROuN6hmKbbnOmpbiYAVl5qTy3WXPXUIJjG1A== +"@intervolga/optimize-cssnano-plugin@^1.0.5": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@intervolga/optimize-cssnano-plugin/-/optimize-cssnano-plugin-1.0.6.tgz#be7c7846128b88f6a9b1d1261a0ad06eb5c0fdf8" + integrity sha512-zN69TnSr0viRSU6cEDIcuPcP67QcpQ6uHACg58FiN9PDrU6SLyGW3MR4tiISbYxy1kDWAVPwD+XwQTWE5cigAA== dependencies: - "@angular-devkit/core" "7.3.0" - enhanced-resolve "4.1.0" - rxjs "6.3.3" - tree-kill "1.2.1" - webpack-sources "1.3.0" + cssnano "^4.0.0" + cssnano-preset-default "^4.0.0" + postcss "^7.0.0" -"@schematics/angular@7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-7.3.0.tgz#0ed0af8250f767ceb42a3f658888697d95381569" - integrity sha512-fOjP/3Rz+Nqrgc+YVaiN88uhPX0FZgUjmMKgMp06lc3xmoc1ScGxoz8AF1fV50Zkvh0Etykzy1LTUczzEUJQqw== +"@mrmlnc/readdir-enhanced@^2.2.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" + integrity sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g== dependencies: - "@angular-devkit/core" "7.3.0" - "@angular-devkit/schematics" "7.3.0" - typescript "3.2.2" + call-me-maybe "^1.0.1" + glob-to-regexp "^0.3.0" -"@schematics/update@0.13.0": - version "0.13.0" - resolved "https://registry.yarnpkg.com/@schematics/update/-/update-0.13.0.tgz#d8f7336da8d80d2fd9cecc3d0c97f31295fedb52" - integrity sha512-HGpZdIL/0w46UyaxpnIAg6SBwzKfaRixHIEihmgJUqA0DG8GZUixRPr1L0YIWC1EZ81cQ+yWL85XhkKBYR+wQg== +"@nodelib/fs.stat@^1.1.2": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b" + integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw== + +"@soda/friendly-errors-webpack-plugin@^1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.1.tgz#706f64bcb4a8b9642b48ae3ace444c70334d615d" + integrity sha512-cWKrGaFX+rfbMrAxVv56DzhPNqOJPZuNIS2HGMELtgGzb+vsMzyig9mml5gZ/hr2BGtSLV+dP2LUEuAL8aG2mQ== dependencies: - "@angular-devkit/core" "7.3.0" - "@angular-devkit/schematics" "7.3.0" - "@yarnpkg/lockfile" "1.1.0" - ini "1.3.5" - pacote "9.4.0" - rxjs "6.3.3" - semver "5.6.0" - semver-intersect "1.4.0" + chalk "^1.1.3" + error-stack-parser "^2.0.0" + string-width "^2.0.0" -"@types/jasmine@*": - version "2.8.6" - resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.6.tgz#14445b6a1613cf4e05dd61c3c3256d0e95c0421e" +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== -"@types/jasmine@~3.3.8": - version "3.3.8" - resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-3.3.8.tgz#fc6abd92f7121431685ec986f0ec8f77b4390a3e" - integrity sha512-BaOFpaddRVV8qykJoWHrHtamml880oh0+DIZWbtJgx0pu+KhDF1gER5hSfCIfzyMrbjMuYFnLUfyo1l0JUVU3Q== - -"@types/jasminewd2@~2.0.2": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/jasminewd2/-/jasminewd2-2.0.3.tgz#0d2886b0cbdae4c0eeba55e30792f584bf040a95" - dependencies: - "@types/jasmine" "*" - -"@types/node@*", "@types/node@~10.12.20": - version "10.12.20" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.20.tgz#f79f959acd3422d0889bd1ead1664bd2d17cd367" - integrity sha512-9spv6SklidqxevvZyOUGjZVz4QRXGu2dNaLyXIFzFYZW0AGDykzPRIUFJXTlQXyfzAucddwTcGtJNim8zqSOPA== - -"@types/q@^0.0.32": - version "0.0.32" - resolved "https://registry.yarnpkg.com/@types/q/-/q-0.0.32.tgz#bd284e57c84f1325da702babfc82a5328190c0c5" - -"@types/selenium-webdriver@^3.0.0": - version "3.0.14" - resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-3.0.14.tgz#0b20a2370e6b1b8322c9c3dfcaa409e6c7c0c0a9" - integrity sha512-4GbNCDs98uHCT/OMv40qQC/OpoPbYn9XdXeTiFwHBBFO6eJhYEPUu2zDKirXSbHlvDV8oZ9l8EQ+HrEx/YS9DQ== - -"@types/source-list-map@*": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" - integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== - -"@types/webpack-sources@^0.1.5": - version "0.1.5" - resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.5.tgz#be47c10f783d3d6efe1471ff7f042611bd464a92" - integrity sha512-zfvjpp7jiafSmrzJ2/i3LqOyTYTuJ7u1KOXlKgDlvsj9Rr0x7ZiYu5lZbXwobL7lmsRNtPXlBfmaUD8eU2Hu8w== +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== dependencies: + "@types/events" "*" + "@types/minimatch" "*" "@types/node" "*" - "@types/source-list-map" "*" - source-map "^0.6.1" + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/node@*": + version "12.6.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.2.tgz#a5ccec6abb6060d5f20d256fb03ed743e9774999" + integrity sha512-gojym4tX0FWeV2gsW4Xmzo5wxGjXGm550oVUII7f7G5o4BV6c7DBdiG1RRQd+y1bvqRyYtPfMK85UM95vsapqQ== + +"@types/normalize-package-data@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" + integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== + +"@types/q@^1.5.1": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" + integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== + +"@types/strip-bom@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2" + integrity sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I= + +"@types/strip-json-comments@0.0.30": + version "0.0.30" + resolved "https://registry.yarnpkg.com/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz#9aa30c04db212a9a0649d6ae6fd50accc40748a1" + integrity sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ== + +"@vue/babel-helper-vue-jsx-merge-props@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz#048fe579958da408fb7a8b2a3ec050b50a661040" + integrity sha512-6tyf5Cqm4m6v7buITuwS+jHzPlIPxbFzEhXR5JGZpbrvOcp1hiQKckd305/3C7C36wFekNTQSxAtgeM0j0yoUw== + +"@vue/babel-plugin-transform-vue-jsx@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-1.0.0.tgz#ebcbf39c312c94114c8c4f407ee4f6c97aa45432" + integrity sha512-U+JNwVQSmaLKjO3lzCUC3cNXxprgezV1N+jOdqbP4xWNaqtWUCJnkjTVcgECM18A/AinDKPcUUeoyhU7yxUxXQ== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0" + html-tags "^2.0.0" + lodash.kebabcase "^4.1.1" + svg-tags "^1.0.0" + +"@vue/babel-preset-app@^3.9.2": + version "3.9.2" + resolved "https://registry.yarnpkg.com/@vue/babel-preset-app/-/babel-preset-app-3.9.2.tgz#b72a9b06abbe3f8f272783be13951271277be338" + integrity sha512-0suuCbu4jkVcVYBjPmuKxeDbrhwThYZHu3DUmtsVuOzFEGeXmco60VmXveniL/bnDUdZyknSuYP4FxgS34gw9w== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-decorators" "^7.1.0" + "@babel/plugin-syntax-dynamic-import" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-transform-runtime" "^7.4.0" + "@babel/preset-env" "^7.0.0 < 7.4.0" + "@babel/runtime" "^7.0.0" + "@babel/runtime-corejs2" "^7.2.0" + "@vue/babel-preset-jsx" "^1.0.0" + babel-plugin-dynamic-import-node "^2.2.0" + babel-plugin-module-resolver "3.2.0" + core-js "^2.6.5" + +"@vue/babel-preset-jsx@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-preset-jsx/-/babel-preset-jsx-1.0.0.tgz#e515cd453a5a8ea6b0f30b2bb92f266d8ab4e9f5" + integrity sha512-5CbDu/QHS+TtQNw5aYAffiMxBBB2Eo9+RJpS8X+6FJbdG5Rvc4TVipEqkrg0pJviWadNg7TEy0Uz4o7VNXeIZw== + dependencies: + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0" + "@vue/babel-sugar-functional-vue" "^1.0.0" + "@vue/babel-sugar-inject-h" "^1.0.0" + "@vue/babel-sugar-v-model" "^1.0.0" + "@vue/babel-sugar-v-on" "^1.0.0" + +"@vue/babel-sugar-functional-vue@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-functional-vue/-/babel-sugar-functional-vue-1.0.0.tgz#17e2c4ca27b74b244da3b923240ec91d10048cb3" + integrity sha512-XE/jNaaorTuhWayCz+QClk5AB9OV5HzrwbzEC6sIUY0J60A28ONQKeTwxfidW42egOkqNH/UU6eE3KLfmiDj0Q== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@vue/babel-sugar-inject-h@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-inject-h/-/babel-sugar-inject-h-1.0.0.tgz#e5efb6c5b5b7988dc03831af6d133bf7bcde6347" + integrity sha512-NxWU+DqtbZgfGvd25GPoFMj+rvyQ8ZA1pHj8vIeqRij+vx3sXoKkObjA9ulZunvWw5F6uG9xYy4ytpxab/X+Hg== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@vue/babel-sugar-v-model@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-v-model/-/babel-sugar-v-model-1.0.0.tgz#f4da56aa67f65a349bd2c269a95e72e601af4613" + integrity sha512-Pfg2Al0io66P1eO6zUbRIgpyKCU2qTnumiE0lao/wA/uNdb7Dx5Tfd1W6tO5SsByETPnEs8i8+gawRIXX40rFw== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0" + camelcase "^5.0.0" + html-tags "^2.0.0" + svg-tags "^1.0.0" + +"@vue/babel-sugar-v-on@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-v-on/-/babel-sugar-v-on-1.0.0.tgz#a633ee8fe205763e865b011246981b7f89668033" + integrity sha512-2aqJaDLKdSSGlxZU+GjFERaSNUaa6DQreV+V/K4W/6Lxj8520/r1lChWEa/zuAoPD2Vhy0D2QrqqO+I0D6CkKw== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0" + camelcase "^5.0.0" + +"@vue/cli-overlay@^3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@vue/cli-overlay/-/cli-overlay-3.9.0.tgz#11f513d1fa11b0135fb8ba8b88d228df0dc542e0" + integrity sha512-QfyvpJl2ChehBT2qzb5EvW921JxW94uFL3+lHa6VT42ImH8awrvkTGZmxTQWhHvATa7r0LKy7M7ZRMyo547esg== + +"@vue/cli-plugin-babel@^3.9.0": + version "3.9.2" + resolved "https://registry.yarnpkg.com/@vue/cli-plugin-babel/-/cli-plugin-babel-3.9.2.tgz#8ff962a383aaeafd2b280998428a57ea23e9539c" + integrity sha512-XqfmGjUGnnJ3NA+HC31F6nkBvB9pFDhk4Lxeao8ZNJcEjKNEBYjlmHunJQdIe/jEXXum6U+U/ZE6DjDStHTIMw== + dependencies: + "@babel/core" "^7.0.0" + "@vue/babel-preset-app" "^3.9.2" + "@vue/cli-shared-utils" "^3.9.0" + babel-loader "^8.0.5" + webpack ">=4 < 4.29" + +"@vue/cli-plugin-eslint@^3.9.0": + version "3.9.2" + resolved "https://registry.yarnpkg.com/@vue/cli-plugin-eslint/-/cli-plugin-eslint-3.9.2.tgz#747c616b13a11f34ac80554eee899cbfcd1977b8" + integrity sha512-AdvWJN+4Px2r3hbTDM2/rCtTcS6VyI7XuRljbfr2V9nF9cJiH4qsXFrTCRj3OgupbXJ14fUGKrLxmznLZIm1jA== + dependencies: + "@vue/cli-shared-utils" "^3.9.0" + babel-eslint "^10.0.1" + eslint-loader "^2.1.2" + globby "^9.2.0" + webpack ">=4 < 4.29" + yorkie "^2.0.0" + optionalDependencies: + eslint "^4.19.1" + eslint-plugin-vue "^4.7.1" + +"@vue/cli-plugin-unit-jest@^3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@vue/cli-plugin-unit-jest/-/cli-plugin-unit-jest-3.9.0.tgz#0662adee9467006381b9cddc7fb3b0a21ccbbd07" + integrity sha512-FzUeTXXM7VUbjNDrqbj/AoUXZd0FZVrW936VO0W57r7uDgv+bh5hcEyzZnOaqFUOHYNFhl0RYD528/Uq5Dgm0A== + dependencies: + "@vue/cli-shared-utils" "^3.9.0" + babel-jest "^23.6.0" + babel-plugin-transform-es2015-modules-commonjs "^6.26.2" + jest "^23.6.0" + jest-serializer-vue "^2.0.2" + jest-transform-stub "^2.0.0" + jest-watch-typeahead "0.2.1" + vue-jest "^3.0.4" + +"@vue/cli-service@^3.9.0": + version "3.9.2" + resolved "https://registry.yarnpkg.com/@vue/cli-service/-/cli-service-3.9.2.tgz#59c95500f1f20ab1cd1905c28f6c3b17c04d6de8" + integrity sha512-R4L9tCMpJ4DzLgu/aU9CEtl5QYsj/FXRrtEgXSKm+71OVtA/o2rkLTC8SLB2Bu7wHP/HCYbaoy4NZqSEQzTuLw== + dependencies: + "@intervolga/optimize-cssnano-plugin" "^1.0.5" + "@soda/friendly-errors-webpack-plugin" "^1.7.1" + "@vue/cli-overlay" "^3.9.0" + "@vue/cli-shared-utils" "^3.9.0" + "@vue/component-compiler-utils" "^2.6.0" + "@vue/preload-webpack-plugin" "^1.1.0" + "@vue/web-component-wrapper" "^1.2.0" + acorn "^6.1.1" + acorn-walk "^6.1.1" + address "^1.0.3" + autoprefixer "^9.5.1" + browserslist "^4.5.4" + cache-loader "^2.0.1" + case-sensitive-paths-webpack-plugin "^2.2.0" + chalk "^2.4.2" + cli-highlight "^2.1.0" + clipboardy "^2.0.0" + cliui "^5.0.0" + copy-webpack-plugin "^4.6.0" + css-loader "^1.0.1" + cssnano "^4.1.10" + current-script-polyfill "^1.0.0" + debug "^4.1.1" + default-gateway "^5.0.2" + dotenv "^7.0.0" + dotenv-expand "^5.1.0" + escape-string-regexp "^1.0.5" + file-loader "^3.0.1" + fs-extra "^7.0.1" + globby "^9.2.0" + hash-sum "^1.0.2" + html-webpack-plugin "^3.2.0" + launch-editor-middleware "^2.2.1" + lodash.defaultsdeep "^4.6.0" + lodash.mapvalues "^4.6.0" + lodash.transform "^4.6.0" + mini-css-extract-plugin "^0.6.0" + minimist "^1.2.0" + ora "^3.4.0" + portfinder "^1.0.20" + postcss-loader "^3.0.0" + read-pkg "^5.0.0" + semver "^6.0.0" + slash "^2.0.0" + source-map-url "^0.4.0" + ssri "^6.0.1" + string.prototype.padend "^3.0.0" + terser-webpack-plugin "^1.2.3" + thread-loader "^2.1.2" + url-loader "^1.1.2" + vue-loader "^15.7.0" + webpack ">=4 < 4.29" + webpack-bundle-analyzer "^3.3.0" + webpack-chain "^4.11.0" + webpack-dev-server "^3.4.1" + webpack-merge "^4.2.1" + +"@vue/cli-shared-utils@^3.9.0": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@vue/cli-shared-utils/-/cli-shared-utils-3.9.0.tgz#cb56a443bf763a873849a11d07e9e7638aa16cc2" + integrity sha512-wumeMZTz5aQ+1Y6uxTKegIsgOXEWT3hT8f9sW2mj5SwNDVyQ+AHZTgSynYExTUJg3dH81uKgFDUpPdAvGxzh8g== + dependencies: + "@hapi/joi" "^15.0.1" + chalk "^2.4.1" + execa "^1.0.0" + launch-editor "^2.2.1" + lru-cache "^5.1.1" + node-ipc "^9.1.1" + open "^6.3.0" + ora "^3.4.0" + request "^2.87.0" + request-promise-native "^1.0.7" + semver "^6.0.0" + string.prototype.padstart "^3.0.0" + +"@vue/component-compiler-utils@^2.5.1", "@vue/component-compiler-utils@^2.6.0": + version "2.6.0" + resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-2.6.0.tgz#aa46d2a6f7647440b0b8932434d22f12371e543b" + integrity sha512-IHjxt7LsOFYc0DkTncB7OXJL7UzwOLPPQCfEUNyxL2qt+tF12THV+EO33O1G2Uk4feMSWua3iD39Itszx0f0bw== + dependencies: + consolidate "^0.15.1" + hash-sum "^1.0.2" + lru-cache "^4.1.2" + merge-source-map "^1.1.0" + postcss "^7.0.14" + postcss-selector-parser "^5.0.0" + prettier "1.16.3" + source-map "~0.6.1" + vue-template-es2015-compiler "^1.9.0" + +"@vue/eslint-config-prettier@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@vue/eslint-config-prettier/-/eslint-config-prettier-4.0.1.tgz#a036d0d2193c5c836542b35a3a7c35c4e1c68c97" + integrity sha512-rJEDXPb61Hfgg8GllO3XXFP98bcIxdNNHSrNcxP/vBSukOolgOwQyZJ5f5z/c7ViPyh5/IDlC4qBnhx/0n+I4g== + dependencies: + eslint-config-prettier "^3.3.0" + eslint-plugin-prettier "^3.0.0" + prettier "^1.15.2" + +"@vue/preload-webpack-plugin@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@vue/preload-webpack-plugin/-/preload-webpack-plugin-1.1.0.tgz#d768dba004261c029b53a77c5ea2d5f9ee4f3cce" + integrity sha512-rcn2KhSHESBFMPj5vc5X2pI9bcBNQQixvJXhD5gZ4rN2iym/uH2qfDSQfUS5+qwiz0a85TCkeUs6w6jxFDudbw== + +"@vue/test-utils@1.0.0-beta.29": + version "1.0.0-beta.29" + resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.29.tgz#c942cf25e891cf081b6a03332b4ae1ef430726f0" + integrity sha512-yX4sxEIHh4M9yAbLA/ikpEnGKMNBCnoX98xE1RwxfhQVcn0MaXNSj1Qmac+ZydTj6VBSEVukchBogXBTwc+9iA== + dependencies: + dom-event-types "^1.0.0" + lodash "^4.17.4" + +"@vue/web-component-wrapper@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@vue/web-component-wrapper/-/web-component-wrapper-1.2.0.tgz#bb0e46f1585a7e289b4ee6067dcc5a6ae62f1dd1" + integrity sha512-Xn/+vdm9CjuC9p3Ae+lTClNutrVhsXpzxvoTXXtoys6kVRX9FkueSUAqSWAyZntmVLlR4DosBV4pH8y5Z/HbUw== "@webassemblyjs/ast@1.7.11": version "1.7.11" @@ -539,95 +1185,92 @@ resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.1.tgz#5c85d662f76fa1d34575766c5dcd6615abcd30d8" integrity sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g== -"@yarnpkg/lockfile@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" - integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== - -JSONStream@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" +abab@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.0.tgz#aba0ab4c5eee2d4c79d3487d85450fb2376ebb0f" + integrity sha512-sY5AXXVZv4Y1VACTtR11UJCPHHudgY5i26Qj5TypE6DKlIApbwb5uqhXcJ5UUGbvZNRh7EeIoW+LrJumBsKp7w== abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== -abbrev@1.0.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" - integrity sha1-kbR5JYinc4wl813W9jdSovh3YTU= - -accepts@~1.3.4, accepts@~1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.5.tgz#eb777df6011723a3b14e8a72c0805c8e86746bd2" +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: + version "1.3.7" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" + integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== dependencies: - mime-types "~2.1.18" - negotiator "0.6.1" + mime-types "~2.1.24" + negotiator "0.6.2" -acorn-dynamic-import@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz#482210140582a36b83c3e342e1cfebcaa9240948" - integrity sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw== - -acorn@^6.0.5: - version "6.0.6" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.6.tgz#cd75181670d5b99bdb1b1c993941d3a239ab1f56" - integrity sha512-5M3G/A4uBSMIlfJ+h9W125vJvPFH/zirISsW5qfxF5YzEvXJCtolLoQvM5yZft0DvMcUrPGKPOlgEu55I6iUtA== - -adm-zip@^0.4.7: - version "0.4.7" - resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.7.tgz#8606c2cbf1c426ce8c8ec00174447fd49b6eafc1" - -after@0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" - -agent-base@4, agent-base@^4.1.0, agent-base@~4.2.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" - integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== +acorn-dynamic-import@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz#901ceee4c7faaef7e07ad2a47e890675da50a278" + integrity sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg== dependencies: - es6-promisify "^5.0.0" + acorn "^5.0.0" -agentkeepalive@^3.4.1: - version "3.5.2" - resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-3.5.2.tgz#a113924dd3fa24a0bc3b78108c450c2abee00f67" - integrity sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ== +acorn-globals@^4.1.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.2.tgz#4e2c2313a597fd589720395f6354b41cd5ec8006" + integrity sha512-BbzvZhVtZP+Bs1J1HcwrQe8ycfO0wStkSGxuul3He3GkHOIZ6eTqOkPuw9IP1X3+IkOo4wiJmwkobzXYz4wewQ== dependencies: - humanize-ms "^1.2.1" + acorn "^6.0.1" + acorn-walk "^6.0.1" + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= + dependencies: + acorn "^3.0.4" + +acorn-jsx@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" + integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== + +acorn-walk@^6.0.1, acorn-walk@^6.1.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" + integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= + +acorn@^5.0.0, acorn@^5.5.0, acorn@^5.5.3, acorn@^5.6.2: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.7, acorn@^6.1.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" + integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== + +address@^1.0.3: + version "1.1.0" + resolved "https://registry.yarnpkg.com/address/-/address-1.1.0.tgz#ef8e047847fcd2c5b6f50c16965f924fd99fe709" + integrity sha512-4diPfzWbLEIElVG4AnqP+00SULlPzNuyJFNnmMrLgyaxG6tZXJ1sn7mjBu4fHrJE+Yp/jgylOweJn2xsLMFggQ== ajv-errors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + integrity sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I= + ajv-keywords@^3.1.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.3.0.tgz#cb6499da9b83177af8bc1732b2f0a1a1a3aacf8c" - integrity sha512-CMzN9S62ZOO4sA/mJZIO4S++ZM7KFWzH3PPWkveLhy4OZ9i1/VatgwWMD46w/XbGCBy7Ye0gCk+Za6mmyfKK7g== + version "3.4.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" + integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== -ajv@6.7.0, ajv@^6.1.0, ajv@^6.5.5: - version "6.7.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.7.0.tgz#e3ce7bb372d6577bb1839f1dfdfcbf5ad2948d96" - integrity sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg== - dependencies: - fast-deep-equal "^2.0.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ajv@^4.9.1: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - -ajv@^5.0.0, ajv@^5.1.0: +ajv@^5.2.3, ajv@^5.3.0: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= @@ -637,17 +1280,32 @@ ajv@^5.0.0, ajv@^5.1.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" +ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1: + version "6.10.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.1.tgz#ebf8d3af22552df9dd049bfbe50cc2390e823593" + integrity sha512-w1YQaVGNC6t2UCPjEawK/vo/dG8OOrVtUmhBT1uJJYxbl5kU2Tj3v6LGqBcsysN1yhuCStJCCA3GqdvKY8sqXQ== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +alphanum-sort@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" + integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= + amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= ansi-colors@^3.0.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" - integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw== + version "3.2.4" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" + integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-escapes@^3.0.0: +ansi-escapes@^3.0.0, ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== @@ -660,97 +1318,106 @@ ansi-html@0.0.7: ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9" - integrity sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w== +ansi-regex@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" + integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= -ansi-styles@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" - dependencies: - color-convert "^1.9.0" - -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" -anymatch@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" - dependencies: - micromatch "^2.1.5" - normalize-path "^2.0.0" +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" + integrity sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw== dependencies: micromatch "^3.1.4" normalize-path "^2.1.1" -app-root-path@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" - -append-transform@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-1.0.0.tgz#046a52ae582a228bd72f58acfbe2967c678759ab" - integrity sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw== +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + integrity sha1-126/jKlNJ24keja61EpLdKthGZE= dependencies: - default-require-extensions "^2.0.0" + default-require-extensions "^1.0.0" aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + +arch@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.1.tgz#8f5c2731aa35a30929221bb0640eed65175ec84e" + integrity sha512-BLM56aPo9vLLFVa8+/+pJLnrZ7QGGTVHWsCwieAWT9o9K8UeGaQbzZbGoabWLOo2ksBCztoXdqBZBplqLDDCSg== are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + version "1.1.5" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21" + integrity sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== dependencies: delegates "^1.0.0" readable-stream "^2.0.6" -arg@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0" - integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg== - argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + integrity sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8= dependencies: arr-flatten "^1.0.1" arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= + +array-filter@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + integrity sha1-fajPLiZijtcygDWB/SH2fKzS7uw= array-find-index@^1.0.1: version "1.0.2" @@ -767,40 +1434,42 @@ array-flatten@^2.1.0: resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== -array-slice@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" +array-map@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= -array-union@^1.0.1: +array-reduce@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= + +array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= dependencies: array-uniq "^1.0.1" array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + integrity sha1-odl8yvy8JiXMcPrc6zalDFiwGlM= array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= -arraybuffer.slice@~0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675" - -arrify@^1.0.0: +arrify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -asap@~2.0.3: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= asn1.js@^4.0.0: version "4.10.1" @@ -812,31 +1481,39 @@ asn1.js@^4.0.0: minimalistic-assert "^1.0.0" asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= assert@^1.1.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" - integrity sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE= + version "1.5.0" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" + integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== dependencies: + object-assign "^4.1.1" util "0.10.3" assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= -async-each@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + +async-each@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" + integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== async-foreach@^0.1.3: version "0.1.3" @@ -846,50 +1523,47 @@ async-foreach@^0.1.3: async-limiter@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.0.tgz#78faed8c3d074ab81f22b4e985d79e8738f720f8" + integrity sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg== -async@1.x, async@^1.5.2: +async@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= -async@^2.5.0, async@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" - integrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ== +async@^2.1.4: + version "2.6.2" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.2.tgz#18330ea7e6e313887f5d2f2a904bac6fe4dd5381" + integrity sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg== dependencies: - lodash "^4.17.10" + lodash "^4.17.11" asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -atob@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@9.4.6: - version "9.4.6" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.4.6.tgz#0ace275e33b37de16b09a5547dbfe73a98c1d446" - integrity sha512-Yp51mevbOEdxDUy5WjiKtpQaecqYq9OqZSL04rSoCiry7Tc5I9FEyo3bfxiTJc1DfHeKwSFCUYbBAiOQ2VGfiw== +autoprefixer@^9.5.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.1.tgz#51967a02d2d2300bb01866c1611ec8348d355a47" + integrity sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw== dependencies: - browserslist "^4.4.1" - caniuse-lite "^1.0.30000929" + browserslist "^4.6.3" + caniuse-lite "^1.0.30000980" + chalk "^2.4.2" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^7.0.13" - postcss-value-parser "^3.3.1" - -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + postcss "^7.0.17" + postcss-value-parser "^4.0.0" aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.2.1, aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: version "1.8.0" @@ -905,7 +1579,49 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-generator@^6.18.0: +babel-core@7.0.0-bridge.0: + version "7.0.0-bridge.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" + integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== + +babel-core@^6.0.0, babel-core@^6.26.0: + version "6.26.3" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.3.tgz#b2e2f09e342d0f0c88e2f02e067794125e75c207" + integrity sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA== + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.1" + debug "^2.6.9" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.8" + slash "^1.0.0" + source-map "^0.5.7" + +babel-eslint@^10.0.1: + version "10.0.2" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" + integrity sha512-UdsurWPtgiPgpJ06ryUnuaSXC2s0WoSZnQmEpbAH65XZSdwowgN5MvyP7e88nW07FYXv72erVtpBkxyDVKhH1Q== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/traverse" "^7.0.0" + "@babel/types" "^7.0.0" + eslint-scope "3.7.1" + eslint-visitor-keys "^1.0.0" + +babel-generator@^6.18.0, babel-generator@^6.26.0: version "6.26.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" integrity sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA== @@ -919,6 +1635,32 @@ babel-generator@^6.18.0: source-map "^0.5.7" trim-right "^1.0.1" +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + integrity sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI= + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-jest@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.6.0.tgz#a644232366557a2240a0c083da6b25786185a2f1" + integrity sha512-lqKGG6LYXYu+DQh/slrQ8nxXQkEkhugdXsU6St7GmhVS7Ilc/22ArwqXNJrf0QaOBjZB0360qZMwXqDYQHXaew== + dependencies: + babel-plugin-istanbul "^4.1.6" + babel-preset-jest "^23.2.0" + +babel-loader@^8.0.5: + version "8.0.6" + resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.6.tgz#e33bdb6f362b03f4bb141a0c21ab87c501b70dfb" + integrity sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw== + dependencies: + find-cache-dir "^2.0.0" + loader-utils "^1.0.2" + mkdirp "^0.5.1" + pify "^4.0.1" + babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" @@ -926,6 +1668,83 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" +babel-plugin-dynamic-import-node@^2.2.0, babel-plugin-dynamic-import-node@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" + integrity sha512-o6qFkpeQEBxcqt0XYlWzAVxNCSCZdUgcR8IRlhD/8DylxjjO4foPcvTW0GGKa/cVt3rvxZ7o5ippJ+/0nvLhlQ== + dependencies: + object.assign "^4.1.0" + +babel-plugin-istanbul@^4.1.6: + version "4.1.6" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45" + integrity sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ== + dependencies: + babel-plugin-syntax-object-rest-spread "^6.13.0" + find-up "^2.1.0" + istanbul-lib-instrument "^1.10.1" + test-exclude "^4.2.1" + +babel-plugin-jest-hoist@^23.2.0: + version "23.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-23.2.0.tgz#e61fae05a1ca8801aadee57a6d66b8cefaf44167" + integrity sha1-5h+uBaHKiAGq3uV6bWa4zvr0QWc= + +babel-plugin-module-resolver@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.2.0.tgz#ddfa5e301e3b9aa12d852a9979f18b37881ff5a7" + integrity sha512-tjR0GvSndzPew/Iayf4uICWZqjBwnlMWjSx6brryfQ81F9rxBVqwDJtFCV8oOs0+vJeefK9TmdZtkIFdFe1UnA== + dependencies: + find-babel-config "^1.1.0" + glob "^7.1.2" + pkg-up "^2.0.0" + reselect "^3.0.1" + resolve "^1.4.0" + +babel-plugin-syntax-object-rest-spread@^6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U= + +babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-es2015-modules-commonjs@^6.26.2: + version "6.26.2" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" + integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-types "^6.26.0" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + integrity sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-preset-jest@^23.2.0: + version "23.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz#8ec7a03a138f001a1a8fb1e8113652bf1a55da46" + integrity sha1-jsegOhOPABoaj7HoETZSvxpV2kY= + dependencies: + babel-plugin-jest-hoist "^23.2.0" + babel-plugin-syntax-object-rest-spread "^6.13.0" + +babel-register@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + integrity sha1-btAhFz4vy0htestFxgCahW9kcHE= + dependencies: + babel-core "^6.26.0" + babel-runtime "^6.26.0" + core-js "^2.5.0" + home-or-tmp "^2.0.0" + lodash "^4.17.4" + mkdirp "^0.5.1" + source-map-support "^0.4.15" + babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -934,7 +1753,7 @@ babel-runtime@^6.22.0, babel-runtime@^6.26.0: core-js "^2.4.0" regenerator-runtime "^0.11.0" -babel-template@^6.16.0: +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= @@ -945,7 +1764,7 @@ babel-template@^6.16.0: babylon "^6.18.0" lodash "^4.17.4" -babel-traverse@^6.18.0, babel-traverse@^6.26.0: +babel-traverse@^6.0.0, babel-traverse@^6.18.0, babel-traverse@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= @@ -960,7 +1779,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.26.0: invariant "^2.2.2" lodash "^4.17.4" -babel-types@^6.18.0, babel-types@^6.26.0: +babel-types@^6.0.0, babel-types@^6.18.0, babel-types@^6.24.1, babel-types@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= @@ -975,30 +1794,20 @@ babylon@^6.18.0: resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== -backo2@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" - balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -base64-arraybuffer@0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz#73926771923b5a19747ad666aa5cd4bf9c6e9ce8" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base64-js@^1.0.2: version "1.3.0" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.0.tgz#cab1e6118f051095e58b5281aea8c1cd22bfc0e3" integrity sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw== -base64id@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/base64id/-/base64id-1.0.0.tgz#47688cb99bb6804f0e06d3e763b1c32e57d8e6b6" - base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" class-utils "^0.3.5" @@ -1014,16 +1823,26 @@ batch@0.6.1: integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= dependencies: tweetnacl "^0.14.3" -better-assert@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/better-assert/-/better-assert-1.0.2.tgz#40866b9e1b9e0b55b481894311e68faffaebc522" +bfj@^6.1.1: + version "6.1.2" + resolved "https://registry.yarnpkg.com/bfj/-/bfj-6.1.2.tgz#325c861a822bcb358a41c78a33b8e6e2086dde7f" + integrity sha512-BmBJa4Lip6BPRINSZ0BPEIfB1wUY/9rwbwvIHQA1KjX9om29B6id0wnWXq7m3bn5JrUVjeOTnVuhPT1FiHwPGw== dependencies: - callsite "1.0.0" + bluebird "^3.5.5" + check-types "^8.0.3" + hoopy "^0.1.4" + tryer "^1.0.1" + +big.js@^3.1.3: + version "3.2.0" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" + integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q== big.js@^5.2.2: version "5.2.2" @@ -1031,70 +1850,42 @@ big.js@^5.2.2: integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== binary-extensions@^1.0.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" - -blob@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/blob/-/blob-0.0.4.tgz#bcf13052ca54463f30f9fc7e95b9a47630a94921" + version "1.13.1" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" + integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== block-stream@*: version "0.0.9" resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= dependencies: inherits "~2.0.0" -blocking-proxy@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/blocking-proxy/-/blocking-proxy-1.0.1.tgz#81d6fd1fe13a4c0d6957df7f91b75e98dac40cb2" - integrity sha512-KE8NFMZr3mN2E0HcvCgRtX7DjhiIQrwle+nSVJVC/yqFb9+xznHl2ZcoBp2L9qzkI4t4cBFJ1efXF8Dwi132RA== - dependencies: - minimist "^1.2.0" - -bluebird@^3.3.0, bluebird@^3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" - -bluebird@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.3.tgz#7d01c6f9616c9a51ab0f8c549a79dfe6ec33efa7" - integrity sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw== +bluebird@^3.1.1, bluebird@^3.5.1, bluebird@^3.5.5: + version "3.5.5" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" + integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== -body-parser@1.18.3: - version "1.18.3" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4" - integrity sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ= +body-parser@1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" + integrity sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw== dependencies: - bytes "3.0.0" + bytes "3.1.0" content-type "~1.0.4" debug "2.6.9" depd "~1.1.2" - http-errors "~1.6.3" - iconv-lite "0.4.23" + http-errors "1.7.2" + iconv-lite "0.4.24" on-finished "~2.3.0" - qs "6.5.2" - raw-body "2.3.3" - type-is "~1.6.16" - -body-parser@^1.16.1: - version "1.18.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.2.tgz#87678a19d84b47d859b83199bd59bce222b10454" - dependencies: - bytes "3.0.0" - content-type "~1.0.4" - debug "2.6.9" - depd "~1.1.1" - http-errors "~1.6.2" - iconv-lite "0.4.19" - on-finished "~2.3.0" - qs "6.5.1" - raw-body "2.3.2" - type-is "~1.6.15" + qs "6.7.0" + raw-body "2.4.0" + type-is "~1.6.17" bonjour@^3.5.0: version "3.5.0" @@ -1108,56 +1899,38 @@ bonjour@^3.5.0: multicast-dns "^6.0.1" multicast-dns-service-types "^1.1.0" -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" - dependencies: - hoek "2.x.x" - -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" +boolbase@^1.0.0, boolbase@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" + integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" -braces@^0.1.2: - version "0.1.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-0.1.5.tgz#c085711085291d8b75fdd74eab0f8597280711e6" - dependencies: - expand-range "^0.1.0" - braces@^1.8.2: version "1.8.5" resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + integrity sha1-uneWLhLf+WnWt2cR6RS3N4V79qc= dependencies: expand-range "^1.8.1" preserve "^0.2.0" repeat-element "^1.1.2" -braces@^2.3.0, braces@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb" +braces@^2.3.1, braces@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" array-unique "^0.3.2" - define-property "^1.0.0" extend-shallow "^2.0.1" fill-range "^4.0.0" isobject "^3.0.1" - kind-of "^6.0.2" repeat-element "^1.1.2" snapdragon "^0.8.1" snapdragon-node "^2.0.1" @@ -1169,6 +1942,18 @@ brorand@^1.0.1: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= +browser-process-hrtime@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" + integrity sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw== + +browser-resolve@^1.11.3: + version "1.11.3" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.3.tgz#9b7cbb3d0f510e4cb86bdbd796124d28b5890af6" + integrity sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ== + dependencies: + resolve "1.1.7" + browserify-aes@^1.0.0, browserify-aes@^1.0.4: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -1228,21 +2013,21 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.4.1: - version "4.4.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.4.1.tgz#42e828954b6b29a7a53e352277be429478a69062" - integrity sha512-pEBxEXg7JwaakBXjATYw/D1YZh4QUSCX/Mnd/wnqSRPPSi1U39iDhDoKGoBUcraKdxDlrYqJxSI5nNvD+dWP2A== +browserslist@^4.0.0, browserslist@^4.3.4, browserslist@^4.5.4, browserslist@^4.6.3: + version "4.6.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.4.tgz#fd0638b3f8867fec2c604ed0ed9300379f8ec7c2" + integrity sha512-ErJT8qGfRt/VWHSr1HeqZzz50DvxHtr1fVL1m5wf20aGrG8e1ce8fpZ2EjZEfs09DDZYSvtRaDlMpWslBf8Low== dependencies: - caniuse-lite "^1.0.30000929" - electron-to-chromium "^1.3.103" - node-releases "^1.1.3" + caniuse-lite "^1.0.30000981" + electron-to-chromium "^1.3.188" + node-releases "^1.1.25" -browserstack@^1.5.1: - version "1.5.2" - resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.5.2.tgz#17d8bb76127a1cc0ea416424df80d218f803673f" - integrity sha512-+6AFt9HzhKykcPF79W6yjEUJcdvZOV0lIXdkORXMJftGrDl0OKWqRF4GHqpDNkxiceDT/uB7Fb/aDwktvXX7dg== +bser@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5" + integrity sha512-8zsjWrQkkBoLK6uxASk1nJ2SKv97ltiGDo6A3wA0/yRPz+CwmEyDo0hUrhIuukG2JHpAl3bvFIixw2/3Hi0DOg== dependencies: - https-proxy-agent "^2.2.1" + node-int64 "^0.4.0" buffer-from@^1.0.0: version "1.1.1" @@ -1268,27 +2053,20 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= -builtins@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" - integrity sha1-y5T662HIaWRR2zZTThQi+U8K7og= - -bulma@^0.7.0: - version "0.7.1" - resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.7.1.tgz#73c2e3b2930c90cc272029cbd19918b493fca486" - bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" + integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= + +bytes@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" + integrity sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg== cacache@^10.0.4: version "10.0.4" @@ -1309,22 +2087,22 @@ cacache@^10.0.4: unique-filename "^1.1.0" y18n "^4.0.0" -cacache@^11.0.1, cacache@^11.0.2, cacache@^11.3.2: - version "11.3.2" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.2.tgz#2d81e308e3d258ca38125b676b98b2ac9ce69bfa" - integrity sha512-E0zP4EPGDOaT2chM08Als91eYnf8Z+eH1awwwVsngUmgppfM5jjJ8l3z5vO5p5w/I3LsiXawb1sW0VY65pQABg== +cacache@^11.3.2: + version "11.3.3" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-11.3.3.tgz#8bd29df8c6a718a6ebd2d010da4d7972ae3bbadc" + integrity sha512-p8WcneCytvzPxhDvYp31PD039vi77I12W+/KfR9S8AZbaiARFBCpsPJS+9uhWfeBfeAtW7o/4vt3MUqLkbY6nA== dependencies: - bluebird "^3.5.3" + bluebird "^3.5.5" chownr "^1.1.1" figgy-pudding "^3.5.1" - glob "^7.1.3" + glob "^7.1.4" graceful-fs "^4.1.15" lru-cache "^5.1.1" mississippi "^3.0.0" mkdirp "^0.5.1" move-concurrently "^1.0.1" promise-inflight "^1.0.1" - rimraf "^2.6.2" + rimraf "^2.6.3" ssri "^6.0.1" unique-filename "^1.1.1" y18n "^4.0.0" @@ -1332,6 +2110,7 @@ cacache@^11.0.1, cacache@^11.0.2, cacache@^11.3.2: cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" component-emitter "^1.2.1" @@ -1343,9 +2122,65 @@ cache-base@^1.0.1: union-value "^1.0.0" unset-value "^1.0.0" -callsite@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20" +cache-loader@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-2.0.1.tgz#5758f41a62d7c23941e3c3c7016e6faeb03acb07" + integrity sha512-V99T3FOynmGx26Zom+JrVBytLBsmUCzVG2/4NnUKgvXN4bEV42R1ERl1IyiH/cvFIDA1Ytq2lPZ9tXDSahcQpQ== + dependencies: + loader-utils "^1.1.0" + mkdirp "^0.5.1" + neo-async "^2.6.0" + normalize-path "^3.0.0" + schema-utils "^1.0.0" + +call-me-maybe@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" + integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= + +caller-callsite@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" + integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= + dependencies: + callsites "^2.0.0" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= + dependencies: + callsites "^0.2.0" + +caller-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" + integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + dependencies: + caller-callsite "^2.0.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@3.0.x: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73" + integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M= + dependencies: + no-case "^2.2.0" + upper-case "^1.1.1" camelcase-keys@^2.0.0: version "2.1.0" @@ -1368,24 +2203,49 @@ camelcase@^3.0.0: camelcase@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -caniuse-lite@^1.0.30000929: - version "1.0.30000933" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000933.tgz#5871ff54b3177675ae1c2a275b2aae7abf2b9222" - integrity sha512-d3QXv7eFTU40DSedSP81dV/ajcGSKpT+GW+uhtWmLvQm9bPk0KK++7i1e2NSW/CXGZhWFt2mFbFtCJ5I5bMuVA== +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -canonical-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-1.0.0.tgz#fcb470c23958def85081856be7a86e904f180d1d" - integrity sha512-feylzsbDxi1gPZ1IjystzIQZagYYLvfKrSuygUCgf7z6x790VEzze5QEkdSV1U58RA7Hi0+v6fv4K54atOzATg== +caniuse-api@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/caniuse-api/-/caniuse-api-3.0.0.tgz#5e4d90e2274961d46291997df599e3ed008ee4c0" + integrity sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw== + dependencies: + browserslist "^4.0.0" + caniuse-lite "^1.0.0" + lodash.memoize "^4.1.2" + lodash.uniq "^4.5.0" + +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000981: + version "1.0.30000984" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000984.tgz#dc96c3c469e9bcfc6ad5bdd24c77ec918ea76fe0" + integrity sha512-n5tKOjMaZ1fksIpQbjERuqCyfgec/m9pferkFQbLmWtqLUdmt12hNhjSwsmPdqeiG2NkITOQhr1VYIwWSAceiA== + +capture-exit@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-1.2.0.tgz#1c5fcc489fd0ab00d4f1ac7ae1072e3173fbab6f" + integrity sha1-HF/MSJ/QqwDU8ax64QcuMXP7q28= + dependencies: + rsvp "^3.3.3" + +case-sensitive-paths-webpack-plugin@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.2.0.tgz#3371ef6365ef9c25fa4b81c16ace0e9c7dc58c3e" + integrity sha512-u5ElzokS8A1pm9vM3/iDgTcI3xqHxuCao94Oz8etI3cf0Tio0p8izkDYbTIn09uP3yUUr6+veaE6IkjnTYS46g== caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" @@ -1393,15 +2253,7 @@ chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.3.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" - dependencies: - ansi-styles "^3.2.0" - escape-string-regexp "^1.0.5" - supports-color "^5.2.0" - -chalk@^2.0.1, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1410,58 +2262,57 @@ chalk@^2.0.1, chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== -chokidar@2.0.4, chokidar@^2.0.0, chokidar@^2.0.2, chokidar@^2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.4.tgz#356ff4e2b0e8e43e322d18a372460bbcf3accd26" - integrity sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ== +check-types@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552" + integrity sha512-YpeKZngUmG65rLudJ4taU7VLkOCTMhNl/u4ctNC56LQS/zJTyNH0Lrtwm1tfTsbLlwvlfsA2d1c8vCf/Kh2KwQ== + +chokidar@^2.0.2, chokidar@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.6.tgz#b6cad653a929e244ce8a834244164d241fa954c5" + integrity sha512-V2jUo67OKkc6ySiRpJrjlpJKl9kDuG+Xb8VgsGzb+aEouhgS1D0weyPU4lEzdAcsCAvrih2J2BqyXqHWvVLw5g== dependencies: anymatch "^2.0.0" - async-each "^1.0.0" - braces "^2.3.0" + async-each "^1.0.1" + braces "^2.3.2" glob-parent "^3.1.0" - inherits "^2.0.1" + inherits "^2.0.3" is-binary-path "^1.0.0" is-glob "^4.0.0" - lodash.debounce "^4.0.8" - normalize-path "^2.1.1" + normalize-path "^3.0.0" path-is-absolute "^1.0.0" - readdirp "^2.0.0" - upath "^1.0.5" + readdirp "^2.2.1" + upath "^1.1.1" optionalDependencies: - fsevents "^1.2.2" - -chokidar@^1.4.2: - version "1.7.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" - dependencies: - anymatch "^1.3.0" - async-each "^1.0.0" - glob-parent "^2.0.0" - inherits "^2.0.1" - is-binary-path "^1.0.0" - is-glob "^2.0.0" - path-is-absolute "^1.0.0" - readdirp "^2.0.0" - optionalDependencies: - fsevents "^1.0.0" + fsevents "^1.2.7" chownr@^1.0.1, chownr@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.1.tgz#54726b8b8fff4df053c42187e801fb4412df1494" - integrity sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g== + version "1.1.2" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6" + integrity sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A== chrome-trace-event@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz#45a91bd2c20c9411f0963b5aaeb9a1b95e09cc48" - integrity sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A== + version "1.0.2" + resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz#234090ee97c7d4ad1a2c4beae27505deffc608a4" + integrity sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ== dependencies: tslib "^1.9.0" +ci-info@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" + integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== + cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.4" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" @@ -1470,26 +2321,22 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" -circular-dependency-plugin@5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/circular-dependency-plugin/-/circular-dependency-plugin-5.0.2.tgz#da168c0b37e7b43563fb9f912c1c007c213389ef" - integrity sha512-oC7/DVAyfcY3UWKm0sN/oVoDedQDQiw/vIiAnuTWTpE5s0zWf7l3WY417Xw/Fbi/QbAjctAkxgMiS9P0s3zkmA== - -circular-json@^0.5.5: - version "0.5.9" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.9.tgz#932763ae88f4f7dead7a0d09c8a51a4743a53b1d" - integrity sha512-4ivwqHpIFJZBuhN3g/pEcdbnGUywkBblloGbkglyloVjjR3uT6tieI89MVOfbP2tHX5sgb01FuLgAOzebNlJNQ== +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" define-property "^0.2.5" isobject "^3.0.0" static-extend "^0.1.1" -clean-css@4.2.1: +clean-css@4.2.x: version "4.2.1" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17" integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g== @@ -1503,14 +2350,39 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-highlight@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.1.tgz#2180223d51618b112f4509cf96e4a6c750b07e97" + integrity sha512-0y0VlNmdD99GXZHYnvrQcmHxP8Bi6T00qucGgBgGv4kJ0RyDthNnnFPupHV7PYv/OXSVk+azFbOeaW6+vGmx9A== + dependencies: + chalk "^2.3.0" + highlight.js "^9.6.0" + mz "^2.4.0" + parse5 "^4.0.0" + yargs "^13.0.0" + +cli-spinners@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.2.0.tgz#e8b988d9206c692302d8ee834e7a85c0144d8f77" + integrity sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ== + cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= +clipboardy@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.1.0.tgz#0123a0c8fac92f256dc56335e0bb8be97a4909a5" + integrity sha512-2pzOUxWcLlXWtn+Jd6js3o12TysNOOVes/aQfg+MT/35vrxWzedHlLwyoJpXjsFKWm95BTNEcMGD9+a7mKzZkQ== + dependencies: + arch "^2.1.1" + execa "^1.0.0" + cliui@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + integrity sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" @@ -1525,6 +2397,15 @@ cliui@^4.0.0: strip-ansi "^4.0.0" wrap-ansi "^2.0.0" +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + clone-deep@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-2.0.2.tgz#00db3a1e173656730d1188c3d6aced6d7ea97713" @@ -1535,147 +2416,165 @@ clone-deep@^2.0.1: kind-of "^6.0.0" shallow-clone "^1.0.0" -clone@^2.1.1, clone@^2.1.2: +clone@2.x: version "2.1.2" resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +coa@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/coa/-/coa-2.0.2.tgz#43f6c21151b4ef2bf57187db0d73de229e3e7ec3" + integrity sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA== + dependencies: + "@types/q" "^1.5.1" + chalk "^2.4.1" + q "^1.1.2" code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -codelyzer@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/codelyzer/-/codelyzer-4.1.0.tgz#3117754538d8f5ffa36dff91d340573a836cf373" - dependencies: - app-root-path "^2.0.1" - css-selector-tokenizer "^0.7.0" - cssauron "^1.4.0" - semver-dsl "^1.0.1" - source-map "^0.5.6" - sprintf-js "^1.0.3" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" object-visit "^1.0.0" -color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" +color-convert@^1.9.0, color-convert@^1.9.1: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: - color-name "^1.1.1" + color-name "1.1.3" -color-name@^1.1.1: +color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -colors@1.1.2, colors@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" +color-name@^1.0.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combine-lists@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/combine-lists/-/combine-lists-1.0.1.tgz#458c07e09e0d900fc28b70a3fec2dacd1d2cb7f6" +color-string@^1.5.2: + version "1.5.3" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.3.tgz#c9bbc5f01b58b5492f3d6857459cb6590ce204cc" + integrity sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw== dependencies: - lodash "^4.5.0" + color-name "^1.0.0" + simple-swizzle "^0.2.2" -combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" +color@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/color/-/color-3.1.2.tgz#68148e7f85d41ad7649c5fa8c8106f098d229e10" + integrity sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg== dependencies: - delayed-stream "~1.0.0" + color-convert "^1.9.1" + color-string "^1.5.2" combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.7.tgz#2d1d24317afb8abe95d6d2c0b07b57813539d828" - integrity sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w== + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" -commander@2, commander@^2.12.1: - version "2.14.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" - -commander@~2.17.1: +commander@2.17.x: version "2.17.1" resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg== +commander@^2.18.0, commander@^2.19.0, commander@^2.20.0, commander@~2.20.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" + integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== + +commander@~2.19.0: + version "2.19.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= -compare-versions@^3.2.1: - version "3.4.0" - resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.4.0.tgz#e0747df5c9cb7f054d6d3dc3e1dbc444f9e92b26" - integrity sha512-tK69D7oNXXqUW3ZNo/z7NXTEz22TCF0pTE+YF9cxvaAM9XnkLo1fV621xCLrRR6aevJlKxExkss0vWqUCUpqdg== +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== -component-bind@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1" - -component-emitter@1.2.1, component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" - -component-inherit@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143" - -compressible@~2.0.14: - version "2.0.15" - resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.15.tgz#857a9ab0a7e5a07d8d837ed43fe2defff64fe212" - integrity sha512-4aE67DL33dSW9gw4CI2H/yTxqHLNcxp0yS6jB+4h+wr3e43+1z7vm0HU9qXOH8j+qjKuL8+UtkOxYQSMq60Ylw== +compressible@~2.0.16: + version "2.0.17" + resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.17.tgz#6e8c108a16ad58384a977f3a482ca20bff2f38c1" + integrity sha512-BGHeLCK1GV7j1bSmQQAi26X+GgWcTjLr/0tzSvMCl3LH1w1IJ4PFSPoV5316b30cneTziC+B1a+3OjoSUcQYmw== dependencies: - mime-db ">= 1.36.0 < 2" + mime-db ">= 1.40.0 < 2" -compression@^1.5.2: - version "1.7.3" - resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.3.tgz#27e0e176aaf260f7f2c2813c3e440adb9f1993db" - integrity sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg== +compression@^1.7.4: + version "1.7.4" + resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" + integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== dependencies: accepts "~1.3.5" bytes "3.0.0" - compressible "~2.0.14" + compressible "~2.0.16" debug "2.6.9" - on-headers "~1.0.1" + on-headers "~1.0.2" safe-buffer "5.1.2" vary "~1.1.2" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -concat-stream@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" +concat-stream@^1.5.0, concat-stream@^1.6.0: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== dependencies: + buffer-from "^1.0.0" inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" -connect-history-api-fallback@^1.3.0: +condense-newlines@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/condense-newlines/-/condense-newlines-0.2.1.tgz#3de985553139475d32502c83b02f60684d24c55f" + integrity sha1-PemFVTE5R10yUCyDsC9gaE0kxV8= + dependencies: + extend-shallow "^2.0.1" + is-whitespace "^0.3.0" + kind-of "^3.0.2" + +config-chain@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" + integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== + dependencies: + ini "^1.3.4" + proto-list "~1.2.1" + +connect-history-api-fallback@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg== -connect@^3.6.0: - version "3.6.6" - resolved "https://registry.yarnpkg.com/connect/-/connect-3.6.6.tgz#09eff6c55af7236e137135a72574858b6786f524" - dependencies: - debug "2.6.9" - finalhandler "1.1.0" - parseurl "~1.3.2" - utils-merge "1.0.1" - console-browserify@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" @@ -1686,22 +2585,33 @@ console-browserify@^1.1.0: console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + +consolidate@^0.15.1: + version "0.15.1" + resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7" + integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw== + dependencies: + bluebird "^3.1.1" constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= -content-disposition@0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" - integrity sha1-DPaLud318r55YcOoUXjLhdunjLQ= +content-disposition@0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" + integrity sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g== + dependencies: + safe-buffer "5.1.2" content-type@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" + integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -convert-source-map@^1.5.0, convert-source-map@^1.5.1: +convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.5.1: version "1.6.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.6.0.tgz#51b537a8c43e0f04dec1993bffcdd504e758ac20" integrity sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A== @@ -1713,13 +2623,15 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= -cookie@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" +cookie@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.0.tgz#beb437e7022b3b6d49019d088665303ebe9c14ba" + integrity sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg== copy-concurrently@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0" + integrity sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A== dependencies: aproba "^1.1.1" fs-write-stream-atomic "^1.0.8" @@ -1731,8 +2643,9 @@ copy-concurrently@^1.0.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-webpack-plugin@4.6.0: +copy-webpack-plugin@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.6.0.tgz#e7f40dd8a68477d405dd1b7a854aae324b158bae" integrity sha512-Y+SQCF+0NoWQryez2zXn5J5knmr9z/9qSQt7fbL78u83rxmigOy8X5+BFn8CFSuX+nKT8gpYwJX68ekqtQt6ZA== @@ -1746,33 +2659,25 @@ copy-webpack-plugin@4.6.0: p-limit "^1.0.0" serialize-javascript "^1.4.0" -core-js@^2.2.0, core-js@^2.4.1: - version "2.5.3" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e" - -core-js@^2.4.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.3.tgz#4b70938bdffdaf64931e66e2db158f0892289c49" - integrity sha512-l00tmFFZOBHtYhN4Cz7k32VM7vTn3rE2ANjQDxdEN6zmXZ/xq1jQuutnmHvMG1ZJ7xd72+TA5YpUK8wz3rWsfQ== - -core-js@~2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.3.0.tgz#fab83fbb0b2d8dc85fa636c4b9d34c75420c6d65" - integrity sha1-+rg/uwstjchfpjbEudNMdUIMbWU= +core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: + version "2.6.9" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" + integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cosmiconfig@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" - integrity sha512-6e5vDdrXZD+t5v0L8CrurPeybg4Fmf+FCSYxXKYVAqLUtyCSbuyqE059d0kDthTNRzKVjL7QMgNpEUlsoYH3iQ== +cosmiconfig@^5.0.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.2.1.tgz#040f726809c591e77a17c0a3626ca45b4f168b1a" + integrity sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA== dependencies: + import-fresh "^2.0.0" is-directory "^0.3.1" - js-yaml "^3.9.0" + js-yaml "^3.13.1" parse-json "^4.0.0" - require-from-string "^2.0.1" create-ecdh@^4.0.0: version "4.0.3" @@ -1813,15 +2718,16 @@ cross-spawn@^3.0.0: lru-cache "^4.0.1" which "^1.2.9" -cross-spawn@^5.0.1: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= dependencies: lru-cache "^4.0.1" shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^6.0.0: +cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== @@ -1832,18 +2738,6 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" - dependencies: - boom "2.x.x" - -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -1861,28 +2755,213 @@ crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -css-parse@1.7.x: - version "1.7.0" - resolved "https://registry.yarnpkg.com/css-parse/-/css-parse-1.7.0.tgz#321f6cf73782a6ff751111390fc05e2c657d8c9b" - integrity sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs= +css-color-names@0.0.4, css-color-names@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" + integrity sha1-gIrcLnnPhHOAabZGyyDsJ762KeA= + +css-declaration-sorter@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz#c198940f63a76d7e36c1e71018b001721054cb22" + integrity sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA== + dependencies: + postcss "^7.0.1" + timsort "^0.3.0" + +css-loader@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-1.0.1.tgz#6885bb5233b35ec47b006057da01cc640b6b79fe" + integrity sha512-+ZHAZm/yqvJ2kDtPne3uX0C+Vr3Zn5jFn2N4HywtS5ujwvsVkyg0VArEXpl3BgczDA8anieki1FIzhchX4yrDw== + dependencies: + babel-code-frame "^6.26.0" + css-selector-tokenizer "^0.7.0" + icss-utils "^2.1.0" + loader-utils "^1.0.2" + lodash "^4.17.11" + postcss "^6.0.23" + postcss-modules-extract-imports "^1.2.0" + postcss-modules-local-by-default "^1.2.0" + postcss-modules-scope "^1.1.0" + postcss-modules-values "^1.3.0" + postcss-value-parser "^3.3.0" + source-list-map "^2.0.0" + +css-select-base-adapter@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz#3b2ff4972cc362ab88561507a95408a1432135d7" + integrity sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w== + +css-select@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-1.2.0.tgz#2b3a110539c5355f1cd8d314623e870b121ec858" + integrity sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg= + dependencies: + boolbase "~1.0.0" + css-what "2.1" + domutils "1.5.1" + nth-check "~1.0.1" + +css-select@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-2.0.2.tgz#ab4386cec9e1f668855564b17c3733b43b2a5ede" + integrity sha512-dSpYaDVoWaELjvZ3mS6IKZM/y2PMPa/XYoEfYNZePL4U/XgyxZNroHEHReDx/d+VgXh9VbCTtFqLkFbmeqeaRQ== + dependencies: + boolbase "^1.0.0" + css-what "^2.1.2" + domutils "^1.7.0" + nth-check "^1.0.2" css-selector-tokenizer@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz#e6988474ae8c953477bf5e7efecfceccd9cf4c86" + version "0.7.1" + resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.1.tgz#a177271a8bca5019172f4f891fc6eed9cbf68d5d" + integrity sha512-xYL0AMZJ4gFzJQsHUKa5jiWWi2vH77WVNg7JYRyewwj6oPh4yb/y6Y9ZCw9dsj/9UauMhtuxR+ogQd//EdEVNA== dependencies: cssesc "^0.1.0" fastparse "^1.1.1" regexpu-core "^1.0.0" -cssauron@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/cssauron/-/cssauron-1.4.0.tgz#a6602dff7e04a8306dc0db9a551e92e8b5662ad8" +css-tree@1.0.0-alpha.28: + version "1.0.0-alpha.28" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.28.tgz#8e8968190d886c9477bc8d61e96f61af3f7ffa7f" + integrity sha512-joNNW1gCp3qFFzj4St6zk+Wh/NBv0vM5YbEreZk0SD4S23S+1xBKb6cLDg2uj4P4k/GUMlIm6cKIDqIG+vdt0w== dependencies: - through X.X.X + mdn-data "~1.1.0" + source-map "^0.5.3" + +css-tree@1.0.0-alpha.29: + version "1.0.0-alpha.29" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.29.tgz#3fa9d4ef3142cbd1c301e7664c1f352bd82f5a39" + integrity sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg== + dependencies: + mdn-data "~1.1.0" + source-map "^0.5.3" + +css-unit-converter@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.1.tgz#d9b9281adcfd8ced935bdbaba83786897f64e996" + integrity sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY= + +css-url-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/css-url-regex/-/css-url-regex-1.1.0.tgz#83834230cc9f74c457de59eebd1543feeb83b7ec" + integrity sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w= + +css-what@2.1, css-what@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.3.tgz#a6d7604573365fe74686c3f311c56513d88285f2" + integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg== + +css@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929" + integrity sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw== + dependencies: + inherits "^2.0.3" + source-map "^0.6.1" + source-map-resolve "^0.5.2" + urix "^0.1.0" cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" + integrity sha1-yBSQPkViM3GgR3tAEJqq++6t27Q= + +cssesc@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-2.0.0.tgz#3b13bd1bb1cb36e1bcb5a4dcd27f54c5dcb35703" + integrity sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg== + +cssnano-preset-default@^4.0.0, cssnano-preset-default@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz#51ec662ccfca0f88b396dcd9679cdb931be17f76" + integrity sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA== + dependencies: + css-declaration-sorter "^4.0.1" + cssnano-util-raw-cache "^4.0.1" + postcss "^7.0.0" + postcss-calc "^7.0.1" + postcss-colormin "^4.0.3" + postcss-convert-values "^4.0.1" + postcss-discard-comments "^4.0.2" + postcss-discard-duplicates "^4.0.2" + postcss-discard-empty "^4.0.1" + postcss-discard-overridden "^4.0.1" + postcss-merge-longhand "^4.0.11" + postcss-merge-rules "^4.0.3" + postcss-minify-font-values "^4.0.2" + postcss-minify-gradients "^4.0.2" + postcss-minify-params "^4.0.2" + postcss-minify-selectors "^4.0.2" + postcss-normalize-charset "^4.0.1" + postcss-normalize-display-values "^4.0.2" + postcss-normalize-positions "^4.0.2" + postcss-normalize-repeat-style "^4.0.2" + postcss-normalize-string "^4.0.2" + postcss-normalize-timing-functions "^4.0.2" + postcss-normalize-unicode "^4.0.1" + postcss-normalize-url "^4.0.1" + postcss-normalize-whitespace "^4.0.2" + postcss-ordered-values "^4.1.2" + postcss-reduce-initial "^4.0.3" + postcss-reduce-transforms "^4.0.2" + postcss-svgo "^4.0.2" + postcss-unique-selectors "^4.0.1" + +cssnano-util-get-arguments@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f" + integrity sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8= + +cssnano-util-get-match@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz#c0e4ca07f5386bb17ec5e52250b4f5961365156d" + integrity sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0= + +cssnano-util-raw-cache@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz#b26d5fd5f72a11dfe7a7846fb4c67260f96bf282" + integrity sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA== + dependencies: + postcss "^7.0.0" + +cssnano-util-same-parent@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz#574082fb2859d2db433855835d9a8456ea18bbf3" + integrity sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q== + +cssnano@^4.0.0, cssnano@^4.1.10: + version "4.1.10" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-4.1.10.tgz#0ac41f0b13d13d465487e111b778d42da631b8b2" + integrity sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ== + dependencies: + cosmiconfig "^5.0.0" + cssnano-preset-default "^4.0.7" + is-resolvable "^1.0.0" + postcss "^7.0.0" + +csso@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/csso/-/csso-3.5.1.tgz#7b9eb8be61628973c1b261e169d2f024008e758b" + integrity sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg== + dependencies: + css-tree "1.0.0-alpha.29" + +"cssom@>= 0.3.2 < 0.4.0", cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.3.0.tgz#c36c466f7037fd30f03baa271b65f0f17b50585c" + integrity sha512-wXsoRfsRfsLVNaVzoKdqvEmK/5PFaEXNspVT22Ots6K/cnJdpoDKuQFw+qlMiXnmaif1OgeC466X1zISgAOcGg== + dependencies: + cssom "~0.3.6" + +current-script-polyfill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/current-script-polyfill/-/current-script-polyfill-1.0.0.tgz#f31cf7e4f3e218b0726e738ca92a02d3488ef615" + integrity sha1-8xz35PPiGLBybnOMqSoC00iO9hU= currently-unhandled@^0.4.1: version "0.4.1" @@ -1891,314 +2970,67 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" -custom-event@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/custom-event/-/custom-event-1.0.1.tgz#5d02a46850adf1b4a317946a3928fccb5bfd0425" - cyclist@~0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" - -d3-array@1, d3-array@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.1.tgz#d1ca33de2f6ac31efadb8e050a021d7e2396d5dc" - -d3-array@^1.1.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f" - integrity sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw== - -d3-axis@1: - version "1.0.12" - resolved "https://registry.yarnpkg.com/d3-axis/-/d3-axis-1.0.12.tgz#cdf20ba210cfbb43795af33756886fb3638daac9" - integrity sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ== - -d3-brush@1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/d3-brush/-/d3-brush-1.0.6.tgz#33691f2032d9db6c5d8cb684ff255a9883629e21" - integrity sha512-lGSiF5SoSqO5/mYGD5FAeGKKS62JdA1EV7HPrU2b5rTX4qEJJtpjaGLJngjnkewQy7UnGstnFd3168wpf5z76w== - dependencies: - d3-dispatch "1" - d3-drag "1" - d3-interpolate "1" - d3-selection "1" - d3-transition "1" - -d3-chord@1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/d3-chord/-/d3-chord-1.0.6.tgz#309157e3f2db2c752f0280fedd35f2067ccbb15f" - integrity sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA== - dependencies: - d3-array "1" - d3-path "1" - -d3-collection@1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/d3-collection/-/d3-collection-1.0.4.tgz#342dfd12837c90974f33f1cc0a785aea570dcdc2" - -d3-color@1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-1.0.3.tgz#bc7643fca8e53a8347e2fbdaffa236796b58509b" - -d3-contour@1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/d3-contour/-/d3-contour-1.3.2.tgz#652aacd500d2264cb3423cee10db69f6f59bead3" - integrity sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg== - dependencies: - d3-array "^1.1.1" - -d3-dispatch@1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/d3-dispatch/-/d3-dispatch-1.0.3.tgz#46e1491eaa9b58c358fce5be4e8bed626e7871f8" - -d3-drag@1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/d3-drag/-/d3-drag-1.2.1.tgz#df8dd4c502fb490fc7462046a8ad98a5c479282d" - dependencies: - d3-dispatch "1" - d3-selection "1" - -d3-dsv@1: - version "1.0.8" - resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.8.tgz#907e240d57b386618dc56468bacfe76bf19764ae" - dependencies: - commander "2" - iconv-lite "0.4" - rw "1" - -d3-ease@1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/d3-ease/-/d3-ease-1.0.3.tgz#68bfbc349338a380c44d8acc4fbc3304aa2d8c0e" - -d3-fetch@1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/d3-fetch/-/d3-fetch-1.1.2.tgz#957c8fbc6d4480599ba191b1b2518bf86b3e1be2" - integrity sha512-S2loaQCV/ZeyTyIF2oP8D1K9Z4QizUzW7cWeAOAS4U88qOt3Ucf6GsmgthuYSdyB2HyEm4CeGvkQxWsmInsIVA== - dependencies: - d3-dsv "1" - -d3-force@1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/d3-force/-/d3-force-1.2.0.tgz#60713f7efe8764f53e685d69433c06914dc4ea4c" - integrity sha512-PFLcDnRVANHMudbQlIB87gcfQorEsDIAvRpZ2bNddfM/WxdsEkyrEaOIPoydhH1I1V4HPjNLGOMLXCA0AuGQ9w== - dependencies: - d3-collection "1" - d3-dispatch "1" - d3-quadtree "1" - d3-timer "1" - -d3-format@1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.2.2.tgz#1a39c479c8a57fe5051b2e67a3bee27061a74e7a" - -d3-format@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.3.0.tgz#a3ac44269a2011cdb87c7b5693040c18cddfff11" - -d3-geo@1: - version "1.11.3" - resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.11.3.tgz#5bb08388f45e4b281491faa72d3abd43215dbd1c" - integrity sha512-n30yN9qSKREvV2fxcrhmHUdXP9TNH7ZZj3C/qnaoU0cVf/Ea85+yT7HY7i8ySPwkwjCNYtmKqQFTvLFngfkItQ== - dependencies: - d3-array "1" - -d3-hierarchy@1: - version "1.1.8" - resolved "https://registry.yarnpkg.com/d3-hierarchy/-/d3-hierarchy-1.1.8.tgz#7a6317bd3ed24e324641b6f1e76e978836b008cc" - integrity sha512-L+GHMSZNwTpiq4rt9GEsNcpLa4M96lXMR8M/nMG9p5hBE0jy6C+3hWtyZMenPQdwla249iJy7Nx0uKt3n+u9+w== - -d3-interpolate@1: - version "1.1.6" - resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-1.1.6.tgz#2cf395ae2381804df08aa1bf766b7f97b5f68fb6" - dependencies: - d3-color "1" - -d3-path@1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.5.tgz#241eb1849bd9e9e8021c0d0a799f8a0e8e441764" - -d3-polygon@1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/d3-polygon/-/d3-polygon-1.0.5.tgz#9a645a0a64ff6cbf9efda96ee0b4a6909184c363" - integrity sha512-RHhh1ZUJZfhgoqzWWuRhzQJvO7LavchhitSTHGu9oj6uuLFzYZVeBzaWTQ2qSO6bz2w55RMoOCf0MsLCDB6e0w== - -d3-quadtree@1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/d3-quadtree/-/d3-quadtree-1.0.3.tgz#ac7987e3e23fe805a990f28e1b50d38fcb822438" - -d3-random@1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.2.tgz#2833be7c124360bf9e2d3fd4f33847cfe6cab291" - integrity sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ== - -d3-scale-chromatic@1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/d3-scale-chromatic/-/d3-scale-chromatic-1.3.3.tgz#dad4366f0edcb288f490128979c3c793583ed3c0" - integrity sha512-BWTipif1CimXcYfT02LKjAyItX5gKiwxuPRgr4xM58JwlLocWbjPLI7aMEjkcoOQXMkYsmNsvv3d2yl/OKuHHw== - dependencies: - d3-color "1" - d3-interpolate "1" - -d3-scale@2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-2.2.2.tgz#4e880e0b2745acaaddd3ede26a9e908a9e17b81f" - integrity sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw== - dependencies: - d3-array "^1.2.0" - d3-collection "1" - d3-format "1" - d3-interpolate "1" - d3-time "1" - d3-time-format "2" - -d3-selection@1, d3-selection@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.3.0.tgz#d53772382d3dc4f7507bfb28bcd2d6aed2a0ad6d" - -d3-shape@1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.3.tgz#b136e6caa9374034b5946bbd414aaa54a39087c3" - integrity sha512-f7V9wHQCmv4s4N7EmD5i0mwJ5y09L8r1rWVrzH1Av0YfgBKJCnTJGho76rS4HNUIw6tTBbWfFcs4ntP/MKWF4A== - dependencies: - d3-path "1" - -d3-time-format@2: - version "2.1.1" - resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-2.1.1.tgz#85b7cdfbc9ffca187f14d3c456ffda268081bb31" - dependencies: - d3-time "1" - -d3-time@1: - version "1.0.8" - resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-1.0.8.tgz#dbd2d6007bf416fe67a76d17947b784bffea1e84" - -d3-timer@1: - version "1.0.7" - resolved "https://registry.yarnpkg.com/d3-timer/-/d3-timer-1.0.7.tgz#df9650ca587f6c96607ff4e60cc38229e8dd8531" - -d3-transition@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/d3-transition/-/d3-transition-1.1.1.tgz#d8ef89c3b848735b060e54a39b32aaebaa421039" - dependencies: - d3-color "1" - d3-dispatch "1" - d3-ease "1" - d3-interpolate "1" - d3-selection "^1.1.0" - d3-timer "1" - -d3-voronoi@1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/d3-voronoi/-/d3-voronoi-1.1.4.tgz#dd3c78d7653d2bb359284ae478645d95944c8297" - integrity sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg== - -d3-zoom@1: - version "1.7.3" - resolved "https://registry.yarnpkg.com/d3-zoom/-/d3-zoom-1.7.3.tgz#f444effdc9055c38077c4299b4df999eb1d47ccb" - integrity sha512-xEBSwFx5Z9T3/VrwDkMt+mr0HCzv7XjpGURJ8lWmIC8wxe32L39eWHIasEe/e7Ox8MPU4p1hvH8PKN2olLzIBg== - dependencies: - d3-dispatch "1" - d3-drag "1" - d3-interpolate "1" - d3-selection "1" - d3-transition "1" - -d3@^5.8.0: - version "5.8.0" - resolved "https://registry.yarnpkg.com/d3/-/d3-5.8.0.tgz#251f12fe46d811ef300664590ec85eb574c44896" - integrity sha512-0rc4LL3fbyWhAqrxOt00svoxB2qoHHo6Bgs0WGcDPZ8ELqbA09evfeCnuy0ZrYbRHc+hCvBZaTT+GW3pnn05fw== - dependencies: - d3-array "1" - d3-axis "1" - d3-brush "1" - d3-chord "1" - d3-collection "1" - d3-color "1" - d3-contour "1" - d3-dispatch "1" - d3-drag "1" - d3-dsv "1" - d3-ease "1" - d3-fetch "1" - d3-force "1" - d3-format "1" - d3-geo "1" - d3-hierarchy "1" - d3-interpolate "1" - d3-path "1" - d3-polygon "1" - d3-quadtree "1" - d3-random "1" - d3-scale "2" - d3-scale-chromatic "1" - d3-selection "1" - d3-shape "1" - d3-time "1" - d3-time-format "2" - d3-timer "1" - d3-transition "1" - d3-voronoi "1" - d3-zoom "1" + integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= dependencies: assert-plus "^1.0.0" -date-fns@^1.29.0: - version "1.29.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" - -date-format@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/date-format/-/date-format-1.2.0.tgz#615e828e233dd1ab9bb9ae0950e0ceccfa6ecad8" +data-urls@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" + integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== + dependencies: + abab "^2.0.0" + whatwg-mimetype "^2.2.0" + whatwg-url "^7.0.0" date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= -debug@*, debug@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" - integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== - dependencies: - ms "^2.1.1" +de-indent@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" + integrity sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0= -debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8: +debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" -debug@3.1.0, debug@=3.1.0, debug@^3.1.0, debug@~3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -debug@^3.2.5: +debug@^3.1.0, debug@^3.2.5, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" -decamelize@^1.1.1, decamelize@^1.1.2: +debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== + dependencies: + ms "^2.1.1" + +decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -decamelize@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" - integrity sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg== - dependencies: - xregexp "4.0.0" + integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= deep-equal@^1.0.1: version "1.0.1" @@ -2210,95 +3042,103 @@ deep-extend@^0.6.0: resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -default-gateway@^2.6.0: - version "2.7.2" - resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-2.7.2.tgz#b7ef339e5e024b045467af403d50348db4642d0f" - integrity sha512-lAc4i9QJR0YHSDFdzeBQKfZ1SRDG3hsJNEkrpcZa8QhBfidLAilT60BDEIVUUGqosFp425KOgB3uYqcnQrWafQ== +deepmerge@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-1.5.2.tgz#10499d868844cdad4fee0842df8c7f6f0c95a753" + integrity sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ== + +default-gateway@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b" + integrity sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA== dependencies: - execa "^0.10.0" + execa "^1.0.0" ip-regex "^2.1.0" -default-require-extensions@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-2.0.0.tgz#f5f8fbb18a7d6d50b21f641f649ebb522cfe24f7" - integrity sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc= +default-gateway@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-5.0.2.tgz#d2d8a13d6fee406d9365d19ec9adccb8a60b82b3" + integrity sha512-wXuT0q8T5vxQNecrTgz/KbU2lPUMRc98I9Y5dnH3yhFB3BGYqtADK4lhivLlG0OfjhmfKx1PGILG2jR4zjI+WA== dependencies: - strip-bom "^3.0.0" + execa "^1.0.0" + ip-regex "^2.1.0" + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + integrity sha1-836hXT4T/9m0N9M+GnW1+5eHTLg= + dependencies: + strip-bom "^2.0.0" + +defaults@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha1-xlYFHpgX2f8I7YgUd/P+QBnz730= + dependencies: + clone "^1.0.2" + +define-properties@^1.1.2, define-properties@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" define-property@^0.2.5: version "0.2.5" resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" isobject "^3.0.1" -del@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -del@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/del/-/del-3.0.0.tgz#53ecf699ffcbcb39637691ab13baf160819766e5" - integrity sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU= +del@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/del/-/del-4.1.1.tgz#9e8f117222ea44a31ff3a156c049b99052a9f0b4" + integrity sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ== dependencies: + "@types/glob" "^7.1.1" globby "^6.1.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - p-map "^1.1.1" - pify "^3.0.0" - rimraf "^2.2.8" + is-path-cwd "^2.0.0" + is-path-in-cwd "^2.0.0" + p-map "^2.0.0" + pify "^4.0.1" + rimraf "^2.6.3" delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= -depd@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.1.tgz#5783b4e1c459f06fa5ca27f991f3d06e7a310359" - -depd@~1.1.1, depd@~1.1.2: +depd@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= -dependency-graph@^0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.7.2.tgz#91db9de6eb72699209d88aea4c1fd5221cac1c49" - integrity sha512-KqtH4/EZdtdfWX0p6MGP9jljvxSY6msy/pRUD4jgNwVpv3v1QmNLlsB3LDSSUg79BRVSn7jI1QPRtArGABovAQ== - des.js@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" @@ -2322,19 +3162,22 @@ detect-indent@^4.0.0: detect-libc@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= + +detect-newline@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" + integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= detect-node@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw== -di@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" - -diff@^3.1.0, diff@^3.2.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" +diff@^3.2.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" + integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== diffie-hellman@^5.0.0: version "5.0.3" @@ -2345,7 +3188,7 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -dir-glob@^2.0.0: +dir-glob@^2.0.0, dir-glob@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== @@ -2372,48 +3215,154 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" -dom-serialize@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: - custom-event "~1.0.0" - ent "~2.2.0" - extend "^3.0.0" - void-elements "^2.0.0" + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +dom-converter@^0.2: + version "0.2.0" + resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" + integrity sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA== + dependencies: + utila "~0.4" + +dom-event-types@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/dom-event-types/-/dom-event-types-1.0.0.tgz#5830a0a29e1bf837fe50a70cd80a597232813cae" + integrity sha512-2G2Vwi2zXTHBGqXHsJ4+ak/iP0N8Ar+G8a7LiD2oup5o4sQWytwqqrZu/O6hIMV0KMID2PL69OhpshLO0n7UJQ== + +dom-serializer@0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" + integrity sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA== + dependencies: + domelementtype "^1.3.0" + entities "^1.1.1" domain-browser@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== -duplexify@^3.4.2, duplexify@^3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.3.tgz#8b5818800df92fd0125b27ab896491912858243e" +domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" + integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== + +domexception@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" + integrity sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug== + dependencies: + webidl-conversions "^4.0.2" + +domhandler@^2.3.0: + version "2.4.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" + integrity sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA== + dependencies: + domelementtype "1" + +domutils@1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" + integrity sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8= + dependencies: + dom-serializer "0" + domelementtype "1" + +domutils@^1.5.1, domutils@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.7.0.tgz#56ea341e834e06e6748af7a1cb25da67ea9f8c2a" + integrity sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg== + dependencies: + dom-serializer "0" + domelementtype "1" + +dot-prop@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== + dependencies: + is-obj "^1.0.0" + +dotenv-expand@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0" + integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA== + +dotenv@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c" + integrity sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g== + +duplexer@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" + integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= + +duplexify@^3.4.2, duplexify@^3.6.0: + version "3.7.1" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" + integrity sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g== dependencies: end-of-stream "^1.0.0" inherits "^2.0.1" readable-stream "^2.0.0" stream-shift "^1.0.0" +easy-stack@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/easy-stack/-/easy-stack-1.0.0.tgz#12c91b3085a37f0baa336e9486eac4bf94e3e788" + integrity sha1-EskbMIWjfwuqM26UhurEv5Tj54g= + ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= dependencies: jsbn "~0.1.0" + safer-buffer "^2.1.0" + +editorconfig@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.3.tgz#bef84c4e75fb8dcb0ce5cee8efd51c15999befc5" + integrity sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g== + dependencies: + commander "^2.19.0" + lru-cache "^4.1.5" + semver "^5.6.0" + sigmund "^1.0.1" ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.3.103: - version "1.3.109" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.109.tgz#ee04a55a5157a5580a5ea88e526b02c84a3a7bc8" - integrity sha512-1qhgVZD9KIULMyeBkbjU/dWmm30zpPUfdWZfVO3nPhbtqMHJqHr4Ua5wBcWtAymVFrUCuAJxjMF1OhG+bR21Ow== +ejs@^2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.2.tgz#3a32c63d1cd16d11266cd4703b14fec4e74ab4f6" + integrity sha512-PcW2a0tyTuPHz3tWyYqtK6r1fZ3gp+3Sop8Ph+ZYN81Ob5rwmbHEzaqs10N3BEsaGTkh/ooniXK+WwszGlc2+Q== + +electron-to-chromium@^1.3.188: + version "1.3.191" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.191.tgz#c451b422cd8b2eab84dedabab5abcae1eaefb6f0" + integrity sha512-jasjtY5RUy/TOyiUYM2fb4BDaPZfm6CXRFeJDMfFsXYADGxUN49RBqtgB7EL2RmJXeIRUk9lM1U6A5yk2YJMPQ== elliptic@^6.0.0: - version "6.4.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.1.tgz#c2d0b7776911b86722c632c3c06c60f2f819939a" - integrity sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ== + version "6.5.0" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.0.tgz#2b8ed4c891b7de3200e14412a5b8248c7af505ca" + integrity sha512-eFOJTMyCYb7xtE/caJ6JJu+bhi67WCYNbkGSknu20pmM8Ke/bqOfdnZWxyoGN26JgfxTbXrsCkEw4KheCT/KGg== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -2423,69 +3372,29 @@ elliptic@^6.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= -encodeurl@~1.0.1, encodeurl@~1.0.2: +encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - integrity sha1-U4tm8+5izRq1HsMjgp0flIDHS+s= - dependencies: - iconv-lite "~0.4.13" - end-of-stream@^1.0.0, end-of-stream@^1.1.0: version "1.4.1" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43" + integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q== dependencies: once "^1.4.0" -engine.io-client@~3.2.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-3.2.1.tgz#6f54c0475de487158a1a7c77d10178708b6add36" - integrity sha512-y5AbkytWeM4jQr7m/koQLc5AxpRKC1hEVUb/s1FUAWEJq5AzJJ4NLvzuKPuxtDi5Mq755WuDvZ6Iv2rXj4PTzw== - dependencies: - component-emitter "1.2.1" - component-inherit "0.0.3" - debug "~3.1.0" - engine.io-parser "~2.1.1" - has-cors "1.1.0" - indexof "0.0.1" - parseqs "0.0.5" - parseuri "0.0.5" - ws "~3.3.1" - xmlhttprequest-ssl "~1.5.4" - yeast "0.1.2" - -engine.io-parser@~2.1.0, engine.io-parser@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-2.1.2.tgz#4c0f4cff79aaeecbbdcfdea66a823c6085409196" - dependencies: - after "0.8.2" - arraybuffer.slice "~0.0.7" - base64-arraybuffer "0.1.5" - blob "0.0.4" - has-binary2 "~1.0.2" - -engine.io@~3.2.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-3.2.1.tgz#b60281c35484a70ee0351ea0ebff83ec8c9522a2" - integrity sha512-+VlKzHzMhaU+GsCIg4AoXF1UdDFjHHwMmMKqMJNDNLlUlejz58FCy4LBqB2YVJskHGYl06BatYWKP2TVdVXE5w== - dependencies: - accepts "~1.3.4" - base64id "1.0.0" - cookie "0.3.1" - debug "~3.1.0" - engine.io-parser "~2.1.0" - ws "~3.3.1" - -enhanced-resolve@4.1.0, enhanced-resolve@^4.1.0: +enhanced-resolve@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng== @@ -2494,88 +3403,276 @@ enhanced-resolve@4.1.0, enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" -ent@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/ent/-/ent-2.2.0.tgz#e964219325a21d05f44466a2f686ed6ce5f5dd1d" - -err-code@^1.0.0: +entities@^1.1.1: version "1.1.2" - resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" - integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA= + resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" + integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== -errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: +errno@^0.1.3, errno@~0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== dependencies: prr "~1.0.1" -error-ex@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" - dependencies: - is-arrayish "^0.2.1" - -error-ex@^1.3.1: +error-ex@^1.2.0, error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" -es6-promise@^4.0.3: - version "4.2.5" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.5.tgz#da6d0d5692efb461e082c14817fe2427d8f5d054" - integrity sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg== - -es6-promise@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.0.2.tgz#010d5858423a5f118979665f46486a95c6ee2bb6" - integrity sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y= - -es6-promisify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" - integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= +error-stack-parser@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.2.tgz#4ae8dbaa2bf90a8b450707b9149dcabca135520d" + integrity sha512-E1fPutRDdIj/hohG0UpT5mayXNCxXP9d+snxFsPU9X0XgccOumKraa3juDMwTUyi7+Bu5+mCGagjg4IYeNbOdw== dependencies: - es6-promise "^4.0.3" + stackframe "^1.0.4" + +es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" + integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== + dependencies: + es-to-primitive "^1.2.0" + function-bind "^1.1.1" + has "^1.0.3" + is-callable "^1.1.4" + is-regex "^1.0.4" + object-keys "^1.0.12" + +es-to-primitive@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" + integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escodegen@1.8.x: - version "1.8.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018" - integrity sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg= +escodegen@^1.9.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.11.1.tgz#c485ff8d6b4cdb89e27f4a856e91f118401ca510" + integrity sha512-JwiqFD9KdGVVpeuRa68yU3zZnBEOcPs0nKW7wZzXky8Z7tffdYUHbe11bPCV5jYlK6DVdKLWLm0f5I/QlL0Kmw== dependencies: - esprima "^2.7.1" - estraverse "^1.9.1" + esprima "^3.1.3" + estraverse "^4.2.0" esutils "^2.0.2" optionator "^0.8.1" optionalDependencies: - source-map "~0.2.0" + source-map "~0.6.1" -eslint-scope@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" - integrity sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA== +eslint-config-prettier@^3.3.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.6.0.tgz#8ca3ffac4bd6eeef623a0651f9d754900e3ec217" + integrity sha512-ixJ4U3uTLXwJts4rmSVW/lMXjlGwCijhBJHk8iVqKKSifeI0qgFEfWl8L63isfc8Od7EiBALF6BX3jKLluf/jQ== + dependencies: + get-stdin "^6.0.0" + +eslint-loader@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.2.1.tgz#28b9c12da54057af0845e2a6112701a2f6bf8337" + integrity sha512-RLgV9hoCVsMLvOxCuNjdqOrUqIj9oJg8hF44vzJaYqsAHuY9G2YAeN3joQ9nxP0p5Th9iFSIpKo+SD8KISxXRg== + dependencies: + loader-fs-cache "^1.0.0" + loader-utils "^1.0.2" + object-assign "^4.0.1" + object-hash "^1.1.4" + rimraf "^2.6.1" + +eslint-plugin-prettier@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" + integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== + dependencies: + prettier-linter-helpers "^1.0.0" + +eslint-plugin-vue@^4.7.1: + version "4.7.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-4.7.1.tgz#c829b9fc62582c1897b5a0b94afd44ecca511e63" + integrity sha512-esETKhVMI7Vdli70Wt4bvAwnZBJeM0pxVX9Yb0wWKxdCJc2EADalVYK/q2FzMw8oKN0wPMdqVCKS8kmR89recA== + dependencies: + vue-eslint-parser "^2.0.3" + +eslint-plugin-vue@^5.0.0: + version "5.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.3.tgz#3ee7597d823b5478804b2feba9863b1b74273961" + integrity sha512-mGwMqbbJf0+VvpGR5Lllq0PMxvTdrZ/ZPjmhkacrCHbubJeJOt+T6E3HUzAifa2Mxi7RSdJfC9HFpOeSYVMMIw== + dependencies: + vue-eslint-parser "^5.0.0" + +eslint-scope@3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" -esprima@2.7.x, esprima@^2.7.1: - version "2.7.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" - integrity sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE= +eslint-scope@^3.7.1: + version "3.7.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.3.tgz#bb507200d3d17f60247636160b4826284b108535" + integrity sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-scope@^4.0.0, eslint-scope@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" + integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" + integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + +eslint@^4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" + integrity sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ== + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.4" + esquery "^1.0.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^1.0.1" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "4.0.2" + text-table "~0.2.0" + +eslint@^5.16.0: + version "5.16.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" + integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.9.1" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^4.0.3" + eslint-utils "^1.3.1" + eslint-visitor-keys "^1.0.0" + espree "^5.0.1" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.7.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^6.2.2" + js-yaml "^3.13.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.11" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^5.5.1" + strip-ansi "^4.0.0" + strip-json-comments "^2.0.1" + table "^5.2.3" + text-table "^0.2.0" + +espree@^3.5.2, espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== + dependencies: + acorn "^5.5.0" + acorn-jsx "^3.0.0" + +espree@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" + integrity sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w== + dependencies: + acorn "^6.0.2" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" + +espree@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" + integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== + dependencies: + acorn "^6.0.7" + acorn-jsx "^5.0.0" + eslint-visitor-keys "^1.0.0" + +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esquery@^1.0.0, esquery@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" esrecurse@^4.1.0: version "4.2.1" @@ -2584,12 +3681,7 @@ esrecurse@^4.1.0: dependencies: estraverse "^4.1.0" -estraverse@^1.9.1: - version "1.9.3" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" - integrity sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q= - -estraverse@^4.1.0, estraverse@^4.1.1: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= @@ -2597,20 +3689,22 @@ estraverse@^4.1.0, estraverse@^4.1.1: esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= etag@~1.8.1: version "1.8.1" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -eventemitter3@1.x.x: - version "1.2.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508" +event-pubsub@4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/event-pubsub/-/event-pubsub-4.3.0.tgz#f68d816bc29f1ec02c539dc58c8dd40ce72cb36e" + integrity sha512-z7IyloorXvKbFx9Bpie2+vMJKKx1fH1EN5yiTfp8CiLOTptSYy1g8H4yDpGlEdshL1PBiFtBHepF2cNsqeEeFQ== eventemitter3@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" - integrity sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== events@^3.0.0: version "3.0.0" @@ -2632,12 +3726,19 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -execa@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" - integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw== +exec-sh@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.2.tgz#2a5e7ffcbd7d0ba2755bdecb16e5a427dfbdec36" + integrity sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw== dependencies: - cross-spawn "^6.0.0" + merge "^1.2.0" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= + dependencies: + cross-spawn "^5.0.1" get-stream "^3.0.0" is-stream "^1.1.0" npm-run-path "^2.0.0" @@ -2645,9 +3746,10 @@ execa@^0.10.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + integrity sha1-2NdrvBtVIX7RkP1t1J08d07PyNo= dependencies: cross-spawn "^5.0.1" get-stream "^3.0.0" @@ -2673,24 +3775,19 @@ execa@^1.0.0: exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - -expand-braces@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/expand-braces/-/expand-braces-0.1.2.tgz#488b1d1d2451cb3d3a6b192cfc030f44c5855fea" - dependencies: - array-slice "^0.2.3" - array-unique "^0.2.1" - braces "^0.1.2" + integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + integrity sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s= dependencies: is-posix-bracket "^0.1.0" expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -2700,81 +3797,94 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expand-range@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-0.1.1.tgz#4cb8eda0993ca56fa4f41fc42f3cbb4ccadff044" - dependencies: - is-number "^0.1.1" - repeat-string "^0.2.2" - expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + integrity sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc= dependencies: fill-range "^2.1.0" -express@^4.16.2: - version "4.16.4" - resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e" - integrity sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg== +expect@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-23.6.0.tgz#1e0c8d3ba9a581c87bd71fb9bc8862d443425f98" + integrity sha512-dgSoOHgmtn/aDGRVFWclQyPDKl2CQRq0hmIEoUAuQs/2rn2NcvCWcSCovm6BLeuB/7EZuLGu2QfnR+qRt5OM4w== dependencies: - accepts "~1.3.5" + ansi-styles "^3.2.0" + jest-diff "^23.6.0" + jest-get-type "^22.1.0" + jest-matcher-utils "^23.6.0" + jest-message-util "^23.4.0" + jest-regex-util "^23.3.0" + +express@^4.16.3, express@^4.17.1: + version "4.17.1" + resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" + integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== + dependencies: + accepts "~1.3.7" array-flatten "1.1.1" - body-parser "1.18.3" - content-disposition "0.5.2" + body-parser "1.19.0" + content-disposition "0.5.3" content-type "~1.0.4" - cookie "0.3.1" + cookie "0.4.0" cookie-signature "1.0.6" debug "2.6.9" depd "~1.1.2" encodeurl "~1.0.2" escape-html "~1.0.3" etag "~1.8.1" - finalhandler "1.1.1" + finalhandler "~1.1.2" fresh "0.5.2" merge-descriptors "1.0.1" methods "~1.1.2" on-finished "~2.3.0" - parseurl "~1.3.2" + parseurl "~1.3.3" path-to-regexp "0.1.7" - proxy-addr "~2.0.4" - qs "6.5.2" - range-parser "~1.2.0" + proxy-addr "~2.0.5" + qs "6.7.0" + range-parser "~1.2.1" safe-buffer "5.1.2" - send "0.16.2" - serve-static "1.13.2" - setprototypeof "1.1.0" - statuses "~1.4.0" - type-is "~1.6.16" + send "0.17.1" + serve-static "1.14.1" + setprototypeof "1.1.1" + statuses "~1.5.0" + type-is "~1.6.18" utils-merge "1.0.1" vary "~1.1.2" extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -external-editor@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" - integrity sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA== +external-editor@^2.0.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" + integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: chardet "^0.7.0" iconv-lite "^0.4.24" @@ -2783,12 +3893,14 @@ external-editor@^3.0.0: extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + integrity sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE= dependencies: is-extglob "^1.0.0" extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" define-property "^1.0.0" @@ -2799,26 +3911,54 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-from-css@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/extract-from-css/-/extract-from-css-0.4.4.tgz#1ea7df2e7c7c6eb9922fa08e8adaea486f6f8f92" + integrity sha1-HqffLnx8brmSL6COitrqSG9vj5I= + dependencies: + css "^2.1.0" + extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= extsprintf@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= fast-deep-equal@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-json-stable-stringify@2.0.0, fast-json-stable-stringify@^2.0.0: +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + +fast-glob@^2.2.6: + version "2.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" + integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== + dependencies: + "@mrmlnc/readdir-enhanced" "^2.2.1" + "@nodelib/fs.stat" "^1.1.2" + glob-parent "^3.1.0" + is-glob "^4.0.0" + merge2 "^1.2.3" + micromatch "^3.1.10" + +fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fast-levenshtein@~2.0.4: version "2.0.6" @@ -2826,8 +3966,9 @@ fast-levenshtein@~2.0.4: integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= fastparse@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" + version "1.1.2" + resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.2.tgz#91728c5a5942eced8531283c79441ee4122c35a9" + integrity sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ== faye-websocket@^0.10.0: version "0.10.0" @@ -2837,13 +3978,20 @@ faye-websocket@^0.10.0: websocket-driver ">=0.5.1" faye-websocket@~0.11.1: - version "0.11.1" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.1.tgz#f0efe18c4f56e4f40afc7e06c719fd5ee6188f38" - integrity sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg= + version "0.11.3" + resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" + integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA== dependencies: websocket-driver ">=0.5.1" -figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + integrity sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg= + dependencies: + bser "^2.0.0" + +figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" integrity sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w== @@ -2855,7 +4003,22 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -file-loader@3.0.1: +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + +file-loader@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-3.0.1.tgz#f8e0ba0b599918b51adfe45d66d1e771ad560faa" integrity sha512-4sNIOXgtH/9WZq4NvlfU3Opn5ynUsqBwSLyM+I7UOwdGigTBYfVVQEwe/msZNX/j4pCJTIM14Fsw66Svo1oVrw== @@ -2866,8 +4029,9 @@ file-loader@3.0.1: filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + integrity sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY= -fileset@^2.0.3: +fileset@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" integrity sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA= @@ -2875,50 +4039,62 @@ fileset@^2.0.3: glob "^7.0.3" minimatch "^3.0.3" +filesize@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.1.tgz#090bb3ee01b6f801a8a8be99d31710b3422bb317" + integrity sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg== + fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + integrity sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q== dependencies: is-number "^2.1.0" isobject "^2.0.0" - randomatic "^1.1.3" + randomatic "^3.0.0" repeat-element "^1.1.2" repeat-string "^1.5.2" fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" repeat-string "^1.6.1" to-regex-range "^2.1.0" -finalhandler@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.0.tgz#ce0b6855b45853e791b2fcc680046d88253dd7f5" - dependencies: - debug "2.6.9" - encodeurl "~1.0.1" - escape-html "~1.0.3" - on-finished "~2.3.0" - parseurl "~1.3.2" - statuses "~1.3.1" - unpipe "~1.0.0" - -finalhandler@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.1.tgz#eebf4ed840079c83f4249038c9d703008301b105" - integrity sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg== +finalhandler@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" + integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== dependencies: debug "2.6.9" encodeurl "~1.0.2" escape-html "~1.0.3" on-finished "~2.3.0" - parseurl "~1.3.2" - statuses "~1.4.0" + parseurl "~1.3.3" + statuses "~1.5.0" unpipe "~1.0.0" +find-babel-config@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/find-babel-config/-/find-babel-config-1.2.0.tgz#a9b7b317eb5b9860cda9d54740a8c8337a2283a2" + integrity sha512-jB2CHJeqy6a820ssiqwrKMeyC6nNdmrcgkKWJWmpoxpE8RKciYJXCcXRq1h2AzCo5I5BJeN2tkGEO3hLTuePRA== + dependencies: + json5 "^0.5.1" + path-exists "^3.0.0" + +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + integrity sha1-yN765XyKUqinhPnjHFfHQumToLk= + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + find-cache-dir@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" @@ -2929,12 +4105,12 @@ find-cache-dir@^1.0.0: pkg-dir "^2.0.0" find-cache-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" - integrity sha512-LDUY6V1Xs5eFskUVYtIwatojt6+9xC9Chnlk/jYOOvn3FAFfSaWddxahDGyNHh0b2dMXa6YW2m0tk8TdVaXHlA== + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7" + integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ== dependencies: commondir "^1.0.1" - make-dir "^1.0.0" + make-dir "^2.0.0" pkg-dir "^3.0.0" find-up@^1.0.0: @@ -2945,7 +4121,7 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^2.0.0, find-up@^2.1.0: +find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= @@ -2959,24 +4135,44 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +flat-cache@^1.2.1: + version "1.3.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" + integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== + dependencies: + circular-json "^0.3.1" + graceful-fs "^4.1.2" + rimraf "~2.6.2" + write "^0.2.1" + +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + flatted@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" - integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== flush-write-stream@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417" + version "1.1.1" + resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" + integrity sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w== dependencies: - inherits "^2.0.1" - readable-stream "^2.0.4" + inherits "^2.0.3" + readable-stream "^2.3.6" follow-redirects@^1.0.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.6.1.tgz#514973c44b5757368bad8bddfe52f81f015c94cb" - integrity sha512-t2JCjbzxQpWvbhts3l6SH1DKzSrx8a+SsaVf4h6bG4kOXUuPYS/kg2Lr4gQSb7eemaHqJkOThF1BGyjlUkO1GQ== + version "1.7.0" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.7.0.tgz#489ebc198dc0e7f64167bd23b03c4c19b5784c76" + integrity sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ== dependencies: - debug "=3.1.0" + debug "^3.2.6" for-in@^0.1.3: version "0.1.8" @@ -2986,10 +4182,12 @@ for-in@^0.1.3: for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= for-own@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + integrity sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4= dependencies: for-in "^1.0.1" @@ -3003,22 +4201,7 @@ for-own@^1.0.0: forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - -form-data@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" - dependencies: - asynckit "^0.4.0" - combined-stream "1.0.6" - mime-types "^2.1.12" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= form-data@~2.3.2: version "2.3.3" @@ -3037,6 +4220,7 @@ forwarded@~0.1.2: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" @@ -3048,26 +4232,31 @@ fresh@0.5.2: from2@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" + integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= dependencies: inherits "^2.0.1" readable-stream "^2.0.0" -fs-access@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fs-access/-/fs-access-1.0.1.tgz#d6a87f262271cefebec30c553407fb995da8777a" +fs-extra@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== dependencies: - null-check "^1.0.0" + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" fs-minipass@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d" - integrity sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ== + version "1.2.6" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.6.tgz#2c5cc30ded81282bfe8a0d7c7c1853ddeb102c07" + integrity sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ== dependencies: minipass "^2.2.1" fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" + integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= dependencies: graceful-fs "^4.1.2" iferr "^0.1.5" @@ -3077,42 +4266,40 @@ fs-write-stream-atomic@^1.0.8: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= -fsevents@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" +fsevents@^1.2.3, fsevents@^1.2.7: + version "1.2.9" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.9.tgz#3f5ed66583ccd6f400b5a00db6f7e861363e388f" + integrity sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw== dependencies: - nan "^2.3.0" - node-pre-gyp "^0.6.39" + nan "^2.12.1" + node-pre-gyp "^0.12.0" -fsevents@^1.2.2: - version "1.2.7" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.7.tgz#4851b664a3783e52003b3c66eb0eee1074933aa4" - integrity sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw== - dependencies: - nan "^2.9.2" - node-pre-gyp "^0.10.0" - -fstream-ignore@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" - dependencies: - fstream "^1.0.0" - inherits "2" - minimatch "^3.0.0" - -fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" +fstream@^1.0.0, fstream@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" + integrity sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg== dependencies: graceful-fs "^4.1.2" inherits "~2.0.0" mkdirp ">=0.5 0" rimraf "2" +function-bind@^1.0.2, function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= dependencies: aproba "^1.0.3" console-control-strings "^1.0.0" @@ -3130,25 +4317,32 @@ gaze@^1.0.0: dependencies: globule "^1.0.0" -genfun@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" - integrity sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA== - get-caller-file@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= -get-stream@^4.0.0, get-stream@^4.1.0: +get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== @@ -3158,16 +4352,19 @@ get-stream@^4.0.0, get-stream@^4.1.0: get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= dependencies: assert-plus "^1.0.0" glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + integrity sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q= dependencies: glob-parent "^2.0.0" is-glob "^2.0.0" @@ -3175,32 +4372,27 @@ glob-base@^0.3.0: glob-parent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + integrity sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg= dependencies: is-glob "^2.0.0" glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= dependencies: is-glob "^3.1.0" path-dirname "^1.0.0" -glob@7.0.x: - version "7.0.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.6.tgz#211bafaf49e525b8cd93260d14ab136152b3f57a" - integrity sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo= - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" +glob-to-regexp@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" + integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@7.1.3, glob@^7.1.2, glob@^7.1.3, glob@~7.1.1: - version "7.1.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== +glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1: + version "7.1.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" + integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -3209,49 +4401,16 @@ glob@7.1.3, glob@^7.1.2, glob@^7.1.3, glob@~7.1.1: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^5.0.15: - version "5.0.15" - resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" - integrity sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E= - dependencies: - inflight "^1.0.4" - inherits "2" - minimatch "2 || 3" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.10.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.10.0.tgz#1e09776dffda5e01816b3bb4077c8b59c24eaa50" - integrity sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ== +globals@^11.0.1, globals@^11.1.0, globals@^11.7.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - globby@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" @@ -3275,6 +4434,20 @@ globby@^7.1.1: pify "^3.0.0" slash "^1.0.0" +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== + dependencies: + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + pify "^4.0.1" + slash "^2.0.0" + globule@^1.0.0: version "1.2.1" resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.1.tgz#5dffb1b191f22d20797a9369b49eab4e9839696d" @@ -3284,52 +4457,44 @@ globule@^1.0.0: lodash "~4.17.10" minimatch "~3.0.2" -graceful-fs@^4.1.11, graceful-fs@^4.1.15: - version "4.1.15" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" - integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA== +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.2.0" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" + integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== -graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + +gzip-size@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-5.1.1.tgz#cb9bee692f87c0612b232840a873904e4c135274" + integrity sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA== + dependencies: + duplexer "^0.1.1" + pify "^4.0.1" handle-thing@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== -handlebars@^4.0.1, handlebars@^4.0.11: - version "4.0.12" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.12.tgz#2c15c8a96d46da5e266700518ba8cb8d919d5bc5" - integrity sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA== +handlebars@^4.0.3: + version "4.1.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67" + integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw== dependencies: - async "^2.5.0" + neo-async "^2.6.0" optimist "^0.6.1" source-map "^0.6.1" optionalDependencies: uglify-js "^3.1.4" -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" - dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" - -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= har-validator@~5.1.0: version "5.1.3" @@ -3342,19 +4507,10 @@ har-validator@~5.1.0: has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= dependencies: ansi-regex "^2.0.0" -has-binary2@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-binary2/-/has-binary2-1.0.2.tgz#e83dba49f0b9be4d026d27365350d9f03f54be98" - dependencies: - isarray "2.0.1" - -has-cors@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39" - has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" @@ -3363,14 +4519,22 @@ has-flag@^1.0.0: has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + +has-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" + integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + integrity sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= has-value@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -3379,6 +4543,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -3387,14 +4552,23 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" kind-of "^4.0.0" +has@^1.0.0, has@^1.0.1, has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + hash-base@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.0.4.tgz#5fc8686847ecd73499403319a6b0a3f3f6ae4918" @@ -3403,6 +4577,11 @@ hash-base@^3.0.0: inherits "^2.0.1" safe-buffer "^5.0.1" +hash-sum@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-1.0.2.tgz#33b40777754c6432573c120cc3808bbd10d47f04" + integrity sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ= + hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" @@ -3411,23 +4590,20 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" -hawk@3.1.3, hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" - dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" +he@1.2.x, he@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" +hex-color-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" + integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== + +highlight.js@^9.6.0: + version "9.15.8" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.15.8.tgz#f344fda123f36f1a65490e932cf90569e4999971" + integrity sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA== hmac-drbg@^1.0.0: version "1.0.1" @@ -3438,19 +4614,20 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + integrity sha1-42w/LSyufXRqhX440Y1fMqeILbg= + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" +hoopy@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d" + integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ== hosted-git-info@^2.1.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" - -hosted-git-info@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== @@ -3465,31 +4642,93 @@ hpack.js@^2.1.6: readable-stream "^2.0.1" wbuf "^1.1.0" -html-entities@^1.2.0: +hsl-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e" + integrity sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4= + +hsla-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38" + integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg= + +html-comment-regex@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.2.tgz#97d4688aeb5c81886a364faa0cad1dda14d433a7" + integrity sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ== + +html-encoding-sniffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + integrity sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw== + dependencies: + whatwg-encoding "^1.0.1" + +html-entities@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" integrity sha1-DfKTUfByEWNRXfueVUPl9u7VFi8= -http-cache-semantics@^3.8.1: - version "3.8.1" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" - integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== +html-minifier@^3.2.3: + version "3.5.21" + resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c" + integrity sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA== + dependencies: + camel-case "3.0.x" + clean-css "4.2.x" + commander "2.17.x" + he "1.2.x" + param-case "2.1.x" + relateurl "0.2.x" + uglify-js "3.4.x" + +html-tags@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-2.0.0.tgz#10b30a386085f43cede353cc8fa7cb0deeea668b" + integrity sha1-ELMKOGCF9Dzt41PMj6fLDe7qZos= + +html-webpack-plugin@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz#b01abbd723acaaa7b37b6af4492ebda03d9dd37b" + integrity sha1-sBq71yOsqqeze2r0SS69oD2d03s= + dependencies: + html-minifier "^3.2.3" + loader-utils "^0.2.16" + lodash "^4.17.3" + pretty-error "^2.0.2" + tapable "^1.0.0" + toposort "^1.0.0" + util.promisify "1.0.0" + +htmlparser2@^3.3.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.10.1.tgz#bd679dc3f59897b6a34bb10749c855bb53a9392f" + integrity sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ== + dependencies: + domelementtype "^1.3.1" + domhandler "^2.3.0" + domutils "^1.5.1" + entities "^1.1.1" + inherits "^2.0.1" + readable-stream "^3.1.1" http-deceiver@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" integrity sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc= -http-errors@1.6.2, http-errors@~1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.2.tgz#0a002cc85707192a7e7946ceedc11155f60ec736" +http-errors@1.7.2: + version "1.7.2" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" + integrity sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg== dependencies: - depd "1.1.1" + depd "~1.1.2" inherits "2.0.3" - setprototypeof "1.0.3" - statuses ">= 1.3.1 < 2" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" -http-errors@1.6.3, http-errors@~1.6.3: +http-errors@~1.6.2: version "1.6.3" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= @@ -3499,37 +4738,33 @@ http-errors@1.6.3, http-errors@~1.6.3: setprototypeof "1.1.0" statuses ">= 1.4.0 < 2" -http-parser-js@>=0.4.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.5.0.tgz#d65edbede84349d0dc30320815a15d39cc3cbbd8" - integrity sha512-cZdEF7r4gfRIq7ezX9J0T+kQmJNOub71dWbgAXVHDct80TKP4MCETtZQ31xyv38UwgzkWPYF/Xc0ge55dW9Z9w== - -http-proxy-agent@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" - integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== +http-errors@~1.7.2: + version "1.7.3" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.3.tgz#6c619e4f9c60308c38519498c14fbb10aacebb06" + integrity sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw== dependencies: - agent-base "4" - debug "3.1.0" + depd "~1.1.2" + inherits "2.0.4" + setprototypeof "1.1.1" + statuses ">= 1.5.0 < 2" + toidentifier "1.0.0" -http-proxy-middleware@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz#0987e6bb5a5606e5a69168d8f967a87f15dd8aab" - integrity sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q== +"http-parser-js@>=0.4.0 <0.4.11": + version "0.4.10" + resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4" + integrity sha1-ksnBN0w1CF912zWexWzCV8u5P6Q= + +http-proxy-middleware@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz#183c7dc4aa1479150306498c210cdaf96080a43a" + integrity sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q== dependencies: - http-proxy "^1.16.2" + http-proxy "^1.17.0" is-glob "^4.0.0" - lodash "^4.17.5" - micromatch "^3.1.9" + lodash "^4.17.11" + micromatch "^3.1.10" -http-proxy@^1.13.0: - version "1.16.2" - resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.16.2.tgz#06dff292952bf64dbe8471fa9df73066d4f37742" - dependencies: - eventemitter3 "1.x.x" - requires-port "1.x.x" - -http-proxy@^1.16.2: +http-proxy@^1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.17.0.tgz#7ad38494658f84605e2f6db4436df410f4e5be9a" integrity sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g== @@ -3538,17 +4773,10 @@ http-proxy@^1.16.2: follow-redirects "^1.0.0" requires-port "^1.0.0" -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" - dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - http-signature@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= dependencies: assert-plus "^1.0.0" jsprim "^1.2.2" @@ -3559,47 +4787,34 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" - integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ== - dependencies: - agent-base "^4.1.0" - debug "^3.1.0" - -humanize-ms@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" - integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= - dependencies: - ms "^2.0.0" - -iconv-lite@0.4, iconv-lite@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -iconv-lite@0.4.23: - version "0.4.23" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" - integrity sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" +icss-replace-symbols@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" + integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0= + +icss-utils@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-2.1.0.tgz#83f0a0ec378bf3246178b6c2ad9136f135b1c962" + integrity sha1-g/Cg7DeL8yRheLbCrZE28TWxyWI= + dependencies: + postcss "^6.0.1" + ieee754@^1.1.4: - version "1.1.12" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.12.tgz#50bf24e5b9c8bb98af4964c941cdb0918da7b60b" - integrity sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA== + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" + integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: version "3.0.1" @@ -3608,20 +4823,15 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.5: +ignore@^3.3.3, ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== -image-size@~0.5.0: - version "0.5.5" - resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" - integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w= - -immediate@~3.0.5: - version "3.0.6" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" - integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= +ignore@^4.0.3, ignore@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== import-cwd@^2.0.0: version "2.1.0" @@ -3630,6 +4840,22 @@ import-cwd@^2.0.0: dependencies: import-from "^2.1.0" +import-fresh@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" + integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + dependencies: + caller-path "^2.0.0" + resolve-from "^3.0.0" + +import-fresh@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-from@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" @@ -3637,6 +4863,14 @@ import-from@^2.1.0: dependencies: resolve-from "^3.0.0" +import-local@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-1.0.0.tgz#5e4ffdc03f4fe6c009c6729beb29631c2f8227bc" + integrity sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ== + dependencies: + pkg-dir "^2.0.0" + resolve-cwd "^2.0.0" + import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -3648,6 +4882,7 @@ import-local@^2.0.0: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= in-publish@^2.0.0: version "2.0.0" @@ -3661,63 +4896,87 @@ indent-string@^2.1.0: dependencies: repeating "^2.0.0" -indexof@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" +indexes-of@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" + integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= -ini@1.3.5, ini@^1.3.4, ini@~1.3.0: +inherits@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + +ini@^1.3.4, ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== -inquirer@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.1.tgz#9943fc4882161bdb0b0c9276769c75b32dbfcd52" - integrity sha512-088kl3DRT2dLU5riVMKKr1DlImd6X7smDhpXUCkJDCKvTEJeRiXh0G132HG9u5a+6Ylw9plFRY7RuTnwohYSpg== +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== dependencies: ansi-escapes "^3.0.0" chalk "^2.0.0" cli-cursor "^2.1.0" cli-width "^2.0.0" - external-editor "^3.0.0" + external-editor "^2.0.4" figures "^2.0.0" - lodash "^4.17.10" + lodash "^4.3.0" mute-stream "0.0.7" run-async "^2.2.0" - rxjs "^6.1.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" string-width "^2.1.0" - strip-ansi "^5.0.0" + strip-ansi "^4.0.0" through "^2.3.6" -internal-ip@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-3.0.1.tgz#df5c99876e1d2eb2ea2d74f520e3f669a00ece27" - integrity sha512-NXXgESC2nNVtU+pqmC9e6R8B1GpKxzsAQhffvh5AL79qKnodd+L7tnEQmTiUAVngqLalPbSqRA7XGIEL5nCd0Q== +inquirer@^6.2.2: + version "6.5.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" + integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== dependencies: - default-gateway "^2.6.0" - ipaddr.js "^1.5.2" + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" -interpret@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" +internal-ip@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907" + integrity sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg== + dependencies: + default-gateway "^4.2.0" + ipaddr.js "^1.9.0" -invariant@^2.2.2: +invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -3727,6 +4986,7 @@ invariant@^2.2.2: invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= invert-kv@^2.0.0: version "2.0.0" @@ -3741,64 +5001,101 @@ ip-regex@^2.1.0: ip@^1.1.0, ip@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" + integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= -ipaddr.js@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" - integrity sha1-6qM9bd16zo9/b+DJygRA5wZzix4= +ipaddr.js@1.9.0, ipaddr.js@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.0.tgz#37df74e430a0e47550fe54a2defe30d8acd95f65" + integrity sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA== -ipaddr.js@^1.5.2: - version "1.8.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.1.tgz#fa4b79fa47fd3def5e3b159825161c0a519c9427" - integrity sha1-+kt5+kf9Pe9eOxWYJRYcClGclCc= +is-absolute-url@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6" + integrity sha1-UFMN+4T8yap9vnhS6Do3uTufKqY= is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + +is-arrayish@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" + integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= dependencies: binary-extensions "^1.0.0" is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" +is-callable@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" + integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== + +is-ci@^1.0.10: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" + integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== dependencies: - builtin-modules "^1.0.0" + ci-info "^1.5.0" + +is-color-stop@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" + integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U= + dependencies: + css-color-names "^0.0.4" + hex-color-regex "^1.1.0" + hsl-regex "^1.0.0" + hsla-regex "^1.0.0" + rgb-regex "^1.0.1" + rgba-regex "^1.0.0" is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= + is-descriptor@^0.1.0: version "0.1.6" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" is-data-descriptor "^0.1.4" @@ -3807,6 +5104,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" is-data-descriptor "^1.0.0" @@ -3820,30 +5118,36 @@ is-directory@^0.3.1: is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + integrity sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE= is-equal-shallow@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + integrity sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ= dependencies: is-primitive "^2.0.0" is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + integrity sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA= is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= is-finite@^1.0.0: version "1.0.2" @@ -3855,189 +5159,224 @@ is-finite@^1.0.0: is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-generator-fn@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-1.0.0.tgz#969d49e1bb3329f6bb7f09089be26578b2ddd46a" + integrity sha1-lp1J4bszKfa7fwkIm+JleLLd1Go= is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + integrity sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM= dependencies: is-extglob "^1.0.0" is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= dependencies: is-extglob "^2.1.0" is-glob@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== dependencies: is-extglob "^2.1.1" -is-number@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-0.1.1.tgz#69a7af116963d47206ec9bd9b48a14216f1e3806" - is-number@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + integrity sha1-Afy7s5NGOlSPL0ZszhbezknbkI8= dependencies: kind-of "^3.0.2" is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-number@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" + integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: +is-obj@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: +is-path-cwd@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-2.2.0.tgz#67d43b82664a7b5191fd9119127eb300048a9fdb" + integrity sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ== + +is-path-in-cwd@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz#bfe2dca26c69f397265a4009963602935a053acb" + integrity sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ== + dependencies: + is-path-inside "^2.1.0" + +is-path-inside@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-2.1.0.tgz#7c9810587d659a40d27bcdb4d5616eab059494b2" + integrity sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg== + dependencies: + path-is-inside "^1.0.2" + +is-plain-obj@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + +is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + integrity sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q= is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + integrity sha1-IHurkWOEmcB7Kt8kCkGochADRXU= is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o= +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= + dependencies: + has "^1.0.1" + +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + +is-svg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-3.0.0.tgz#9321dbd29c212e5ca99c4fa9794c714bcafa2f75" + integrity sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ== + dependencies: + html-comment-regex "^1.1.0" + +is-symbol@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" + integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + dependencies: + has-symbols "^1.0.0" is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= +is-whitespace@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/is-whitespace/-/is-whitespace-0.3.0.tgz#1639ecb1be036aec69a54cbb401cfbed7114ab7f" + integrity sha1-Fjnssb4DauxppUy7QBz77XEUq38= + is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== is-wsl@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" + integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isarray@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e" - -isbinaryfile@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/isbinaryfile/-/isbinaryfile-3.0.2.tgz#4a3e974ec0cba9004d3fc6cde7209ea69368a621" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-api@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-2.0.6.tgz#cd7b33ee678f6c01531d05f5e567ebbcd25f8ecc" - integrity sha512-8W5oeAGWXhtTJjAyVfvavOLVyZCTNCKsyF6GON/INKlBdO7uJ/bv3qnPj5M6ERKzmMCJS1kntnjjGuJ86fn3rQ== +istanbul-api@^1.3.1: + version "1.3.7" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.3.7.tgz#a86c770d2b03e11e3f778cd7aedd82d2722092aa" + integrity sha512-4/ApBnMVeEPG3EkSzcw25wDe4N66wxwn+KKn6b47vyek8Xb3NBAcg4xfuQbS7BqcZuTX4wxfD5lVagdggR3gyA== dependencies: - async "^2.6.1" - compare-versions "^3.2.1" - fileset "^2.0.3" - istanbul-lib-coverage "^2.0.1" - istanbul-lib-hook "^2.0.1" - istanbul-lib-instrument "^3.0.0" - istanbul-lib-report "^2.0.2" - istanbul-lib-source-maps "^2.0.1" - istanbul-reports "^2.0.1" - js-yaml "^3.12.0" - make-dir "^1.3.0" + async "^2.1.4" + fileset "^2.0.2" + istanbul-lib-coverage "^1.2.1" + istanbul-lib-hook "^1.2.2" + istanbul-lib-instrument "^1.10.2" + istanbul-lib-report "^1.1.5" + istanbul-lib-source-maps "^1.2.6" + istanbul-reports "^1.5.1" + js-yaml "^3.7.0" + mkdirp "^0.5.1" once "^1.4.0" -istanbul-instrumenter-loader@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-instrumenter-loader/-/istanbul-instrumenter-loader-3.0.1.tgz#9957bd59252b373fae5c52b7b5188e6fde2a0949" - integrity sha512-a5SPObZgS0jB/ixaKSMdn6n/gXSrK2S6q/UfRJBT3e6gQmVjwZROTODQsYW5ZNwOu78hG62Y3fWlebaVOL0C+w== - dependencies: - convert-source-map "^1.5.0" - istanbul-lib-instrument "^1.7.3" - loader-utils "^1.1.0" - schema-utils "^0.3.0" - -istanbul-lib-coverage@^1.2.1: +istanbul-lib-coverage@^1.2.0, istanbul-lib-coverage@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.1.tgz#ccf7edcd0a0bb9b8f729feeb0930470f9af664f0" integrity sha512-PzITeunAgyGbtY1ibVIUiV679EFChHjoMNRibEIobvmrCRaIgwLxNucOSimtNWUhEib/oO7QY2imD75JVgCJWQ== -istanbul-lib-coverage@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#2aee0e073ad8c5f6a0b00e0dfbf52b4667472eda" - integrity sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA== - -istanbul-lib-hook@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-2.0.1.tgz#918a57b75a0f951d552a08487ca1fa5336433d72" - integrity sha512-ufiZoiJ8CxY577JJWEeFuxXZoMqiKpq/RqZtOAYuQLvlkbJWscq9n3gc4xrCGH9n4pW0qnTxOz1oyMmVtk8E1w== +istanbul-lib-hook@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.2.2.tgz#bc6bf07f12a641fbf1c85391d0daa8f0aea6bf86" + integrity sha512-/Jmq7Y1VeHnZEQ3TL10VHyb564mn6VrQXHchON9Jf/AEcmQ3ZIiyD1BVzNOKTZf/G3gE+kiGK6SmpF9y3qGPLw== dependencies: - append-transform "^1.0.0" + append-transform "^0.4.0" -istanbul-lib-instrument@^1.7.3: +istanbul-lib-instrument@^1.10.1, istanbul-lib-instrument@^1.10.2: version "1.10.2" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.2.tgz#1f55ed10ac3c47f2bdddd5307935126754d0a9ca" integrity sha512-aWHxfxDqvh/ZlxR8BBaEPVSWDPUkGD63VjGQn3jcw8jCp7sHEMKcrj4xfJn/ABzdMEHiQNyvDQhqm5o8+SQg7A== @@ -4050,99 +5389,413 @@ istanbul-lib-instrument@^1.7.3: istanbul-lib-coverage "^1.2.1" semver "^5.3.0" -istanbul-lib-instrument@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.0.0.tgz#b5f066b2a161f75788be17a9d556f40a0cf2afc9" - integrity sha512-eQY9vN9elYjdgN9Iv6NS/00bptm02EBBk70lRMaVjeA6QYocQgenVrSgC28TJurdnZa80AGO3ASdFN+w/njGiQ== +istanbul-lib-report@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.5.tgz#f2a657fc6282f96170aaf281eb30a458f7f4170c" + integrity sha512-UsYfRMoi6QO/doUshYNqcKJqVmFe9w51GZz8BS3WB0lYxAllQYklka2wP9+dGZeHYaWIdcXUx8JGdbqaoXRXzw== dependencies: - "@babel/generator" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/template" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - istanbul-lib-coverage "^2.0.1" - semver "^5.5.0" + istanbul-lib-coverage "^1.2.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" -istanbul-lib-report@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.2.tgz#430a2598519113e1da7af274ba861bd42dd97535" - integrity sha512-rJ8uR3peeIrwAxoDEbK4dJ7cqqtxBisZKCuwkMtMv0xYzaAnsAi3AHrHPAAtNXzG/bcCgZZ3OJVqm1DTi9ap2Q== - dependencies: - istanbul-lib-coverage "^2.0.1" - make-dir "^1.3.0" - supports-color "^5.4.0" - -istanbul-lib-source-maps@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-2.0.1.tgz#ce8b45131d8293fdeaa732f4faf1852d13d0a97e" - integrity sha512-30l40ySg+gvBLcxTrLzR4Z2XTRj3HgRCA/p2rnbs/3OiTaoj054gAbuP5DcLOtwqmy4XW8qXBHzrmP2/bQ9i3A== +istanbul-lib-source-maps@^1.2.4, istanbul-lib-source-maps@^1.2.6: + version "1.2.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.6.tgz#37b9ff661580f8fca11232752ee42e08c6675d8f" + integrity sha512-TtbsY5GIHgbMsMiRw35YBHGpZ1DVFEO19vxxeiDMYaeOFOCzfnYVxvl6pOUIZR4dtPhAGpSMup8OyF8ubsaqEg== dependencies: debug "^3.1.0" - istanbul-lib-coverage "^2.0.1" - make-dir "^1.3.0" - rimraf "^2.6.2" - source-map "^0.6.1" + istanbul-lib-coverage "^1.2.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" -istanbul-reports@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.0.1.tgz#fb8d6ea850701a3984350b977a969e9a556116a7" - integrity sha512-CT0QgMBJqs6NJLF678ZHcquUAZIoBIUNzdJrRJfpkI9OnzG6MkUfHxbJC3ln981dMswC7/B1mfX3LNkhgJxsuw== +istanbul-reports@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.5.1.tgz#97e4dbf3b515e8c484caea15d6524eebd3ff4e1a" + integrity sha512-+cfoZ0UXzWjhAdzosCPP3AN8vvef8XDkWtTfgaN+7L3YTpNYITnCaEkceo5SEYy644VkHka/P1FvkWvrG/rrJw== dependencies: - handlebars "^4.0.11" + handlebars "^4.0.3" -istanbul@0.4.5: - version "0.4.5" - resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b" - integrity sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs= +javascript-stringify@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-1.6.0.tgz#142d111f3a6e3dae8f4a9afd77d45855b5a9cce3" + integrity sha1-FC0RHzpuPa6PSpr9d9RYVbWpzOM= + +jest-changed-files@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-23.4.2.tgz#1eed688370cd5eebafe4ae93d34bb3b64968fe83" + integrity sha512-EyNhTAUWEfwnK0Is/09LxoqNDOn7mU7S3EHskG52djOFS/z+IT0jT3h3Ql61+dklcG7bJJitIWEMB4Sp1piHmA== dependencies: - abbrev "1.0.x" - async "1.x" - escodegen "1.8.x" - esprima "2.7.x" - glob "^5.0.15" - handlebars "^4.0.1" - js-yaml "3.x" - mkdirp "0.5.x" - nopt "3.x" - once "1.x" - resolve "1.1.x" - supports-color "^3.1.0" - which "^1.1.1" - wordwrap "^1.0.0" + throat "^4.0.0" -jasmine-core@^3.3, jasmine-core@~3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.3.0.tgz#dea1cdc634bc93c7e0d4ad27185df30fa971b10e" - integrity sha512-3/xSmG/d35hf80BEN66Y6g9Ca5l/Isdeg/j6zvbTYlTzeKinzmaTM4p9am5kYqOmE05D7s1t8FGjzdSnbUbceA== - -jasmine-core@~2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e" - -jasmine-spec-reporter@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz#1d632aec0341670ad324f92ba84b4b32b35e9e22" +jest-cli@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.6.0.tgz#61ab917744338f443ef2baa282ddffdd658a5da4" + integrity sha512-hgeD1zRUp1E1zsiyOXjEn4LzRLWdJBV//ukAHGlx6s5mfCNJTbhbHjgxnDUXA8fsKWN/HqFFF6X5XcCwC/IvYQ== dependencies: - colors "1.1.2" + ansi-escapes "^3.0.0" + chalk "^2.0.1" + exit "^0.1.2" + glob "^7.1.2" + graceful-fs "^4.1.11" + import-local "^1.0.0" + is-ci "^1.0.10" + istanbul-api "^1.3.1" + istanbul-lib-coverage "^1.2.0" + istanbul-lib-instrument "^1.10.1" + istanbul-lib-source-maps "^1.2.4" + jest-changed-files "^23.4.2" + jest-config "^23.6.0" + jest-environment-jsdom "^23.4.0" + jest-get-type "^22.1.0" + jest-haste-map "^23.6.0" + jest-message-util "^23.4.0" + jest-regex-util "^23.3.0" + jest-resolve-dependencies "^23.6.0" + jest-runner "^23.6.0" + jest-runtime "^23.6.0" + jest-snapshot "^23.6.0" + jest-util "^23.4.0" + jest-validate "^23.6.0" + jest-watcher "^23.4.0" + jest-worker "^23.2.0" + micromatch "^2.3.11" + node-notifier "^5.2.1" + prompts "^0.1.9" + realpath-native "^1.0.0" + rimraf "^2.5.4" + slash "^1.0.0" + string-length "^2.0.0" + strip-ansi "^4.0.0" + which "^1.2.12" + yargs "^11.0.0" -jasmine@2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e" - integrity sha1-awicChFXax8W3xG4AUbZHU6Lij4= +jest-config@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.6.0.tgz#f82546a90ade2d8c7026fbf6ac5207fc22f8eb1d" + integrity sha512-i8V7z9BeDXab1+VNo78WM0AtWpBRXJLnkT+lyT+Slx/cbP5sZJ0+NDuLcmBE5hXAoK0aUp7vI+MOxR+R4d8SRQ== + dependencies: + babel-core "^6.0.0" + babel-jest "^23.6.0" + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^23.4.0" + jest-environment-node "^23.4.0" + jest-get-type "^22.1.0" + jest-jasmine2 "^23.6.0" + jest-regex-util "^23.3.0" + jest-resolve "^23.6.0" + jest-util "^23.4.0" + jest-validate "^23.6.0" + micromatch "^2.3.11" + pretty-format "^23.6.0" + +jest-diff@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.6.0.tgz#1500f3f16e850bb3d71233408089be099f610c7d" + integrity sha512-Gz9l5Ov+X3aL5L37IT+8hoCUsof1CVYBb2QEkOupK64XyRR3h+uRpYIm97K7sY8diFxowR8pIGEdyfMKTixo3g== + dependencies: + chalk "^2.0.1" + diff "^3.2.0" + jest-get-type "^22.1.0" + pretty-format "^23.6.0" + +jest-docblock@^23.2.0: + version "23.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-23.2.0.tgz#f085e1f18548d99fdd69b20207e6fd55d91383a7" + integrity sha1-8IXh8YVI2Z/dabICB+b9VdkTg6c= + dependencies: + detect-newline "^2.1.0" + +jest-each@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.6.0.tgz#ba0c3a82a8054387016139c733a05242d3d71575" + integrity sha512-x7V6M/WGJo6/kLoissORuvLIeAoyo2YqLOoCDkohgJ4XOXSqOtyvr8FbInlAWS77ojBsZrafbozWoKVRdtxFCg== + dependencies: + chalk "^2.0.1" + pretty-format "^23.6.0" + +jest-environment-jsdom@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-23.4.0.tgz#056a7952b3fea513ac62a140a2c368c79d9e6023" + integrity sha1-BWp5UrP+pROsYqFAosNox52eYCM= + dependencies: + jest-mock "^23.2.0" + jest-util "^23.4.0" + jsdom "^11.5.1" + +jest-environment-node@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-23.4.0.tgz#57e80ed0841dea303167cce8cd79521debafde10" + integrity sha1-V+gO0IQd6jAxZ8zozXlSHeuv3hA= + dependencies: + jest-mock "^23.2.0" + jest-util "^23.4.0" + +jest-get-type@^22.1.0: + version "22.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" + integrity sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w== + +jest-haste-map@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.6.0.tgz#2e3eb997814ca696d62afdb3f2529f5bbc935e16" + integrity sha512-uyNhMyl6dr6HaXGHp8VF7cK6KpC6G9z9LiMNsst+rJIZ8l7wY0tk8qwjPmEghczojZ2/ZhtEdIabZ0OQRJSGGg== + dependencies: + fb-watchman "^2.0.0" + graceful-fs "^4.1.11" + invariant "^2.2.4" + jest-docblock "^23.2.0" + jest-serializer "^23.0.1" + jest-worker "^23.2.0" + micromatch "^2.3.11" + sane "^2.0.0" + +jest-jasmine2@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.6.0.tgz#840e937f848a6c8638df24360ab869cc718592e0" + integrity sha512-pe2Ytgs1nyCs8IvsEJRiRTPC0eVYd8L/dXJGU08GFuBwZ4sYH/lmFDdOL3ZmvJR8QKqV9MFuwlsAi/EWkFUbsQ== + dependencies: + babel-traverse "^6.0.0" + chalk "^2.0.1" + co "^4.6.0" + expect "^23.6.0" + is-generator-fn "^1.0.0" + jest-diff "^23.6.0" + jest-each "^23.6.0" + jest-matcher-utils "^23.6.0" + jest-message-util "^23.4.0" + jest-snapshot "^23.6.0" + jest-util "^23.4.0" + pretty-format "^23.6.0" + +jest-leak-detector@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.6.0.tgz#e4230fd42cf381a1a1971237ad56897de7e171de" + integrity sha512-f/8zA04rsl1Nzj10HIyEsXvYlMpMPcy0QkQilVZDFOaPbv2ur71X5u2+C4ZQJGyV/xvVXtCCZ3wQ99IgQxftCg== + dependencies: + pretty-format "^23.6.0" + +jest-matcher-utils@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.6.0.tgz#726bcea0c5294261a7417afb6da3186b4b8cac80" + integrity sha512-rosyCHQfBcol4NsckTn01cdelzWLU9Cq7aaigDf8VwwpIRvWE/9zLgX2bON+FkEW69/0UuYslUe22SOdEf2nog== + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + pretty-format "^23.6.0" + +jest-message-util@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.4.0.tgz#17610c50942349508d01a3d1e0bda2c079086a9f" + integrity sha1-F2EMUJQjSVCNAaPR4L2iwHkIap8= + dependencies: + "@babel/code-frame" "^7.0.0-beta.35" + chalk "^2.0.1" + micromatch "^2.3.11" + slash "^1.0.0" + stack-utils "^1.0.1" + +jest-mock@^23.2.0: + version "23.2.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-23.2.0.tgz#ad1c60f29e8719d47c26e1138098b6d18b261134" + integrity sha1-rRxg8p6HGdR8JuETgJi20YsmETQ= + +jest-regex-util@^23.3.0: + version "23.3.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.3.0.tgz#5f86729547c2785c4002ceaa8f849fe8ca471bc5" + integrity sha1-X4ZylUfCeFxAAs6qj4Sf6MpHG8U= + +jest-resolve-dependencies@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.6.0.tgz#b4526af24c8540d9a3fab102c15081cf509b723d" + integrity sha512-EkQWkFWjGKwRtRyIwRwI6rtPAEyPWlUC2MpzHissYnzJeHcyCn1Hc8j7Nn1xUVrS5C6W5+ZL37XTem4D4pLZdA== + dependencies: + jest-regex-util "^23.3.0" + jest-snapshot "^23.6.0" + +jest-resolve@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.6.0.tgz#cf1d1a24ce7ee7b23d661c33ba2150f3aebfa0ae" + integrity sha512-XyoRxNtO7YGpQDmtQCmZjum1MljDqUCob7XlZ6jy9gsMugHdN2hY4+Acz9Qvjz2mSsOnPSH7skBmDYCHXVZqkA== + dependencies: + browser-resolve "^1.11.3" + chalk "^2.0.1" + realpath-native "^1.0.0" + +jest-runner@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.6.0.tgz#3894bd219ffc3f3cb94dc48a4170a2e6f23a5a38" + integrity sha512-kw0+uj710dzSJKU6ygri851CObtCD9cN8aNkg8jWJf4ewFyEa6kwmiH/r/M1Ec5IL/6VFa0wnAk6w+gzUtjJzA== dependencies: exit "^0.1.2" - glob "^7.0.6" - jasmine-core "~2.8.0" + graceful-fs "^4.1.11" + jest-config "^23.6.0" + jest-docblock "^23.2.0" + jest-haste-map "^23.6.0" + jest-jasmine2 "^23.6.0" + jest-leak-detector "^23.6.0" + jest-message-util "^23.4.0" + jest-runtime "^23.6.0" + jest-util "^23.4.0" + jest-worker "^23.2.0" + source-map-support "^0.5.6" + throat "^4.0.0" -jasminewd2@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/jasminewd2/-/jasminewd2-2.2.0.tgz#e37cf0b17f199cce23bea71b2039395246b4ec4e" +jest-runtime@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.6.0.tgz#059e58c8ab445917cd0e0d84ac2ba68de8f23082" + integrity sha512-ycnLTNPT2Gv+TRhnAYAQ0B3SryEXhhRj1kA6hBPSeZaNQkJ7GbZsxOLUkwg6YmvWGdX3BB3PYKFLDQCAE1zNOw== + dependencies: + babel-core "^6.0.0" + babel-plugin-istanbul "^4.1.6" + chalk "^2.0.1" + convert-source-map "^1.4.0" + exit "^0.1.2" + fast-json-stable-stringify "^2.0.0" + graceful-fs "^4.1.11" + jest-config "^23.6.0" + jest-haste-map "^23.6.0" + jest-message-util "^23.4.0" + jest-regex-util "^23.3.0" + jest-resolve "^23.6.0" + jest-snapshot "^23.6.0" + jest-util "^23.4.0" + jest-validate "^23.6.0" + micromatch "^2.3.11" + realpath-native "^1.0.0" + slash "^1.0.0" + strip-bom "3.0.0" + write-file-atomic "^2.1.0" + yargs "^11.0.0" + +jest-serializer-vue@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/jest-serializer-vue/-/jest-serializer-vue-2.0.2.tgz#b238ef286357ec6b480421bd47145050987d59b3" + integrity sha1-sjjvKGNX7GtIBCG9RxRQUJh9WbM= + dependencies: + pretty "2.0.0" + +jest-serializer@^23.0.1: + version "23.0.1" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-23.0.1.tgz#a3776aeb311e90fe83fab9e533e85102bd164165" + integrity sha1-o3dq6zEekP6D+rnlM+hRAr0WQWU= + +jest-snapshot@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.6.0.tgz#f9c2625d1b18acda01ec2d2b826c0ce58a5aa17a" + integrity sha512-tM7/Bprftun6Cvj2Awh/ikS7zV3pVwjRYU2qNYS51VZHgaAMBs5l4o/69AiDHhQrj5+LA2Lq4VIvK7zYk/bswg== + dependencies: + babel-types "^6.0.0" + chalk "^2.0.1" + jest-diff "^23.6.0" + jest-matcher-utils "^23.6.0" + jest-message-util "^23.4.0" + jest-resolve "^23.6.0" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^23.6.0" + semver "^5.5.0" + +jest-transform-stub@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jest-transform-stub/-/jest-transform-stub-2.0.0.tgz#19018b0851f7568972147a5d60074b55f0225a7d" + integrity sha512-lspHaCRx/mBbnm3h4uMMS3R5aZzMwyNpNIJLXj4cEsV0mIUtS4IjYJLSoyjRCtnxb6RIGJ4NL2quZzfIeNhbkg== + +jest-util@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-23.4.0.tgz#4d063cb927baf0a23831ff61bec2cbbf49793561" + integrity sha1-TQY8uSe68KI4Mf9hvsLLv0l5NWE= + dependencies: + callsites "^2.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.11" + is-ci "^1.0.10" + jest-message-util "^23.4.0" + mkdirp "^0.5.1" + slash "^1.0.0" + source-map "^0.6.0" + +jest-validate@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.6.0.tgz#36761f99d1ed33fcd425b4e4c5595d62b6597474" + integrity sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A== + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + leven "^2.1.0" + pretty-format "^23.6.0" + +jest-watch-typeahead@0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-0.2.1.tgz#6c40f232996ca6c39977e929e9f79b189e7d87e4" + integrity sha512-xdhEtKSj0gmnkDQbPTIHvcMmXNUDzYpHLEJ5TFqlaI+schi2NI96xhWiZk9QoesAS7oBmKwWWsHazTrYl2ORgg== + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.4.1" + jest-watcher "^23.1.0" + slash "^2.0.0" + string-length "^2.0.0" + strip-ansi "^5.0.0" + +jest-watcher@^23.1.0, jest-watcher@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-23.4.0.tgz#d2e28ce74f8dad6c6afc922b92cabef6ed05c91c" + integrity sha1-0uKM50+NrWxq/JIrksq+9u0FyRw= + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.1" + string-length "^2.0.0" + +jest-worker@^23.2.0: + version "23.2.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-23.2.0.tgz#faf706a8da36fae60eb26957257fa7b5d8ea02b9" + integrity sha1-+vcGqNo2+uYOsmlXJX+ntdjqArk= + dependencies: + merge-stream "^1.0.1" + +jest@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-23.6.0.tgz#ad5835e923ebf6e19e7a1d7529a432edfee7813d" + integrity sha512-lWzcd+HSiqeuxyhG+EnZds6iO3Y3ZEnMrfZq/OTGvF/C+Z4fPMCdhWTGSAiO2Oym9rbEXfwddHhh6jqrTF3+Lw== + dependencies: + import-local "^1.0.0" + jest-cli "^23.6.0" js-base64@^2.1.8: version "2.5.1" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw== +js-beautify@^1.6.12, js-beautify@^1.6.14: + version "1.10.0" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.0.tgz#9753a13c858d96828658cd18ae3ca0e5783ea672" + integrity sha512-OMwf/tPDpE/BLlYKqZOhqWsd3/z2N3KOlyn1wsCRGFwViE8LOQTcDtathQvHvZc+q+zWmcNAbwKSC+iJoMaH2Q== + dependencies: + config-chain "^1.1.12" + editorconfig "^0.15.3" + glob "^7.1.3" + mkdirp "~0.5.1" + nopt "~4.0.1" + +js-levenshtein@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + +js-message@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/js-message/-/js-message-1.0.5.tgz#2300d24b1af08e89dd095bc1a4c9c9cfcb892d15" + integrity sha1-IwDSSxrwjondCVvBpMnJz8uJLRU= + +js-queue@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/js-queue/-/js-queue-2.0.0.tgz#362213cf860f468f0125fc6c96abc1742531f948" + integrity sha1-NiITz4YPRo8BJfxslqvBdCUx+Ug= + dependencies: + easy-stack "^1.0.0" + "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -4151,18 +5804,12 @@ js-base64@^2.1.8: js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@3.x, js-yaml@^3.12.0, js-yaml@^3.9.0: - version "3.12.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.1.tgz#295c8632a18a23e054cf5c9d3cecafe678167600" - integrity sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@^3.7.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" +js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.7.0, js-yaml@^3.9.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -4170,6 +5817,39 @@ js-yaml@^3.7.0: jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +jsdom@^11.5.1: + version "11.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" + integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== + dependencies: + abab "^2.0.0" + acorn "^5.5.3" + acorn-globals "^4.1.0" + array-equal "^1.0.0" + cssom ">= 0.3.2 < 0.4.0" + cssstyle "^1.0.0" + data-urls "^1.0.0" + domexception "^1.0.1" + escodegen "^1.9.1" + html-encoding-sniffer "^1.0.2" + left-pad "^1.3.0" + nwsapi "^2.0.7" + parse5 "4.0.0" + pn "^1.1.0" + request "^2.87.0" + request-promise-native "^1.0.5" + sax "^1.2.4" + symbol-tree "^3.2.2" + tough-cookie "^2.3.4" + w3c-hr-time "^1.0.1" + webidl-conversions "^4.0.2" + whatwg-encoding "^1.0.3" + whatwg-mimetype "^2.1.0" + whatwg-url "^6.4.1" + ws "^5.2.0" + xml-name-validator "^3.0.0" jsesc@^1.3.0: version "1.3.0" @@ -4184,8 +5864,9 @@ jsesc@^2.5.1: jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= -json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: +json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== @@ -4193,6 +5874,7 @@ json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1, json-parse-bet json-schema-traverse@^0.3.0: version "0.3.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= json-schema-traverse@^0.4.1: version "0.4.1" @@ -4202,21 +5884,27 @@ json-schema-traverse@^0.4.1: json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= -json-stable-stringify@^1.0.1: +json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json3@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" - integrity sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE= + version "3.3.3" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" + integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== + +json5@^0.5.0, json5@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= json5@^1.0.1: version "1.0.1" @@ -4225,103 +5913,36 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" +json5@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== + dependencies: + minimist "^1.2.0" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= dependencies: assert-plus "1.0.0" extsprintf "1.3.0" json-schema "0.2.3" verror "1.10.0" -jszip@^3.1.3: - version "3.1.5" - resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.1.5.tgz#e3c2a6c6d706ac6e603314036d43cd40beefdf37" - integrity sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ== - dependencies: - core-js "~2.3.0" - es6-promise "~3.0.2" - lie "~3.1.0" - pako "~1.0.2" - readable-stream "~2.0.6" - -karma-chrome-launcher@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz#cf1b9d07136cc18fe239327d24654c3dbc368acf" - dependencies: - fs-access "^1.0.0" - which "^1.2.1" - -karma-coverage-istanbul-reporter@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.4.tgz#402ae4ed6eadb9d9dafbd408ffda17897c0d003a" - integrity sha512-xJS7QSQIVU6VK9HuJ/ieE5yynxKhjCCkd96NLY/BX/HXsx0CskU9JJiMQbd4cHALiddMwI4OWh1IIzeWrsavJw== - dependencies: - istanbul-api "^2.0.5" - minimatch "^3.0.4" - -karma-jasmine-html-reporter@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-1.4.0.tgz#1abbd30d4509a8c82b96707ae7d2fa4da459ca19" - integrity sha512-0wxhwA8PLPpICZ4o2GRnPi67hf3JhfQm5WCB8nElh4qsE6wRNOTtrqooyBPNqI087Xr2SBhxLg5fU+BJ/qxRrw== - -karma-jasmine@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-2.0.1.tgz#26e3e31f2faf272dd80ebb0e1898914cc3a19763" - integrity sha512-iuC0hmr9b+SNn1DaUD2QEYtUxkS1J+bSJSn7ejdEexs7P8EYvA1CWkEdrDQ+8jVH3AgWlCNwjYsT1chjcNW9lA== - dependencies: - jasmine-core "^3.3" - -karma-source-map-support@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/karma-source-map-support/-/karma-source-map-support-1.3.0.tgz#36dd4d8ca154b62ace95696236fae37caf0a7dde" - integrity sha512-HcPqdAusNez/ywa+biN4EphGz62MmQyPggUsDfsHqa7tSe4jdsxgvTKuDfIazjL+IOxpVWyT7Pr4dhAV+sxX5Q== - dependencies: - source-map-support "^0.5.5" - -karma@~4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/karma/-/karma-4.0.0.tgz#f28e38a2b66243fde3f98e12a8dcaa2c6ff8ca9c" - integrity sha512-EFoFs3F6G0BcUGPNOn/YloGOb3h09hzTguyXlg6loHlKY76qbJikkcyPk43m2kfRF65TUGda/mig29QQtyhm1g== - dependencies: - bluebird "^3.3.0" - body-parser "^1.16.1" - chokidar "^2.0.3" - colors "^1.1.0" - combine-lists "^1.0.0" - connect "^3.6.0" - core-js "^2.2.0" - di "^0.0.1" - dom-serialize "^2.2.0" - expand-braces "^0.1.1" - flatted "^2.0.0" - glob "^7.1.1" - graceful-fs "^4.1.2" - http-proxy "^1.13.0" - isbinaryfile "^3.0.0" - lodash "^4.17.5" - log4js "^3.0.0" - mime "^2.3.1" - minimatch "^3.0.2" - optimist "^0.6.1" - qjobs "^1.1.4" - range-parser "^1.2.0" - rimraf "^2.6.0" - safe-buffer "^5.0.1" - socket.io "2.1.1" - source-map "^0.6.1" - tmp "0.0.33" - useragent "2.3.0" - -killable@^1.0.0: +killable@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/killable/-/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" integrity sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg== @@ -4329,32 +5950,51 @@ killable@^1.0.0: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== -lazy-cache@^2.0.2: +kleur@^2.0.1: version "2.0.2" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-2.0.2.tgz#b704f4944d95e255d038f0cb05fb8a602c55a300" + integrity sha512-77XF9iTllATmG9lSlIv0qdQ2BQ/h9t0bJllHlbvsQ0zUWfU7Yi0S8L5JXzPZgkefIiajLmBJJ4BsMJmqcf7oxQ== + +launch-editor-middleware@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/launch-editor-middleware/-/launch-editor-middleware-2.2.1.tgz#e14b07e6c7154b0a4b86a0fd345784e45804c157" + integrity sha512-s0UO2/gEGiCgei3/2UN3SMuUj1phjQN8lcpnvgLSz26fAzNWPQ6Nf/kF5IFClnfU2ehp6LrmKdMU/beveO+2jg== dependencies: - set-getter "^0.1.0" + launch-editor "^2.2.1" + +launch-editor@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/launch-editor/-/launch-editor-2.2.1.tgz#871b5a3ee39d6680fcc26d37930b6eeda89db0ca" + integrity sha512-On+V7K2uZK6wK7x691ycSUbLD/FyKKelArkbaAMSSJU8JmqmhwN2+mnJDNINuJWSrh2L0kDk+ZQtbC/gOWUwLw== + dependencies: + chalk "^2.3.0" + shell-quote "^1.6.1" lcid@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" @@ -4365,32 +6005,17 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" -less-loader@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-4.1.0.tgz#2c1352c5b09a4f84101490274fd51674de41363e" - integrity sha512-KNTsgCE9tMOM70+ddxp9yyt9iHqgmSs0yTZc5XH5Wo+g80RWRIYNqE58QJKm/yMud5wZEvz50ugRDuzVIkyahg== - dependencies: - clone "^2.1.1" - loader-utils "^1.1.0" - pify "^3.0.0" +left-pad@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" + integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -less@3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/less/-/less-3.9.0.tgz#b7511c43f37cf57dc87dffd9883ec121289b1474" - integrity sha512-31CmtPEZraNUtuUREYjSqRkeETFdyEHSEPAGq4erDlUXtda7pzNmctdljdIagSb589d/qXGWiiP31R5JVf+v0w== - dependencies: - clone "^2.1.2" - optionalDependencies: - errno "^0.1.1" - graceful-fs "^4.1.2" - image-size "~0.5.0" - mime "^1.4.1" - mkdirp "^0.5.0" - promise "^7.1.1" - request "^2.83.0" - source-map "~0.6.0" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= -levn@~0.3.0: +levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= @@ -4398,20 +6023,10 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -license-webpack-plugin@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-2.1.0.tgz#83acaa6e89c3c5316effdd80cb4ec9c5cd8efc2f" - integrity sha512-vDiBeMWxjE9n6TabQ9J4FH8urFdsRK0Nvxn1cit9biCiR9aq1zBR0X2BlAkEiIG6qPamLeU0GzvIgLkrFc398A== - dependencies: - "@types/webpack-sources" "^0.1.5" - webpack-sources "^1.2.0" - -lie@~3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e" - integrity sha1-mkNrLMd0bKWd56QfpGmz77dr2H4= - dependencies: - immediate "~3.0.5" +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= load-json-file@^1.0.0: version "1.1.0" @@ -4424,21 +6039,30 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -load-json-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" +loader-fs-cache@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/loader-fs-cache/-/loader-fs-cache-1.0.2.tgz#54cedf6b727e1779fd8f01205f05f6e88706f086" + integrity sha512-70IzT/0/L+M20jUlEqZhZyArTU6VKLRTYRDAYN26g4jfzpJqjipLL3/hgYpySqI9PwsVRHHFja0LfEmsx9X2Cw== dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" + find-cache-dir "^0.1.1" + mkdirp "0.5.1" -loader-runner@^2.3.0: +loader-runner@^2.3.0, loader-runner@^2.3.1: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== -loader-utils@1.2.3, loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0: +loader-utils@^0.2.16: + version "0.2.17" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" + integrity sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g= + dependencies: + big.js "^3.1.3" + emojis-list "^2.0.0" + json5 "^0.5.0" + object-assign "^4.0.1" + +loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" integrity sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA== @@ -4450,6 +6074,7 @@ loader-utils@1.2.3, loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1. locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -4462,55 +6087,62 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash.assign@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" - integrity sha1-DZnzzNem0mHRm9rrkkUAXShYCOc= - -lodash.clonedeep@^4.3.2, lodash.clonedeep@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" - integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= - -lodash.debounce@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= - -lodash.mergewith@^4.6.0: +lodash.defaultsdeep@^4.6.0: version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927" - integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ== + resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6" + integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== + +lodash.kebabcase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= + +lodash.mapvalues@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + integrity sha1-G6+lAF3p3W9PJmaMMMo3IwzJaJw= + +lodash.memoize@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= lodash.tail@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664" integrity sha1-0jM6NtnncXyK0vfKyv7HwytERmQ= -lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.4, lodash@~4.17.10: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash.transform@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.transform/-/lodash.transform-4.6.0.tgz#12306422f63324aed8483d3f38332b5f670547a0" + integrity sha1-EjBkIvYzJK7YSD0/ODMrX2cFR6A= -lodash@^4.17.5, lodash@^4.5.0: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +lodash.uniq@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -log4js@^3.0.0: - version "3.0.6" - resolved "https://registry.yarnpkg.com/log4js/-/log4js-3.0.6.tgz#e6caced94967eeeb9ce399f9f8682a4b2b28c8ff" - integrity sha512-ezXZk6oPJCWL483zj64pNkMuY/NcRX5MPiB0zE6tjZM137aeusrOnW1ecxgF9cmwMWkBMhjteQxBPoZBh9FDxQ== +lodash@4.x, lodash@^4.0.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@~4.17.10: + version "4.17.14" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" + integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== + +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + integrity sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg== dependencies: - circular-json "^0.5.5" - date-format "^1.2.0" - debug "^3.1.0" - rfdc "^1.1.2" - streamroller "0.7.0" + chalk "^2.0.1" -loglevel@^1.4.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa" - integrity sha1-4PyVEztu8nbNyIh82vJKpvFW+Po= +loglevel@^1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.3.tgz#77f2eb64be55a404c9fd04ad16d57c1d6d6b1280" + integrity sha512-LoEDv5pgpvWgPF4kNYuIp0qqSJVWak/dML0RY74xlzMZiT9w77teNAwKYKWBTYjlokMirg+o3jBwp+vlLrcfAA== loose-envify@^1.0.0: version "1.4.0" @@ -4527,14 +6159,12 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lru-cache@4.1.x, lru-cache@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" +lower-case@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" + integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= -lru-cache@^4.1.1, lru-cache@^4.1.2, lru-cache@^4.1.3: +lru-cache@^4.0.1, lru-cache@^4.1.1, lru-cache@^4.1.2, lru-cache@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== @@ -4549,40 +6179,27 @@ lru-cache@^5.1.1: dependencies: yallist "^3.0.2" -magic-string@^0.25.0: - version "0.25.1" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.1.tgz#b1c248b399cd7485da0fe7385c2fc7011843266e" - integrity sha512-sCuTz6pYom8Rlt4ISPFn6wuFodbKMIHUMv4Qko9P17dpxb7s52KJTmRuZZqHdGmLCK9AOcDare039nRIcfdkEg== - dependencies: - sourcemap-codec "^1.4.1" - -make-dir@^1.0.0, make-dir@^1.3.0: +make-dir@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" integrity sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ== dependencies: pify "^3.0.0" -make-error@^1.1.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.4.tgz#19978ed575f9e9545d2ff8c13e33b5d18a67d535" - -make-fetch-happen@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-4.0.1.tgz#141497cb878f243ba93136c83d8aba12c216c083" - integrity sha512-7R5ivfy9ilRJ1EMKIOziwrns9fGeAD4bAha8EB7BIiBBLHm2KeTUGCrICFt2rbHfzheTLynv50GnNTK1zDTrcQ== +make-dir@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" + integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== dependencies: - agentkeepalive "^3.4.1" - cacache "^11.0.1" - http-cache-semantics "^3.8.1" - http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" - lru-cache "^4.1.2" - mississippi "^3.0.0" - node-fetch-npm "^2.0.2" - promise-retry "^1.1.1" - socks-proxy-agent "^4.0.0" - ssri "^6.0.0" + pify "^4.0.1" + semver "^5.6.0" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= + dependencies: + tmpl "1.0.x" map-age-cleaner@^0.1.1: version "0.1.3" @@ -4594,6 +6211,7 @@ map-age-cleaner@^0.1.1: map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" @@ -4603,9 +6221,15 @@ map-obj@^1.0.0, map-obj@^1.0.1: map-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" +math-random@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c" + integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A== + md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -4615,26 +6239,33 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +mdn-data@~1.1.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.4.tgz#50b5d4ffc4575276573c4eedb8780812a8419f01" + integrity sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA== + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= mem@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= dependencies: mimic-fn "^1.0.0" mem@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.1.0.tgz#aeb9be2d21f47e78af29e4ac5978e8afa2ca5b8a" - integrity sha512-I5u6Q1x7wxO0kdOpYBB28xueHADYps5uty/zg936CiG8NTe5sJL8EjrCuLneuDW3PlMdZBGDIn8BirEVdovZvg== + version "4.3.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" + integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== dependencies: map-age-cleaner "^0.1.1" - mimic-fn "^1.0.0" + mimic-fn "^2.0.0" p-is-promise "^2.0.0" -memory-fs@^0.4.0, memory-fs@~0.4.1: +memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= @@ -4663,14 +6294,39 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= +merge-source-map@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646" + integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw== + dependencies: + source-map "^0.6.1" + +merge-stream@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-1.0.1.tgz#4041202d508a342ba00174008df0c251b8c135e1" + integrity sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE= + dependencies: + readable-stream "^2.0.1" + +merge2@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.2.3.tgz#7ee99dbd69bb6481689253f018488a1b902b0ed5" + integrity sha512-gdUU1Fwj5ep4kplwcmftruWofEFt6lfpkkr3h860CXbAB9c3hGb55EOL2ali0Td5oebvW0E1+3Sr+Ur7XfKpRA== + +merge@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.1.tgz#38bebf80c3220a8a487b6fcfb3941bb11720c145" + integrity sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ== + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -micromatch@^2.1.5: +micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + integrity sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU= dependencies: arr-diff "^2.0.0" array-unique "^0.2.1" @@ -4686,25 +6342,7 @@ micromatch@^2.1.5: parse-glob "^3.0.4" regex-cache "^0.4.2" -micromatch@^3.1.4: - version "3.1.9" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.9.tgz#15dc93175ae39e52e93087847096effc73efcf89" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -micromatch@^3.1.8, micromatch@^3.1.9: +micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== @@ -4731,53 +6369,45 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -"mime-db@>= 1.36.0 < 2", mime-db@~1.37.0: - version "1.37.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.37.0.tgz#0b6a0ce6fdbe9576e25f1f2d2fde8830dc0ad0d8" - integrity sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg== +mime-db@1.40.0, "mime-db@>= 1.40.0 < 2": + version "1.40.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" + integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== -mime-db@~1.33.0: - version "1.33.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" - -mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.18, mime-types@~2.1.7: - version "2.1.18" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" +mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24: + version "2.1.24" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" + integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== dependencies: - mime-db "~1.33.0" + mime-db "1.40.0" -mime-types@~2.1.19: - version "2.1.21" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.21.tgz#28995aa1ecb770742fe6ae7e58f9181c744b3f96" - integrity sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg== - dependencies: - mime-db "~1.37.0" - -mime@1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6" - integrity sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ== - -mime@^1.4.1: +mime@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.3.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.0.tgz#e051fd881358585f3279df333fe694da0bcffdd6" - integrity sha512-ikBcWwyqXQSHKtciCcctu9YfPbFYZ4+gbHEmE0Q8jzcTYQg5dHCr3g2wwAZjPoJfQVXZq6KXAjpXOTf5/cjT7w== +mime@^2.0.3, mime@^2.4.2: + version "2.4.4" + resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" + integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -mini-css-extract-plugin@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.5.0.tgz#ac0059b02b9692515a637115b0cc9fed3a35c7b0" - integrity sha512-IuaLjruM0vMKhUUT51fQdQzBYTX49dLj8w68ALEAe2A4iYNpIC4eMac67mt3NzycvjOlf07/kYxJDc0RTl1Wqw== +mimic-fn@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mini-css-extract-plugin@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.6.0.tgz#a3f13372d6fcde912f3ee4cd039665704801e3b9" + integrity sha512-79q5P7YGI6rdnVyIAV4NXpBQJFWdkzJxCim3Kog4078fM0piAaFlwocqbejdWtLW1cEzCexPrh6EdyFsPgVdAw== dependencies: loader-utils "^1.1.0" + normalize-url "^2.0.1" schema-utils "^1.0.0" webpack-sources "^1.1.0" @@ -4791,25 +6421,29 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -"minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -minipass@^2.2.1, minipass@^2.3.4, minipass@^2.3.5: +minipass@^2.2.1, minipass@^2.3.5: version "2.3.5" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.3.5.tgz#cacebe492022497f656b0f0f51e2682a9ed2d848" integrity sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA== @@ -4817,7 +6451,7 @@ minipass@^2.2.1, minipass@^2.3.4, minipass@^2.3.5: safe-buffer "^5.1.2" yallist "^3.0.0" -minizlib@^1.1.1: +minizlib@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.2.1.tgz#dd27ea6136243c7c880684e8672bb3a45fd9b614" integrity sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA== @@ -4857,8 +6491,9 @@ mississippi@^3.0.0: through2 "^2.0.0" mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" @@ -4871,15 +6506,17 @@ mixin-object@^2.0.1: for-in "^0.1.3" is-extendable "^0.1.1" -mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: +mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" + integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= dependencies: aproba "^1.1.1" copy-concurrently "^1.0.0" @@ -4891,12 +6528,18 @@ move-concurrently@^1.0.1: ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= -ms@^2.0.0, ms@^2.1.1: +ms@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + multicast-dns-service-types@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901" @@ -4915,25 +6558,30 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= -nan@^2.10.0, nan@^2.9.2: - version "2.12.1" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.12.1.tgz#7b1aa193e9aa86057e3c7bbd0ac448e770925552" - integrity sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw== +mz@^2.4.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" -nan@^2.3.0: - version "2.9.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" +nan@^2.12.1, nan@^2.13.2: + version "2.14.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" + integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" array-unique "^0.3.2" define-property "^2.0.2" extend-shallow "^3.0.2" fragment-cache "^0.2.1" - is-odd "^2.0.0" is-windows "^1.0.2" kind-of "^6.0.2" object.pick "^1.3.0" @@ -4941,37 +6589,49 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + needle@^2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e" - integrity sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA== + version "2.4.0" + resolved "https://registry.yarnpkg.com/needle/-/needle-2.4.0.tgz#6833e74975c444642590e15a750288c5f939b57c" + integrity sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg== dependencies: - debug "^2.1.2" + debug "^3.2.6" iconv-lite "^0.4.4" sax "^1.2.4" -negotiator@0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" +negotiator@0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" + integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== -neo-async@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835" - integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA== +neo-async@^2.5.0, neo-async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" + integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch-npm@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/node-fetch-npm/-/node-fetch-npm-2.0.2.tgz#7258c9046182dca345b4208eda918daf33697ff7" - integrity sha512-nJIxm1QmAj4v3nfCvEeCrYSoVwXyxLnaPBK5W1W5DGEJwjlKuC2VEUycGw5oxk+4zZahRrB84PUJJgEmhFTDFw== +no-case@^2.2.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac" + integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ== dependencies: - encoding "^0.1.11" - json-parse-better-errors "^1.0.0" - safe-buffer "^5.1.1" + lower-case "^1.1.1" + +node-cache@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-4.2.0.tgz#48ac796a874e762582692004a376d26dfa875811" + integrity sha512-obRu6/f7S024ysheAjoYFEEBqqDWv4LOMNJEuO8vMeEw2AT4z+NCzO4hlc2lhI4vATzbCQv6kke9FVdx0RbCOw== + dependencies: + clone "2.x" + lodash "4.x" node-forge@0.7.5: version "0.7.5" @@ -4996,10 +6656,24 @@ node-gyp@^3.8.0: tar "^2.0.0" which "1" +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + +node-ipc@^9.1.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/node-ipc/-/node-ipc-9.1.1.tgz#4e245ed6938e65100e595ebc5dc34b16e8dd5d69" + integrity sha512-FAyICv0sIRJxVp3GW5fzgaf9jwwRQxAKDJlmNFUL5hOy+W4X/I5AypyHoq0DXXbo9o/gt79gj++4cMr4jVWE/w== + dependencies: + event-pubsub "4.3.0" + js-message "1.0.5" + js-queue "2.0.0" + node-libs-browser@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.0.tgz#c72f60d9d46de08a940dedbb25f3ffa2f9bbaa77" - integrity sha512-5MQunG/oyOaBdttrL40dA7bUfPORLRWMUJLQtMg7nluxUvk5XwnLdL9twQHFAjRx/y7mIMkLKT9++qPbbk6BZA== + version "2.2.1" + resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.2.1.tgz#b64f513d18338625f90346d27b0d235e631f6425" + integrity sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q== dependencies: assert "^1.1.1" browserify-zlib "^0.2.0" @@ -5011,7 +6685,7 @@ node-libs-browser@^2.0.0: events "^3.0.0" https-browserify "^1.0.0" os-browserify "^0.3.0" - path-browserify "0.0.0" + path-browserify "0.0.1" process "^0.11.10" punycode "^1.2.4" querystring-es3 "^0.2.0" @@ -5023,12 +6697,23 @@ node-libs-browser@^2.0.0: tty-browserify "0.0.0" url "^0.11.0" util "^0.11.0" - vm-browserify "0.0.4" + vm-browserify "^1.0.1" -node-pre-gyp@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc" - integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A== +node-notifier@^5.2.1: + version "5.4.0" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.0.tgz#7b455fdce9f7de0c63538297354f3db468426e6a" + integrity sha512-SUDEb+o71XR5lXSTyivXd9J7fCloE3SyP4lSgt3lU2oSANiox+SxlNRGPjDKrwU1YN3ix2KN/VGGCg0t01rttQ== + dependencies: + growly "^1.3.0" + is-wsl "^1.1.0" + semver "^5.5.0" + shellwords "^0.1.1" + which "^1.3.0" + +node-pre-gyp@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149" + integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A== dependencies: detect-libc "^1.0.2" mkdirp "^0.5.1" @@ -5041,33 +6726,17 @@ node-pre-gyp@^0.10.0: semver "^5.3.0" tar "^4" -node-pre-gyp@^0.6.39: - version "0.6.39" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" - dependencies: - detect-libc "^1.0.2" - hawk "3.1.3" - mkdirp "^0.5.1" - nopt "^4.0.1" - npmlog "^4.0.2" - rc "^1.1.7" - request "2.81.0" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^2.2.1" - tar-pack "^3.4.0" - -node-releases@^1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.6.tgz#47d160033e24a64e79487a62de63cf691052ec54" - integrity sha512-lODUVHEIZutZx+TDdOk47qLik8FJMXzJ+WnyUGci1MTvTOyzZrz5eVPIIpc5Hb3NfHZGeGHeuwrRYVI1PEITWg== +node-releases@^1.1.25: + version "1.1.25" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.25.tgz#0c2d7dbc7fed30fbe02a9ee3007b8c90bf0133d3" + integrity sha512-fI5BXuk83lKEoZDdH3gRhtsNgh05/wZacuXkgbiYkceE7+QIMXOg98n9ZV7mz27B+kFHnqHcUpscZZlGRSmTpQ== dependencies: semver "^5.3.0" -node-sass@4.11.0: - version "4.11.0" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a" - integrity sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA== +node-sass@^4.9.0: + version "4.12.0" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.12.0.tgz#0914f531932380114a30cc5fa4fa63233a25f017" + integrity sha512-A1Iv4oN+Iel6EPv77/HddXErL2a+gZ4uBeZUy+a8O35CFYTXhgA8MgLCWBtwpGZdCvTvQ9d+bQxX/QC36GDPpQ== dependencies: async-foreach "^0.1.3" chalk "^1.1.1" @@ -5076,12 +6745,10 @@ node-sass@4.11.0: get-stdin "^4.0.1" glob "^7.0.3" in-publish "^2.0.0" - lodash.assign "^4.2.0" - lodash.clonedeep "^4.3.2" - lodash.mergewith "^4.6.0" + lodash "^4.17.11" meow "^3.7.0" mkdirp "^0.5.1" - nan "^2.10.0" + nan "^2.13.2" node-gyp "^3.8.0" npmlog "^4.0.0" request "^2.88.0" @@ -5089,112 +6756,103 @@ node-sass@4.11.0: stdout-stream "^1.4.0" "true-case-path" "^1.0.2" -"nopt@2 || 3", nopt@3.x: +"nopt@2 || 3": version "3.0.6" resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= dependencies: abbrev "1" -nopt@^4.0.1: +nopt@^4.0.1, nopt@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= dependencies: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.3.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" +normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== dependencies: hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" + resolve "^1.10.0" semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-package-data@^2.3.4, normalize-package-data@^2.4.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.2.tgz#6b2abd85774e51f7936f1395e45acb905dc849b2" - integrity sha512-YcMnjqeoUckXTPKZSAsPjUPLxH85XotbpqK3w4RyCwdFQSU5FxxBys8buehkSfg0j9fKvV1hn7O0+8reEgkAiw== - dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" +normalize-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" + integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k= -normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1: +normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= dependencies: remove-trailing-separator "^1.0.1" +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + normalize-range@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI= -npm-bundled@^1.0.1: - version "1.0.5" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.5.tgz#3c1732b7ba936b3a10325aef616467c0ccbcc979" - integrity sha512-m/e6jgWu8/v5niCUKQi9qQl8QdeEduFA96xHDDzFGqly0OOjI7c+60KM/2sppfnUU9JJagf+zs+yGhqSOFj71g== - -npm-package-arg@6.1.0, npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.0.tgz#15ae1e2758a5027efb4c250554b85a737db7fcc1" - integrity sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA== +normalize-url@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-2.0.1.tgz#835a9da1551fa26f70e92329069a23aa6574d7e6" + integrity sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw== dependencies: - hosted-git-info "^2.6.0" - osenv "^0.1.5" - semver "^5.5.0" - validate-npm-package-name "^3.0.0" + prepend-http "^2.0.0" + query-string "^5.0.1" + sort-keys "^2.0.0" -npm-packlist@^1.1.12, npm-packlist@^1.1.6: - version "1.2.0" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.2.0.tgz#55a60e793e272f00862c7089274439a4cc31fc7f" - integrity sha512-7Mni4Z8Xkx0/oegoqlcao/JpPCPEMtUvsmB0q7mgvlMinykJLSRTYuFqoQLYgGY8biuxIeiHO+QNJKbCfljewQ== +normalize-url@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" + integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== + +npm-bundled@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" + integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== + +npm-packlist@^1.1.6: + version "1.4.4" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.4.tgz#866224233850ac534b63d1a6e76050092b5d2f44" + integrity sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw== dependencies: ignore-walk "^3.0.1" npm-bundled "^1.0.1" -npm-pick-manifest@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-2.2.3.tgz#32111d2a9562638bb2c8f2bf27f7f3092c8fae40" - integrity sha512-+IluBC5K201+gRU85vFlUwX3PFShZAbAgDNp2ewJdWMVSppdo/Zih0ul2Ecky/X7b51J7LrrUAP+XOmOCvYZqA== - dependencies: - figgy-pudding "^3.5.1" - npm-package-arg "^6.0.0" - semver "^5.4.1" - -npm-registry-fetch@^3.8.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-3.9.0.tgz#44d841780e2833f06accb34488f8c7450d1a6856" - integrity sha512-srwmt8YhNajAoSAaDWndmZgx89lJwIZ1GWxOuckH4Coek4uHv5S+o/l9FLQe/awA+JwTnj4FJHldxhlXdZEBmw== - dependencies: - JSONStream "^1.3.4" - bluebird "^3.5.1" - figgy-pudding "^3.4.1" - lru-cache "^4.1.3" - make-fetch-happen "^4.0.1" - npm-package-arg "^6.1.0" - npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== dependencies: are-we-there-yet "~1.1.2" console-control-strings "~1.1.0" gauge "~2.7.3" set-blocking "~2.0.0" -null-check@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/null-check/-/null-check-1.0.0.tgz#977dffd7176012b9ec30d2a39db5cf72a0439edd" +nth-check@^1.0.2, nth-check@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c" + integrity sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg== + dependencies: + boolbase "~1.0.0" num2fraction@^1.2.2: version "1.2.2" @@ -5204,41 +6862,71 @@ num2fraction@^1.2.2: number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -oauth-sign@~0.8.1, oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" +nwsapi@^2.0.7: + version "2.1.4" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.1.4.tgz#e006a878db23636f8e8a67d33ca0e4edf61a842f" + integrity sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw== oauth-sign@~0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object-component@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= object-copy@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" +object-hash@^1.1.4: + version "1.3.1" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" + integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== + +object-keys@^1.0.11, object-keys@^1.0.12: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" +object.assign@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" + integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== + dependencies: + define-properties "^1.1.2" + function-bind "^1.1.1" + has-symbols "^1.0.0" + object-keys "^1.0.11" + +object.getownpropertydescriptors@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" + integrity sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.5.1" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + integrity sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo= dependencies: for-own "^0.1.4" is-extendable "^0.1.1" @@ -5246,9 +6934,20 @@ object.omit@^2.0.0: object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" +object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + obuf@^1.0.0, obuf@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" @@ -5257,17 +6956,19 @@ obuf@^1.0.0, obuf@^1.1.2: on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" + integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= dependencies: ee-first "1.1.1" -on-headers@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7" - integrity sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c= +on-headers@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.2.tgz#772b0ae6aaa525c399e489adfad90c403eb3c28f" + integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== -once@1.x, once@^1.3.0, once@^1.3.1, once@^1.3.3, once@^1.4.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" @@ -5278,21 +6979,34 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" -opn@5.4.0, opn@^5.1.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/opn/-/opn-5.4.0.tgz#cb545e7aab78562beb11aa3bfabc7042e1761035" - integrity sha512-YF9MNdVy/0qvJvDtunAOzFw9iasOQHpVthTCvGzxt61Il64AYSGdK+rYwld7NAfk9qJ7dt+hymBNSc9LNYS+Sw== +open@^6.3.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9" + integrity sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg== dependencies: is-wsl "^1.1.0" -optimist@^0.6.1, optimist@~0.6.0: +opener@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed" + integrity sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA== + +opn@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" + integrity sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA== + dependencies: + is-wsl "^1.1.0" + +optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= @@ -5304,6 +7018,18 @@ optionator@^0.8.1: type-check "~0.3.2" wordwrap "~1.0.0" +ora@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" + integrity sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg== + dependencies: + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-spinners "^2.0.0" + log-symbols "^2.2.0" + strip-ansi "^5.2.0" + wcwidth "^1.0.1" + original@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" @@ -5319,6 +7045,7 @@ os-browserify@^0.3.0: os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= os-locale@^1.4.0: version "1.4.0" @@ -5330,12 +7057,13 @@ os-locale@^1.4.0: os-locale@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== dependencies: execa "^0.7.0" lcid "^1.0.0" mem "^1.1.0" -os-locale@^3.0.0: +os-locale@^3.0.0, os-locale@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== @@ -5344,11 +7072,12 @@ os-locale@^3.0.0: lcid "^2.0.0" mem "^4.0.0" -os-tmpdir@^1.0.0, os-tmpdir@~1.0.1, os-tmpdir@~1.0.2: +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.4, osenv@^0.1.5: +osenv@0, osenv@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -5364,35 +7093,31 @@ p-defer@^1.0.0: p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-is-promise@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.0.0.tgz#7554e3d572109a87e1f3f53f6a7d85d1b194f4c5" - integrity sha512-pzQPhYMCAgLAKPWD2jC3Se9fEfrD9npNos0y150EeqZll7akhEgGhTW/slB6lHku8AvYGiJ+YJ5hfHKePPgFWg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" + integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== -p-limit@^1.0.0: +p-limit@^1.0.0, p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" -p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" - dependencies: - p-try "^1.0.0" - p-limit@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.1.0.tgz#1d5a0d20fb12707c758a655f6bbc4386b5930d68" - integrity sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g== + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.0.tgz#417c9941e6027a9abcba5092dd2904e255b5fbc2" + integrity sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ== dependencies: p-try "^2.0.0" p-locate@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" @@ -5403,70 +7128,60 @@ p-locate@^3.0.0: dependencies: p-limit "^2.0.0" -p-map@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" - integrity sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA== +p-map@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + +p-retry@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328" + integrity sha512-XE6G4+YTTkT2a0UWb2kjZe8xNwf8bIbnqpc/IS/idOBVhyves0mK5OJgeocjx7q5pvX/6m23xuzVPYT1uGM73w== + dependencies: + retry "^0.12.0" p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" - integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== -pacote@9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-9.4.0.tgz#af979abdeb175cd347c3e33be3241af1ed254807" - integrity sha512-WQ1KL/phGMkedYEQx9ODsjj7xvwLSpdFJJdEXrLyw5SILMxcTNt5DTxT2Z93fXuLFYJBlZJdnwdalrQdB/rX5w== - dependencies: - bluebird "^3.5.3" - cacache "^11.3.2" - figgy-pudding "^3.5.1" - get-stream "^4.1.0" - glob "^7.1.3" - lru-cache "^5.1.1" - make-fetch-happen "^4.0.1" - minimatch "^3.0.4" - minipass "^2.3.5" - mississippi "^3.0.0" - mkdirp "^0.5.1" - normalize-package-data "^2.4.0" - npm-package-arg "^6.1.0" - npm-packlist "^1.1.12" - npm-pick-manifest "^2.2.3" - npm-registry-fetch "^3.8.0" - osenv "^0.1.5" - promise-inflight "^1.0.1" - promise-retry "^1.1.1" - protoduck "^5.0.1" - rimraf "^2.6.2" - safe-buffer "^5.1.2" - semver "^5.6.0" - ssri "^6.0.1" - tar "^4.4.8" - unique-filename "^1.1.1" - which "^1.3.1" - -pako@~1.0.2, pako@~1.0.5: - version "1.0.8" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.8.tgz#6844890aab9c635af868ad5fecc62e8acbba3ea4" - integrity sha512-6i0HVbUfcKaTv+EG8ZTr75az7GFXcLYk9UyLEg7Notv/Ma+z/UG3TCoz6GiNeOrn1E/e63I0X/Hpw18jHOTUnA== +pako@~1.0.5: + version "1.0.10" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.10.tgz#4328badb5086a426aa90f541977d4955da5c9732" + integrity sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw== parallel-transform@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/parallel-transform/-/parallel-transform-1.1.0.tgz#d410f065b05da23081fcd10f28854c29bda33b06" + integrity sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY= dependencies: cyclist "~0.2.2" inherits "^2.0.3" readable-stream "^2.1.5" +param-case@2.1.x: + version "2.1.1" + resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247" + integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc= + dependencies: + no-case "^2.2.0" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-asn1@^5.0.0: - version "5.1.3" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.3.tgz#1600c6cc0727365d68b97f3aa78939e735a75204" - integrity sha512-VrPoetlz7B/FqjBLD2f5wBVZvsZVLnRUrxVLfRYhGXCODa/NWE4p3Wp+6+aV3ZPL3KM7/OZmxDIwwijD7yuucg== + version "5.1.4" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.4.tgz#37f6628f823fbdeb2273b4d540434a22f3ef1fcc" + integrity sha512-Qs5duJcuvNExRfFZ99HDD3z4mAi3r9Wl/FOjEOijlxwCZs7E7mW2vjTpgQ4J8LpTF8x5v+1Vn5UQFejmWT11aw== dependencies: asn1.js "^4.0.0" browserify-aes "^1.0.0" @@ -5478,6 +7193,7 @@ parse-asn1@^5.0.0: parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + integrity sha1-ssN2z7EfNVE7rdFz7wu246OIORw= dependencies: glob-base "^0.3.0" is-dotfile "^1.0.0" @@ -5487,6 +7203,7 @@ parse-glob@^3.0.4: parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck= dependencies: error-ex "^1.2.0" @@ -5498,39 +7215,40 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" -parse5@4.0.0: +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + +parse5@4.0.0, parse5@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== -parseqs@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d" - dependencies: - better-assert "~1.0.0" - -parseuri@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/parseuri/-/parseuri-0.0.5.tgz#80204a50d4dbb779bfdc6ebe2778d90e4bce320a" - dependencies: - better-assert "~1.0.0" - -parseurl@~1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3" +parseurl@~1.3.2, parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= -path-browserify@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" - integrity sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo= +path-browserify@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" + integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= path-exists@^2.0.0: version "2.1.0" @@ -5542,24 +7260,24 @@ path-exists@^2.0.0: path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= -path-is-absolute@^1.0.0: +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.1: +path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -path-parse@^1.0.6: +path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== @@ -5578,12 +7296,6 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -path-type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" - dependencies: - pify "^2.0.0" - path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -5602,31 +7314,44 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" -performance-now@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -pify@^2.0.0, pify@^2.3.0: +pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= pify@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= + +pify@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" + integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q= + dependencies: + find-up "^1.0.0" pkg-dir@^2.0.0: version "2.0.0" @@ -5642,10 +7367,27 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -portfinder@^1.0.9: - version "1.0.20" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.20.tgz#bea68632e54b2e13ab7b0c4775e9b41bf270e44a" - integrity sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw== +pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" + integrity sha1-yBmscoBZpGHKscOImivjxJoATX8= + dependencies: + find-up "^2.1.0" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== + +pn@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" + integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA== + +portfinder@^1.0.20: + version "1.0.21" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.21.tgz#60e1397b95ac170749db70034ece306b9a27e324" + integrity sha512-ESabpDCzmBS3ekHbmpAIiESq3udRsCBGiBZLsC+HgBKv2ezb0R4oG+7RnYEVZ/ZCfhel5Tx3UzdNWA0Lox2QCA== dependencies: async "^1.5.2" debug "^2.2.0" @@ -5654,26 +7396,74 @@ portfinder@^1.0.9: posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= -postcss-import@12.0.1: - version "12.0.1" - resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-12.0.1.tgz#cf8c7ab0b5ccab5649024536e565f841928b7153" - integrity sha512-3Gti33dmCjyKBgimqGxL3vcV8w9+bsHwO5UrBawp796+jdardbcFl4RP5w/76BwNL7aGzpKstIfF9I+kdE8pTw== +postcss-calc@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.1.tgz#36d77bab023b0ecbb9789d84dcb23c4941145436" + integrity sha512-oXqx0m6tb4N3JGdmeMSc/i91KppbYsFZKdH0xMOqK8V1rJlzrKlTdokz8ozUXLVejydRN6u2IddxpcijRj2FqQ== dependencies: - postcss "^7.0.1" - postcss-value-parser "^3.2.3" - read-cache "^1.0.0" - resolve "^1.1.7" + css-unit-converter "^1.1.1" + postcss "^7.0.5" + postcss-selector-parser "^5.0.0-rc.4" + postcss-value-parser "^3.3.1" + +postcss-colormin@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-4.0.3.tgz#ae060bce93ed794ac71264f08132d550956bd381" + integrity sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw== + dependencies: + browserslist "^4.0.0" + color "^3.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-convert-values@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz#ca3813ed4da0f812f9d43703584e449ebe189a7f" + integrity sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-discard-comments@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz#1fbabd2c246bff6aaad7997b2b0918f4d7af4033" + integrity sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg== + dependencies: + postcss "^7.0.0" + +postcss-discard-duplicates@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz#3fe133cd3c82282e550fc9b239176a9207b784eb" + integrity sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ== + dependencies: + postcss "^7.0.0" + +postcss-discard-empty@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz#c8c951e9f73ed9428019458444a02ad90bb9f765" + integrity sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w== + dependencies: + postcss "^7.0.0" + +postcss-discard-overridden@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz#652aef8a96726f029f5e3e00146ee7a4e755ff57" + integrity sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg== + dependencies: + postcss "^7.0.0" postcss-load-config@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-2.0.0.tgz#f1312ddbf5912cd747177083c5ef7a19d62ee484" - integrity sha512-V5JBLzw406BB8UIfsAWSK2KSwIJ5yoEIVFb4gVkXci0QdKgA24jLmHZ/ghe/GgX0lJ0/D1uUK1ejhzEY94MChQ== + version "2.1.0" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-2.1.0.tgz#c84d692b7bb7b41ddced94ee62e8ab31b417b003" + integrity sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q== dependencies: - cosmiconfig "^4.0.0" + cosmiconfig "^5.0.0" import-cwd "^2.0.0" -postcss-loader@3.0.0: +postcss-loader@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-3.0.0.tgz#6b97943e47c72d845fa9e03f273773d4e8dd6c2d" integrity sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA== @@ -5683,15 +7473,269 @@ postcss-loader@3.0.0: postcss-load-config "^2.0.0" schema-utils "^1.0.0" -postcss-value-parser@^3.2.3, postcss-value-parser@^3.3.1: +postcss-merge-longhand@^4.0.11: + version "4.0.11" + resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz#62f49a13e4a0ee04e7b98f42bb16062ca2549e24" + integrity sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw== + dependencies: + css-color-names "0.0.4" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + stylehacks "^4.0.0" + +postcss-merge-rules@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz#362bea4ff5a1f98e4075a713c6cb25aefef9a650" + integrity sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ== + dependencies: + browserslist "^4.0.0" + caniuse-api "^3.0.0" + cssnano-util-same-parent "^4.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" + vendors "^1.0.0" + +postcss-minify-font-values@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz#cd4c344cce474343fac5d82206ab2cbcb8afd5a6" + integrity sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-minify-gradients@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz#93b29c2ff5099c535eecda56c4aa6e665a663471" + integrity sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q== + dependencies: + cssnano-util-get-arguments "^4.0.0" + is-color-stop "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-minify-params@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz#6b9cef030c11e35261f95f618c90036d680db874" + integrity sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg== + dependencies: + alphanum-sort "^1.0.0" + browserslist "^4.0.0" + cssnano-util-get-arguments "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + uniqs "^2.0.0" + +postcss-minify-selectors@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz#e2e5eb40bfee500d0cd9243500f5f8ea4262fbd8" + integrity sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g== + dependencies: + alphanum-sort "^1.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" + +postcss-modules-extract-imports@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.1.tgz#dc87e34148ec7eab5f791f7cd5849833375b741a" + integrity sha512-6jt9XZwUhwmRUhb/CkyJY020PYaPJsCyt3UjbaWo6XEbH/94Hmv6MP7fG2C5NDU/BcHzyGYxNtHvM+LTf9HrYw== + dependencies: + postcss "^6.0.1" + +postcss-modules-local-by-default@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069" + integrity sha1-99gMOYxaOT+nlkRmvRlQCn1hwGk= + dependencies: + css-selector-tokenizer "^0.7.0" + postcss "^6.0.1" + +postcss-modules-scope@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90" + integrity sha1-1upkmUx5+XtipytCb75gVqGUu5A= + dependencies: + css-selector-tokenizer "^0.7.0" + postcss "^6.0.1" + +postcss-modules-values@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20" + integrity sha1-7P+p1+GSUYOJ9CrQ6D9yrsRW6iA= + dependencies: + icss-replace-symbols "^1.1.0" + postcss "^6.0.1" + +postcss-normalize-charset@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz#8b35add3aee83a136b0471e0d59be58a50285dd4" + integrity sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g== + dependencies: + postcss "^7.0.0" + +postcss-normalize-display-values@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz#0dbe04a4ce9063d4667ed2be476bb830c825935a" + integrity sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ== + dependencies: + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-positions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz#05f757f84f260437378368a91f8932d4b102917f" + integrity sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA== + dependencies: + cssnano-util-get-arguments "^4.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-repeat-style@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz#c4ebbc289f3991a028d44751cbdd11918b17910c" + integrity sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q== + dependencies: + cssnano-util-get-arguments "^4.0.0" + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-string@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz#cd44c40ab07a0c7a36dc5e99aace1eca4ec2690c" + integrity sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA== + dependencies: + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-timing-functions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz#8e009ca2a3949cdaf8ad23e6b6ab99cb5e7d28d9" + integrity sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A== + dependencies: + cssnano-util-get-match "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-unicode@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz#841bd48fdcf3019ad4baa7493a3d363b52ae1cfb" + integrity sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg== + dependencies: + browserslist "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-url@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz#10e437f86bc7c7e58f7b9652ed878daaa95faae1" + integrity sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA== + dependencies: + is-absolute-url "^2.0.0" + normalize-url "^3.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-normalize-whitespace@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz#bf1d4070fe4fcea87d1348e825d8cc0c5faa7d82" + integrity sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA== + dependencies: + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-ordered-values@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz#0cf75c820ec7d5c4d280189559e0b571ebac0eee" + integrity sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw== + dependencies: + cssnano-util-get-arguments "^4.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-reduce-initial@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz#7fd42ebea5e9c814609639e2c2e84ae270ba48df" + integrity sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA== + dependencies: + browserslist "^4.0.0" + caniuse-api "^3.0.0" + has "^1.0.0" + postcss "^7.0.0" + +postcss-reduce-transforms@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz#17efa405eacc6e07be3414a5ca2d1074681d4e29" + integrity sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg== + dependencies: + cssnano-util-get-match "^4.0.0" + has "^1.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + +postcss-selector-parser@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz#4f875f4afb0c96573d5cf4d74011aee250a7e865" + integrity sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU= + dependencies: + dot-prop "^4.1.1" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-selector-parser@^5.0.0, postcss-selector-parser@^5.0.0-rc.4: + version "5.0.0" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-5.0.0.tgz#249044356697b33b64f1a8f7c80922dddee7195c" + integrity sha512-w+zLE5Jhg6Liz8+rQOWEAwtwkyqpfnmsinXjXg6cY7YIONZZtgvE0v2O0uhQBs0peNomOJwWRKt6JBfTdTd3OQ== + dependencies: + cssesc "^2.0.0" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-svgo@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-4.0.2.tgz#17b997bc711b333bab143aaed3b8d3d6e3d38258" + integrity sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw== + dependencies: + is-svg "^3.0.0" + postcss "^7.0.0" + postcss-value-parser "^3.0.0" + svgo "^1.0.0" + +postcss-unique-selectors@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz#9446911f3289bfd64c6d680f073c03b1f9ee4bac" + integrity sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg== + dependencies: + alphanum-sort "^1.0.0" + postcss "^7.0.0" + uniqs "^2.0.0" + +postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== -postcss@7.0.14, postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.13: - version "7.0.14" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.14.tgz#4527ed6b1ca0d82c53ce5ec1a2041c2346bbd6e5" - integrity sha512-NsbD6XUUMZvBxtQAJuWDJeeC4QFsmWsfozWxCJPWf3M55K9iu2iMDaKqyoOdTJ1R4usBXuxlVFAIo8rZPQD4Bg== +postcss-value-parser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d" + integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ== + +postcss@^6.0.1, postcss@^6.0.23: + version "6.0.23" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" + integrity sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag== + dependencies: + chalk "^2.4.1" + source-map "^0.6.1" + supports-color "^5.4.0" + +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.5: + version "7.0.17" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" + integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== dependencies: chalk "^2.4.2" source-map "^0.6.1" @@ -5702,82 +7746,103 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prepend-http@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" + integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= + preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks= -prettier@^1.16.4: - version "1.16.4" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717" - integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +prettier@1.16.3: + version "1.16.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.3.tgz#8c62168453badef702f34b45b6ee899574a6a65d" + integrity sha512-kn/GU6SMRYPxUakNXhpP0EedT/KmaPzr0H5lIsDogrykbaxOpOfAFfk5XA7DZrJyMAv1wlMV3CPcZruGXVVUZw== + +prettier@^1.15.2: + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== + +pretty-error@^2.0.2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3" + integrity sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM= + dependencies: + renderkid "^2.0.1" + utila "~0.4" + +pretty-format@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.6.0.tgz#5eaac8eeb6b33b987b7fe6097ea6a8a146ab5760" + integrity sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw== + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +pretty@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pretty/-/pretty-2.0.0.tgz#adbc7960b7bbfe289a557dc5f737619a220d06a5" + integrity sha1-rbx5YLe7/iiaVX3F9zdhmiINBqU= + dependencies: + condense-newlines "^0.2.1" + extend-shallow "^2.0.1" + js-beautify "^1.6.12" + +private@^0.1.6, private@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== process@^0.11.10: version "0.11.10" resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" + integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= -promise-retry@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d" - integrity sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0= +prompts@^0.1.9: + version "0.1.14" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-0.1.14.tgz#a8e15c612c5c9ec8f8111847df3337c9cbd443b2" + integrity sha512-rxkyiE9YH6zAz/rZpywySLKkpaj0NMVyNw1qhsubdbjjSgcayjTShDreZGlFMcGSu5sab3bAKPfFk78PB90+8w== dependencies: - err-code "^1.0.0" - retry "^0.10.0" + kleur "^2.0.1" + sisteransi "^0.1.1" -promise@^7.1.1: - version "7.3.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" - integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== - dependencies: - asap "~2.0.3" +proto-list@~1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= -protoduck@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/protoduck/-/protoduck-5.0.1.tgz#03c3659ca18007b69a50fd82a7ebcc516261151f" - integrity sha512-WxoCeDCoCBY55BMvj4cAEjdVUFGRWed9ZxPlqTKYyw1nDDTQ4pqmnIMAGfJlg7Dx35uB/M+PHJPTmGOvaCaPTg== - dependencies: - genfun "^5.0.0" - -protractor@~5.4.2: - version "5.4.2" - resolved "https://registry.yarnpkg.com/protractor/-/protractor-5.4.2.tgz#329efe37f48b2141ab9467799be2d4d12eb48c13" - integrity sha512-zlIj64Cr6IOWP7RwxVeD8O4UskLYPoyIcg0HboWJL9T79F1F0VWtKkGTr/9GN6BKL+/Q/GmM7C9kFVCfDbP5sA== - dependencies: - "@types/q" "^0.0.32" - "@types/selenium-webdriver" "^3.0.0" - blocking-proxy "^1.0.0" - browserstack "^1.5.1" - chalk "^1.1.3" - glob "^7.0.3" - jasmine "2.8.0" - jasminewd2 "^2.1.0" - optimist "~0.6.0" - q "1.4.1" - saucelabs "^1.5.0" - selenium-webdriver "3.6.0" - source-map-support "~0.4.0" - webdriver-js-extender "2.1.0" - webdriver-manager "^12.0.6" - -proxy-addr@~2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" - integrity sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA== +proxy-addr@~2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" + integrity sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ== dependencies: forwarded "~0.1.2" - ipaddr.js "1.8.0" + ipaddr.js "1.9.0" prr@~1.0.1: version "1.0.1" @@ -5787,11 +7852,12 @@ prr@~1.0.1: pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= -psl@^1.1.24: - version "1.1.31" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.1.31.tgz#e9aa86d0101b5b105cbe93ac6b784cd547276184" - integrity sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw== +psl@^1.1.24, psl@^1.1.28: + version "1.2.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.2.0.tgz#df12b5b1b3a30f51c329eacbdef98f3a6e136dc6" + integrity sha512-GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA== public-encrypt@^4.0.0: version "4.0.3" @@ -5808,6 +7874,7 @@ public-encrypt@^4.0.0: pump@^2.0.0, pump@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/pump/-/pump-2.0.1.tgz#12399add6e4cf7526d973cbc8b5ce2e2908b3909" + integrity sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA== dependencies: end-of-stream "^1.1.0" once "^1.3.1" @@ -5821,10 +7888,11 @@ pump@^3.0.0: once "^1.3.1" pumpify@^1.3.3: - version "1.4.0" - resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.4.0.tgz#80b7c5df7e24153d03f0e7ac8a05a5d068bd07fb" + version "1.5.1" + resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.5.1.tgz#36513be246ab27570b1a374a5ce278bfd74370ce" + integrity sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ== dependencies: - duplexify "^3.5.3" + duplexify "^3.6.0" inherits "^2.0.3" pump "^2.0.0" @@ -5836,36 +7904,36 @@ punycode@1.3.2: punycode@^1.2.4, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= -punycode@^2.1.0: +punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -q@1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e" - -q@^1.4.1: +q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" + integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= -qjobs@^1.1.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/qjobs/-/qjobs-1.2.0.tgz#c45e9c61800bd087ef88d7e256423bdd49e5d071" +qs@6.7.0: + version "6.7.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" + integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ== -qs@6.5.1, qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - -qs@6.5.2, qs@~6.5.2: +qs@~6.5.2: version "6.5.2" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" +query-string@^5.0.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb" + integrity sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw== + dependencies: + decode-uri-component "^0.2.0" + object-assign "^4.1.0" + strict-uri-encode "^1.0.0" querystring-es3@^0.2.0: version "0.2.1" @@ -5877,22 +7945,24 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= -querystringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.0.tgz#7ded8dfbf7879dcc60d0a644ac6754b283ad17ef" - integrity sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg== +querystringify@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" + integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" +randomatic@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed" + integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.6.tgz#d302c522948588848a8d300c932b44c24231da80" - integrity sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A== + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" @@ -5904,47 +7974,21 @@ randomfill@^1.0.3: randombytes "^2.0.5" safe-buffer "^5.1.0" -range-parser@^1.0.3, range-parser@^1.2.0, range-parser@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" - integrity sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4= +range-parser@^1.2.1, range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" +raw-body@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.4.0.tgz#a1ce6fb9c9bc356ca52e89256ab59059e13d0332" + integrity sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== dependencies: - bytes "3.0.0" - http-errors "1.6.2" - iconv-lite "0.4.19" + bytes "3.1.0" + http-errors "1.7.2" + iconv-lite "0.4.24" unpipe "1.0.0" -raw-body@2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3" - integrity sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw== - dependencies: - bytes "3.0.0" - http-errors "1.6.3" - iconv-lite "0.4.23" - unpipe "1.0.0" - -raw-loader@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-1.0.0.tgz#3f9889e73dadbda9a424bce79809b4133ad46405" - integrity sha512-Uqy5AqELpytJTRxYT4fhltcKPj0TyaEpzJDcGz7DFJi+pQOOi3GjR/DOdxTkTsF+NzhnldIoG6TORaBlInUuqA== - dependencies: - loader-utils "^1.1.0" - schema-utils "^1.0.0" - -rc@^1.1.7: - version "1.2.5" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.5.tgz#275cd687f6e3b36cc756baa26dfee80a790301fd" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -5955,13 +7999,6 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -read-cache@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774" - integrity sha1-5mTvMRYRZsl1HNvo28+GtftY93Q= - dependencies: - pify "^2.3.0" - read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -5970,13 +8007,6 @@ read-pkg-up@^1.0.1: find-up "^1.0.0" read-pkg "^1.0.0" -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - read-pkg@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" @@ -5986,27 +8016,17 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" -read-pkg@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" +read-pkg@^5.0.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" -"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0: - version "2.3.4" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.0.3" - util-deprecate "~1.0.1" - -readable-stream@^2.0.1, readable-stream@^2.3.3, readable-stream@^2.3.6: +"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== @@ -6019,42 +8039,30 @@ readable-stream@^2.0.1, readable-stream@^2.3.3, readable-stream@^2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.6: - version "3.1.1" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.1.1.tgz#ed6bbc6c5ba58b090039ff18ce670515795aeb06" - integrity sha512-DkN66hPyqDhnIQ6Jcsvx9bFjhw214O4poMBcIMgPVpQvNy9a0e0Uhg5SqySyDKAmUlwt8LonTBz1ezOnM8pUdA== +readable-stream@^3.0.6, readable-stream@^3.1.1: + version "3.4.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" + integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" util-deprecate "^1.0.1" -readable-stream@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" - integrity sha1-j5A0HmilPMySh4jaz80Rs265t44= +readdirp@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525" + integrity sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ== dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - -readdirp@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" - dependencies: - graceful-fs "^4.1.2" - minimatch "^3.0.2" + graceful-fs "^4.1.11" + micromatch "^3.1.10" readable-stream "^2.0.2" - set-immediate-shim "^1.0.1" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= +realpath-native@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.1.0.tgz#2003294fea23fb0672f2476ebe22fcf498a2d65c" + integrity sha512-wlgPA6cCIIg9gKz0fgAPjnzh4yR/LnXovwuo9hvyGvx3h8nX4+/iLZplfUWasXpqD8BdnGnP5njOFjkUwPzvjA== dependencies: - resolve "^1.1.6" + util.promisify "^1.0.0" redent@^1.0.0: version "1.0.0" @@ -6064,65 +8072,140 @@ redent@^1.0.0: indent-string "^2.1.0" strip-indent "^1.0.1" -reflect-metadata@^0.1.2: - version "0.1.12" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.12.tgz#311bf0c6b63cd782f228a81abe146a2bfa9c56f2" +regenerate-unicode-properties@^8.0.2: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== + dependencies: + regenerate "^1.4.0" -regenerate@^1.2.1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" +regenerate@^1.2.1, regenerate@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" + integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== +regenerator-runtime@^0.13.2: + version "0.13.2" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz#32e59c9a6fb9b1a4aff09b4930ca2d4477343447" + integrity sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA== + +regenerator-transform@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.0.tgz#2ca9aaf7a2c239dd32e4761218425b8c7a86ecaf" + integrity sha512-rtOelq4Cawlbmq9xuMR5gdFmv7ku/sFoB7sRiywx7aq53bc52b4j6zvH7Te1Vt/X2YveDKnCGUbioieU7FEL3w== + dependencies: + private "^0.1.6" + regex-cache@^0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + integrity sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ== dependencies: is-equal-shallow "^0.1.3" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexp-tree@^0.1.6: + version "0.1.11" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" + integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== + +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" + integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== + +regexpp@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" + integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== + regexpu-core@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" + integrity sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs= dependencies: regenerate "^1.2.1" regjsgen "^0.2.0" regjsparser "^0.1.4" +regexpu-core@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" + integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.0.2" + regjsgen "^0.5.0" + regjsparser "^0.6.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.1.0" + regjsgen@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" + integrity sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc= + +regjsgen@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.0.tgz#a7634dc08f89209c2049adda3525711fb97265dd" + integrity sha512-RnIrLhrXCX5ow/E5/Mh2O4e/oa1/jW0eaBKTSy3LaCj+M3Bqvm97GWDp2yUtzIs4LEn65zR2yiYGFqb2ApnzDA== regjsparser@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" + integrity sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw= dependencies: jsesc "~0.5.0" +regjsparser@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.0.tgz#f1e6ae8b7da2bae96c99399b868cd6c933a2ba9c" + integrity sha512-RQ7YyokLiQBomUJuUG8iGVvkgOLxwyZM8k6d3q5SAXpg4r5TZJZigKFvC6PpD+qQ98bCDC5YelPeA3EucDoNeQ== + dependencies: + jsesc "~0.5.0" + +relateurl@0.2.x: + version "0.2.7" + resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" + integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + +renderkid@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149" + integrity sha512-z8CLQp7EZBPCwCnncgf9C4XAi3WR0dv+uWu/PjIyhhAb5d6IJ/QZqlHFprHeKT+59//V6BNUsLbvN8+2LarxGA== + dependencies: + css-select "^1.1.0" + dom-converter "^0.2" + htmlparser2 "^3.3.0" + strip-ansi "^3.0.0" + utila "^0.4.0" repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" - -repeat-string@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-0.2.2.tgz#c7a8d3236068362059a7e4651fc6884e8b1fb4ae" + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= repeating@^2.0.0: version "2.0.1" @@ -6131,61 +8214,23 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" +request-promise-core@1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.2.tgz#339f6aababcafdb31c799ff158700336301d3346" + integrity sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag== dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" + lodash "^4.17.11" -request@^2.78.0: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" +request-promise-native@^1.0.5, request-promise-native@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.7.tgz#a49868a624bdea5069f1251d0a836e0d89aa2c59" + integrity sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w== dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" + request-promise-core "1.1.2" + stealthy-require "^1.1.1" + tough-cookie "^2.3.3" -request@^2.83.0, request@^2.87.0, request@^2.88.0: +request@^2.87.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -6214,21 +8259,36 @@ request@^2.83.0, request@^2.87.0, request@^2.88.0: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - -require-from-string@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-main-filename@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= -requires-port@1.x.x, requires-port@^1.0.0: +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= +reselect@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/reselect/-/reselect-3.0.1.tgz#efdaa98ea7451324d092b2b2163a6a1d7a9a2147" + integrity sha1-79qpjqdFEyTQkrKyFjpqHXqaIUc= + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -6236,33 +8296,38 @@ resolve-cwd@^2.0.0: dependencies: resolve-from "^3.0.0" +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= + resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" integrity sha1-six699nWiBvItuZTM17rywoYh0g= +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@1.1.x: +resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.6, resolve@^1.1.7: - version "1.10.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" - integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== +resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.8.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" + integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: path-parse "^1.0.6" -resolve@^1.3.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" - dependencies: - path-parse "^1.0.5" - restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -6274,22 +8339,29 @@ restore-cursor@^2.0.0: ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -retry@^0.10.0: - version "0.10.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4" - integrity sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q= +retry@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= -rfdc@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.1.2.tgz#e6e72d74f5dc39de8f538f65e00c36c18018e349" - integrity sha512-92ktAgvZhBzYTIK0Mja9uen5q5J3NRVMoDkJL2VMwq6SXjVCgqvQeVP2XAaUY6HT+XpQYeLSjb3UoitBryKmdA== +rgb-regex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" + integrity sha1-wODWiC3w4jviVKR16O3UGRX+rrE= -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1, rimraf@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" +rgba-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" + integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= + +rimraf@2, rimraf@2.6.3, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@~2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== dependencies: - glob "^7.0.5" + glob "^7.1.3" ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" @@ -6299,6 +8371,11 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rsvp@^3.3.3: + version "3.6.2" + resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" + integrity sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw== + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -6309,47 +8386,67 @@ run-async@^2.2.0: run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" + integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= dependencies: aproba "^1.1.1" -rw@1: - version "1.3.3" - resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + integrity sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74= + dependencies: + rx-lite "*" -rxjs@6.3.3: - version "6.3.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55" - integrity sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw== +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= + +rxjs@^6.4.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" + integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== dependencies: tslib "^1.9.0" -rxjs@^6.1.0, rxjs@^6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.4.0.tgz#f3bb0fe7bda7fb69deac0c16f17b50b0b8790504" - integrity sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw== - dependencies: - tslib "^1.9.0" - -safe-buffer@5.1.2, safe-buffer@^5.1.0, safe-buffer@^5.1.2: +safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +sane@^2.0.0: + version "2.5.2" + resolved "https://registry.yarnpkg.com/sane/-/sane-2.5.2.tgz#b4dc1861c21b427e929507a3e751e2a2cb8ab3fa" + integrity sha1-tNwYYcIbQn6SlQej51HiosuKs/o= + dependencies: + anymatch "^2.0.0" + capture-exit "^1.2.0" + exec-sh "^0.2.0" + fb-watchman "^2.0.0" + micromatch "^3.1.4" + minimist "^1.1.1" + walker "~1.0.5" + watch "~0.18.0" + optionalDependencies: + fsevents "^1.2.3" + sass-graph@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.4.tgz#13fbd63cd1caf0908b9fd93476ad43a51d1e0b49" @@ -6360,7 +8457,7 @@ sass-graph@^2.2.4: scss-tokenizer "^0.2.3" yargs "^7.0.0" -sass-loader@7.1.0: +sass-loader@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.1.0.tgz#16fd5138cb8b424bf8a759528a1972d72aad069d" integrity sha512-+G+BKGglmZM2GUSfT9TLuEp6tzehHPjAMoRRItOojWIqIGPloVCMhNIQuG639eJ+y033PaGTSjLaTHts8Kw79w== @@ -6372,30 +8469,11 @@ sass-loader@7.1.0: pify "^3.0.0" semver "^5.5.0" -saucelabs@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/saucelabs/-/saucelabs-1.5.0.tgz#9405a73c360d449b232839919a86c396d379fd9d" - integrity sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ== - dependencies: - https-proxy-agent "^2.2.1" - -sax@0.5.x: - version "0.5.8" - resolved "https://registry.yarnpkg.com/sax/-/sax-0.5.8.tgz#d472db228eb331c2506b0e8c15524adb939d12c1" - integrity sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE= - -sax@>=0.6.0, sax@^1.2.4: +sax@^1.2.4, sax@~1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -schema-utils@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.3.0.tgz#f5877222ce3e931edae039f17eb3716e7137f8cf" - integrity sha1-9YdyIs4+kx7a4DnxfrNxbnE3+M8= - dependencies: - ajv "^5.0.0" - schema-utils@^0.4.4: version "0.4.7" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" @@ -6426,54 +8504,32 @@ select-hose@^2.0.0: resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= -selenium-webdriver@3.6.0, selenium-webdriver@^3.0.1: - version "3.6.0" - resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz#2ba87a1662c020b8988c981ae62cb2a01298eafc" - integrity sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q== - dependencies: - jszip "^3.1.3" - rimraf "^2.5.4" - tmp "0.0.30" - xml2js "^0.4.17" - -selfsigned@^1.9.1: +selfsigned@^1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-1.10.4.tgz#cdd7eccfca4ed7635d47a08bf2d5d3074092e2cd" integrity sha512-9AukTiDmHXGXWtWjembZ5NDmVvP2695EtpgbCsxCa68w3c88B+alqbmZ4O3hZ4VWGXeGWzEVdvqgAJD8DQPCDw== dependencies: node-forge "0.7.5" -semver-dsl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/semver-dsl/-/semver-dsl-1.0.1.tgz#d3678de5555e8a61f629eed025366ae5f27340a0" - dependencies: - semver "^5.3.0" +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: + version "5.7.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" + integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== -semver-intersect@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/semver-intersect/-/semver-intersect-1.4.0.tgz#bdd9c06bedcdd2fedb8cd352c3c43ee8c61321f3" - integrity sha512-d8fvGg5ycKAq0+I6nfWeCx6ffaWJCsBYU0H2Rq56+/zFePYfT8mXkB3tWBSjR5BerkHNZ5eTPIk1/LBYas35xQ== - dependencies: - semver "^5.0.0" - -"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" - -semver@5.6.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== +semver@^6.0.0, semver@^6.1.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" + integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= -send@0.16.2: - version "0.16.2" - resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" - integrity sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw== +send@0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" + integrity sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg== dependencies: debug "2.6.9" depd "~1.1.2" @@ -6482,19 +8538,19 @@ send@0.16.2: escape-html "~1.0.3" etag "~1.8.1" fresh "0.5.2" - http-errors "~1.6.2" - mime "1.4.1" - ms "2.0.0" + http-errors "~1.7.2" + mime "1.6.0" + ms "2.1.1" on-finished "~2.3.0" - range-parser "~1.2.0" - statuses "~1.4.0" + range-parser "~1.2.1" + statuses "~1.5.0" -serialize-javascript@^1.4.0: - version "1.6.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.6.1.tgz#4d1f697ec49429a847ca6f442a2a755126c4d879" - integrity sha512-A5MOagrPFga4YaKQSWHryl7AXvbQkEqpw4NNYMTNYUNV51bA8ABHgYFpqKx+YFFrw59xMV1qGH1R4AgoNIVgCw== +serialize-javascript@^1.4.0, serialize-javascript@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.7.0.tgz#d6e0dfb2a3832a8c94468e6eb1db97e55a192a65" + integrity sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA== -serve-index@^1.7.2: +serve-index@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" integrity sha1-03aNabHn2C5c4FD/9bRTvqEqkjk= @@ -6507,42 +8563,25 @@ serve-index@^1.7.2: mime-types "~2.1.17" parseurl "~1.3.2" -serve-static@1.13.2: - version "1.13.2" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.13.2.tgz#095e8472fd5b46237db50ce486a43f4b86c6cec1" - integrity sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw== +serve-static@1.14.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" + integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== dependencies: encodeurl "~1.0.2" escape-html "~1.0.3" - parseurl "~1.3.2" - send "0.16.2" + parseurl "~1.3.3" + send "0.17.1" set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-getter@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" - dependencies: - to-object-path "^0.3.0" - -set-immediate-shim@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" - -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" - dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" - -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" +set-value@^2.0.0, set-value@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" + integrity sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw== dependencies: extend-shallow "^2.0.1" is-extendable "^0.1.1" @@ -6554,15 +8593,16 @@ setimmediate@^1.0.4: resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= -setprototypeof@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" - setprototypeof@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656" integrity sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ== +setprototypeof@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" + integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== + sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.11" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" @@ -6583,40 +8623,82 @@ shallow-clone@^1.0.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= -shelljs@^0.8.1: - version "0.8.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" - integrity sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A== +shell-quote@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" + integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" + array-filter "~0.0.0" + array-map "~0.0.0" + array-reduce "~0.0.0" + jsonify "~0.0.0" + +shellwords@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== + +sigmund@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA= signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + dependencies: + is-arrayish "^0.3.1" + +sisteransi@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-0.1.1.tgz#5431447d5f7d1675aac667ccd0b865a4994cb3ce" + integrity sha512-PmGOd02bM9YO5ifxpw36nrNMBTptEtfRl4qUYl9SndkolplkrZZOW7PGHjrZL53QvMVj9nQ+TKqUnRsw4tJa4g== + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= -smart-buffer@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.0.2.tgz#5207858c3815cc69110703c6b94e46c15634395d" - integrity sha512-JDhEpTKzXusOqXZ0BUIdH+CjFdO/CR3tLlf5CN34IypI+xMmXW1uB16OOY8z3cICbJlDAVJzNbwBhNO0wt9OAw== +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" + integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== + +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== + dependencies: + is-fullwidth-code-point "^2.0.0" + +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== + dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" + is-fullwidth-code-point "^2.0.0" snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" isobject "^3.0.0" @@ -6625,12 +8707,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.1.tgz#e12b5487faded3e3dea0ac91e9400bf75b401370" + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" debug "^2.2.0" @@ -6639,64 +8723,7 @@ snapdragon@^0.8.1: map-cache "^0.2.2" source-map "^0.5.6" source-map-resolve "^0.5.0" - use "^2.0.0" - -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" - dependencies: - hoek "2.x.x" - -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - dependencies: - hoek "4.x.x" - -socket.io-adapter@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz#2a805e8a14d6372124dd9159ad4502f8cb07f06b" - -socket.io-client@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-2.1.1.tgz#dcb38103436ab4578ddb026638ae2f21b623671f" - integrity sha512-jxnFyhAuFxYfjqIgduQlhzqTcOEQSn+OHKVfAxWaNWa7ecP7xSNk2Dx/3UEsDcY7NcFafxvNvKPmmO7HTwTxGQ== - dependencies: - backo2 "1.0.2" - base64-arraybuffer "0.1.5" - component-bind "1.0.0" - component-emitter "1.2.1" - debug "~3.1.0" - engine.io-client "~3.2.0" - has-binary2 "~1.0.2" - has-cors "1.1.0" - indexof "0.0.1" - object-component "0.0.3" - parseqs "0.0.5" - parseuri "0.0.5" - socket.io-parser "~3.2.0" - to-array "0.1.4" - -socket.io-parser@~3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-3.2.0.tgz#e7c6228b6aa1f814e6148aea325b51aa9499e077" - integrity sha512-FYiBx7rc/KORMJlgsXysflWx/RIvtqZbyGLlHZvjfmPTPeuD/I8MaW7cfFrj5tRltICJdgwflhfZ3NVVbVLFQA== - dependencies: - component-emitter "1.2.1" - debug "~3.1.0" - isarray "2.0.1" - -socket.io@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-2.1.1.tgz#a069c5feabee3e6b214a75b40ce0652e1cfb9980" - integrity sha512-rORqq9c+7W0DAK3cleWNSyfv/qKXV99hV4tZe+gGLfBECw3XEhBy7x85F3wypA9688LKjtwO9pX9L33/xQI8yA== - dependencies: - debug "~3.1.0" - engine.io "~3.2.0" - has-binary2 "~1.0.2" - socket.io-adapter "~1.1.0" - socket.io-client "2.1.1" - socket.io-parser "~3.2.0" + use "^3.1.0" sockjs-client@1.3.0: version "1.3.0" @@ -6718,133 +8745,91 @@ sockjs@0.3.19: faye-websocket "^0.10.0" uuid "^3.0.1" -socks-proxy-agent@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-4.0.1.tgz#5936bf8b707a993079c6f37db2091821bffa6473" - integrity sha512-Kezx6/VBguXOsEe5oU3lXYyKMi4+gva72TwJ7pQY5JfqUx2nMk7NXA6z/mpNqIlfQjWYVfeuNvQjexiTaTn6Nw== +sort-keys@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-2.0.0.tgz#658535584861ec97d730d6cf41822e1f56684128" + integrity sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg= dependencies: - agent-base "~4.2.0" - socks "~2.2.0" - -socks@~2.2.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.2.3.tgz#7399ce11e19b2a997153c983a9ccb6306721f2dc" - integrity sha512-+2r83WaRT3PXYoO/1z+RDEBE7Z2f9YcdQnJ0K/ncXXbV5gJ6wYfNAebYFYiiUjM6E4JyXnPY8cimwyvFYHVUUA== - dependencies: - ip "^1.1.5" - smart-buffer "4.0.2" + is-plain-obj "^1.0.0" source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -source-list-map@~0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" - integrity sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY= - -source-map-loader@0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-0.2.4.tgz#c18b0dc6e23bf66f6792437557c569a11e072271" - integrity sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ== +source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: - async "^2.5.0" - loader-utils "^1.1.0" - -source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" - dependencies: - atob "^2.0.0" + atob "^2.1.1" decode-uri-component "^0.2.0" resolve-url "^0.2.1" source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@0.5.10, source-map-support@^0.5.5, source-map-support@^0.5.6, source-map-support@~0.5.6: - version "0.5.10" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c" - integrity sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ== +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + integrity sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA== + dependencies: + source-map "^0.5.6" + +source-map-support@^0.5.6, source-map-support@~0.5.12: + version "0.5.12" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599" + integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ== dependencies: buffer-from "^1.0.0" source-map "^0.6.0" -source-map-support@~0.4.0: - version "0.4.18" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" - dependencies: - source-map "^0.5.6" - source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= -source-map@0.1.x: - version "0.1.43" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" - integrity sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y= - dependencies: - amdefine ">=0.0.4" - -source-map@0.5.6: - version "0.5.6" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" - integrity sha1-dc449SvwczxafwwRjYEzSiu19BI= - -source-map@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - -source-map@^0.4.2, source-map@~0.4.1: +source-map@^0.4.2: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" integrity sha1-66T12pwNyZneaAMti092FzZSA2s= dependencies: amdefine ">=0.0.4" -source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - -source-map@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d" - integrity sha1-2rc/vPwrqBm03gO9b26qSBZLP50= - dependencies: - amdefine ">=0.0.4" - -sourcemap-codec@^1.4.1: - version "1.4.4" - resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.4.tgz#c63ea927c029dd6bd9a2b7fa03b3fec02ad56e9f" - integrity sha512-CYAPYdBu34781kLHkaW3m6b/uUSyMOC2R61gcYMWooeuaGtjof86ZA/8T+qVPPt7np1085CR9hmMGrySwEc8Xg== + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== spdx-correct@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" + version "3.1.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" + integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== spdx-expression-parse@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== dependencies: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== spdy-transport@^3.0.0: version "3.0.0" @@ -6869,39 +8854,31 @@ spdy@^4.0.0: select-hose "^2.0.0" spdy-transport "^3.0.0" -speed-measure-webpack-plugin@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/speed-measure-webpack-plugin/-/speed-measure-webpack-plugin-1.3.0.tgz#c7ffafef513df3d63d5d546c8fc1986dfc4969aa" - integrity sha512-b9Yd0TrzceMVYSbuamM1sFsGM1oVfyFTM22gOoyLhymNvBVApuYpkdFOgYkKJpN/KhTpcCYcTGHg7X+FJ33Vvw== - dependencies: - chalk "^2.0.1" - split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" -sprintf-js@^1.0.3: - version "1.1.1" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.1.tgz#36be78320afe5801f6cea3ee78b6e5aab940ea0c" - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== dependencies: asn1 "~0.2.3" assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" ecc-jsbn "~0.1.1" + getpass "^0.1.1" jsbn "~0.1.0" + safer-buffer "^2.0.2" tweetnacl "~0.14.0" ssri@^5.2.4: @@ -6911,40 +8888,41 @@ ssri@^5.2.4: dependencies: safe-buffer "^5.1.1" -ssri@^6.0.0, ssri@^6.0.1: +ssri@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== dependencies: figgy-pudding "^3.5.1" +stable@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf" + integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== + +stack-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8" + integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA== + +stackframe@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.0.4.tgz#357b24a992f9427cba6b545d96a14ed2cbca187b" + integrity sha512-to7oADIniaYwS3MhtCa/sQhrxidCCQiF/qp4/m5iN3ipf0Y7Xlri0f6eG29r08aL7JYl8n32AF3Q5GYBZ7K8vw== + static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" object-copy "^0.1.0" -stats-webpack-plugin@0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/stats-webpack-plugin/-/stats-webpack-plugin-0.7.0.tgz#ccffe9b745de8bbb155571e063f8263fc0e2bc06" - integrity sha512-NT0YGhwuQ0EOX+uPhhUcI6/+1Sq/pMzNuSCBVT4GbFl/ac6I/JZefBcjlECNfAb1t3GOx5dEj1Z7x0cAxeeVLQ== - dependencies: - lodash "^4.17.4" - -"statuses@>= 1.3.1 < 2", statuses@~1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.4.0.tgz#bb73d446da2796106efcc1b601a253d6c46bd087" - -"statuses@>= 1.4.0 < 2": +"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= -statuses@~1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" - stdout-stream@^1.4.0: version "1.4.1" resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" @@ -6952,6 +8930,11 @@ stdout-stream@^1.4.0: dependencies: readable-stream "^2.0.1" +stealthy-require@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b" + integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks= + stream-browserify@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" @@ -6961,8 +8944,9 @@ stream-browserify@^2.0.1: readable-stream "^2.0.2" stream-each@^1.1.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.2.tgz#8e8c463f91da8991778765873fe4d960d8f616bd" + version "1.2.3" + resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" + integrity sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw== dependencies: end-of-stream "^1.1.0" stream-shift "^1.0.0" @@ -6981,26 +8965,31 @@ stream-http@^2.7.2: stream-shift@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" + integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= -streamroller@0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-0.7.0.tgz#a1d1b7cf83d39afb0d63049a5acbf93493bdf64b" - integrity sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ== +strict-uri-encode@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" + integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= dependencies: - date-format "^1.2.0" - debug "^3.1.0" - mkdirp "^0.5.1" - readable-stream "^2.3.0" + astral-regex "^1.0.0" + strip-ansi "^4.0.0" string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: +"string-width@^1.0.2 || 2", string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -7008,6 +8997,33 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string.prototype.padend@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0" + integrity sha1-86rvfBcZ8XDF6rHDK/eA2W4h8vA= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.4.3" + function-bind "^1.0.2" + +string.prototype.padstart@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/string.prototype.padstart/-/string.prototype.padstart-3.0.0.tgz#5bcfad39f4649bb2d031292e19bcf0b510d4b242" + integrity sha1-W8+tOfRkm7LQMSkuGbzwtRDUskI= + dependencies: + define-properties "^1.1.2" + es-abstract "^1.4.3" + function-bind "^1.0.2" + string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" @@ -7015,16 +9031,6 @@ string_decoder@^1.0.0, string_decoder@^1.1.1: dependencies: safe-buffer "~5.1.0" -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -7032,28 +9038,31 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringstream@~0.0.4, stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.0.0.tgz#f78f68b5d0866c20b2c9b8c61b5298508dc8756f" - integrity sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow== +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== dependencies: - ansi-regex "^4.0.0" + ansi-regex "^4.1.0" + +strip-bom@3.0.0, strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= strip-bom@^2.0.0: version "2.0.0" @@ -7062,13 +9071,10 @@ strip-bom@^2.0.0: dependencies: is-utf8 "^0.2.0" -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= strip-indent@^1.0.1: version "1.0.1" @@ -7077,63 +9083,44 @@ strip-indent@^1.0.1: dependencies: get-stdin "^4.0.1" -strip-json-comments@~2.0.1: +strip-indent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" + integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= + +strip-json-comments@^2.0.0, strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -style-loader@0.23.1: - version "0.23.1" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.23.1.tgz#cb9154606f3e771ab6c4ab637026a1049174d925" - integrity sha512-XK+uv9kWwhZMZ1y7mysB+zoihsEj4wneFWAS5qoiLwzW0WzSqMrrsIy+a3zkQJq0ipFtBpX5W3MqyRIBF/WFGg== +stylehacks@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5" + integrity sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g== dependencies: - loader-utils "^1.1.0" - schema-utils "^1.0.0" - -stylus-loader@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/stylus-loader/-/stylus-loader-3.0.2.tgz#27a706420b05a38e038e7cacb153578d450513c6" - integrity sha512-+VomPdZ6a0razP+zinir61yZgpw2NfljeSsdUF5kJuEzlo3khXhY19Fn6l8QQz1GRJGtMCo8nG5C04ePyV7SUA== - dependencies: - loader-utils "^1.0.2" - lodash.clonedeep "^4.5.0" - when "~3.6.x" - -stylus@0.54.5: - version "0.54.5" - resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.54.5.tgz#42b9560931ca7090ce8515a798ba9e6aa3d6dc79" - integrity sha1-QrlWCTHKcJDOhRWnmLqeaqPW3Hk= - dependencies: - css-parse "1.7.x" - debug "*" - glob "7.0.x" - mkdirp "0.5.x" - sax "0.5.x" - source-map "0.1.x" + browserslist "^4.0.0" + postcss "^7.0.0" + postcss-selector-parser "^3.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= -supports-color@^3.1.0: +supports-color@^3.1.2: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" integrity sha1-ZawFBLOVQXHYpklGsq48u4pfVPY= dependencies: has-flag "^1.0.0" -supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0: +supports-color@^5.3.0, supports-color@^5.4.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -supports-color@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" - dependencies: - has-flag "^3.0.0" - supports-color@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.1.0.tgz#0764abc69c63d5ac842dd4867e8d025e880df8f3" @@ -7141,82 +9128,163 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" -symbol-observable@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" - integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== +svg-tags@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" + integrity sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q= + +svgo@^1.0.0: + version "1.2.2" + resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.2.2.tgz#0253d34eccf2aed4ad4f283e11ee75198f9d7316" + integrity sha512-rAfulcwp2D9jjdGu+0CuqlrAUin6bBWrpoqXWwKDZZZJfXcUXQSxLJOFJCQCSA0x0pP2U0TxSlJu2ROq5Bq6qA== + dependencies: + chalk "^2.4.1" + coa "^2.0.2" + css-select "^2.0.0" + css-select-base-adapter "^0.1.1" + css-tree "1.0.0-alpha.28" + css-url-regex "^1.1.0" + csso "^3.5.1" + js-yaml "^3.13.1" + mkdirp "~0.5.1" + object.values "^1.1.0" + sax "~1.2.4" + stable "^0.1.8" + unquote "~1.1.1" + util.promisify "~1.0.0" + +symbol-tree@^3.2.2: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +table@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + integrity sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA== + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + +table@^5.2.3: + version "5.4.1" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.1.tgz#0691ae2ebe8259858efb63e550b6d5f9300171e8" + integrity sha512-E6CK1/pZe2N75rGZQotFOdmzWQ1AILtgYbMAbAjvms0S1l5IDB47zG3nCnFGB/w+7nB3vKofbLXCH7HPBo864w== + dependencies: + ajv "^6.9.1" + lodash "^4.17.11" + slice-ansi "^2.1.0" + string-width "^3.0.0" tapable@^1.0.0, tapable@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.1.tgz#4d297923c5a72a42360de2ab52dadfaaec00018e" - integrity sha512-9I2ydhj8Z9veORCw5PRm4u9uebCn0mcCa6scWoNcbZ6dAtoo2618u9UUzxgmsCOreJpqDDuv61LvwofW7hLcBA== + version "1.1.3" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" + integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA== -tar-pack@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" - dependencies: - debug "^2.2.0" - fstream "^1.0.10" - fstream-ignore "^1.0.5" - once "^1.3.3" - readable-stream "^2.1.4" - rimraf "^2.5.1" - tar "^2.2.1" - uid-number "^0.0.6" - -tar@^2.0.0, tar@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" - integrity sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE= +tar@^2.0.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" + integrity sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA== dependencies: block-stream "*" - fstream "^1.0.2" + fstream "^1.0.12" inherits "2" -tar@^4, tar@^4.4.8: - version "4.4.8" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.8.tgz#b19eec3fde2a96e64666df9fdb40c5ca1bc3747d" - integrity sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ== +tar@^4: + version "4.4.10" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.10.tgz#946b2810b9a5e0b26140cf78bea6b0b0d689eba1" + integrity sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA== dependencies: chownr "^1.1.1" fs-minipass "^1.2.5" - minipass "^2.3.4" - minizlib "^1.1.1" + minipass "^2.3.5" + minizlib "^1.2.1" mkdirp "^0.5.0" safe-buffer "^5.1.2" - yallist "^3.0.2" + yallist "^3.0.3" -terser-webpack-plugin@1.2.1, terser-webpack-plugin@^1.1.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.2.1.tgz#7545da9ae5f4f9ae6a0ac961eb46f5e7c845cc26" - integrity sha512-GGSt+gbT0oKcMDmPx4SRSfJPE1XaN3kQRWG4ghxKQw9cn5G9x6aCKSsgYdvyM0na9NJ4Drv0RG6jbBByZ5CMjw== +terser-webpack-plugin@^1.1.0, terser-webpack-plugin@^1.2.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz#69aa22426299f4b5b3775cbed8cb2c5d419aa1d4" + integrity sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg== dependencies: - cacache "^11.0.2" + cacache "^11.3.2" find-cache-dir "^2.0.0" + is-wsl "^1.1.0" + loader-utils "^1.2.3" schema-utils "^1.0.0" - serialize-javascript "^1.4.0" + serialize-javascript "^1.7.0" source-map "^0.6.1" - terser "^3.8.1" - webpack-sources "^1.1.0" - worker-farm "^1.5.2" + terser "^4.0.0" + webpack-sources "^1.3.0" + worker-farm "^1.7.0" -terser@^3.8.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.14.1.tgz#cc4764014af570bc79c79742358bd46926018a32" - integrity sha512-NSo3E99QDbYSMeJaEk9YW2lTg3qS9V0aKGlb+PlOrei1X02r1wSBHCNX/O+yeTRFSWPKPIGj6MqvvdqV4rnVGw== +terser@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.2.tgz#b2656c8a506f7ce805a3f300a2ff48db022fa391" + integrity sha512-jvNoEQSPXJdssFwqPSgWjsOrb+ELoE+ILpHPKXC83tIxOlh2U75F1KuB2luLD/3a6/7K3Vw5pDn+hvu0C4AzSw== dependencies: - commander "~2.17.1" + commander "^2.20.0" source-map "~0.6.1" - source-map-support "~0.5.6" + source-map-support "~0.5.12" + +test-exclude@^4.2.1: + version "4.2.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.3.tgz#a9a5e64474e4398339245a0a769ad7c2f4a97c20" + integrity sha512-SYbXgY64PT+4GAL2ocI3HwPa4Q4TBKm0cwAVeKOt/Aoc0gSpNRjJX8w0pA1LMKZ3LBmd8pYBqApFNQLII9kavA== + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +text-table@^0.2.0, text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.0" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" + integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= + dependencies: + any-promise "^1.0.0" + +thread-loader@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/thread-loader/-/thread-loader-2.1.2.tgz#f585dd38e852c7f9cded5d092992108148f5eb30" + integrity sha512-7xpuc9Ifg6WU+QYw/8uUqNdRwMD+N5gjwHKMqETrs96Qn+7BHwECpt2Brzr4HFlf4IAkZsayNhmGdbkBsTJ//w== + dependencies: + loader-runner "^2.3.1" + loader-utils "^1.1.0" + neo-async "^2.6.0" + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= through2@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" + version "2.0.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" + integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== dependencies: - readable-stream "^2.1.5" + readable-stream "~2.3.6" xtend "~4.0.1" -"through@>=2.2.7 <3", through@X.X.X, through@^2.3.6: +through@^2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= @@ -7233,22 +9301,22 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" -tmp@0.0.30: - version "0.0.30" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.30.tgz#72419d4a8be7d6ce75148fd8b324e593a711c2ed" - dependencies: - os-tmpdir "~1.0.1" +timsort@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= -tmp@0.0.33, tmp@0.0.x, tmp@^0.0.33: +tmp@^0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== dependencies: os-tmpdir "~1.0.2" -to-array@0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890" +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= to-arraybuffer@^1.0.0: version "1.0.1" @@ -7268,12 +9336,14 @@ to-fast-properties@^2.0.0: to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -7281,17 +9351,30 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" extend-shallow "^3.0.2" regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@~2.3.0, tough-cookie@~2.3.3: - version "2.3.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" +toidentifier@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" + integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== + +toposort@^1.0.0: + version "1.0.7" + resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" + integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= + +tough-cookie@^2.3.3, tough-cookie@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== dependencies: - punycode "^1.4.1" + psl "^1.1.28" + punycode "^2.1.1" tough-cookie@~2.4.3: version "2.4.3" @@ -7301,10 +9384,12 @@ tough-cookie@~2.4.3: psl "^1.1.24" punycode "^1.4.1" -tree-kill@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a" - integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q== +tr46@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" + integrity sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk= + dependencies: + punycode "^2.1.0" trim-newlines@^1.0.0: version "1.0.0" @@ -7314,6 +9399,7 @@ trim-newlines@^1.0.0: trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= "true-case-path@^1.0.2": version "1.0.3" @@ -7322,55 +9408,25 @@ trim-right@^1.0.1: dependencies: glob "^7.1.2" -ts-node@~8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.0.2.tgz#9ecdf8d782a0ca4c80d1d641cbb236af4ac1b756" - integrity sha512-MosTrinKmaAcWgO8tqMjMJB22h+sp3Rd1i4fdoWY4mhBDekOwIAKI/bzmRi7IcbCmjquccYg2gcF6NBkLgr0Tw== - dependencies: - arg "^4.1.0" - diff "^3.1.0" - make-error "^1.1.1" - source-map-support "^0.5.6" - yn "^3.0.0" +tryer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8" + integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -tslib@^1.8.0, tslib@^1.8.1: - version "1.9.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" +tsconfig@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7" + integrity sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw== + dependencies: + "@types/strip-bom" "^3.0.0" + "@types/strip-json-comments" "0.0.30" + strip-bom "^3.0.0" + strip-json-comments "^2.0.0" tslib@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== - -tslint-config-prettier@^1.18.0: - version "1.18.0" - resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" - integrity sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg== - -tslint@~5.12.1: - version "5.12.1" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.12.1.tgz#8cec9d454cf8a1de9b0a26d7bdbad6de362e52c1" - integrity sha512-sfodBHOucFg6egff8d1BvuofoOQ/nOeYNfbp7LDlKBcLNrL3lmS5zoiDGyOMdT7YsEXAwWpTdAHwOGOc8eRZAw== - dependencies: - babel-code-frame "^6.22.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^3.2.0" - glob "^7.1.1" - js-yaml "^3.7.0" - minimatch "^3.0.4" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.8.0" - tsutils "^2.27.2" - -tsutils@^2.27.2: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== tty-browserify@0.0.0: version "0.0.0" @@ -7380,12 +9436,14 @@ tty-browserify@0.0.0: tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= dependencies: safe-buffer "^5.0.1" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= type-check@~0.3.2: version "0.3.2" @@ -7394,52 +9452,82 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-is@~1.6.15, type-is@~1.6.16: - version "1.6.16" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.16.tgz#f89ce341541c672b25ee7ae3c73dee3b2be50194" - integrity sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q== +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + +type-is@~1.6.17, type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== dependencies: media-typer "0.3.0" - mime-types "~2.1.18" + mime-types "~2.1.24" typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@3.2.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" - integrity sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg== - -typescript@3.2.4, typescript@~3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d" - integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg== - -uglify-js@^3.1.4: - version "3.4.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3" - integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q== +uglify-js@3.4.x: + version "3.4.10" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.10.tgz#9ad9563d8eb3acdfb8d38597d2af1d815f6a755f" + integrity sha512-Y2VsbPVs0FIshJztycsO2SfPk7/KAF/T72qzv9u5EpQ4kB2hQoHlhNQTsNyy6ul7lQtqJN/AoWeS23OzEiEFxw== dependencies: - commander "~2.17.1" + commander "~2.19.0" source-map "~0.6.1" -uid-number@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" +uglify-js@^3.1.4: + version "3.6.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" + integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg== + dependencies: + commander "~2.20.0" + source-map "~0.6.1" -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" +unicode-canonical-property-names-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" + integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== + +unicode-match-property-ecmascript@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" + integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== + dependencies: + unicode-canonical-property-names-ecmascript "^1.0.4" + unicode-property-aliases-ecmascript "^1.0.4" + +unicode-match-property-value-ecmascript@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz#5b4b426e08d13a80365e0d657ac7a6c1ec46a277" + integrity sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g== + +unicode-property-aliases-ecmascript@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz#a9cc6cc7ce63a0a3023fc99e341b94431d405a57" + integrity sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw== union-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + version "1.0.1" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" + integrity sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg== dependencies: arr-union "^3.1.0" get-value "^2.0.6" is-extendable "^0.1.1" - set-value "^0.4.3" + set-value "^2.0.1" + +uniq@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" + integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= + +uniqs@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02" + integrity sha1-/+3ks2slKQaW5uFl1KWe25mOawI= unique-filename@^1.1.0, unique-filename@^1.1.1: version "1.1.1" @@ -7449,26 +9537,44 @@ unique-filename@^1.1.0, unique-filename@^1.1.1: unique-slug "^2.0.0" unique-slug@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.0.tgz#db6676e7c7cc0629878ff196097c78855ae9f4ab" + version "2.0.2" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" + integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== dependencies: imurmurhash "^0.1.4" +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + +unquote@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/unquote/-/unquote-1.1.1.tgz#8fded7324ec6e88a0ff8b905e7c098cdc086d544" + integrity sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ= unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" isobject "^3.0.0" -upath@^1.0.5: - version "1.1.0" - resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.0.tgz#35256597e46a581db4793d0ce47fa9aebfc9fabd" - integrity sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw== +upath@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.1.2.tgz#3db658600edaeeccbe6db5e684d67ee8c2acd068" + integrity sha512-kXpym8nmDmlCBr7nKdIx8P2jNBa+pBpIUFRnKJ4dr8htyYGJFokkr2ZvERRtUN+9SY+JqXouNgUPtv6JQva/2Q== + +upper-case@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598" + integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg= uri-js@^4.2.2: version "4.2.2" @@ -7480,13 +9586,23 @@ uri-js@^4.2.2: urix@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + +url-loader@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-1.1.2.tgz#b971d191b83af693c5e3fea4064be9e1f2d7f8d8" + integrity sha512-dXHkKmw8FhPqu8asTc1puBfe3TehOCo2+RmOOev5suNCIYBcT626kxiWg1NBVkwc4rO8BGa7gP70W7VXuqHrjg== + dependencies: + loader-utils "^1.1.0" + mime "^2.0.3" + schema-utils "^1.0.0" url-parse@^1.4.3: - version "1.4.4" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.4.tgz#cac1556e95faa0303691fec5cf9d5a1bc34648f8" - integrity sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg== + version "1.4.7" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.4.7.tgz#a8a83535e8c00a316e403a5db4ac1b9b853ae278" + integrity sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg== dependencies: - querystringify "^2.0.0" + querystringify "^2.1.1" requires-port "^1.0.0" url@^0.11.0: @@ -7497,25 +9613,23 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" -use@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" - dependencies: - define-property "^0.2.5" - isobject "^3.0.0" - lazy-cache "^2.0.2" - -useragent@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/useragent/-/useragent-2.3.0.tgz#217f943ad540cb2128658ab23fc960f6a88c9972" - integrity sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw== - dependencies: - lru-cache "4.1.x" - tmp "0.0.x" +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +util.promisify@1.0.0, util.promisify@^1.0.0, util.promisify@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" + integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== + dependencies: + define-properties "^1.1.2" + object.getownpropertydescriptors "^2.0.3" util@0.10.3: version "0.10.3" @@ -7531,13 +9645,15 @@ util@^0.11.0: dependencies: inherits "2.0.3" +utila@^0.4.0, utila@~0.4: + version "0.4.0" + resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" + integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= + utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - -uuid@^3.0.0, uuid@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" + integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= uuid@^3.0.1, uuid@^3.3.2: version "3.3.2" @@ -7545,42 +9661,150 @@ uuid@^3.0.1, uuid@^3.3.2: integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== validate-npm-package-license@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== dependencies: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validate-npm-package-name@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" - integrity sha1-X6kS2B630MdK/BQN5zF/DKffQ34= - dependencies: - builtins "^1.0.3" - vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= +vendors@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.3.tgz#a6467781abd366217c050f8202e7e50cc9eef8c0" + integrity sha512-fOi47nsJP5Wqefa43kyWSg80qF+Q3XA6MUkgi7Hp1HQaKDQW4cQrK2D0P7mmbFtsV1N89am55Yru/nyEwRubcw== + verror@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= dependencies: assert-plus "^1.0.0" core-util-is "1.0.2" extsprintf "^1.2.0" -vm-browserify@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" - integrity sha1-XX6kW7755Kb/ZflUOOCofDV9WnM= - dependencies: - indexof "0.0.1" +vm-browserify@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.0.tgz#bd76d6a23323e2ca8ffa12028dc04559c75f9019" + integrity sha512-iq+S7vZJE60yejDYM0ek6zg308+UZsdtPExWP9VZoCFCz1zkJoXFnAX7aZfd/ZwrkidzdUZL0C/ryW+JwAiIGw== -void-elements@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec" +vue-eslint-parser@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1" + integrity sha512-ZezcU71Owm84xVF6gfurBQUGg8WQ+WZGxgDEQu1IHFBZNx7BFZg3L1yHxrCBNNwbwFtE1GuvfJKMtb6Xuwc/Bw== + dependencies: + debug "^3.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.2" + esquery "^1.0.0" + lodash "^4.17.4" + +vue-eslint-parser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-5.0.0.tgz#00f4e4da94ec974b821a26ff0ed0f7a78402b8a1" + integrity sha512-JlHVZwBBTNVvzmifwjpZYn0oPWH2SgWv5dojlZBsrhablDu95VFD+hriB1rQGwbD+bms6g+rAFhQHk6+NyiS6g== + dependencies: + debug "^4.1.0" + eslint-scope "^4.0.0" + eslint-visitor-keys "^1.0.0" + espree "^4.1.0" + esquery "^1.0.1" + lodash "^4.17.11" + +vue-hot-reload-api@^2.3.0: + version "2.3.3" + resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.3.tgz#2756f46cb3258054c5f4723de8ae7e87302a1ccf" + integrity sha512-KmvZVtmM26BQOMK1rwUZsrqxEGeKiYSZGA7SNWE6uExx8UX/cj9hq2MRV/wWC3Cq6AoeDGk57rL9YMFRel/q+g== + +vue-jest@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/vue-jest/-/vue-jest-3.0.4.tgz#b6a2b0d874968f26fa775ac901903fece531e08b" + integrity sha512-PY9Rwt4OyaVlA+KDJJ0614CbEvNOkffDI9g9moLQC/2DDoo0YrqZm7dHi13Q10uoK5Nt5WCYFdeAheOExPah0w== + dependencies: + babel-plugin-transform-es2015-modules-commonjs "^6.26.0" + chalk "^2.1.0" + extract-from-css "^0.4.4" + find-babel-config "^1.1.0" + js-beautify "^1.6.14" + node-cache "^4.1.1" + object-assign "^4.1.1" + source-map "^0.5.6" + tsconfig "^7.0.0" + vue-template-es2015-compiler "^1.6.0" + +vue-loader@^15.7.0: + version "15.7.0" + resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.7.0.tgz#27275aa5a3ef4958c5379c006dd1436ad04b25b3" + integrity sha512-x+NZ4RIthQOxcFclEcs8sXGEWqnZHodL2J9Vq+hUz+TDZzBaDIh1j3d9M2IUlTjtrHTZy4uMuRdTi8BGws7jLA== + dependencies: + "@vue/component-compiler-utils" "^2.5.1" + hash-sum "^1.0.2" + loader-utils "^1.1.0" + vue-hot-reload-api "^2.3.0" + vue-style-loader "^4.1.0" + +vue-router@^3.0.3: + version "3.0.7" + resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.7.tgz#b36ca107b4acb8ff5bc4ff824584059c23fcb87b" + integrity sha512-utJ+QR3YlIC/6x6xq17UMXeAfxEvXA0VKD3PiSio7hBOZNusA1jXcbxZxVEfJunLp48oonjTepY8ORoIlRx/EQ== + +vue-style-loader@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/vue-style-loader/-/vue-style-loader-4.1.2.tgz#dedf349806f25ceb4e64f3ad7c0a44fba735fcf8" + integrity sha512-0ip8ge6Gzz/Bk0iHovU9XAUQaFt/G2B61bnWa2tCcqqdgfHs1lF9xXorFbE55Gmy92okFT+8bfmySuUOu13vxQ== + dependencies: + hash-sum "^1.0.2" + loader-utils "^1.0.2" + +vue-template-compiler@^2.6.10: + version "2.6.10" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.6.10.tgz#323b4f3495f04faa3503337a82f5d6507799c9cc" + integrity sha512-jVZkw4/I/HT5ZMvRnhv78okGusqe0+qH2A0Em0Cp8aq78+NK9TII263CDVz2QXZsIT+yyV/gZc/j/vlwa+Epyg== + dependencies: + de-indent "^1.0.2" + he "^1.1.0" + +vue-template-es2015-compiler@^1.6.0, vue-template-es2015-compiler@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825" + integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw== + +vue@^2.6.10: + version "2.6.10" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" + integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== + +vuex@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.1.tgz#0c264bfe30cdbccf96ab9db3177d211828a5910e" + integrity sha512-ER5moSbLZuNSMBFnEBVGhQ1uCBNJslH9W/Dw2W7GZN23UQA69uapP5GTT9Vm8Trc0PzBSVt6LzF3hGjmv41xcg== + +w3c-hr-time@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz#82ac2bff63d950ea9e3189a58a65625fedf19045" + integrity sha1-gqwr/2PZUOqeMYmlimViX+3xkEU= + dependencies: + browser-process-hrtime "^0.1.2" + +walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= + dependencies: + makeerror "1.0.x" + +watch@~0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" + integrity sha1-KAlUdsbffJDJYxOJkMClQj60uYY= + dependencies: + exec-sh "^0.2.0" + minimist "^1.2.0" watchpack@^1.5.0: version "1.6.0" @@ -7598,93 +9822,91 @@ wbuf@^1.1.0, wbuf@^1.7.3: dependencies: minimalistic-assert "^1.0.0" -webdriver-js-extender@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/webdriver-js-extender/-/webdriver-js-extender-2.1.0.tgz#57d7a93c00db4cc8d556e4d3db4b5db0a80c3bb7" - integrity sha512-lcUKrjbBfCK6MNsh7xaY2UAUmZwe+/ib03AjVOpFobX4O7+83BUveSrLfU0Qsyb1DaKJdQRbuU+kM9aZ6QUhiQ== +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g= dependencies: - "@types/selenium-webdriver" "^3.0.0" - selenium-webdriver "^3.0.1" + defaults "^1.0.3" -webdriver-manager@^12.0.6: - version "12.0.6" - resolved "https://registry.yarnpkg.com/webdriver-manager/-/webdriver-manager-12.0.6.tgz#3df1a481977010b4cbf8c9d85c7a577828c0e70b" - dependencies: - adm-zip "^0.4.7" - chalk "^1.1.1" - del "^2.2.0" - glob "^7.0.3" - ini "^1.3.4" - minimist "^1.2.0" - q "^1.4.1" - request "^2.78.0" - rimraf "^2.5.2" - semver "^5.3.0" - xml2js "^0.4.17" +webidl-conversions@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== -webpack-core@^0.6.8: - version "0.6.9" - resolved "https://registry.yarnpkg.com/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2" - integrity sha1-/FcViMhVjad76e+23r3Fo7FyvcI= +webpack-bundle-analyzer@^3.3.0: + version "3.3.2" + resolved "https://registry.yarnpkg.com/webpack-bundle-analyzer/-/webpack-bundle-analyzer-3.3.2.tgz#3da733a900f515914e729fcebcd4c40dde71fc6f" + integrity sha512-7qvJLPKB4rRWZGjVp5U1KEjwutbDHSKboAl0IfafnrdXMrgC0tOtZbQD6Rw0u4cmpgRN4O02Fc0t8eAT+FgGzA== dependencies: - source-list-map "~0.1.7" - source-map "~0.4.1" + acorn "^6.0.7" + acorn-walk "^6.1.1" + bfj "^6.1.1" + chalk "^2.4.1" + commander "^2.18.0" + ejs "^2.6.1" + express "^4.16.3" + filesize "^3.6.1" + gzip-size "^5.0.0" + lodash "^4.17.10" + mkdirp "^0.5.1" + opener "^1.5.1" + ws "^6.0.0" -webpack-dev-middleware@3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.4.0.tgz#1132fecc9026fd90f0ecedac5cbff75d1fb45890" - integrity sha512-Q9Iyc0X9dP9bAsYskAVJ/hmIZZQwf/3Sy4xCAZgL5cUkjZmUZLt4l5HpbST/Pdgjn3u6pE7u5OdGd1apgzRujA== +webpack-chain@^4.11.0: + version "4.12.1" + resolved "https://registry.yarnpkg.com/webpack-chain/-/webpack-chain-4.12.1.tgz#6c8439bbb2ab550952d60e1ea9319141906c02a6" + integrity sha512-BCfKo2YkDe2ByqkEWe1Rw+zko4LsyS75LVr29C6xIrxAg9JHJ4pl8kaIZ396SUSNp6b4815dRZPSTAS8LlURRQ== dependencies: - memory-fs "~0.4.1" - mime "^2.3.1" - range-parser "^1.0.3" + deepmerge "^1.5.2" + javascript-stringify "^1.6.0" + +webpack-dev-middleware@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.7.0.tgz#ef751d25f4e9a5c8a35da600c5fda3582b5c6cff" + integrity sha512-qvDesR1QZRIAZHOE3iQ4CXLZZSQ1lAUsSpnQmlB1PBfoN/xdRjmge3Dok0W4IdaVLJOGJy3sGI4sZHwjRU0PCA== + dependencies: + memory-fs "^0.4.1" + mime "^2.4.2" + range-parser "^1.2.1" webpack-log "^2.0.0" -webpack-dev-middleware@3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.5.1.tgz#9265b7742ef50f54f54c1d9af022fc17c1be9b88" - integrity sha512-4dwCh/AyMOYAybggUr8fiCkRnjVDp+Cqlr9c+aaNB3GJYgRGYQWJ1YX/WAKUNA9dPNHZ6QSN2lYDKqjKSI8Vqw== - dependencies: - memory-fs "~0.4.1" - mime "^2.3.1" - range-parser "^1.0.3" - webpack-log "^2.0.0" - -webpack-dev-server@3.1.14: - version "3.1.14" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.1.14.tgz#60fb229b997fc5a0a1fc6237421030180959d469" - integrity sha512-mGXDgz5SlTxcF3hUpfC8hrQ11yhAttuUQWf1Wmb+6zo3x6rb7b9mIfuQvAPLdfDRCGRGvakBWHdHOa0I9p/EVQ== +webpack-dev-server@^3.4.1: + version "3.7.2" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.7.2.tgz#f79caa5974b7f8b63268ef5421222a8486d792f5" + integrity sha512-mjWtrKJW2T9SsjJ4/dxDC2fkFVUw8jlpemDERqV0ZJIkjjjamR2AbQlr3oz+j4JLhYCHImHnXZK5H06P2wvUew== dependencies: ansi-html "0.0.7" bonjour "^3.5.0" - chokidar "^2.0.0" - compression "^1.5.2" - connect-history-api-fallback "^1.3.0" - debug "^3.1.0" - del "^3.0.0" - express "^4.16.2" - html-entities "^1.2.0" - http-proxy-middleware "~0.18.0" + chokidar "^2.1.6" + compression "^1.7.4" + connect-history-api-fallback "^1.6.0" + debug "^4.1.1" + del "^4.1.1" + express "^4.17.1" + html-entities "^1.2.1" + http-proxy-middleware "^0.19.1" import-local "^2.0.0" - internal-ip "^3.0.1" + internal-ip "^4.3.0" ip "^1.1.5" - killable "^1.0.0" - loglevel "^1.4.1" - opn "^5.1.0" - portfinder "^1.0.9" + killable "^1.0.1" + loglevel "^1.6.3" + opn "^5.5.0" + p-retry "^3.0.1" + portfinder "^1.0.20" schema-utils "^1.0.0" - selfsigned "^1.9.1" - semver "^5.6.0" - serve-index "^1.7.2" + selfsigned "^1.10.4" + semver "^6.1.1" + serve-index "^1.9.1" sockjs "0.3.19" sockjs-client "1.3.0" spdy "^4.0.0" - strip-ansi "^3.0.0" - supports-color "^5.1.0" + strip-ansi "^3.0.1" + supports-color "^6.1.0" url "^0.11.0" - webpack-dev-middleware "3.4.0" + webpack-dev-middleware "^3.7.0" webpack-log "^2.0.0" - yargs "12.0.2" + yargs "12.0.5" webpack-log@^2.0.0: version "2.0.0" @@ -7694,14 +9916,14 @@ webpack-log@^2.0.0: ansi-colors "^3.0.0" uuid "^3.3.2" -webpack-merge@4.2.1: +webpack-merge@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.1.tgz#5e923cf802ea2ace4fd5af1d3247368a633489b4" integrity sha512-4p8WQyS98bUJcCvFMbdGZyZmsKuWjWVnVHnAS3FFg0HDaRVrPbkivx2RYCre8UiemD67RsiFFLfn4JhLAin8Vw== dependencies: lodash "^4.17.5" -webpack-sources@1.3.0, webpack-sources@^1.1.0, webpack-sources@^1.2.0, webpack-sources@^1.3.0: +webpack-sources@^1.1.0, webpack-sources@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.3.0.tgz#2a28dcb9f1f45fe960d8f1493252b5ee6530fa85" integrity sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA== @@ -7709,24 +9931,17 @@ webpack-sources@1.3.0, webpack-sources@^1.1.0, webpack-sources@^1.2.0, webpack-s source-list-map "^2.0.0" source-map "~0.6.1" -webpack-subresource-integrity@1.1.0-rc.6: - version "1.1.0-rc.6" - resolved "https://registry.yarnpkg.com/webpack-subresource-integrity/-/webpack-subresource-integrity-1.1.0-rc.6.tgz#37f6f1264e1eb378e41465a98da80fad76ab8886" - integrity sha512-Az7y8xTniNhaA0620AV1KPwWOqawurVVDzQSpPAeR5RwNbL91GoBSJAAo9cfd+GiFHwsS5bbHepBw1e6Hzxy4w== - dependencies: - webpack-core "^0.6.8" - -webpack@4.29.0: - version "4.29.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.29.0.tgz#f2cfef83f7ae404ba889ff5d43efd285ca26e750" - integrity sha512-pxdGG0keDBtamE1mNvT5zyBdx+7wkh6mh7uzMOo/uRQ/fhsdj5FXkh/j5mapzs060forql1oXqXN9HJGju+y7w== +"webpack@>=4 < 4.29": + version "4.28.4" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.28.4.tgz#1ddae6c89887d7efb752adf0c3cd32b9b07eacd0" + integrity sha512-NxjD61WsK/a3JIdwWjtIpimmvE6UrRi3yG54/74Hk9rwNj5FPkA4DJCf1z4ByDWLkvZhTZE+P3C/eh6UD5lDcw== dependencies: "@webassemblyjs/ast" "1.7.11" "@webassemblyjs/helper-module-context" "1.7.11" "@webassemblyjs/wasm-edit" "1.7.11" "@webassemblyjs/wasm-parser" "1.7.11" - acorn "^6.0.5" - acorn-dynamic-import "^4.0.0" + acorn "^5.6.2" + acorn-dynamic-import "^3.0.0" ajv "^6.1.0" ajv-keywords "^3.1.0" chrome-trace-event "^1.0.0" @@ -7747,11 +9962,12 @@ webpack@4.29.0: webpack-sources "^1.3.0" websocket-driver@>=0.5.1: - version "0.7.0" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.0.tgz#0caf9d2d755d93aee049d4bdd0d3fe2cca2a24eb" - integrity sha1-DK+dLXVdk67gSdS90NP+LMoqJOs= + version "0.7.3" + resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9" + integrity sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg== dependencies: - http-parser-js ">=0.4.0" + http-parser-js ">=0.4.0 <0.4.11" + safe-buffer ">=5.1.0" websocket-extensions ">=0.1.1" websocket-extensions@>=0.1.1: @@ -7759,10 +9975,35 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== -when@~3.6.x: - version "3.6.4" - resolved "https://registry.yarnpkg.com/when/-/when-3.6.4.tgz#473b517ec159e2b85005497a13983f095412e34e" - integrity sha1-RztRfsFZ4rhQBUl6E5g/CVQS404= +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: + version "1.0.5" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" + integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== + dependencies: + iconv-lite "0.4.24" + +whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" + integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== + +whatwg-url@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" + integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" + +whatwg-url@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.0.0.tgz#fde926fa54a599f3adf82dff25a9f7be02dc6edd" + integrity sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ== + dependencies: + lodash.sortby "^4.7.0" + tr46 "^1.0.1" + webidl-conversions "^4.0.2" which-module@^1.0.0: version "1.0.0" @@ -7772,108 +10013,143 @@ which-module@^1.0.0: which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.1.1, which@^1.3.1: +which@1, which@^1.2.12, which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" -which@^1.2.1, which@^1.2.9: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" - dependencies: - isexe "^2.0.0" - wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== dependencies: - string-width "^1.0.2" - -wordwrap@^1.0.0, wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + string-width "^1.0.2 || 2" wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= -worker-farm@^1.5.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0" - integrity sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ== +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + +worker-farm@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" + integrity sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw== dependencies: errno "~0.1.7" wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" strip-ansi "^3.0.1" +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -ws@~3.3.1: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" +write-file-atomic@^2.1.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + dependencies: + mkdirp "^0.5.1" + +ws@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== dependencies: async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" -xml2js@^0.4.17: - version "0.4.19" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" +ws@^6.0.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" + integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== dependencies: - sax ">=0.6.0" - xmlbuilder "~9.0.1" + async-limiter "~1.0.0" -xmlbuilder@~9.0.1: - version "9.0.7" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" - -xmlhttprequest-ssl@~1.5.4: - version "1.5.5" - resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e" - -xregexp@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" - integrity sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg== +xml-name-validator@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" + integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== xtend@^4.0.0, xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= "y18n@^3.2.1 || ^4.0.0", y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.2: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" integrity sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A== -yargs-parser@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" - integrity sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ== +yargs-parser@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4" + integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== dependencies: - camelcase "^4.1.0" + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^13.1.0: + version "13.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" + integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" yargs-parser@^5.0.0: version "5.0.0" @@ -7882,19 +10158,20 @@ yargs-parser@^5.0.0: dependencies: camelcase "^3.0.0" -yargs-parser@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" +yargs-parser@^9.0.2: + version "9.0.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= dependencies: camelcase "^4.1.0" -yargs@12.0.2: - version "12.0.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.2.tgz#fe58234369392af33ecbef53819171eff0f5aadc" - integrity sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ== +yargs@12.0.5: + version "12.0.5" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" + integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw== dependencies: cliui "^4.0.0" - decamelize "^2.0.0" + decamelize "^1.2.0" find-up "^3.0.0" get-caller-file "^1.0.1" os-locale "^3.0.0" @@ -7904,26 +10181,42 @@ yargs@12.0.2: string-width "^2.0.0" which-module "^2.0.0" y18n "^3.2.1 || ^4.0.0" - yargs-parser "^10.1.0" + yargs-parser "^11.1.1" -yargs@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" - integrity sha1-UqzCP+7Kw0BCB47njAwAf1CF20w= +yargs@^11.0.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" + integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A== dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" + cliui "^4.0.0" decamelize "^1.1.1" + find-up "^2.1.0" get-caller-file "^1.0.1" os-locale "^2.0.0" - read-pkg-up "^2.0.0" require-directory "^2.1.1" require-main-filename "^1.0.1" set-blocking "^2.0.0" string-width "^2.0.0" which-module "^2.0.0" y18n "^3.2.1" - yargs-parser "^7.0.0" + yargs-parser "^9.0.2" + +yargs@^13.0.0: + version "13.2.4" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.2.4.tgz#0b562b794016eb9651b98bd37acf364aa5d6dc83" + integrity sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + os-locale "^3.1.0" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.0" yargs@^7.0.0: version "7.1.0" @@ -7944,15 +10237,12 @@ yargs@^7.0.0: y18n "^3.2.1" yargs-parser "^5.0.0" -yeast@0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419" - -yn@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.0.0.tgz#0073c6b56e92aed652fbdfd62431f2d6b9a7a091" - integrity sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q== - -zone.js@^0.8.19: - version "0.8.20" - resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.20.tgz#a218c48db09464b19ff6fc8f0d4bb5b1046e185d" +yorkie@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yorkie/-/yorkie-2.0.0.tgz#92411912d435214e12c51c2ae1093e54b6bb83d9" + integrity sha512-jcKpkthap6x63MB4TxwCyuIGkV0oYP/YRyuQU5UO0Yz/E/ZAu+653/uov+phdmO54n6BcvFRyyt0RRrWdN2mpw== + dependencies: + execa "^0.8.0" + is-ci "^1.0.10" + normalize-path "^1.0.0" + strip-indent "^2.0.0" From 62800116d3b267fd5cb1c77f01c4e2e7edc65ce4 Mon Sep 17 00:00:00 2001 From: Ryan Fitzpatrick Date: Mon, 15 Jul 2019 08:52:04 -0400 Subject: [PATCH 20/49] Add Jaeger collector endpoint --- docs/content/observability/tracing/jaeger.md | 55 +++++++++++++- .../reference/static-configuration/cli-ref.md | 11 ++- .../reference/static-configuration/env-ref.md | 11 ++- .../reference/static-configuration/file.toml | 4 + .../reference/static-configuration/file.yaml | 4 + .../tracing/simple-jaeger-collector.toml | 76 +++++++++++++++++++ integration/tracing_test.go | 27 +++++++ pkg/tracing/jaeger/jaeger.go | 49 ++++++++---- 8 files changed, 221 insertions(+), 16 deletions(-) create mode 100644 integration/fixtures/tracing/simple-jaeger-collector.toml diff --git a/docs/content/observability/tracing/jaeger.md b/docs/content/observability/tracing/jaeger.md index 458d7ecd8..1f1ed3a0e 100644 --- a/docs/content/observability/tracing/jaeger.md +++ b/docs/content/observability/tracing/jaeger.md @@ -13,7 +13,8 @@ To enable the Jaeger: ``` !!! warning - Traefik is only able to send data over the compact thrift protocol to the [Jaeger agent](https://www.jaegertracing.io/docs/deployment/#agent). + Traefik is able to send data over the compact thrift protocol to the [Jaeger agent](https://www.jaegertracing.io/docs/deployment/#agent) + or a [Jaeger collector](https://www.jaegertracing.io/docs/deployment/#collectors). #### `samplingServerURL` @@ -144,3 +145,55 @@ This must be in lower-case to avoid mismatches when decoding incoming headers. --tracing --tracing.jaeger.traceContextHeaderName="uber-trace-id" ``` + +### `collector` +#### `endpoint` + +_Optional, Default=""_ + +Collector Endpoint instructs reporter to send spans to jaeger-collector at this URL. + +```toml tab="File" +[tracing] + [tracing.jaeger.collector] + endpoint = "http://127.0.0.1:14268/api/traces?format=jaeger.thrift" +``` + +```bash tab="CLI" +--tracing +--tracing.jaeger.collector.endpoint="http://127.0.0.1:14268/api/traces?format=jaeger.thrift" +``` + +#### `user` + +_Optional, Default=""_ + +User instructs reporter to include a user for basic http authentication when sending spans to jaeger-collector. + +```toml tab="File" +[tracing] + [tracing.jaeger.collector] + user = "my-user" +``` + +```bash tab="CLI" +--tracing +--tracing.jaeger.collector.user="my-user" +``` + +#### `password` + +_Optional, Default=""_ + +Password instructs reporter to include a password for basic http authentication when sending spans to jaeger-collector. + +```toml tab="File" +[tracing] + [tracing.jaeger.collector] + password = "my-password" +``` + +```bash tab="CLI" +--tracing +--tracing.jaeger.collector.password="my-password" +``` diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index 8f167ade0..b65592f29 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -540,6 +540,15 @@ Set instana-agent's log level. ('error','warn','info','debug') (Default: ```info `--tracing.jaeger`: Settings for Jaeger. (Default: ```false```) +`--tracing.jaeger.collector.endpoint`: +Instructs reporter to send spans to jaeger-collector at this URL. + +`--tracing.jaeger.collector.password`: +Password for basic http authentication when sending spans to jaeger-collector. + +`--tracing.jaeger.collector.user`: +User for basic http authentication when sending spans to jaeger-collector. + `--tracing.jaeger.gen128bit`: Generate 128 bit span IDs. (Default: ```false```) @@ -547,7 +556,7 @@ Generate 128 bit span IDs. (Default: ```false```) Set jaeger-agent's host:port that the reporter will used. (Default: ```127.0.0.1:6831```) `--tracing.jaeger.propagation`: -Which propgation format to use (jaeger/b3). (Default: ```jaeger```) +Which propagation format to use (jaeger/b3). (Default: ```jaeger```) `--tracing.jaeger.samplingparam`: Set the sampling parameter. (Default: ```1.000000```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index ed0b45b3b..dff7024e4 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -540,6 +540,15 @@ Set instana-agent's log level. ('error','warn','info','debug') (Default: ```info `TRAEFIK_TRACING_JAEGER`: Settings for Jaeger. (Default: ```false```) +`TRAEFIK_TRACING_JAEGER_COLLECTOR_ENDPOINT`: +Instructs reporter to send spans to jaeger-collector at this URL. + +`TRAEFIK_TRACING_JAEGER_COLLECTOR_PASSWORD`: +Password for basic http authentication when sending spans to jaeger-collector. + +`TRAEFIK_TRACING_JAEGER_COLLECTOR_USER`: +User for basic http authentication when sending spans to jaeger-collector. + `TRAEFIK_TRACING_JAEGER_GEN128BIT`: Generate 128 bit span IDs. (Default: ```false```) @@ -547,7 +556,7 @@ Generate 128 bit span IDs. (Default: ```false```) Set jaeger-agent's host:port that the reporter will used. (Default: ```127.0.0.1:6831```) `TRAEFIK_TRACING_JAEGER_PROPAGATION`: -Which propgation format to use (jaeger/b3). (Default: ```jaeger```) +Which propagation format to use (jaeger/b3). (Default: ```jaeger```) `TRAEFIK_TRACING_JAEGER_SAMPLINGPARAM`: Set the sampling parameter. (Default: ```1.000000```) diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index fc6e851ef..029088fab 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -174,6 +174,10 @@ gen128Bit = true propagation = "foobar" traceContextHeaderName = "foobar" + [tracing.jaeger.collector] + endpoint = "foobar" + user = "foobar" + password = "foobar" [tracing.zipkin] httpEndpoint = "foobar" sameSpan = true diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index 6d234f095..533400bde 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -185,6 +185,10 @@ tracing: gen128Bit: true propagation: foobar traceContextHeaderName: foobar + collector: + endpoint: foobar + user: foobar + password: foobar zipkin: httpEndpoint: foobar sameSpan: true diff --git a/integration/fixtures/tracing/simple-jaeger-collector.toml b/integration/fixtures/tracing/simple-jaeger-collector.toml new file mode 100644 index 000000000..14bb2b42a --- /dev/null +++ b/integration/fixtures/tracing/simple-jaeger-collector.toml @@ -0,0 +1,76 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[api] + +[entryPoints] + [entryPoints.web] + address = ":8000" + +[tracing] + servicename = "tracing" + [tracing.jaeger] + samplingType = "const" + samplingParam = 1.0 + samplingServerURL = "http://{{.IP}}:5778/sampling" + [tracing.jaeger.collector] + endpoint = "http://{{.IP}}:14268/api/traces?format=jaeger.thrift" + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[http.routers] + [http.routers.router1] + Service = "service1" + Middlewares = ["retry", "ratelimit"] + Rule = "Path(`/ratelimit`)" + [http.routers.router2] + Service = "service2" + Middlewares = ["retry"] + Rule = "Path(`/retry`)" + [http.routers.router3] + 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 + + +[http.services] + [http.services.service1] + [http.services.service1.loadBalancer] + passHostHeader = true + [[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.service3] + passHostHeader = true + [http.services.service3.loadBalancer] + [[http.services.service3.loadBalancer.servers]] + url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}" diff --git a/integration/tracing_test.go b/integration/tracing_test.go index d1c718ba8..03e5e18b8 100644 --- a/integration/tracing_test.go +++ b/integration/tracing_test.go @@ -258,3 +258,30 @@ func (s *TracingSuite) TestJaegerAuth(c *check.C) { err = try.GetRequest("http://"+s.IP+":16686/api/traces?service=tracing", 20*time.Second, try.BodyContains("EntryPoint web", "basic-auth@file")) c.Assert(err, checker.IsNil) } + +func (s *TracingSuite) TestJaegerAuthCollector(c *check.C) { + s.startJaeger(c) + defer s.composeProject.Stop(c, "jaeger") + file := s.adaptFile(c, "fixtures/tracing/simple-jaeger-collector.toml", TracingTemplate{ + WhoAmiIP: s.WhoAmiIP, + WhoAmiPort: s.WhoAmiPort, + IP: s.IP, + }) + defer os.Remove(file) + + cmd, display := s.traefikCmd(withConfigFile(file)) + defer display(c) + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + // wait for traefik + err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", time.Second, try.BodyContains("basic-auth")) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://127.0.0.1:8000/auth", 500*time.Millisecond, try.StatusCodeIs(http.StatusUnauthorized)) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://"+s.IP+":16686/api/traces?service=tracing", 20*time.Second, try.BodyContains("EntryPoint web", "basic-auth@file")) + c.Assert(err, checker.IsNil) +} diff --git a/pkg/tracing/jaeger/jaeger.go b/pkg/tracing/jaeger/jaeger.go index 458c7444a..2c463adbf 100644 --- a/pkg/tracing/jaeger/jaeger.go +++ b/pkg/tracing/jaeger/jaeger.go @@ -13,18 +13,19 @@ import ( jaegermet "github.com/uber/jaeger-lib/metrics" ) -// Name sets the name of this tracer +// Name sets the name of this tracer. const Name = "jaeger" -// Config provides configuration settings for a jaeger tracer +// Config provides configuration settings for a jaeger tracer. type Config struct { - 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"` + 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 propagation 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"` + Collector *Collector `description:"Define the collector information" json:"collector,omitempty" toml:"collector,omitempty" yaml:"collector,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -38,18 +39,40 @@ func (c *Config) SetDefaults() { c.TraceContextHeaderName = jaegercli.TraceContextHeaderName } +// Collector provides configuration settings for jaeger collector. +type Collector struct { + Endpoint string `description:"Instructs reporter to send spans to jaeger-collector at this URL." json:"endpoint,omitempty" toml:"endpoint,omitempty" yaml:"endpoint,omitempty" export:"true"` + User string `description:"User for basic http authentication when sending spans to jaeger-collector." json:"user,omitempty" toml:"user,omitempty" yaml:"user,omitempty"` + Password string `description:"Password for basic http authentication when sending spans to jaeger-collector." json:"password,omitempty" toml:"password,omitempty" yaml:"password,omitempty"` +} + +// SetDefaults sets the default values. +func (c *Collector) SetDefaults() { + c.Endpoint = "" + c.User = "" + c.Password = "" +} + // Setup sets up the tracer func (c *Config) Setup(componentName string) (opentracing.Tracer, io.Closer, error) { + reporter := &jaegercfg.ReporterConfig{ + LogSpans: true, + LocalAgentHostPort: c.LocalAgentHostPort, + } + + if c.Collector != nil { + reporter.CollectorEndpoint = c.Collector.Endpoint + reporter.User = c.Collector.User + reporter.Password = c.Collector.Password + } + jcfg := jaegercfg.Configuration{ Sampler: &jaegercfg.SamplerConfig{ SamplingServerURL: c.SamplingServerURL, Type: c.SamplingType, Param: c.SamplingParam, }, - Reporter: &jaegercfg.ReporterConfig{ - LogSpans: true, - LocalAgentHostPort: c.LocalAgentHostPort, - }, + Reporter: reporter, Headers: &jaeger.HeadersConfig{ TraceContextHeaderName: c.TraceContextHeaderName, }, From 6fdd48509ebf3f938849147202626779d0b74618 Mon Sep 17 00:00:00 2001 From: mpl Date: Mon, 15 Jul 2019 17:04:04 +0200 Subject: [PATCH 21/49] config: deal with multiple errors and their criticality Co-authored-by: Julien Salleyron --- integration/fixtures/router_errors.toml | 45 ++++ integration/fixtures/service_errors.toml | 34 +++ integration/simple_test.go | 45 ++++ integration/testdata/rawdata-crd.json | 22 +- integration/testdata/rawdata-ingress.json | 8 +- pkg/api/handler.go | 18 +- pkg/api/handler_entrypoint_test.go | 4 +- pkg/api/handler_http.go | 8 +- pkg/api/handler_http_test.go | 120 +++++----- pkg/api/handler_overview.go | 30 ++- pkg/api/handler_overview_test.go | 56 +++-- pkg/api/handler_tcp.go | 6 +- pkg/api/handler_tcp_test.go | 43 ++-- pkg/api/handler_test.go | 15 +- pkg/api/testdata/getrawdata.json | 14 +- pkg/api/testdata/overview-dynamic.json | 14 +- pkg/api/testdata/router-bar.json | 3 +- pkg/api/testdata/routers-many-lastpage.json | 15 +- pkg/api/testdata/routers-page2.json | 3 +- pkg/api/testdata/routers.json | 6 +- pkg/api/testdata/service-bar.json | 1 + pkg/api/testdata/services-page2.json | 1 + pkg/api/testdata/services.json | 2 + pkg/config/{dynamic => runtime}/runtime.go | 195 ++++++++++++---- .../{dynamic => runtime}/runtime_test.go | 215 ++++++++++-------- pkg/healthcheck/healthcheck.go | 10 +- pkg/healthcheck/healthcheck_test.go | 4 +- pkg/responsemodifiers/response_modifier.go | 6 +- .../response_modifier_test.go | 3 +- pkg/server/middleware/middlewares.go | 12 +- pkg/server/middleware/middlewares_test.go | 9 +- .../router/route_appender_aggregator.go | 4 +- pkg/server/router/route_appender_factory.go | 4 +- pkg/server/router/router.go | 22 +- pkg/server/router/router_test.go | 15 +- pkg/server/router/tcp/router.go | 30 ++- pkg/server/router/tcp/router_test.go | 27 +-- pkg/server/server.go | 3 +- pkg/server/server_configuration.go | 7 +- pkg/server/server_configuration_test.go | 3 +- pkg/server/server_test.go | 3 +- pkg/server/service/service.go | 12 +- pkg/server/service/service_test.go | 9 +- pkg/server/service/tcp/service.go | 6 +- pkg/server/service/tcp/service_test.go | 25 +- 45 files changed, 725 insertions(+), 412 deletions(-) create mode 100644 integration/fixtures/router_errors.toml create mode 100644 integration/fixtures/service_errors.toml rename pkg/config/{dynamic => runtime}/runtime.go (50%) rename pkg/config/{dynamic => runtime}/runtime_test.go (82%) diff --git a/integration/fixtures/router_errors.toml b/integration/fixtures/router_errors.toml new file mode 100644 index 000000000..335339e2b --- /dev/null +++ b/integration/fixtures/router_errors.toml @@ -0,0 +1,45 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web-secure] + address = ":4443" + +[api] + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[http.routers] + [http.routers.router4] + service = "service1" + rule = "Host(`snitest.net`)" + [http.routers.router4.tls] + options = "foo" + + [http.routers.router5] + service = "service1" + rule = "Host(`snitest.net`)" + middlewares = [ "unknown" ] + [http.routers.router5.tls] + options = "baz" + +[http.services] + [http.services.service1] + [http.services.service1.loadBalancer] + [[http.services.service1.loadBalancer.servers]] + url = "http://127.0.0.1:9010" + +[tls.options] + + [tls.options.foo] + minversion = "VersionTLS11" + + [tls.options.baz] + minversion = "VersionTLS11" diff --git a/integration/fixtures/service_errors.toml b/integration/fixtures/service_errors.toml new file mode 100644 index 000000000..3bdc495bb --- /dev/null +++ b/integration/fixtures/service_errors.toml @@ -0,0 +1,34 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web-secure] + address = ":4443" + +[api] + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[http.routers] + [http.routers.router4] + service = "service1" + rule = "Host(`snitest.net`)" + + [http.routers.router5] + service = "service2" + rule = "Host(`snitest.com`)" + +[http.services] + [http.services.service1] + + [http.services.service2] + [http.services.service2.loadBalancer] + [[http.services.service2.loadBalancer.servers]] + url = "http://127.0.0.1:9010" diff --git a/integration/simple_test.go b/integration/simple_test.go index ef4baa451..b7309d809 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -524,3 +524,48 @@ func (s *SimpleSuite) TestSimpleConfigurationHostRequestTrailingPeriod(c *check. } } } + +func (s *SimpleSuite) TestRouterConfigErrors(c *check.C) { + file := s.adaptFile(c, "fixtures/router_errors.toml", struct{}{}) + defer os.Remove(file) + + cmd, output := s.traefikCmd(withConfigFile(file)) + defer output(c) + + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + // All errors + err = try.GetRequest("http://127.0.0.1:8080/api/http/routers", 1000*time.Millisecond, try.BodyContains(`["middleware \"unknown@file\" does not exist","found different TLS options for routers on the same host snitest.net, so using the default TLS option instead"]`)) + c.Assert(err, checker.IsNil) + + // router4 is enabled, but in warning state because its tls options conf was messed up + err = try.GetRequest("http://127.0.0.1:8080/api/http/routers/router4@file", 1000*time.Millisecond, try.BodyContains(`"status":"warning"`)) + c.Assert(err, checker.IsNil) + + // router5 is disabled because its middleware conf is broken + err = try.GetRequest("http://127.0.0.1:8080/api/http/routers/router5@file", 1000*time.Millisecond, try.BodyContains()) + c.Assert(err, checker.IsNil) +} + +func (s *SimpleSuite) TestServiceConfigErrors(c *check.C) { + file := s.adaptFile(c, "fixtures/service_errors.toml", struct{}{}) + defer os.Remove(file) + + cmd, output := s.traefikCmd(withConfigFile(file)) + defer output(c) + + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + err = try.GetRequest("http://127.0.0.1:8080/api/http/services", 1000*time.Millisecond, try.BodyContains(`["the service \"service1@file\" doesn't have any load balancer"]`)) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://127.0.0.1:8080/api/http/services/service1@file", 1000*time.Millisecond, try.BodyContains(`"status":"disabled"`)) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://127.0.0.1:8080/api/http/services/service2@file", 1000*time.Millisecond, try.BodyContains(`"status":"enabled"`)) + c.Assert(err, checker.IsNil) +} diff --git a/integration/testdata/rawdata-crd.json b/integration/testdata/rawdata-crd.json index 1851ddd5e..8b2dadbbb 100644 --- a/integration/testdata/rawdata-crd.json +++ b/integration/testdata/rawdata-crd.json @@ -9,7 +9,8 @@ "priority": 12, "tls": { "options": "default/mytlsoption" - } + }, + "status": "enabled" }, "default/test2.route-23c7f4c450289ee29016@kubernetescrd": { "entryPoints": [ @@ -19,7 +20,8 @@ "default/stripprefix" ], "service": "default/test2.route-23c7f4c450289ee29016", - "rule": "Host(`foo.com`) \u0026\u0026 PathPrefix(`/tobestripped`)" + "rule": "Host(`foo.com`) \u0026\u0026 PathPrefix(`/tobestripped`)", + "status": "enabled" } }, "middlewares": { @@ -39,7 +41,7 @@ "loadBalancer": { "servers": [ { - "url": "http://10.42.0.3:80" + "url": "http://10.42.0.4:80" }, { "url": "http://10.42.0.5:80" @@ -47,11 +49,12 @@ ], "passHostHeader": true }, + "status": "enabled", "usedBy": [ "default/test.route-6b204d94623b3df4370c@kubernetescrd" ], "serverStatus": { - "http://10.42.0.3:80": "UP", + "http://10.42.0.4:80": "UP", "http://10.42.0.5:80": "UP" } }, @@ -59,7 +62,7 @@ "loadBalancer": { "servers": [ { - "url": "http://10.42.0.3:80" + "url": "http://10.42.0.4:80" }, { "url": "http://10.42.0.5:80" @@ -67,11 +70,12 @@ ], "passHostHeader": true }, + "status": "enabled", "usedBy": [ "default/test2.route-23c7f4c450289ee29016@kubernetescrd" ], "serverStatus": { - "http://10.42.0.3:80": "UP", + "http://10.42.0.4:80": "UP", "http://10.42.0.5:80": "UP" } } @@ -86,7 +90,8 @@ "tls": { "passthrough": false, "options": "default/mytlsoption" - } + }, + "status": "enabled" } }, "tcpServices": { @@ -94,13 +99,14 @@ "loadBalancer": { "servers": [ { - "address": "10.42.0.4:8080" + "address": "10.42.0.3:8080" }, { "address": "10.42.0.6:8080" } ] }, + "status": "enabled", "usedBy": [ "default/test3.crd-673acf455cb2dab0b43a@kubernetescrd" ] diff --git a/integration/testdata/rawdata-ingress.json b/integration/testdata/rawdata-ingress.json index c22fdf46e..79692c664 100644 --- a/integration/testdata/rawdata-ingress.json +++ b/integration/testdata/rawdata-ingress.json @@ -2,7 +2,8 @@ "routers": { "whoami-test/whoami@kubernetes": { "service": "default/whoami/http", - "rule": "Host(`whoami.test`) \u0026\u0026 PathPrefix(`/whoami`)" + "rule": "Host(`whoami.test`) \u0026\u0026 PathPrefix(`/whoami`)", + "status": "enabled" } }, "services": { @@ -10,7 +11,7 @@ "loadBalancer": { "servers": [ { - "url": "http://10.42.0.2:80" + "url": "http://10.42.0.4:80" }, { "url": "http://10.42.0.5:80" @@ -18,11 +19,12 @@ ], "passHostHeader": true }, + "status": "enabled", "usedBy": [ "whoami-test/whoami@kubernetes" ], "serverStatus": { - "http://10.42.0.2:80": "UP", + "http://10.42.0.4:80": "UP", "http://10.42.0.5:80": "UP" } } diff --git a/pkg/api/handler.go b/pkg/api/handler.go index 79e0540d7..75fa1f7ff 100644 --- a/pkg/api/handler.go +++ b/pkg/api/handler.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/types" @@ -24,17 +24,17 @@ const ( const nextPageHeader = "X-Next-Page" type serviceInfoRepresentation struct { - *dynamic.ServiceInfo + *runtime.ServiceInfo ServerStatus map[string]string `json:"serverStatus,omitempty"` } // RunTimeRepresentation is the configuration information exposed by the API handler. type RunTimeRepresentation struct { - Routers map[string]*dynamic.RouterInfo `json:"routers,omitempty"` - Middlewares map[string]*dynamic.MiddlewareInfo `json:"middlewares,omitempty"` + Routers map[string]*runtime.RouterInfo `json:"routers,omitempty"` + Middlewares map[string]*runtime.MiddlewareInfo `json:"middlewares,omitempty"` Services map[string]*serviceInfoRepresentation `json:"services,omitempty"` - TCPRouters map[string]*dynamic.TCPRouterInfo `json:"tcpRouters,omitempty"` - TCPServices map[string]*dynamic.TCPServiceInfo `json:"tcpServices,omitempty"` + TCPRouters map[string]*runtime.TCPRouterInfo `json:"tcpRouters,omitempty"` + TCPServices map[string]*runtime.TCPServiceInfo `json:"tcpServices,omitempty"` } type pageInfo struct { @@ -48,7 +48,7 @@ type Handler struct { dashboard bool debug bool // runtimeConfiguration is the data set used to create all the data representations exposed by the API. - runtimeConfiguration *dynamic.RuntimeConfiguration + runtimeConfiguration *runtime.Configuration staticConfig static.Configuration statistics *types.Statistics // stats *thoasstats.Stats // FIXME stats @@ -58,10 +58,10 @@ type Handler struct { // New returns a Handler defined by staticConfig, and if provided, by runtimeConfig. // It finishes populating the information provided in the runtimeConfig. -func New(staticConfig static.Configuration, runtimeConfig *dynamic.RuntimeConfiguration) *Handler { +func New(staticConfig static.Configuration, runtimeConfig *runtime.Configuration) *Handler { rConfig := runtimeConfig if rConfig == nil { - rConfig = &dynamic.RuntimeConfiguration{} + rConfig = &runtime.Configuration{} } return &Handler{ diff --git a/pkg/api/handler_entrypoint_test.go b/pkg/api/handler_entrypoint_test.go index 162e655a2..333fd6c4c 100644 --- a/pkg/api/handler_entrypoint_test.go +++ b/pkg/api/handler_entrypoint_test.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -198,7 +198,7 @@ func TestHandler_EntryPoints(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - handler := New(test.conf, &dynamic.RuntimeConfiguration{}) + handler := New(test.conf, &runtime.Configuration{}) router := mux.NewRouter() handler.Append(router) diff --git a/pkg/api/handler_http.go b/pkg/api/handler_http.go index 02b8165f9..d13d92f7a 100644 --- a/pkg/api/handler_http.go +++ b/pkg/api/handler_http.go @@ -7,25 +7,25 @@ import ( "strconv" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" ) type routerRepresentation struct { - *dynamic.RouterInfo + *runtime.RouterInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type serviceRepresentation struct { - *dynamic.ServiceInfo + *runtime.ServiceInfo ServerStatus map[string]string `json:"serverStatus,omitempty"` Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type middlewareRepresentation struct { - *dynamic.MiddlewareInfo + *runtime.MiddlewareInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } diff --git a/pkg/api/handler_http_test.go b/pkg/api/handler_http_test.go index 2d9a2235a..2d04091c7 100644 --- a/pkg/api/handler_http_test.go +++ b/pkg/api/handler_http_test.go @@ -11,6 +11,7 @@ import ( "github.com/containous/mux" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,13 +27,13 @@ func TestHandler_HTTP(t *testing.T) { testCases := []struct { desc string path string - conf dynamic.RuntimeConfiguration + conf runtime.Configuration expected expected }{ { desc: "all routers, but no config", path: "/api/http/routers", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -42,8 +43,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all routers", path: "/api/http/routers", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + conf: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "test@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -71,8 +72,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all routers, pagination, 1 res per page, want page 2", path: "/api/http/routers?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + conf: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -107,7 +108,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all routers, pagination, 19 results overall, 7 res per page, want page 3", path: "/api/http/routers?page=3&per_page=7", - conf: dynamic.RuntimeConfiguration{ + conf: runtime.Configuration{ Routers: generateHTTPRouters(19), }, expected: expected{ @@ -119,7 +120,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all routers, pagination, 5 results overall, 10 res per page, want page 2", path: "/api/http/routers?page=2&per_page=10", - conf: dynamic.RuntimeConfiguration{ + conf: runtime.Configuration{ Routers: generateHTTPRouters(5), }, expected: expected{ @@ -129,7 +130,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all routers, pagination, 10 results overall, 10 res per page, want page 2", path: "/api/http/routers?page=2&per_page=10", - conf: dynamic.RuntimeConfiguration{ + conf: runtime.Configuration{ Routers: generateHTTPRouters(10), }, expected: expected{ @@ -139,8 +140,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one router by id", path: "/api/http/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + conf: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -148,6 +149,7 @@ func TestHandler_HTTP(t *testing.T) { Rule: "Host(`foo.bar`)", Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, }, + Status: "enabled", }, }, }, @@ -159,8 +161,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one router by id, that does not exist", path: "/api/http/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + conf: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -178,7 +180,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one router by id, but no config", path: "/api/http/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -186,7 +188,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all services, but no config", path: "/api/http/services", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -196,10 +198,10 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all services", path: "/api/http/services", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + conf: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ + "bar@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -211,11 +213,11 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, } - si.UpdateStatus("http://127.0.0.1", "UP") + si.UpdateServerStatus("http://127.0.0.1", "UP") return si }(), - "baz@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + "baz@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -227,7 +229,7 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider"}, } - si.UpdateStatus("http://127.0.0.2", "UP") + si.UpdateServerStatus("http://127.0.0.2", "UP") return si }(), }, @@ -241,10 +243,10 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all services, 1 res per page, want page 2", path: "/api/http/services?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + conf: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ + "bar@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -256,11 +258,11 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, } - si.UpdateStatus("http://127.0.0.1", "UP") + si.UpdateServerStatus("http://127.0.0.1", "UP") return si }(), - "baz@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + "baz@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -272,11 +274,11 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider"}, } - si.UpdateStatus("http://127.0.0.2", "UP") + si.UpdateServerStatus("http://127.0.0.2", "UP") return si }(), - "test@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + "test@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -288,7 +290,7 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, } - si.UpdateStatus("http://127.0.0.4", "UP") + si.UpdateServerStatus("http://127.0.0.4", "UP") return si }(), }, @@ -302,10 +304,10 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one service by id", path: "/api/http/services/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + conf: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ + "bar@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -317,7 +319,7 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, } - si.UpdateStatus("http://127.0.0.1", "UP") + si.UpdateServerStatus("http://127.0.0.1", "UP") return si }(), }, @@ -330,10 +332,10 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one service by id, that does not exist", path: "/api/http/services/nono@myprovider", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ - "bar@myprovider": func() *dynamic.ServiceInfo { - si := &dynamic.ServiceInfo{ + conf: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ + "bar@myprovider": func() *runtime.ServiceInfo { + si := &runtime.ServiceInfo{ Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ Servers: []dynamic.Server{ @@ -345,7 +347,7 @@ func TestHandler_HTTP(t *testing.T) { }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, } - si.UpdateStatus("http://127.0.0.1", "UP") + si.UpdateServerStatus("http://127.0.0.1", "UP") return si }(), }, @@ -357,7 +359,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one service by id, but no config", path: "/api/http/services/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -365,7 +367,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all middlewares, but no config", path: "/api/http/middlewares", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -375,8 +377,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all middlewares", path: "/api/http/middlewares", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ + conf: runtime.Configuration{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -412,8 +414,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "all middlewares, 1 res per page, want page 2", path: "/api/http/middlewares?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ + conf: runtime.Configuration{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -449,8 +451,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one middleware by id", path: "/api/http/middlewares/auth@myprovider", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ + conf: runtime.Configuration{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -485,8 +487,8 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one middleware by id, that does not exist", path: "/api/http/middlewares/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - Middlewares: map[string]*dynamic.MiddlewareInfo{ + conf: runtime.Configuration{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -504,7 +506,7 @@ func TestHandler_HTTP(t *testing.T) { { desc: "one middleware by id, but no config", path: "/api/http/middlewares/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -517,6 +519,8 @@ func TestHandler_HTTP(t *testing.T) { t.Parallel() rtConf := &test.conf + // To lazily initialize the Statuses. + rtConf.PopulateUsedBy() handler := New(static.Configuration{API: &static.API{}, Global: &static.Global{}}, rtConf) router := mux.NewRouter() handler.Append(router) @@ -560,10 +564,10 @@ func TestHandler_HTTP(t *testing.T) { } } -func generateHTTPRouters(nbRouters int) map[string]*dynamic.RouterInfo { - routers := make(map[string]*dynamic.RouterInfo, nbRouters) +func generateHTTPRouters(nbRouters int) map[string]*runtime.RouterInfo { + routers := make(map[string]*runtime.RouterInfo, nbRouters) for i := 0; i < nbRouters; i++ { - routers[fmt.Sprintf("bar%2d@myprovider", i)] = &dynamic.RouterInfo{ + routers[fmt.Sprintf("bar%2d@myprovider", i)] = &runtime.RouterInfo{ Router: &dynamic.Router{ EntryPoints: []string{"web"}, Service: "foo-service@myprovider", diff --git a/pkg/api/handler_overview.go b/pkg/api/handler_overview.go index 01c15f2b5..6d6c51751 100644 --- a/pkg/api/handler_overview.go +++ b/pkg/api/handler_overview.go @@ -5,7 +5,7 @@ import ( "net/http" "reflect" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" ) @@ -60,37 +60,45 @@ func (h Handler) getOverview(rw http.ResponseWriter, request *http.Request) { } } -func getHTTPRouterSection(routers map[string]*dynamic.RouterInfo) *section { +func getHTTPRouterSection(routers map[string]*runtime.RouterInfo) *section { var countErrors int + var countWarnings int for _, rt := range routers { - if rt.Err != "" { + switch rt.Status { + case runtime.StatusDisabled: countErrors++ + case runtime.StatusWarning: + countWarnings++ } } return §ion{ Total: len(routers), - Warnings: 0, // TODO + Warnings: countWarnings, Errors: countErrors, } } -func getHTTPServiceSection(services map[string]*dynamic.ServiceInfo) *section { +func getHTTPServiceSection(services map[string]*runtime.ServiceInfo) *section { var countErrors int + var countWarnings int for _, svc := range services { - if svc.Err != nil { + switch svc.Status { + case runtime.StatusDisabled: countErrors++ + case runtime.StatusWarning: + countWarnings++ } } return §ion{ Total: len(services), - Warnings: 0, // TODO + Warnings: countWarnings, Errors: countErrors, } } -func getHTTPMiddlewareSection(middlewares map[string]*dynamic.MiddlewareInfo) *section { +func getHTTPMiddlewareSection(middlewares map[string]*runtime.MiddlewareInfo) *section { var countErrors int for _, md := range middlewares { if md.Err != nil { @@ -100,12 +108,12 @@ func getHTTPMiddlewareSection(middlewares map[string]*dynamic.MiddlewareInfo) *s return §ion{ Total: len(middlewares), - Warnings: 0, // TODO + Warnings: 0, Errors: countErrors, } } -func getTCPRouterSection(routers map[string]*dynamic.TCPRouterInfo) *section { +func getTCPRouterSection(routers map[string]*runtime.TCPRouterInfo) *section { var countErrors int for _, rt := range routers { if rt.Err != "" { @@ -120,7 +128,7 @@ func getTCPRouterSection(routers map[string]*dynamic.TCPRouterInfo) *section { } } -func getTCPServiceSection(services map[string]*dynamic.TCPServiceInfo) *section { +func getTCPServiceSection(services map[string]*runtime.TCPServiceInfo) *section { var countErrors int for _, svc := range services { if svc.Err != nil { diff --git a/pkg/api/handler_overview_test.go b/pkg/api/handler_overview_test.go index bfdaf0b42..418335c40 100644 --- a/pkg/api/handler_overview_test.go +++ b/pkg/api/handler_overview_test.go @@ -9,6 +9,7 @@ import ( "github.com/containous/mux" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/provider/docker" "github.com/containous/traefik/pkg/provider/file" @@ -33,14 +34,14 @@ func TestHandler_Overview(t *testing.T) { desc string path string confStatic static.Configuration - confDyn dynamic.RuntimeConfiguration + confDyn runtime.Configuration expected expected }{ { desc: "without data in the dynamic configuration", path: "/api/overview", confStatic: static.Configuration{API: &static.API{}, Global: &static.Global{}}, - confDyn: dynamic.RuntimeConfiguration{}, + confDyn: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, jsonFile: "testdata/overview-empty.json", @@ -50,21 +51,34 @@ func TestHandler_Overview(t *testing.T) { desc: "with data in the dynamic configuration", path: "/api/overview", confStatic: static.Configuration{API: &static.API{}, Global: &static.Global{}}, - confDyn: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + confDyn: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ - Servers: []dynamic.Server{ - { - URL: "http://127.0.0.1", - }, - }, + Servers: []dynamic.Server{{URL: "http://127.0.0.1"}}, }, }, + Status: runtime.StatusEnabled, + }, + "bar-service@myprovider": { + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{{URL: "http://127.0.0.1"}}, + }, + }, + Status: runtime.StatusWarning, + }, + "fii-service@myprovider": { + Service: &dynamic.Service{ + LoadBalancer: &dynamic.LoadBalancerService{ + Servers: []dynamic.Server{{URL: "http://127.0.0.1"}}, + }, + }, + Status: runtime.StatusDisabled, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -85,9 +99,10 @@ func TestHandler_Overview(t *testing.T) { Prefix: "/toto", }, }, + Err: []string{"error"}, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -95,6 +110,7 @@ func TestHandler_Overview(t *testing.T) { Rule: "Host(`foo.bar`)", Middlewares: []string{"auth", "addPrefixTest@anotherprovider"}, }, + Status: runtime.StatusEnabled, }, "test@myprovider": { Router: &dynamic.Router{ @@ -103,9 +119,19 @@ func TestHandler_Overview(t *testing.T) { Rule: "Host(`foo.bar.other`)", Middlewares: []string{"addPrefixTest", "auth"}, }, + Status: runtime.StatusWarning, + }, + "foo@myprovider": { + Router: &dynamic.Router{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar.other`)", + Middlewares: []string{"addPrefixTest", "auth"}, + }, + Status: runtime.StatusDisabled, }, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "tcpfoo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -118,7 +144,7 @@ func TestHandler_Overview(t *testing.T) { }, }, }, - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "tcpbar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -156,7 +182,7 @@ func TestHandler_Overview(t *testing.T) { Rancher: &rancher.Provider{}, }, }, - confDyn: dynamic.RuntimeConfiguration{}, + confDyn: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, jsonFile: "testdata/overview-providers.json", @@ -175,7 +201,7 @@ func TestHandler_Overview(t *testing.T) { Jaeger: &jaeger.Config{}, }, }, - confDyn: dynamic.RuntimeConfiguration{}, + confDyn: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, jsonFile: "testdata/overview-features.json", diff --git a/pkg/api/handler_tcp.go b/pkg/api/handler_tcp.go index 81217f240..6dcb0915a 100644 --- a/pkg/api/handler_tcp.go +++ b/pkg/api/handler_tcp.go @@ -7,18 +7,18 @@ import ( "strconv" "github.com/containous/mux" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" ) type tcpRouterRepresentation struct { - *dynamic.TCPRouterInfo + *runtime.TCPRouterInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } type tcpServiceRepresentation struct { - *dynamic.TCPServiceInfo + *runtime.TCPServiceInfo Name string `json:"name,omitempty"` Provider string `json:"provider,omitempty"` } diff --git a/pkg/api/handler_tcp_test.go b/pkg/api/handler_tcp_test.go index 20f7cbeb8..9c68b0f2b 100644 --- a/pkg/api/handler_tcp_test.go +++ b/pkg/api/handler_tcp_test.go @@ -9,6 +9,7 @@ import ( "github.com/containous/mux" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -24,13 +25,13 @@ func TestHandler_TCP(t *testing.T) { testCases := []struct { desc string path string - conf dynamic.RuntimeConfiguration + conf runtime.Configuration expected expected }{ { desc: "all TCP routers, but no config", path: "/api/tcp/routers", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -40,8 +41,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "all TCP routers", path: "/api/tcp/routers", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + conf: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "test@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -70,8 +71,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "all TCP routers, pagination, 1 res per page, want page 2", path: "/api/tcp/routers?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + conf: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -104,8 +105,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "one TCP router by id", path: "/api/tcp/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + conf: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -123,8 +124,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "one TCP router by id, that does not exist", path: "/api/tcp/routers/foo@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + conf: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -141,7 +142,7 @@ func TestHandler_TCP(t *testing.T) { { desc: "one TCP router by id, but no config", path: "/api/tcp/routers/bar@myprovider", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusNotFound, }, @@ -149,7 +150,7 @@ func TestHandler_TCP(t *testing.T) { { desc: "all tcp services, but no config", path: "/api/tcp/services", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusOK, nextPage: "1", @@ -159,8 +160,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "all tcp services", path: "/api/tcp/services", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "bar@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -196,8 +197,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "all tcp services, 1 res per page, want page 2", path: "/api/tcp/services?page=2&per_page=1", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "bar@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -244,8 +245,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "one tcp service by id", path: "/api/tcp/services/bar@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "bar@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -268,8 +269,8 @@ func TestHandler_TCP(t *testing.T) { { desc: "one tcp service by id, that does not exist", path: "/api/tcp/services/nono@myprovider", - conf: dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "bar@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -291,7 +292,7 @@ func TestHandler_TCP(t *testing.T) { { desc: "one tcp service by id, but no config", path: "/api/tcp/services/foo@myprovider", - conf: dynamic.RuntimeConfiguration{}, + conf: runtime.Configuration{}, expected: expected{ statusCode: http.StatusNotFound, }, diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go index 59f0d5edc..1055eead0 100644 --- a/pkg/api/handler_test.go +++ b/pkg/api/handler_test.go @@ -10,6 +10,7 @@ import ( "github.com/containous/mux" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,14 +27,14 @@ func TestHandler_RawData(t *testing.T) { testCases := []struct { desc string path string - conf dynamic.RuntimeConfiguration + conf runtime.Configuration expected expected }{ { desc: "Get rawdata", path: "/api/rawdata", - conf: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -46,7 +47,7 @@ func TestHandler_RawData(t *testing.T) { }, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -69,7 +70,7 @@ func TestHandler_RawData(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -87,7 +88,7 @@ func TestHandler_RawData(t *testing.T) { }, }, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "tcpfoo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -100,7 +101,7 @@ func TestHandler_RawData(t *testing.T) { }, }, }, - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "tcpbar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, diff --git a/pkg/api/testdata/getrawdata.json b/pkg/api/testdata/getrawdata.json index 7e238245b..9ef1b9111 100644 --- a/pkg/api/testdata/getrawdata.json +++ b/pkg/api/testdata/getrawdata.json @@ -9,7 +9,8 @@ "addPrefixTest@anotherprovider" ], "service": "foo-service@myprovider", - "rule": "Host(`foo.bar`)" + "rule": "Host(`foo.bar`)", + "status": "enabled" }, "test@myprovider": { "entryPoints": [ @@ -20,7 +21,8 @@ "auth" ], "service": "foo-service@myprovider", - "rule": "Host(`foo.bar.other`)" + "rule": "Host(`foo.bar.other`)", + "status": "enabled" } }, "middlewares": { @@ -62,6 +64,7 @@ ], "passHostHeader": false }, + "status": "enabled", "usedBy": [ "bar@myprovider", "test@myprovider" @@ -74,14 +77,16 @@ "web" ], "service": "tcpfoo-service@myprovider", - "rule": "HostSNI(`foo.bar`)" + "rule": "HostSNI(`foo.bar`)", + "status": "enabled" }, "tcptest@myprovider": { "entryPoints": [ "web" ], "service": "tcpfoo-service@myprovider", - "rule": "HostSNI(`foo.bar.other`)" + "rule": "HostSNI(`foo.bar.other`)", + "status": "enabled" } }, "tcpServices": { @@ -93,6 +98,7 @@ } ] }, + "status": "enabled", "usedBy": [ "tcpbar@myprovider", "tcptest@myprovider" diff --git a/pkg/api/testdata/overview-dynamic.json b/pkg/api/testdata/overview-dynamic.json index 346f47433..c2c864386 100644 --- a/pkg/api/testdata/overview-dynamic.json +++ b/pkg/api/testdata/overview-dynamic.json @@ -6,19 +6,19 @@ }, "http": { "middlewares": { - "errors": 0, + "errors": 1, "total": 3, "warnings": 0 }, "routers": { - "errors": 0, - "total": 2, - "warnings": 0 + "errors": 1, + "total": 3, + "warnings": 1 }, "services": { - "errors": 0, - "total": 1, - "warnings": 0 + "errors": 1, + "total": 3, + "warnings": 1 } }, "tcp": { diff --git a/pkg/api/testdata/router-bar.json b/pkg/api/testdata/router-bar.json index ea407a3a3..267a9628b 100644 --- a/pkg/api/testdata/router-bar.json +++ b/pkg/api/testdata/router-bar.json @@ -9,5 +9,6 @@ "name": "bar@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" } \ No newline at end of file diff --git a/pkg/api/testdata/routers-many-lastpage.json b/pkg/api/testdata/routers-many-lastpage.json index c13b87a55..290672375 100644 --- a/pkg/api/testdata/routers-many-lastpage.json +++ b/pkg/api/testdata/routers-many-lastpage.json @@ -6,7 +6,8 @@ "name": "bar14@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar14`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" }, { "entryPoints": [ @@ -15,7 +16,8 @@ "name": "bar15@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar15`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" }, { "entryPoints": [ @@ -24,7 +26,8 @@ "name": "bar16@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar16`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" }, { "entryPoints": [ @@ -33,7 +36,8 @@ "name": "bar17@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar17`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" }, { "entryPoints": [ @@ -42,6 +46,7 @@ "name": "bar18@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar18`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" } ] \ No newline at end of file diff --git a/pkg/api/testdata/routers-page2.json b/pkg/api/testdata/routers-page2.json index 73d97c6d6..8c7f65d1b 100644 --- a/pkg/api/testdata/routers-page2.json +++ b/pkg/api/testdata/routers-page2.json @@ -6,6 +6,7 @@ "name": "baz@myprovider", "provider": "myprovider", "rule": "Host(`toto.bar`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" } ] \ No newline at end of file diff --git a/pkg/api/testdata/routers.json b/pkg/api/testdata/routers.json index f0e4c37b8..664aedc51 100644 --- a/pkg/api/testdata/routers.json +++ b/pkg/api/testdata/routers.json @@ -10,7 +10,8 @@ "name": "bar@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" }, { "entryPoints": [ @@ -23,6 +24,7 @@ "name": "test@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar.other`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "enabled" } ] \ No newline at end of file diff --git a/pkg/api/testdata/service-bar.json b/pkg/api/testdata/service-bar.json index 529e3382a..e26b65a72 100644 --- a/pkg/api/testdata/service-bar.json +++ b/pkg/api/testdata/service-bar.json @@ -12,6 +12,7 @@ "serverStatus": { "http://127.0.0.1": "UP" }, + "status": "enabled", "usedBy": [ "foo@myprovider", "test@myprovider" diff --git a/pkg/api/testdata/services-page2.json b/pkg/api/testdata/services-page2.json index 2f5dce034..66b8390d1 100644 --- a/pkg/api/testdata/services-page2.json +++ b/pkg/api/testdata/services-page2.json @@ -13,6 +13,7 @@ "serverStatus": { "http://127.0.0.2": "UP" }, + "status": "enabled", "usedBy": [ "foo@myprovider" ] diff --git a/pkg/api/testdata/services.json b/pkg/api/testdata/services.json index 9abd426f8..bd54b536c 100644 --- a/pkg/api/testdata/services.json +++ b/pkg/api/testdata/services.json @@ -13,6 +13,7 @@ "serverStatus": { "http://127.0.0.1": "UP" }, + "status": "enabled", "usedBy": [ "foo@myprovider", "test@myprovider" @@ -32,6 +33,7 @@ "serverStatus": { "http://127.0.0.2": "UP" }, + "status": "enabled", "usedBy": [ "foo@myprovider" ] diff --git a/pkg/config/dynamic/runtime.go b/pkg/config/runtime/runtime.go similarity index 50% rename from pkg/config/dynamic/runtime.go rename to pkg/config/runtime/runtime.go index 94dfe2c94..4c6221af3 100644 --- a/pkg/config/dynamic/runtime.go +++ b/pkg/config/runtime/runtime.go @@ -1,4 +1,4 @@ -package dynamic +package runtime import ( "context" @@ -6,11 +6,19 @@ import ( "strings" "sync" + "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/log" ) -// RuntimeConfiguration holds the information about the currently running traefik instance. -type RuntimeConfiguration struct { +// Status of the router/service +const ( + StatusEnabled = "enabled" + StatusDisabled = "disabled" + StatusWarning = "warning" +) + +// Configuration holds the information about the currently running traefik instance. +type Configuration struct { Routers map[string]*RouterInfo `json:"routers,omitempty"` Middlewares map[string]*MiddlewareInfo `json:"middlewares,omitempty"` Services map[string]*ServiceInfo `json:"services,omitempty"` @@ -18,20 +26,20 @@ type RuntimeConfiguration struct { TCPServices map[string]*TCPServiceInfo `json:"tcpServices,omitempty"` } -// NewRuntimeConfig returns a RuntimeConfiguration initialized with the given conf. It never returns nil. -func NewRuntimeConfig(conf Configuration) *RuntimeConfiguration { +// NewConfig returns a Configuration initialized with the given conf. It never returns nil. +func NewConfig(conf dynamic.Configuration) *Configuration { if conf.HTTP == nil && conf.TCP == nil { - return &RuntimeConfiguration{} + return &Configuration{} } - runtimeConfig := &RuntimeConfiguration{} + runtimeConfig := &Configuration{} if conf.HTTP != nil { routers := conf.HTTP.Routers if len(routers) > 0 { runtimeConfig.Routers = make(map[string]*RouterInfo, len(routers)) for k, v := range routers { - runtimeConfig.Routers[k] = &RouterInfo{Router: v} + runtimeConfig.Routers[k] = &RouterInfo{Router: v, Status: StatusEnabled} } } @@ -39,7 +47,7 @@ func NewRuntimeConfig(conf Configuration) *RuntimeConfiguration { if len(services) > 0 { runtimeConfig.Services = make(map[string]*ServiceInfo, len(services)) for k, v := range services { - runtimeConfig.Services[k] = &ServiceInfo{Service: v} + runtimeConfig.Services[k] = &ServiceInfo{Service: v, Status: StatusEnabled} } } @@ -56,14 +64,14 @@ func NewRuntimeConfig(conf Configuration) *RuntimeConfiguration { if len(conf.TCP.Routers) > 0 { runtimeConfig.TCPRouters = make(map[string]*TCPRouterInfo, len(conf.TCP.Routers)) for k, v := range conf.TCP.Routers { - runtimeConfig.TCPRouters[k] = &TCPRouterInfo{TCPRouter: v} + runtimeConfig.TCPRouters[k] = &TCPRouterInfo{TCPRouter: v, Status: StatusEnabled} } } if len(conf.TCP.Services) > 0 { runtimeConfig.TCPServices = make(map[string]*TCPServiceInfo, len(conf.TCP.Services)) for k, v := range conf.TCP.Services { - runtimeConfig.TCPServices[k] = &TCPServiceInfo{TCPService: v} + runtimeConfig.TCPServices[k] = &TCPServiceInfo{TCPService: v, Status: StatusEnabled} } } } @@ -73,7 +81,7 @@ func NewRuntimeConfig(conf Configuration) *RuntimeConfiguration { // PopulateUsedBy populates all the UsedBy lists of the underlying fields of r, // based on the relations between the included services, routers, and middlewares. -func (r *RuntimeConfiguration) PopulateUsedBy() { +func (r *Configuration) PopulateUsedBy() { if r == nil { return } @@ -81,6 +89,11 @@ func (r *RuntimeConfiguration) PopulateUsedBy() { logger := log.WithoutContext() for routerName, routerInfo := range r.Routers { + // lazily initialize Status in case caller forgot to do it + if routerInfo.Status == "" { + routerInfo.Status = StatusEnabled + } + providerName := getProviderName(routerName) if providerName == "" { logger.WithField(log.RouterName, routerName).Error("router name is not fully qualified") @@ -102,7 +115,12 @@ func (r *RuntimeConfiguration) PopulateUsedBy() { r.Services[serviceName].UsedBy = append(r.Services[serviceName].UsedBy, routerName) } - for k := range r.Services { + for k, serviceInfo := range r.Services { + // lazily initialize Status in case caller forgot to do it + if serviceInfo.Status == "" { + serviceInfo.Status = StatusEnabled + } + sort.Strings(r.Services[k].UsedBy) } @@ -111,6 +129,11 @@ func (r *RuntimeConfiguration) PopulateUsedBy() { } for routerName, routerInfo := range r.TCPRouters { + // lazily initialize Status in case caller forgot to do it + if routerInfo.Status == "" { + routerInfo.Status = StatusEnabled + } + providerName := getProviderName(routerName) if providerName == "" { logger.WithField(log.RouterName, routerName).Error("tcp router name is not fully qualified") @@ -124,7 +147,12 @@ func (r *RuntimeConfiguration) PopulateUsedBy() { r.TCPServices[serviceName].UsedBy = append(r.TCPServices[serviceName].UsedBy, routerName) } - for k := range r.TCPServices { + for k, serviceInfo := range r.TCPServices { + // lazily initialize Status in case caller forgot to do it + if serviceInfo.Status == "" { + serviceInfo.Status = StatusEnabled + } + sort.Strings(r.TCPServices[k].UsedBy) } } @@ -138,8 +166,8 @@ func contains(entryPoints []string, entryPointName string) bool { return false } -// GetRoutersByEntrypoints returns all the http routers by entrypoints name and routers name -func (r *RuntimeConfiguration) GetRoutersByEntrypoints(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*RouterInfo { +// GetRoutersByEntryPoints returns all the http routers by entry points name and routers name +func (r *Configuration) GetRoutersByEntryPoints(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*RouterInfo { entryPointsRouters := make(map[string]map[string]*RouterInfo) for rtName, rt := range r.Routers { @@ -169,8 +197,8 @@ func (r *RuntimeConfiguration) GetRoutersByEntrypoints(ctx context.Context, entr return entryPointsRouters } -// GetTCPRoutersByEntrypoints returns all the tcp routers by entrypoints name and routers name -func (r *RuntimeConfiguration) GetTCPRoutersByEntrypoints(ctx context.Context, entryPoints []string) map[string]map[string]*TCPRouterInfo { +// GetTCPRoutersByEntryPoints returns all the tcp routers by entry points name and routers name +func (r *Configuration) GetTCPRoutersByEntryPoints(ctx context.Context, entryPoints []string) map[string]map[string]*TCPRouterInfo { entryPointsRouters := make(map[string]map[string]*TCPRouterInfo) for rtName, rt := range r.TCPRouters { @@ -199,57 +227,126 @@ func (r *RuntimeConfiguration) GetTCPRoutersByEntrypoints(ctx context.Context, e // RouterInfo holds information about a currently running HTTP router type RouterInfo struct { - *Router // dynamic configuration - Err string `json:"error,omitempty"` // initialization error + *dynamic.Router // dynamic configuration + // Err contains all the errors that occurred during router's creation. + Err []string `json:"error,omitempty"` + // Status reports whether the router is disabled, in a warning state, or all good (enabled). + // If not in "enabled" state, the reason for it should be in the list of Err. + // It is the caller's responsibility to set the initial status. + Status string `json:"status,omitempty"` +} + +// AddError adds err to r.Err, if it does not already exist. +// If critical is set, r is marked as disabled. +func (r *RouterInfo) AddError(err error, critical bool) { + for _, value := range r.Err { + if value == err.Error() { + return + } + } + + r.Err = append(r.Err, err.Error()) + if critical { + r.Status = StatusDisabled + return + } + + // only set it to "warning" if not already in a worse state + if r.Status != StatusDisabled { + r.Status = StatusWarning + } } // TCPRouterInfo holds information about a currently running TCP router type TCPRouterInfo struct { - *TCPRouter // dynamic configuration - Err string `json:"error,omitempty"` // initialization error + *dynamic.TCPRouter // dynamic configuration + Err string `json:"error,omitempty"` // initialization error + // Status reports whether the router is disabled, in a warning state, or all good (enabled). + // If not in "enabled" state, the reason for it should be in the list of Err. + // It is the caller's responsibility to set the initial status. + Status string `json:"status,omitempty"` } // MiddlewareInfo holds information about a currently running middleware type MiddlewareInfo struct { - *Middleware // dynamic configuration - Err error `json:"error,omitempty"` // initialization error - UsedBy []string `json:"usedBy,omitempty"` // list of routers and services using that middleware + *dynamic.Middleware // dynamic configuration + // Err contains all the errors that occurred during service creation. + Err []string `json:"error,omitempty"` + UsedBy []string `json:"usedBy,omitempty"` // list of routers and services using that middleware +} + +// AddError adds err to s.Err, if it does not already exist. +// If critical is set, m is marked as disabled. +func (m *MiddlewareInfo) AddError(err error) { + for _, value := range m.Err { + if value == err.Error() { + return + } + } + + m.Err = append(m.Err, err.Error()) } // ServiceInfo holds information about a currently running service type ServiceInfo struct { - *Service // dynamic configuration - Err error `json:"error,omitempty"` // initialization error - UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service + *dynamic.Service // dynamic configuration + // Err contains all the errors that occurred during service creation. + Err []string `json:"error,omitempty"` + // Status reports whether the service is disabled, in a warning state, or all good (enabled). + // If not in "enabled" state, the reason for it should be in the list of Err. + // It is the caller's responsibility to set the initial status. + Status string `json:"status,omitempty"` + UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service - statusMu sync.RWMutex - status map[string]string // keyed by server URL + serverStatusMu sync.RWMutex + serverStatus map[string]string // keyed by server URL } -// UpdateStatus sets the status of the server in the ServiceInfo. -// It is the responsibility of the caller to check that s is not nil. -func (s *ServiceInfo) UpdateStatus(server string, status string) { - s.statusMu.Lock() - defer s.statusMu.Unlock() - - if s.status == nil { - s.status = make(map[string]string) +// AddError adds err to s.Err, if it does not already exist. +// If critical is set, s is marked as disabled. +func (s *ServiceInfo) AddError(err error, critical bool) { + for _, value := range s.Err { + if value == err.Error() { + return + } } - s.status[server] = status + + s.Err = append(s.Err, err.Error()) + if critical { + s.Status = StatusDisabled + return + } + + // only set it to "warning" if not already in a worse state + if s.Status != StatusDisabled { + s.Status = StatusWarning + } +} + +// UpdateServerStatus sets the status of the server in the ServiceInfo. +// It is the responsibility of the caller to check that s is not nil. +func (s *ServiceInfo) UpdateServerStatus(server string, status string) { + s.serverStatusMu.Lock() + defer s.serverStatusMu.Unlock() + + if s.serverStatus == nil { + s.serverStatus = make(map[string]string) + } + s.serverStatus[server] = status } // GetAllStatus returns all the statuses of all the servers in ServiceInfo. // It is the responsibility of the caller to check that s is not nil func (s *ServiceInfo) GetAllStatus() map[string]string { - s.statusMu.RLock() - defer s.statusMu.RUnlock() + s.serverStatusMu.RLock() + defer s.serverStatusMu.RUnlock() - if len(s.status) == 0 { + if len(s.serverStatus) == 0 { return nil } - allStatus := make(map[string]string, len(s.status)) - for k, v := range s.status { + allStatus := make(map[string]string, len(s.serverStatus)) + for k, v := range s.serverStatus { allStatus[k] = v } return allStatus @@ -257,9 +354,13 @@ func (s *ServiceInfo) GetAllStatus() map[string]string { // TCPServiceInfo holds information about a currently running TCP service type TCPServiceInfo struct { - *TCPService // dynamic configuration - Err error `json:"error,omitempty"` // initialization error - UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service + *dynamic.TCPService // dynamic configuration + Err error `json:"error,omitempty"` // initialization error + // Status reports whether the service is disabled, in a warning state, or all good (enabled). + // If not in "enabled" state, the reason for it should be in the list of Err. + // It is the caller's responsibility to set the initial status. + Status string `json:"status,omitempty"` + UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service } func getProviderName(elementName string) string { diff --git a/pkg/config/dynamic/runtime_test.go b/pkg/config/runtime/runtime_test.go similarity index 82% rename from pkg/config/dynamic/runtime_test.go rename to pkg/config/runtime/runtime_test.go index 4cd1be4e1..0d5885f22 100644 --- a/pkg/config/dynamic/runtime_test.go +++ b/pkg/config/runtime/runtime_test.go @@ -1,30 +1,31 @@ -package dynamic_test +package runtime_test import ( "context" "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // all the Routers/Middlewares/Services are considered fully qualified -func TestPopulateUsedby(t *testing.T) { +func TestPopulateUsedBy(t *testing.T) { testCases := []struct { desc string - conf *dynamic.RuntimeConfiguration - expected dynamic.RuntimeConfiguration + conf *runtime.Configuration + expected runtime.Configuration }{ { desc: "nil config", conf: nil, - expected: dynamic.RuntimeConfiguration{}, + expected: runtime.Configuration{}, }, { desc: "One service used by two routers", - conf: &dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + conf: &runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "foo@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -40,7 +41,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -57,12 +58,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -71,8 +72,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "One service used by two routers, but one router with wrong rule", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -83,7 +84,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "foo@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -100,12 +101,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -114,15 +115,15 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Broken Service used by one Router", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: nil, }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -132,11 +133,11 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -145,8 +146,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 different Services each used by a disctinct router.", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -184,7 +185,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "foo@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -201,12 +202,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": {}, "foo@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"foo@myprovider"}, }, @@ -218,8 +219,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 middlewares both used by 2 Routers", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -232,7 +233,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -248,7 +249,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -267,17 +268,17 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": {}, "test@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, @@ -289,8 +290,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Unknown middleware is not used by the Router", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -303,7 +304,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -312,7 +313,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -323,8 +324,8 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + expected: runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -333,8 +334,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "Broken middleware is used by Router", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -347,7 +348,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -356,7 +357,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -367,16 +368,16 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -385,8 +386,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "2 middlewares from 2 disctinct providers both used by 2 Routers", - conf: &dynamic.RuntimeConfiguration{ - Services: map[string]*dynamic.ServiceInfo{ + conf: &runtime.Configuration{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{ @@ -399,7 +400,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { Middleware: &dynamic.Middleware{ BasicAuth: &dynamic.BasicAuth{ @@ -422,7 +423,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - Routers: map[string]*dynamic.RouterInfo{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": { Router: &dynamic.Router{ EntryPoints: []string{"web"}, @@ -441,17 +442,17 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - Routers: map[string]*dynamic.RouterInfo{ + expected: runtime.Configuration{ + Routers: map[string]*runtime.RouterInfo{ "bar@myprovider": {}, "test@myprovider": {}, }, - Services: map[string]*dynamic.ServiceInfo{ + Services: map[string]*runtime.ServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, }, - Middlewares: map[string]*dynamic.MiddlewareInfo{ + Middlewares: map[string]*runtime.MiddlewareInfo{ "auth@myprovider": { UsedBy: []string{"bar@myprovider", "test@myprovider"}, }, @@ -468,8 +469,8 @@ func TestPopulateUsedby(t *testing.T) { // TCP tests from hereon { desc: "TCP, One service used by two routers", - conf: &dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + conf: &runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "foo@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -485,7 +486,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -504,12 +505,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + expected: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -518,8 +519,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, One service used by two routers, but one router with wrong rule", - conf: &dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: &runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -532,7 +533,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "foo@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -549,12 +550,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + expected: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "foo@myprovider": {}, "bar@myprovider": {}, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider", "foo@myprovider"}, }, @@ -563,15 +564,15 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, Broken Service used by one Router", - conf: &dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: &runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: nil, }, }, }, - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -581,11 +582,11 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + expected: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": {}, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"bar@myprovider"}, }, @@ -594,8 +595,8 @@ func TestPopulateUsedby(t *testing.T) { }, { desc: "TCP, 2 different Services each used by a disctinct router.", - conf: &dynamic.RuntimeConfiguration{ - TCPServices: map[string]*dynamic.TCPServiceInfo{ + conf: &runtime.Configuration{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -629,7 +630,7 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "foo@myprovider": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -646,12 +647,12 @@ func TestPopulateUsedby(t *testing.T) { }, }, }, - expected: dynamic.RuntimeConfiguration{ - TCPRouters: map[string]*dynamic.TCPRouterInfo{ + expected: runtime.Configuration{ + TCPRouters: map[string]*runtime.TCPRouterInfo{ "bar@myprovider": {}, "foo@myprovider": {}, }, - TCPServices: map[string]*dynamic.TCPServiceInfo{ + TCPServices: map[string]*runtime.TCPServiceInfo{ "foo-service@myprovider": { UsedBy: []string{"foo@myprovider"}, }, @@ -690,24 +691,24 @@ func TestPopulateUsedby(t *testing.T) { } -func TestGetTCPRoutersByEntrypoints(t *testing.T) { +func TestGetTCPRoutersByEntryPoints(t *testing.T) { testCases := []struct { desc string conf dynamic.Configuration entryPoints []string - expected map[string]map[string]*dynamic.TCPRouterInfo + expected map[string]map[string]*runtime.TCPRouterInfo }{ { desc: "Empty Configuration without entrypoint", conf: dynamic.Configuration{}, entryPoints: []string{""}, - expected: map[string]map[string]*dynamic.TCPRouterInfo{}, + expected: map[string]map[string]*runtime.TCPRouterInfo{}, }, { desc: "Empty Configuration with unknown entrypoints", conf: dynamic.Configuration{}, entryPoints: []string{"foo"}, - expected: map[string]map[string]*dynamic.TCPRouterInfo{}, + expected: map[string]map[string]*runtime.TCPRouterInfo{}, }, { desc: "Valid configuration with an unknown entrypoint", @@ -732,7 +733,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"foo"}, - expected: map[string]map[string]*dynamic.TCPRouterInfo{}, + expected: map[string]map[string]*runtime.TCPRouterInfo{}, }, { desc: "Valid configuration with a known entrypoint", @@ -777,7 +778,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web"}, - expected: map[string]map[string]*dynamic.TCPRouterInfo{ + expected: map[string]map[string]*runtime.TCPRouterInfo{ "web": { "foo": { TCPRouter: &dynamic.TCPRouter{ @@ -785,6 +786,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "foo-service@myprovider", Rule: "HostSNI(`bar.foo`)", }, + Status: "enabled", }, "foobar": { TCPRouter: &dynamic.TCPRouter{ @@ -792,6 +794,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", }, + Status: "enabled", }, }, }, @@ -839,7 +842,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web", "webs"}, - expected: map[string]map[string]*dynamic.TCPRouterInfo{ + expected: map[string]map[string]*runtime.TCPRouterInfo{ "web": { "foo": { TCPRouter: &dynamic.TCPRouter{ @@ -847,6 +850,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "foo-service@myprovider", Rule: "HostSNI(`bar.foo`)", }, + Status: "enabled", }, "foobar": { TCPRouter: &dynamic.TCPRouter{ @@ -854,6 +858,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", }, + Status: "enabled", }, }, "webs": { @@ -864,6 +869,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "bar-service@myprovider", Rule: "HostSNI(`foo.bar`)", }, + Status: "enabled", }, "foobar": { TCPRouter: &dynamic.TCPRouter{ @@ -871,6 +877,7 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "HostSNI(`bar.foobar`)", }, + Status: "enabled", }, }, }, @@ -881,31 +888,31 @@ func TestGetTCPRoutersByEntrypoints(t *testing.T) { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() - runtimeConfig := dynamic.NewRuntimeConfig(test.conf) - actual := runtimeConfig.GetTCPRoutersByEntrypoints(context.Background(), test.entryPoints) + runtimeConfig := runtime.NewConfig(test.conf) + actual := runtimeConfig.GetTCPRoutersByEntryPoints(context.Background(), test.entryPoints) assert.Equal(t, test.expected, actual) }) } } -func TestGetRoutersByEntrypoints(t *testing.T) { +func TestGetRoutersByEntryPoints(t *testing.T) { testCases := []struct { desc string conf dynamic.Configuration entryPoints []string - expected map[string]map[string]*dynamic.RouterInfo + expected map[string]map[string]*runtime.RouterInfo }{ { desc: "Empty Configuration without entrypoint", conf: dynamic.Configuration{}, entryPoints: []string{""}, - expected: map[string]map[string]*dynamic.RouterInfo{}, + expected: map[string]map[string]*runtime.RouterInfo{}, }, { desc: "Empty Configuration with unknown entrypoints", conf: dynamic.Configuration{}, entryPoints: []string{"foo"}, - expected: map[string]map[string]*dynamic.RouterInfo{}, + expected: map[string]map[string]*runtime.RouterInfo{}, }, { desc: "Valid configuration with an unknown entrypoint", @@ -930,7 +937,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"foo"}, - expected: map[string]map[string]*dynamic.RouterInfo{}, + expected: map[string]map[string]*runtime.RouterInfo{}, }, { desc: "Valid configuration with a known entrypoint", @@ -975,7 +982,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web"}, - expected: map[string]map[string]*dynamic.RouterInfo{ + expected: map[string]map[string]*runtime.RouterInfo{ "web": { "foo": { Router: &dynamic.Router{ @@ -983,6 +990,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, + Status: "enabled", }, "foobar": { Router: &dynamic.Router{ @@ -990,6 +998,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", }, + Status: "enabled", }, }, }, @@ -1037,7 +1046,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { }, }, entryPoints: []string{"web", "webs"}, - expected: map[string]map[string]*dynamic.RouterInfo{ + expected: map[string]map[string]*runtime.RouterInfo{ "web": { "foo": { Router: &dynamic.Router{ @@ -1045,6 +1054,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "foo-service@myprovider", Rule: "Host(`bar.foo`)", }, + Status: "enabled", }, "foobar": { Router: &dynamic.Router{ @@ -1052,6 +1062,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", }, + Status: "enabled", }, }, "webs": { @@ -1062,6 +1073,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "bar-service@myprovider", Rule: "Host(`foo.bar`)", }, + Status: "enabled", }, "foobar": { Router: &dynamic.Router{ @@ -1069,6 +1081,7 @@ func TestGetRoutersByEntrypoints(t *testing.T) { Service: "foobar-service@myprovider", Rule: "Host(`bar.foobar`)", }, + Status: "enabled", }, }, }, @@ -1079,8 +1092,8 @@ func TestGetRoutersByEntrypoints(t *testing.T) { test := test t.Run(test.desc, func(t *testing.T) { t.Parallel() - runtimeConfig := dynamic.NewRuntimeConfig(test.conf) - actual := runtimeConfig.GetRoutersByEntrypoints(context.Background(), test.entryPoints, false) + runtimeConfig := runtime.NewConfig(test.conf) + actual := runtimeConfig.GetRoutersByEntryPoints(context.Background(), test.entryPoints, false) assert.Equal(t, test.expected, actual) }) } diff --git a/pkg/healthcheck/healthcheck.go b/pkg/healthcheck/healthcheck.go index f36a2b039..1da028d27 100644 --- a/pkg/healthcheck/healthcheck.go +++ b/pkg/healthcheck/healthcheck.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/safe" "github.com/go-kit/kit/metrics" @@ -229,7 +229,7 @@ func checkHealth(serverURL *url.URL, backend *BackendConfig) error { } // NewLBStatusUpdater returns a new LbStatusUpdater -func NewLBStatusUpdater(bh BalancerHandler, svinfo *dynamic.ServiceInfo) *LbStatusUpdater { +func NewLBStatusUpdater(bh BalancerHandler, svinfo *runtime.ServiceInfo) *LbStatusUpdater { return &LbStatusUpdater{ BalancerHandler: bh, serviceInfo: svinfo, @@ -240,7 +240,7 @@ func NewLBStatusUpdater(bh BalancerHandler, svinfo *dynamic.ServiceInfo) *LbStat // so it can keep track of the status of a server in the ServiceInfo. type LbStatusUpdater struct { BalancerHandler - serviceInfo *dynamic.ServiceInfo // can be nil + serviceInfo *runtime.ServiceInfo // can be nil } // RemoveServer removes the given server from the BalancerHandler, @@ -248,7 +248,7 @@ type LbStatusUpdater struct { func (lb *LbStatusUpdater) RemoveServer(u *url.URL) error { err := lb.BalancerHandler.RemoveServer(u) if err == nil && lb.serviceInfo != nil { - lb.serviceInfo.UpdateStatus(u.String(), serverDown) + lb.serviceInfo.UpdateServerStatus(u.String(), serverDown) } return err } @@ -258,7 +258,7 @@ func (lb *LbStatusUpdater) RemoveServer(u *url.URL) error { func (lb *LbStatusUpdater) UpsertServer(u *url.URL, options ...roundrobin.ServerOption) error { err := lb.BalancerHandler.UpsertServer(u, options...) if err == nil && lb.serviceInfo != nil { - lb.serviceInfo.UpdateStatus(u.String(), serverUp) + lb.serviceInfo.UpdateServerStatus(u.String(), serverUp) } return err } diff --git a/pkg/healthcheck/healthcheck_test.go b/pkg/healthcheck/healthcheck_test.go index 9dc9ef406..59fbe8f43 100644 --- a/pkg/healthcheck/healthcheck_test.go +++ b/pkg/healthcheck/healthcheck_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -443,7 +443,7 @@ func (th *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func TestLBStatusUpdater(t *testing.T) { lb := &testLoadBalancer{RWMutex: &sync.RWMutex{}} - svInfo := &dynamic.ServiceInfo{} + svInfo := &runtime.ServiceInfo{} lbsu := NewLBStatusUpdater(lb, svInfo) newServer, err := url.Parse("http://foo.com") assert.Nil(t, err) diff --git a/pkg/responsemodifiers/response_modifier.go b/pkg/responsemodifiers/response_modifier.go index cf30f42cf..e12bddf9c 100644 --- a/pkg/responsemodifiers/response_modifier.go +++ b/pkg/responsemodifiers/response_modifier.go @@ -4,17 +4,17 @@ import ( "context" "net/http" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" ) // NewBuilder creates a builder. -func NewBuilder(configs map[string]*dynamic.MiddlewareInfo) *Builder { +func NewBuilder(configs map[string]*runtime.MiddlewareInfo) *Builder { return &Builder{configs: configs} } // Builder holds builder configuration. type Builder struct { - configs map[string]*dynamic.MiddlewareInfo + configs map[string]*runtime.MiddlewareInfo } // Build Builds the response modifier. diff --git a/pkg/responsemodifiers/response_modifier_test.go b/pkg/responsemodifiers/response_modifier_test.go index f407c124c..de48fc4b3 100644 --- a/pkg/responsemodifiers/response_modifier_test.go +++ b/pkg/responsemodifiers/response_modifier_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/middlewares/headers" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -166,7 +167,7 @@ func TestBuilderBuild(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Middlewares: test.conf, }, diff --git a/pkg/server/middleware/middlewares.go b/pkg/server/middleware/middlewares.go index 7d2609623..8333247bc 100644 --- a/pkg/server/middleware/middlewares.go +++ b/pkg/server/middleware/middlewares.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/middlewares/addprefix" "github.com/containous/traefik/pkg/middlewares/auth" "github.com/containous/traefik/pkg/middlewares/buffering" @@ -39,7 +39,7 @@ const ( // Builder the middleware builder type Builder struct { - configs map[string]*dynamic.MiddlewareInfo + configs map[string]*runtime.MiddlewareInfo serviceBuilder serviceBuilder } @@ -48,7 +48,7 @@ type serviceBuilder interface { } // NewBuilder creates a new Builder -func NewBuilder(configs map[string]*dynamic.MiddlewareInfo, serviceBuilder serviceBuilder) *Builder { +func NewBuilder(configs map[string]*runtime.MiddlewareInfo, serviceBuilder serviceBuilder) *Builder { return &Builder{configs: configs, serviceBuilder: serviceBuilder} } @@ -66,19 +66,19 @@ func (b *Builder) BuildChain(ctx context.Context, middlewares []string) *alice.C var err error if constructorContext, err = checkRecursion(constructorContext, middlewareName); err != nil { - b.configs[middlewareName].Err = err + b.configs[middlewareName].AddError(err) return nil, err } constructor, err := b.buildConstructor(constructorContext, middlewareName) if err != nil { - b.configs[middlewareName].Err = err + b.configs[middlewareName].AddError(err) return nil, err } handler, err := constructor(next) if err != nil { - b.configs[middlewareName].Err = err + b.configs[middlewareName].AddError(err) return nil, err } diff --git a/pkg/server/middleware/middlewares_test.go b/pkg/server/middleware/middlewares_test.go index ead213a69..5da03c335 100644 --- a/pkg/server/middleware/middlewares_test.go +++ b/pkg/server/middleware/middlewares_test.go @@ -8,13 +8,14 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/server/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestBuilder_BuildChainNilConfig(t *testing.T) { - testConfig := map[string]*dynamic.MiddlewareInfo{ + testConfig := map[string]*runtime.MiddlewareInfo{ "empty": {}, } middlewaresBuilder := NewBuilder(testConfig, nil) @@ -25,7 +26,7 @@ func TestBuilder_BuildChainNilConfig(t *testing.T) { } func TestBuilder_BuildChainNonExistentChain(t *testing.T) { - testConfig := map[string]*dynamic.MiddlewareInfo{ + testConfig := map[string]*runtime.MiddlewareInfo{ "foobar": {}, } middlewaresBuilder := NewBuilder(testConfig, nil) @@ -264,7 +265,7 @@ func TestBuilder_BuildChainWithContext(t *testing.T) { ctx = internal.AddProviderInContext(ctx, "foobar@"+test.contextProvider) } - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Middlewares: test.configuration, }, @@ -315,7 +316,7 @@ func TestBuilder_buildConstructor(t *testing.T) { }, } - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Middlewares: testConfig, }, diff --git a/pkg/server/router/route_appender_aggregator.go b/pkg/server/router/route_appender_aggregator.go index 5f1423546..271498a23 100644 --- a/pkg/server/router/route_appender_aggregator.go +++ b/pkg/server/router/route_appender_aggregator.go @@ -6,7 +6,7 @@ import ( "github.com/containous/alice" "github.com/containous/mux" "github.com/containous/traefik/pkg/api" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/metrics" @@ -20,7 +20,7 @@ type chainBuilder interface { // NewRouteAppenderAggregator Creates a new RouteAppenderAggregator func NewRouteAppenderAggregator(ctx context.Context, chainBuilder chainBuilder, conf static.Configuration, - entryPointName string, runtimeConfiguration *dynamic.RuntimeConfiguration) *RouteAppenderAggregator { + entryPointName string, runtimeConfiguration *runtime.Configuration) *RouteAppenderAggregator { aggregator := &RouteAppenderAggregator{} if conf.Providers != nil && conf.Providers.Rest != nil { diff --git a/pkg/server/router/route_appender_factory.go b/pkg/server/router/route_appender_factory.go index ea44a4e21..5565aa616 100644 --- a/pkg/server/router/route_appender_factory.go +++ b/pkg/server/router/route_appender_factory.go @@ -3,7 +3,7 @@ package router import ( "context" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/provider/acme" "github.com/containous/traefik/pkg/server/middleware" @@ -27,7 +27,7 @@ type RouteAppenderFactory struct { } // NewAppender Creates a new RouteAppender -func (r *RouteAppenderFactory) NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *dynamic.RuntimeConfiguration) types.RouteAppender { +func (r *RouteAppenderFactory) NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *runtime.Configuration) types.RouteAppender { aggregator := NewRouteAppenderAggregator(ctx, middlewaresBuilder, r.staticConfiguration, r.entryPointName, runtimeConfiguration) if r.acmeProvider != nil && r.acmeProvider.HTTPChallenge != nil && r.acmeProvider.HTTPChallenge.EntryPoint == r.entryPointName { diff --git a/pkg/server/router/router.go b/pkg/server/router/router.go index 104e9b42f..79a7aec15 100644 --- a/pkg/server/router/router.go +++ b/pkg/server/router/router.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/containous/alice" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/recovery" @@ -22,7 +22,7 @@ const ( ) // NewManager Creates a new Manager -func NewManager(conf *dynamic.RuntimeConfiguration, +func NewManager(conf *runtime.Configuration, serviceManager *service.Manager, middlewaresBuilder *middleware.Builder, modifierBuilder *responsemodifiers.Builder, @@ -42,15 +42,15 @@ type Manager struct { serviceManager *service.Manager middlewaresBuilder *middleware.Builder modifierBuilder *responsemodifiers.Builder - conf *dynamic.RuntimeConfiguration + conf *runtime.Configuration } -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*dynamic.RouterInfo { +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { if m.conf != nil { - return m.conf.GetRoutersByEntrypoints(ctx, entryPoints, tls) + return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) } - return make(map[string]map[string]*dynamic.RouterInfo) + return make(map[string]map[string]*runtime.RouterInfo) } // BuildHandlers Builds handler for all entry points @@ -83,7 +83,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string, t return entryPointHandlers } -func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*dynamic.RouterInfo) (http.Handler, error) { +func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*runtime.RouterInfo) (http.Handler, error) { router, err := rules.NewRouter() if err != nil { return nil, err @@ -95,14 +95,14 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string handler, err := m.buildRouterHandler(ctxRouter, routerName, routerConfig) if err != nil { - routerConfig.Err = err.Error() + routerConfig.AddError(err, true) logger.Error(err) continue } err = router.AddRoute(routerConfig.Rule, routerConfig.Priority, handler) if err != nil { - routerConfig.Err = err.Error() + routerConfig.AddError(err, true) logger.Error(err) continue } @@ -118,7 +118,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string return chain.Then(router) } -func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, routerConfig *dynamic.RouterInfo) (http.Handler, error) { +func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, routerConfig *runtime.RouterInfo) (http.Handler, error) { if handler, ok := m.routerHandlers[routerName]; ok { return handler, nil } @@ -141,7 +141,7 @@ func (m *Manager) buildRouterHandler(ctx context.Context, routerName string, rou return m.routerHandlers[routerName], nil } -func (m *Manager) buildHTTPHandler(ctx context.Context, router *dynamic.RouterInfo, routerName string) (http.Handler, error) { +func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterInfo, routerName string) (http.Handler, error) { qualifiedNames := make([]string, len(router.Middlewares)) for i, name := range router.Middlewares { qualifiedNames[i] = internal.GetQualifiedName(ctx, name) diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index 8e110008f..387dcbcc2 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/requestdecorator" "github.com/containous/traefik/pkg/responsemodifiers" @@ -298,7 +299,7 @@ func TestRouterManager_Get(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routersConfig, @@ -399,7 +400,7 @@ func TestAccessLog(t *testing.T) { for _, test := range testCases { t.Run(test.desc, func(t *testing.T) { - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routersConfig, @@ -685,7 +686,7 @@ func TestRuntimeConfiguration(t *testing.T) { entryPoints := []string{"web"} - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: test.serviceConfig, Routers: test.routerConfig, @@ -694,7 +695,7 @@ func TestRuntimeConfiguration(t *testing.T) { }) serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) - responseModifierFactory := responsemodifiers.NewBuilder(map[string]*dynamic.MiddlewareInfo{}) + responseModifierFactory := responsemodifiers.NewBuilder(map[string]*runtime.MiddlewareInfo{}) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) _ = routerManager.BuildHandlers(context.Background(), entryPoints, false) @@ -709,7 +710,7 @@ func TestRuntimeConfiguration(t *testing.T) { } } for _, v := range rtConf.Routers { - if v.Err != "" { + if len(v.Err) > 0 { allErrors++ } } @@ -759,7 +760,7 @@ func BenchmarkRouterServe(b *testing.B) { } entryPoints := []string{"web"} - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: serviceConfig, Routers: routersConfig, @@ -802,7 +803,7 @@ func BenchmarkService(b *testing.B) { }, } - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{ + rtConf := runtime.NewConfig(dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Services: serviceConfig, }, diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index fba89d2c6..3111f3838 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/rules" "github.com/containous/traefik/pkg/server/internal" @@ -16,7 +16,7 @@ import ( ) // NewManager Creates a new Manager -func NewManager(conf *dynamic.RuntimeConfiguration, +func NewManager(conf *runtime.Configuration, serviceManager *tcpservice.Manager, httpHandlers map[string]http.Handler, httpsHandlers map[string]http.Handler, @@ -37,23 +37,23 @@ type Manager struct { httpHandlers map[string]http.Handler httpsHandlers map[string]http.Handler tlsManager *traefiktls.Manager - conf *dynamic.RuntimeConfiguration + conf *runtime.Configuration } -func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*dynamic.TCPRouterInfo { +func (m *Manager) getTCPRouters(ctx context.Context, entryPoints []string) map[string]map[string]*runtime.TCPRouterInfo { if m.conf != nil { - return m.conf.GetTCPRoutersByEntrypoints(ctx, entryPoints) + return m.conf.GetTCPRoutersByEntryPoints(ctx, entryPoints) } - return make(map[string]map[string]*dynamic.TCPRouterInfo) + return make(map[string]map[string]*runtime.TCPRouterInfo) } -func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*dynamic.RouterInfo { +func (m *Manager) getHTTPRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*runtime.RouterInfo { if m.conf != nil { - return m.conf.GetRoutersByEntrypoints(ctx, entryPoints, tls) + return m.conf.GetRoutersByEntryPoints(ctx, entryPoints, tls) } - return make(map[string]map[string]*dynamic.RouterInfo) + return make(map[string]map[string]*runtime.RouterInfo) } // BuildHandlers builds the handlers for the given entrypoints @@ -79,7 +79,7 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m return entryPointHandlers } -func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*dynamic.TCPRouterInfo, configsHTTP map[string]*dynamic.RouterInfo, handlerHTTP http.Handler, handlerHTTPS http.Handler) (*tcp.Router, error) { +func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*runtime.TCPRouterInfo, configsHTTP map[string]*runtime.RouterInfo, handlerHTTP http.Handler, handlerHTTPS http.Handler) (*tcp.Router, error) { router := &tcp.Router{} router.HTTPHandler(handlerHTTP) const defaultTLSConfigName = "default" @@ -108,7 +108,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string domains, err := rules.ParseDomains(routerHTTPConfig.Rule) if err != nil { routerErr := fmt.Errorf("invalid rule %s, error: %v", routerHTTPConfig.Rule, err) - routerHTTPConfig.Err = routerErr.Error() + routerHTTPConfig.AddError(routerErr, true) logger.Debug(routerErr) continue } @@ -126,7 +126,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string tlsConf, err := m.tlsManager.Get("default", tlsOptionsName) if err != nil { - routerHTTPConfig.Err = err.Error() + routerHTTPConfig.AddError(err, true) logger.Debug(err) continue } @@ -156,11 +156,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string } else { routers := make([]string, 0, len(tlsConfigs)) for _, v := range tlsConfigs { - // TODO: properly deal with critical errors VS non-critical errors - if configsHTTP[v.routerName].Err != "" { - configsHTTP[v.routerName].Err += "\n" - } - configsHTTP[v.routerName].Err += fmt.Sprintf("found different TLS options for routers on the same host %v, so using the default TLS option instead", hostSNI) + configsHTTP[v.routerName].AddError(fmt.Errorf("found different TLS options for routers on the same host %v, so using the default TLS option instead", hostSNI), false) routers = append(routers, v.routerName) } logger.Warnf("Found different TLS options for routers on the same host %v, so using the default TLS options instead for these routers: %#v", hostSNI, routers) diff --git a/pkg/server/router/tcp/router_test.go b/pkg/server/router/tcp/router_test.go index b2320f9e0..a3fda9d7a 100644 --- a/pkg/server/router/tcp/router_test.go +++ b/pkg/server/router/tcp/router_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/server/service/tcp" "github.com/containous/traefik/pkg/tls" "github.com/stretchr/testify/assert" @@ -13,13 +14,13 @@ import ( func TestRuntimeConfiguration(t *testing.T) { testCases := []struct { desc string - serviceConfig map[string]*dynamic.TCPServiceInfo - routerConfig map[string]*dynamic.TCPRouterInfo + serviceConfig map[string]*runtime.TCPServiceInfo + routerConfig map[string]*runtime.TCPRouterInfo expectedError int }{ { desc: "No error", - serviceConfig: map[string]*dynamic.TCPServiceInfo{ + serviceConfig: map[string]*runtime.TCPServiceInfo{ "foo-service": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -37,7 +38,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*dynamic.TCPRouterInfo{ + routerConfig: map[string]*runtime.TCPRouterInfo{ "foo": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -66,7 +67,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "One router with wrong rule", - serviceConfig: map[string]*dynamic.TCPServiceInfo{ + serviceConfig: map[string]*runtime.TCPServiceInfo{ "foo-service": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -79,7 +80,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*dynamic.TCPRouterInfo{ + routerConfig: map[string]*runtime.TCPRouterInfo{ "foo": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -100,7 +101,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "All router with wrong rule", - serviceConfig: map[string]*dynamic.TCPServiceInfo{ + serviceConfig: map[string]*runtime.TCPServiceInfo{ "foo-service": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -113,7 +114,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*dynamic.TCPRouterInfo{ + routerConfig: map[string]*runtime.TCPRouterInfo{ "foo": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -133,7 +134,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with unknown service", - serviceConfig: map[string]*dynamic.TCPServiceInfo{ + serviceConfig: map[string]*runtime.TCPServiceInfo{ "foo-service": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -146,7 +147,7 @@ func TestRuntimeConfiguration(t *testing.T) { }, }, }, - routerConfig: map[string]*dynamic.TCPRouterInfo{ + routerConfig: map[string]*runtime.TCPRouterInfo{ "foo": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -167,14 +168,14 @@ func TestRuntimeConfiguration(t *testing.T) { }, { desc: "Router with broken service", - serviceConfig: map[string]*dynamic.TCPServiceInfo{ + serviceConfig: map[string]*runtime.TCPServiceInfo{ "foo-service": { TCPService: &dynamic.TCPService{ LoadBalancer: nil, }, }, }, - routerConfig: map[string]*dynamic.TCPRouterInfo{ + routerConfig: map[string]*runtime.TCPRouterInfo{ "bar": { TCPRouter: &dynamic.TCPRouter{ EntryPoints: []string{"web"}, @@ -195,7 +196,7 @@ func TestRuntimeConfiguration(t *testing.T) { entryPoints := []string{"web"} - conf := &dynamic.RuntimeConfiguration{ + conf := &runtime.Configuration{ TCPServices: test.serviceConfig, TCPRouters: test.routerConfig, } diff --git a/pkg/server/server.go b/pkg/server/server.go index 0feadb30f..99e925e07 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -10,6 +10,7 @@ import ( "time" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/metrics" @@ -47,7 +48,7 @@ type Server struct { // RouteAppenderFactory the route appender factory interface type RouteAppenderFactory interface { - NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *dynamic.RuntimeConfiguration) types.RouteAppender + NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *runtime.Configuration) types.RouteAppender } func setupTracing(conf *static.Tracing) tracing.Backend { diff --git a/pkg/server/server_configuration.go b/pkg/server/server_configuration.go index 1a184274e..d159e4c85 100644 --- a/pkg/server/server_configuration.go +++ b/pkg/server/server_configuration.go @@ -10,6 +10,7 @@ import ( "github.com/containous/alice" "github.com/containous/mux" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/requestdecorator" @@ -65,7 +66,7 @@ func (s *Server) loadConfigurationTCP(configurations dynamic.Configurations) map s.tlsManager.UpdateConfigs(conf.TLS.Stores, conf.TLS.Options, conf.TLS.Certificates) - rtConf := dynamic.NewRuntimeConfig(conf) + rtConf := runtime.NewConfig(conf) handlersNonTLS, handlersTLS := s.createHTTPHandlers(ctx, rtConf, entryPoints) routersTCP := s.createTCPRouters(ctx, rtConf, entryPoints, handlersNonTLS, handlersTLS) rtConf.PopulateUsedBy() @@ -74,7 +75,7 @@ func (s *Server) loadConfigurationTCP(configurations dynamic.Configurations) map } // the given configuration must not be nil. its fields will get mutated. -func (s *Server) createTCPRouters(ctx context.Context, configuration *dynamic.RuntimeConfiguration, entryPoints []string, handlers map[string]http.Handler, handlersTLS map[string]http.Handler) map[string]*tcpCore.Router { +func (s *Server) createTCPRouters(ctx context.Context, configuration *runtime.Configuration, entryPoints []string, handlers map[string]http.Handler, handlersTLS map[string]http.Handler) map[string]*tcpCore.Router { if configuration == nil { return make(map[string]*tcpCore.Router) } @@ -87,7 +88,7 @@ func (s *Server) createTCPRouters(ctx context.Context, configuration *dynamic.Ru } // createHTTPHandlers returns, for the given configuration and entryPoints, the HTTP handlers for non-TLS connections, and for the TLS ones. the given configuration must not be nil. its fields will get mutated. -func (s *Server) createHTTPHandlers(ctx context.Context, configuration *dynamic.RuntimeConfiguration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) { +func (s *Server) createHTTPHandlers(ctx context.Context, configuration *runtime.Configuration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) { serviceManager := service.NewManager(configuration.Services, s.defaultRoundTripper) middlewaresBuilder := middleware.NewBuilder(configuration.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(configuration.Middlewares) diff --git a/pkg/server/server_configuration_test.go b/pkg/server/server_configuration_test.go index 6bdcc706d..9d12b725c 100644 --- a/pkg/server/server_configuration_test.go +++ b/pkg/server/server_configuration_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" th "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -46,7 +47,7 @@ func TestReuseService(t *testing.T) { srv := NewServer(staticConfig, nil, entryPoints, nil) - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{HTTP: dynamicConfigs}) + rtConf := runtime.NewConfig(dynamic.Configuration{HTTP: dynamicConfigs}) entrypointsHandlers, _ := srv.createHTTPHandlers(context.Background(), rtConf, []string{"http"}) // Test that the /ok path returns a status 200. diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index e2b2219f9..4756a197e 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" th "github.com/containous/traefik/pkg/testhelpers" "github.com/containous/traefik/pkg/types" @@ -253,7 +254,7 @@ func TestServerResponseEmptyBackend(t *testing.T) { } srv := NewServer(globalConfig, nil, entryPointsConfig, nil) - rtConf := dynamic.NewRuntimeConfig(dynamic.Configuration{HTTP: test.config(testServer.URL)}) + rtConf := runtime.NewConfig(dynamic.Configuration{HTTP: test.config(testServer.URL)}) entryPoints, _ := srv.createHTTPHandlers(context.Background(), rtConf, []string{"http"}) responseRecorder := &httptest.ResponseRecorder{} diff --git a/pkg/server/service/service.go b/pkg/server/service/service.go index 03ec8e138..3e9974ff7 100644 --- a/pkg/server/service/service.go +++ b/pkg/server/service/service.go @@ -10,6 +10,7 @@ import ( "github.com/containous/alice" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/healthcheck" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/middlewares/accesslog" @@ -26,7 +27,7 @@ const ( ) // NewManager creates a new Manager -func NewManager(configs map[string]*dynamic.ServiceInfo, defaultRoundTripper http.RoundTripper) *Manager { +func NewManager(configs map[string]*runtime.ServiceInfo, defaultRoundTripper http.RoundTripper) *Manager { return &Manager{ bufferPool: newBufferPool(), defaultRoundTripper: defaultRoundTripper, @@ -40,7 +41,7 @@ type Manager struct { bufferPool httputil.BufferPool defaultRoundTripper http.RoundTripper balancers map[string][]healthcheck.BalancerHandler - configs map[string]*dynamic.ServiceInfo + configs map[string]*runtime.ServiceInfo } // BuildHTTP Creates a http.Handler for a service configuration. @@ -58,13 +59,14 @@ func (m *Manager) BuildHTTP(rootCtx context.Context, serviceName string, respons // TODO Should handle multiple service types // FIXME Check if the service is declared multiple times with different types if conf.LoadBalancer == nil { - conf.Err = fmt.Errorf("the service %q doesn't have any load balancer", serviceName) - return nil, conf.Err + sErr := fmt.Errorf("the service %q doesn't have any load balancer", serviceName) + conf.AddError(sErr, true) + return nil, sErr } lb, err := m.getLoadBalancerServiceHandler(ctx, serviceName, conf.LoadBalancer, responseModifier) if err != nil { - conf.Err = err + conf.AddError(err, true) return nil, err } diff --git a/pkg/server/service/service_test.go b/pkg/server/service/service_test.go index 963d67b25..6d96ea0db 100644 --- a/pkg/server/service/service_test.go +++ b/pkg/server/service/service_test.go @@ -8,6 +8,7 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/server/internal" "github.com/containous/traefik/pkg/testhelpers" "github.com/stretchr/testify/assert" @@ -287,13 +288,13 @@ func TestManager_Build(t *testing.T) { testCases := []struct { desc string serviceName string - configs map[string]*dynamic.ServiceInfo + configs map[string]*runtime.ServiceInfo providerName string }{ { desc: "Simple service name", serviceName: "serviceName", - configs: map[string]*dynamic.ServiceInfo{ + configs: map[string]*runtime.ServiceInfo{ "serviceName": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{}, @@ -304,7 +305,7 @@ func TestManager_Build(t *testing.T) { { desc: "Service name with provider", serviceName: "serviceName@provider-1", - configs: map[string]*dynamic.ServiceInfo{ + configs: map[string]*runtime.ServiceInfo{ "serviceName@provider-1": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{}, @@ -315,7 +316,7 @@ func TestManager_Build(t *testing.T) { { desc: "Service name with provider in context", serviceName: "serviceName", - configs: map[string]*dynamic.ServiceInfo{ + configs: map[string]*runtime.ServiceInfo{ "serviceName@provider-1": { Service: &dynamic.Service{ LoadBalancer: &dynamic.LoadBalancerService{}, diff --git a/pkg/server/service/tcp/service.go b/pkg/server/service/tcp/service.go index 704ba9fc2..6abc92d04 100644 --- a/pkg/server/service/tcp/service.go +++ b/pkg/server/service/tcp/service.go @@ -5,7 +5,7 @@ import ( "fmt" "net" - "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" "github.com/containous/traefik/pkg/server/internal" "github.com/containous/traefik/pkg/tcp" @@ -13,11 +13,11 @@ import ( // Manager is the TCPHandlers factory type Manager struct { - configs map[string]*dynamic.TCPServiceInfo + configs map[string]*runtime.TCPServiceInfo } // NewManager creates a new manager -func NewManager(conf *dynamic.RuntimeConfiguration) *Manager { +func NewManager(conf *runtime.Configuration) *Manager { return &Manager{ configs: conf.TCPServices, } diff --git a/pkg/server/service/tcp/service_test.go b/pkg/server/service/tcp/service_test.go index 15550eb63..a4ec678d6 100644 --- a/pkg/server/service/tcp/service_test.go +++ b/pkg/server/service/tcp/service_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/containous/traefik/pkg/config/dynamic" + "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/server/internal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -14,7 +15,7 @@ func TestManager_BuildTCP(t *testing.T) { testCases := []struct { desc string serviceName string - configs map[string]*dynamic.TCPServiceInfo + configs map[string]*runtime.TCPServiceInfo providerName string expectedError string }{ @@ -27,7 +28,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing lb configuration", serviceName: "test", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "test": { TCPService: &dynamic.TCPService{}, }, @@ -37,7 +38,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "no such host, server is skipped, error is logged", serviceName: "test", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "test": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -52,7 +53,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "invalid IP address, server is skipped, error is logged", serviceName: "test", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "test": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -67,7 +68,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Simple service name", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{}, @@ -78,7 +79,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Service name with provider", serviceName: "serviceName@provider-1", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{}, @@ -89,7 +90,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Service name with provider in context", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{}, @@ -101,7 +102,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Server with correct host:port as address", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -119,7 +120,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "Server with correct ip:port as address", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -137,7 +138,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing port in address with hostname, server is skipped, error is logged", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -155,7 +156,7 @@ func TestManager_BuildTCP(t *testing.T) { { desc: "missing port in address with ip, server is skipped, error is logged", serviceName: "serviceName", - configs: map[string]*dynamic.TCPServiceInfo{ + configs: map[string]*runtime.TCPServiceInfo{ "serviceName@provider-1": { TCPService: &dynamic.TCPService{ LoadBalancer: &dynamic.TCPLoadBalancerService{ @@ -177,7 +178,7 @@ func TestManager_BuildTCP(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - manager := NewManager(&dynamic.RuntimeConfiguration{ + manager := NewManager(&runtime.Configuration{ TCPServices: test.configs, }) From a17ac234579838cf56bdc85db17f326a285036e3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou Date: Tue, 16 Jul 2019 06:48:03 +0200 Subject: [PATCH 22/49] Update Dynamic Configuration Reference for both Docker and Marathon --- .../reference/dynamic-configuration/docker.md | 2 + .../dynamic-configuration/docker.yml | 3 + .../dynamic-configuration/labels.yml | 329 +++++++++--------- .../dynamic-configuration/marathon.md | 2 + .../dynamic-configuration/marathon.yml | 2 + docs/mkdocs.yml | 1 + 6 files changed, 174 insertions(+), 165 deletions(-) create mode 100644 docs/content/reference/dynamic-configuration/docker.yml create mode 100644 docs/content/reference/dynamic-configuration/marathon.yml diff --git a/docs/content/reference/dynamic-configuration/docker.md b/docs/content/reference/dynamic-configuration/docker.md index b8c137743..93317e0f1 100644 --- a/docs/content/reference/dynamic-configuration/docker.md +++ b/docs/content/reference/dynamic-configuration/docker.md @@ -6,5 +6,7 @@ Dynamic configuration with Docker Labels The labels are case insensitive. ```yaml +labels: +--8<-- "content/reference/dynamic-configuration/docker.yml" --8<-- "content/reference/dynamic-configuration/labels.yml" ``` diff --git a/docs/content/reference/dynamic-configuration/docker.yml b/docs/content/reference/dynamic-configuration/docker.yml new file mode 100644 index 000000000..f91fef5b1 --- /dev/null +++ b/docs/content/reference/dynamic-configuration/docker.yml @@ -0,0 +1,3 @@ + - "traefik.enable=true" + - "traefik.docker.network=foobar" + - "traefik.docker.lbswarm=true" diff --git a/docs/content/reference/dynamic-configuration/labels.yml b/docs/content/reference/dynamic-configuration/labels.yml index 3cd3e4767..01fd638ec 100644 --- a/docs/content/reference/dynamic-configuration/labels.yml +++ b/docs/content/reference/dynamic-configuration/labels.yml @@ -1,165 +1,164 @@ -labels: -- "traefik.http.middlewares.middleware00.addprefix.prefix=foobar" -- "traefik.http.middlewares.middleware01.basicauth.headerfield=foobar" -- "traefik.http.middlewares.middleware01.basicauth.realm=foobar" -- "traefik.http.middlewares.middleware01.basicauth.removeheader=true" -- "traefik.http.middlewares.middleware01.basicauth.users=foobar, foobar" -- "traefik.http.middlewares.middleware01.basicauth.usersfile=foobar" -- "traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes=42" -- "traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes=42" -- "traefik.http.middlewares.middleware02.buffering.memrequestbodybytes=42" -- "traefik.http.middlewares.middleware02.buffering.memresponsebodybytes=42" -- "traefik.http.middlewares.middleware02.buffering.retryexpression=foobar" -- "traefik.http.middlewares.middleware03.chain.middlewares=foobar, foobar" -- "traefik.http.middlewares.middleware04.circuitbreaker.expression=foobar" -- "traefik.http.middlewares.middleware05.compress=true" -- "traefik.http.middlewares.middleware06.digestauth.headerfield=foobar" -- "traefik.http.middlewares.middleware06.digestauth.realm=foobar" -- "traefik.http.middlewares.middleware06.digestauth.removeheader=true" -- "traefik.http.middlewares.middleware06.digestauth.users=foobar, foobar" -- "traefik.http.middlewares.middleware06.digestauth.usersfile=foobar" -- "traefik.http.middlewares.middleware07.errors.query=foobar" -- "traefik.http.middlewares.middleware07.errors.service=foobar" -- "traefik.http.middlewares.middleware07.errors.status=foobar, foobar" -- "traefik.http.middlewares.middleware08.forwardauth.address=foobar" -- "traefik.http.middlewares.middleware08.forwardauth.authresponseheaders=foobar, foobar" -- "traefik.http.middlewares.middleware08.forwardauth.tls.ca=foobar" -- "traefik.http.middlewares.middleware08.forwardauth.tls.caoptional=true" -- "traefik.http.middlewares.middleware08.forwardauth.tls.cert=foobar" -- "traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify=true" -- "traefik.http.middlewares.middleware08.forwardauth.tls.key=foobar" -- "traefik.http.middlewares.middleware08.forwardauth.trustforwardheader=true" -- "traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials=true" -- "traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders=foobar, foobar" -- "traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods=foobar, foobar" -- "traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin=foobar" -- "traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders=foobar, foobar" -- "traefik.http.middlewares.middleware09.headers.accesscontrolmaxage=42" -- "traefik.http.middlewares.middleware09.headers.addvaryheader=true" -- "traefik.http.middlewares.middleware09.headers.allowedhosts=foobar, foobar" -- "traefik.http.middlewares.middleware09.headers.browserxssfilter=true" -- "traefik.http.middlewares.middleware09.headers.contentsecuritypolicy=foobar" -- "traefik.http.middlewares.middleware09.headers.contenttypenosniff=true" -- "traefik.http.middlewares.middleware09.headers.custombrowserxssvalue=foobar" -- "traefik.http.middlewares.middleware09.headers.customframeoptionsvalue=foobar" -- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name0=foobar" -- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name1=foobar" -- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name0=foobar" -- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name1=foobar" -- "traefik.http.middlewares.middleware09.headers.forcestsheader=true" -- "traefik.http.middlewares.middleware09.headers.framedeny=true" -- "traefik.http.middlewares.middleware09.headers.hostsproxyheaders=foobar, foobar" -- "traefik.http.middlewares.middleware09.headers.isdevelopment=true" -- "traefik.http.middlewares.middleware09.headers.publickey=foobar" -- "traefik.http.middlewares.middleware09.headers.referrerpolicy=foobar" -- "traefik.http.middlewares.middleware09.headers.sslforcehost=true" -- "traefik.http.middlewares.middleware09.headers.sslhost=foobar" -- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0=foobar" -- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1=foobar" -- "traefik.http.middlewares.middleware09.headers.sslredirect=true" -- "traefik.http.middlewares.middleware09.headers.ssltemporaryredirect=true" -- "traefik.http.middlewares.middleware09.headers.stsincludesubdomains=true" -- "traefik.http.middlewares.middleware09.headers.stspreload=true" -- "traefik.http.middlewares.middleware09.headers.stsseconds=42" -- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth=42" -- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips=foobar, foobar" -- "traefik.http.middlewares.middleware10.ipwhitelist.sourcerange=foobar, foobar" -- "traefik.http.middlewares.middleware11.maxconn.amount=42" -- "traefik.http.middlewares.middleware11.maxconn.extractorfunc=foobar" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.sans=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" -- "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" -- "traefik.http.middlewares.middleware13.ratelimit.extractorfunc=foobar" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.average=42" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.burst=42" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.period=42" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.average=42" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.burst=42" -- "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.period=42" -- "traefik.http.middlewares.middleware14.redirectregex.permanent=true" -- "traefik.http.middlewares.middleware14.redirectregex.regex=foobar" -- "traefik.http.middlewares.middleware14.redirectregex.replacement=foobar" -- "traefik.http.middlewares.middleware15.redirectscheme.permanent=true" -- "traefik.http.middlewares.middleware15.redirectscheme.port=foobar" -- "traefik.http.middlewares.middleware15.redirectscheme.scheme=foobar" -- "traefik.http.middlewares.middleware16.replacepath.path=foobar" -- "traefik.http.middlewares.middleware17.replacepathregex.regex=foobar" -- "traefik.http.middlewares.middleware17.replacepathregex.replacement=foobar" -- "traefik.http.middlewares.middleware18.retry.attempts=42" -- "traefik.http.middlewares.middleware19.stripprefix.prefixes=foobar, foobar" -- "traefik.http.middlewares.middleware20.stripprefixregex.regex=foobar, foobar" -- "traefik.http.routers.router0.entrypoints=foobar, foobar" -- "traefik.http.routers.router0.middlewares=foobar, foobar" -- "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=foobar" -- "traefik.http.routers.router1.entrypoints=foobar, foobar" -- "traefik.http.routers.router1.middlewares=foobar, foobar" -- "traefik.http.routers.router1.priority=42" -- "traefik.http.routers.router1.rule=foobar" -- "traefik.http.routers.router1.service=foobar" -- "traefik.http.routers.router1.tls=true" -- "traefik.http.routers.router1.tls.options=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.stickiness=true" -- "traefik.http.services.service0.loadbalancer.stickiness.cookiename=foobar" -- "traefik.http.services.service0.loadbalancer.stickiness.httponlycookie=true" -- "traefik.http.services.service0.loadbalancer.stickiness.securecookie=true" -- "traefik.http.services.service0.loadbalancer.server.port=foobar" -- "traefik.http.services.service0.loadbalancer.server.scheme=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.stickiness=true" -- "traefik.http.services.service1.loadbalancer.stickiness.cookiename=foobar" -- "traefik.http.services.service1.loadbalancer.stickiness.httponlycookie=true" -- "traefik.http.services.service1.loadbalancer.stickiness.securecookie=true" -- "traefik.http.services.service1.loadbalancer.server.port=foobar" -- "traefik.http.services.service1.loadbalancer.server.scheme=foobar" -- "traefik.tcp.routers.tcprouter0.entrypoints=foobar, foobar" -- "traefik.tcp.routers.tcprouter0.rule=foobar" -- "traefik.tcp.routers.tcprouter0.service=foobar" -- "traefik.tcp.routers.tcprouter0.tls=true" -- "traefik.tcp.routers.tcprouter0.tls.options=foobar" -- "traefik.tcp.routers.tcprouter0.tls.passthrough=true" -- "traefik.tcp.routers.tcprouter1.entrypoints=foobar, foobar" -- "traefik.tcp.routers.tcprouter1.rule=foobar" -- "traefik.tcp.routers.tcprouter1.service=foobar" -- "traefik.tcp.routers.tcprouter1.tls=true" -- "traefik.tcp.routers.tcprouter1.tls.options=foobar" -- "traefik.tcp.routers.tcprouter1.tls.passthrough=true" -- "traefik.tcp.services.tcpservice0.loadbalancer.server.port=foobar" -- "traefik.tcp.services.tcpservice1.loadbalancer.server.port=foobar" \ No newline at end of file + - "traefik.http.middlewares.middleware00.addprefix.prefix=foobar" + - "traefik.http.middlewares.middleware01.basicauth.headerfield=foobar" + - "traefik.http.middlewares.middleware01.basicauth.realm=foobar" + - "traefik.http.middlewares.middleware01.basicauth.removeheader=true" + - "traefik.http.middlewares.middleware01.basicauth.users=foobar, foobar" + - "traefik.http.middlewares.middleware01.basicauth.usersfile=foobar" + - "traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes=42" + - "traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes=42" + - "traefik.http.middlewares.middleware02.buffering.memrequestbodybytes=42" + - "traefik.http.middlewares.middleware02.buffering.memresponsebodybytes=42" + - "traefik.http.middlewares.middleware02.buffering.retryexpression=foobar" + - "traefik.http.middlewares.middleware03.chain.middlewares=foobar, foobar" + - "traefik.http.middlewares.middleware04.circuitbreaker.expression=foobar" + - "traefik.http.middlewares.middleware05.compress=true" + - "traefik.http.middlewares.middleware06.digestauth.headerfield=foobar" + - "traefik.http.middlewares.middleware06.digestauth.realm=foobar" + - "traefik.http.middlewares.middleware06.digestauth.removeheader=true" + - "traefik.http.middlewares.middleware06.digestauth.users=foobar, foobar" + - "traefik.http.middlewares.middleware06.digestauth.usersfile=foobar" + - "traefik.http.middlewares.middleware07.errors.query=foobar" + - "traefik.http.middlewares.middleware07.errors.service=foobar" + - "traefik.http.middlewares.middleware07.errors.status=foobar, foobar" + - "traefik.http.middlewares.middleware08.forwardauth.address=foobar" + - "traefik.http.middlewares.middleware08.forwardauth.authresponseheaders=foobar, foobar" + - "traefik.http.middlewares.middleware08.forwardauth.tls.ca=foobar" + - "traefik.http.middlewares.middleware08.forwardauth.tls.caoptional=true" + - "traefik.http.middlewares.middleware08.forwardauth.tls.cert=foobar" + - "traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify=true" + - "traefik.http.middlewares.middleware08.forwardauth.tls.key=foobar" + - "traefik.http.middlewares.middleware08.forwardauth.trustforwardheader=true" + - "traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials=true" + - "traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders=foobar, foobar" + - "traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods=foobar, foobar" + - "traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin=foobar" + - "traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders=foobar, foobar" + - "traefik.http.middlewares.middleware09.headers.accesscontrolmaxage=42" + - "traefik.http.middlewares.middleware09.headers.addvaryheader=true" + - "traefik.http.middlewares.middleware09.headers.allowedhosts=foobar, foobar" + - "traefik.http.middlewares.middleware09.headers.browserxssfilter=true" + - "traefik.http.middlewares.middleware09.headers.contentsecuritypolicy=foobar" + - "traefik.http.middlewares.middleware09.headers.contenttypenosniff=true" + - "traefik.http.middlewares.middleware09.headers.custombrowserxssvalue=foobar" + - "traefik.http.middlewares.middleware09.headers.customframeoptionsvalue=foobar" + - "traefik.http.middlewares.middleware09.headers.customrequestheaders.name0=foobar" + - "traefik.http.middlewares.middleware09.headers.customrequestheaders.name1=foobar" + - "traefik.http.middlewares.middleware09.headers.customresponseheaders.name0=foobar" + - "traefik.http.middlewares.middleware09.headers.customresponseheaders.name1=foobar" + - "traefik.http.middlewares.middleware09.headers.forcestsheader=true" + - "traefik.http.middlewares.middleware09.headers.framedeny=true" + - "traefik.http.middlewares.middleware09.headers.hostsproxyheaders=foobar, foobar" + - "traefik.http.middlewares.middleware09.headers.isdevelopment=true" + - "traefik.http.middlewares.middleware09.headers.publickey=foobar" + - "traefik.http.middlewares.middleware09.headers.referrerpolicy=foobar" + - "traefik.http.middlewares.middleware09.headers.sslforcehost=true" + - "traefik.http.middlewares.middleware09.headers.sslhost=foobar" + - "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0=foobar" + - "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1=foobar" + - "traefik.http.middlewares.middleware09.headers.sslredirect=true" + - "traefik.http.middlewares.middleware09.headers.ssltemporaryredirect=true" + - "traefik.http.middlewares.middleware09.headers.stsincludesubdomains=true" + - "traefik.http.middlewares.middleware09.headers.stspreload=true" + - "traefik.http.middlewares.middleware09.headers.stsseconds=42" + - "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth=42" + - "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips=foobar, foobar" + - "traefik.http.middlewares.middleware10.ipwhitelist.sourcerange=foobar, foobar" + - "traefik.http.middlewares.middleware11.maxconn.amount=42" + - "traefik.http.middlewares.middleware11.maxconn.extractorfunc=foobar" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.sans=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" + - "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" + - "traefik.http.middlewares.middleware13.ratelimit.extractorfunc=foobar" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.average=42" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.burst=42" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.period=42" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.average=42" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.burst=42" + - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.period=42" + - "traefik.http.middlewares.middleware14.redirectregex.permanent=true" + - "traefik.http.middlewares.middleware14.redirectregex.regex=foobar" + - "traefik.http.middlewares.middleware14.redirectregex.replacement=foobar" + - "traefik.http.middlewares.middleware15.redirectscheme.permanent=true" + - "traefik.http.middlewares.middleware15.redirectscheme.port=foobar" + - "traefik.http.middlewares.middleware15.redirectscheme.scheme=foobar" + - "traefik.http.middlewares.middleware16.replacepath.path=foobar" + - "traefik.http.middlewares.middleware17.replacepathregex.regex=foobar" + - "traefik.http.middlewares.middleware17.replacepathregex.replacement=foobar" + - "traefik.http.middlewares.middleware18.retry.attempts=42" + - "traefik.http.middlewares.middleware19.stripprefix.prefixes=foobar, foobar" + - "traefik.http.middlewares.middleware20.stripprefixregex.regex=foobar, foobar" + - "traefik.http.routers.router0.entrypoints=foobar, foobar" + - "traefik.http.routers.router0.middlewares=foobar, foobar" + - "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=foobar" + - "traefik.http.routers.router1.entrypoints=foobar, foobar" + - "traefik.http.routers.router1.middlewares=foobar, foobar" + - "traefik.http.routers.router1.priority=42" + - "traefik.http.routers.router1.rule=foobar" + - "traefik.http.routers.router1.service=foobar" + - "traefik.http.routers.router1.tls=true" + - "traefik.http.routers.router1.tls.options=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.stickiness=true" + - "traefik.http.services.service0.loadbalancer.stickiness.cookiename=foobar" + - "traefik.http.services.service0.loadbalancer.stickiness.httponlycookie=true" + - "traefik.http.services.service0.loadbalancer.stickiness.securecookie=true" + - "traefik.http.services.service0.loadbalancer.server.port=foobar" + - "traefik.http.services.service0.loadbalancer.server.scheme=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.stickiness=true" + - "traefik.http.services.service1.loadbalancer.stickiness.cookiename=foobar" + - "traefik.http.services.service1.loadbalancer.stickiness.httponlycookie=true" + - "traefik.http.services.service1.loadbalancer.stickiness.securecookie=true" + - "traefik.http.services.service1.loadbalancer.server.port=foobar" + - "traefik.http.services.service1.loadbalancer.server.scheme=foobar" + - "traefik.tcp.routers.tcprouter0.entrypoints=foobar, foobar" + - "traefik.tcp.routers.tcprouter0.rule=foobar" + - "traefik.tcp.routers.tcprouter0.service=foobar" + - "traefik.tcp.routers.tcprouter0.tls=true" + - "traefik.tcp.routers.tcprouter0.tls.options=foobar" + - "traefik.tcp.routers.tcprouter0.tls.passthrough=true" + - "traefik.tcp.routers.tcprouter1.entrypoints=foobar, foobar" + - "traefik.tcp.routers.tcprouter1.rule=foobar" + - "traefik.tcp.routers.tcprouter1.service=foobar" + - "traefik.tcp.routers.tcprouter1.tls=true" + - "traefik.tcp.routers.tcprouter1.tls.options=foobar" + - "traefik.tcp.routers.tcprouter1.tls.passthrough=true" + - "traefik.tcp.services.tcpservice0.loadbalancer.server.port=foobar" + - "traefik.tcp.services.tcpservice1.loadbalancer.server.port=foobar" \ No newline at end of file diff --git a/docs/content/reference/dynamic-configuration/marathon.md b/docs/content/reference/dynamic-configuration/marathon.md index 60260605d..a1d3d3da9 100644 --- a/docs/content/reference/dynamic-configuration/marathon.md +++ b/docs/content/reference/dynamic-configuration/marathon.md @@ -4,5 +4,7 @@ Dynamic configuration with Marathon Labels {: .subtitle } ```yaml +labels: +--8<-- "content/reference/dynamic-configuration/marathon.yml" --8<-- "content/reference/dynamic-configuration/labels.yml" ``` diff --git a/docs/content/reference/dynamic-configuration/marathon.yml b/docs/content/reference/dynamic-configuration/marathon.yml new file mode 100644 index 000000000..d6adde450 --- /dev/null +++ b/docs/content/reference/dynamic-configuration/marathon.yml @@ -0,0 +1,2 @@ + - "traefik.enable=true" + - "traefik.marathon.ipaddressidx=42" diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index fe9216ff4..a6398a2be 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -148,5 +148,6 @@ nav: - 'Environment variables': 'reference/static-configuration/env.md' - 'Dynamic Configuration': - 'Docker': 'reference/dynamic-configuration/docker.md' + - 'Marathon': 'reference/dynamic-configuration/marathon.md' - 'Kubernetes CRD': 'reference/dynamic-configuration/kubernetes-crd.md' - 'File': 'reference/dynamic-configuration/file.md' From 889b38f75ad843f23a3c25b546242f4b086d9aa2 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 16 Jul 2019 09:54:04 +0200 Subject: [PATCH 23/49] Improve tracing documentation --- docs/content/observability/tracing/datadog.md | 39 ++++++-- .../content/observability/tracing/haystack.md | 66 ++++++++++++-- docs/content/observability/tracing/instana.md | 31 ++++++- docs/content/observability/tracing/jaeger.md | 90 ++++++++++++++++--- .../content/observability/tracing/overview.md | 20 ++++- docs/content/observability/tracing/zipkin.md | 47 ++++++++-- 6 files changed, 255 insertions(+), 38 deletions(-) diff --git a/docs/content/observability/tracing/datadog.md b/docs/content/observability/tracing/datadog.md index 5d68d399d..92da66d7b 100644 --- a/docs/content/observability/tracing/datadog.md +++ b/docs/content/observability/tracing/datadog.md @@ -2,11 +2,16 @@ To enable the DataDog: -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.dataDog] ``` +```yaml tab="File (YAML)" +tracing: + dataDog: {} +``` + ```bash tab="CLI" --tracing --tracing.datadog @@ -18,12 +23,18 @@ _Required, Default="127.0.0.1:8126"_ Local Agent Host Port instructs reporter to send spans to datadog-tracing-agent at this address. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.dataDog] localAgentHostPort = "127.0.0.1:8126" ``` +```yaml tab="File (YAML)" +tracing: + dataDog: + localAgentHostPort: 127.0.0.1:8126 +``` + ```bash tab="CLI" --tracing --tracing.datadog.localAgentHostPort="127.0.0.1:8126" @@ -35,12 +46,18 @@ _Optional, Default=false_ Enable DataDog debug. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.dataDog] debug = true ``` +```yaml tab="File (YAML)" +tracing: + dataDog: + debug: true +``` + ```bash tab="CLI" --tracing --tracing.datadog.debug=true @@ -52,12 +69,18 @@ _Optional, Default=empty_ Apply shared tag in a form of Key:Value to all the traces. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.dataDog] globalTag = "sample" ``` +```yaml tab="File (YAML)" +tracing: + dataDog: + globalTag: sample +``` + ```bash tab="CLI" --tracing --tracing.datadog.globalTag="sample" @@ -70,12 +93,18 @@ _Optional, Default=false_ Enable priority sampling. When using distributed tracing, this option must be enabled in order to get all the parts of a distributed trace sampled. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.dataDog] prioritySampling = true ``` +```yaml tab="File (YAML)" +tracing: + dataDog: + prioritySampling: true +``` + ```bash tab="CLI" --tracing --tracing.datadog.prioritySampling=true diff --git a/docs/content/observability/tracing/haystack.md b/docs/content/observability/tracing/haystack.md index 6b6b1ac0d..86557c220 100644 --- a/docs/content/observability/tracing/haystack.md +++ b/docs/content/observability/tracing/haystack.md @@ -2,11 +2,16 @@ To enable the Haystack: -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] ``` +```yaml tab="File (YAML)" +tracing: + haystack: {} +``` + ```bash tab="CLI" --tracing --tracing.haystack @@ -18,12 +23,18 @@ _Require, Default="127.0.0.1"_ Local Agent Host instructs reporter to send spans to haystack-agent at this address. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] localAgentHost = "127.0.0.1" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + localAgentHost: 127.0.0.1 +``` + ```bash tab="CLI" --tracing --tracing.haystack.localAgentHost="127.0.0.1" @@ -35,12 +46,18 @@ _Require, Default=42699_ Local Agent port instructs reporter to send spans to the haystack-agent at this port. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] localAgentPort = 42699 ``` +```yaml tab="File (YAML)" +tracing: + haystack: + localAgentPort: 42699 +``` + ```bash tab="CLI" --tracing --tracing.haystack.localAgentPort=42699 @@ -52,12 +69,18 @@ _Optional, Default=empty_ Apply shared tag in a form of Key:Value to all the traces. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] globalTag = "sample:test" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + globalTag: sample:test +``` + ```bash tab="CLI" --tracing --tracing.haystack.globalTag="sample:test" @@ -69,12 +92,18 @@ _Optional, Default=empty_ Specifies the header name that will be used to store the trace ID. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] traceIDHeaderName = "sample" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + traceIDHeaderName: sample +``` + ```bash tab="CLI" --tracing --tracing.haystack.traceIDHeaderName="sample" @@ -86,12 +115,18 @@ _Optional, Default=empty_ Specifies the header name that will be used to store the span ID. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] parentIDHeaderName = "sample" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + parentIDHeaderName: "sample" +``` + ```bash tab="CLI" --tracing --tracing.haystack.parentIDHeaderName="sample" @@ -103,15 +138,21 @@ _Optional, Default=empty_ Apply shared tag in a form of Key:Value to all the traces. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] spanIDHeaderName = "sample:test" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + spanIDHeaderName: "sample:test" +``` + ```bash tab="CLI" --tracing ---tracing.haystack.spanIDHeaderName="sample:test" +--tracing.haystack.spanIDHeaderName=sample:test ``` #### `baggagePrefixHeaderName` @@ -120,12 +161,19 @@ _Optional, Default=empty_ Specifies the header name prefix that will be used to store baggage items in a map. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.haystack] baggagePrefixHeaderName = "sample" ``` +```yaml tab="File (YAML)" +tracing: + haystack: + baggagePrefixHeaderName: "sample" +``` + + ```bash tab="CLI" --tracing --tracing.haystack.baggagePrefixHeaderName="sample" diff --git a/docs/content/observability/tracing/instana.md b/docs/content/observability/tracing/instana.md index 66c09f744..27daa3304 100644 --- a/docs/content/observability/tracing/instana.md +++ b/docs/content/observability/tracing/instana.md @@ -2,11 +2,16 @@ To enable the Instana: -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.instana] ``` +```yaml tab="File (YAML)" +tracing: + instana: {} +``` + ```bash tab="CLI" --tracing --tracing.instana @@ -18,12 +23,18 @@ _Require, Default="127.0.0.1"_ Local Agent Host instructs reporter to send spans to instana-agent at this address. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.instana] localAgentHost = "127.0.0.1" ``` +```yaml tab="File (YAML)" +tracing: + instana: + localAgentHost: 127.0.0.1 +``` + ```bash tab="CLI" --tracing --tracing.instana.localAgentHost="127.0.0.1" @@ -35,12 +46,18 @@ _Require, Default=42699_ Local Agent port instructs reporter to send spans to the instana-agent at this port. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.instana] localAgentPort = 42699 ``` +```yaml tab="File (YAML)" +tracing: + instana: + localAgentPort: 42699 +``` + ```bash tab="CLI" --tracing --tracing.instana.localAgentPort=42699 @@ -59,12 +76,18 @@ Valid values for logLevel field are: - `debug` - `info` -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.instana] logLevel = "info" ``` +```yaml tab="File (YAML)" +tracing: + instana: + logLevel: info +``` + ```bash tab="CLI" --tracing --tracing.instana.logLevel="info" diff --git a/docs/content/observability/tracing/jaeger.md b/docs/content/observability/tracing/jaeger.md index 1f1ed3a0e..0979ff6e1 100644 --- a/docs/content/observability/tracing/jaeger.md +++ b/docs/content/observability/tracing/jaeger.md @@ -2,11 +2,16 @@ To enable the Jaeger: -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] ``` +```yaml tab="File (YAML)" +tracing: + jaeger: {} +``` + ```bash tab="CLI" --tracing --tracing.jaeger @@ -22,12 +27,18 @@ _Required, Default="http://localhost:5778/sampling"_ Sampling Server URL is the address of jaeger-agent's HTTP sampling server. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] samplingServerURL = "http://localhost:5778/sampling" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + samplingServerURL: http://localhost:5778/sampling +``` + ```bash tab="CLI" --tracing --tracing.jaeger.samplingServerURL="http://localhost:5778/sampling" @@ -39,12 +50,18 @@ _Required, Default="const"_ Sampling Type specifies the type of the sampler: `const`, `probabilistic`, `rateLimiting`. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] samplingType = "const" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + samplingType: const +``` + ```bash tab="CLI" --tracing --tracing.jaeger.samplingType="const" @@ -62,12 +79,18 @@ Valid values for Param field are: - for `probabilistic` sampler, a probability between 0 and 1 - for `rateLimiting` sampler, the number of spans per second -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] samplingParam = 1.0 ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + samplingParam: 1.0 +``` + ```bash tab="CLI" --tracing --tracing.jaeger.samplingParam="1.0" @@ -79,12 +102,18 @@ _Required, Default="127.0.0.1:6831"_ Local Agent Host Port instructs reporter to send spans to jaeger-agent at this address. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] localAgentHostPort = "127.0.0.1:6831" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + localAgentHostPort: 127.0.0.1:6831 +``` + ```bash tab="CLI" --tracing --tracing.jaeger.localAgentHostPort="127.0.0.1:6831" @@ -96,12 +125,18 @@ _Optional, Default=false_ Generate 128-bit trace IDs, compatible with OpenCensus. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] gen128Bit = true ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + gen128Bit: true +``` + ```bash tab="CLI" --tracing --tracing.jaeger.gen128Bit @@ -117,12 +152,18 @@ This can be either: - `jaeger`, jaeger's default trace header. - `b3`, compatible with OpenZipkin -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] propagation = "jaeger" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + propagation: jaeger +``` + ```bash tab="CLI" --tracing --tracing.jaeger.propagation="jaeger" @@ -135,12 +176,18 @@ _Required, Default="uber-trace-id"_ Trace Context Header Name is the http header name used to propagate tracing context. This must be in lower-case to avoid mismatches when decoding incoming headers. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger] traceContextHeaderName = "uber-trace-id" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + traceContextHeaderName: uber-trace-id +``` + ```bash tab="CLI" --tracing --tracing.jaeger.traceContextHeaderName="uber-trace-id" @@ -153,12 +200,19 @@ _Optional, Default=""_ Collector Endpoint instructs reporter to send spans to jaeger-collector at this URL. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger.collector] endpoint = "http://127.0.0.1:14268/api/traces?format=jaeger.thrift" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + collector: + endpoint: http://127.0.0.1:14268/api/traces?format=jaeger.thrift +``` + ```bash tab="CLI" --tracing --tracing.jaeger.collector.endpoint="http://127.0.0.1:14268/api/traces?format=jaeger.thrift" @@ -170,12 +224,19 @@ _Optional, Default=""_ User instructs reporter to include a user for basic http authentication when sending spans to jaeger-collector. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger.collector] user = "my-user" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + collector: + user: my-user +``` + ```bash tab="CLI" --tracing --tracing.jaeger.collector.user="my-user" @@ -187,12 +248,19 @@ _Optional, Default=""_ Password instructs reporter to include a password for basic http authentication when sending spans to jaeger-collector. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.jaeger.collector] password = "my-password" ``` +```yaml tab="File (YAML)" +tracing: + jaeger: + collector: + password: my-password +``` + ```bash tab="CLI" --tracing --tracing.jaeger.collector.password="my-password" diff --git a/docs/content/observability/tracing/overview.md b/docs/content/observability/tracing/overview.md index 2de86bd07..4b0ad2cba 100644 --- a/docs/content/observability/tracing/overview.md +++ b/docs/content/observability/tracing/overview.md @@ -21,10 +21,14 @@ By default, Traefik uses Jaeger as tracing backend. To enable the tracing: -```toml tab="File" +```toml tab="File (TOML)" [tracing] ``` +```yaml tab="File (YAML)" +tracing: {} +``` + ```bash tab="CLI" --tracing ``` @@ -37,11 +41,16 @@ _Required, Default="traefik"_ Service name used in selected backend. -```toml tab="File" +```toml tab="File (TOML)" [tracing] serviceName = "traefik" ``` +```yaml tab="File (YAML)" +tracing: + serviceName: traefik +``` + ```bash tab="CLI" --tracing --tracing.serviceName="traefik" @@ -56,11 +65,16 @@ This can prevent certain tracing providers to drop traces that exceed their leng `0` means no truncation will occur. -```toml tab="File" +```toml tab="File (TOML)" [tracing] spanNameLimit = 150 ``` +```yaml tab="File (YAML)" +tracing: + spanNameLimit: 150 +``` + ```bash tab="CLI" --tracing --tracing.spanNameLimit=150 diff --git a/docs/content/observability/tracing/zipkin.md b/docs/content/observability/tracing/zipkin.md index 14954468d..dc2665e85 100644 --- a/docs/content/observability/tracing/zipkin.md +++ b/docs/content/observability/tracing/zipkin.md @@ -2,11 +2,16 @@ To enable the Zipkin: -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] ``` +```yaml tab="File (YAML)" +tracing: + zipkin: {} +``` + ```bash tab="CLI" --tracing --tracing.zipkin @@ -18,12 +23,18 @@ _Required, Default="http://localhost:9411/api/v1/spans"_ Zipkin HTTP endpoint used to send data. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] httpEndpoint = "http://localhost:9411/api/v1/spans" ``` +```yaml tab="File (YAML)" +tracing: + zipkin: + httpEndpoint: http://localhost:9411/api/v1/spans +``` + ```bash tab="CLI" --tracing --tracing.zipkin.httpEndpoint="http://localhost:9411/api/v1/spans" @@ -35,12 +46,18 @@ _Optional, Default=false_ Enable Zipkin debug. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] debug = true ``` +```yaml tab="File (YAML)" +tracing: + zipkin: + debug: true +``` + ```bash tab="CLI" --tracing --tracing.zipkin.debug=true @@ -52,12 +69,18 @@ _Optional, Default=false_ Use Zipkin SameSpan RPC style traces. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] sameSpan = true ``` +```yaml tab="File (YAML)" +tracing: + zipkin: + sameSpan: true +``` + ```bash tab="CLI" --tracing --tracing.zipkin.sameSpan=true @@ -69,12 +92,18 @@ _Optional, Default=true_ Use Zipkin 128 bit root span IDs. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] id128Bit = false ``` +```yaml tab="File (YAML)" +tracing: + zipkin: + id128Bit: false +``` + ```bash tab="CLI" --tracing --tracing.zipkin.id128Bit=false @@ -86,12 +115,18 @@ _Required, Default=1.0_ The rate between 0.0 and 1.0 of requests to trace. -```toml tab="File" +```toml tab="File (TOML)" [tracing] [tracing.zipkin] sampleRate = 0.2 ``` +```yaml tab="File (YAML)" +tracing: + zipkin: + sampleRate: 0.2 +``` + ```bash tab="CLI" --tracing --tracing.zipkin.sampleRate="0.2" From 8b08f89d2c9b7907cdf55f183e9f6aeeee65cd4f Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Mon, 17 Jun 2019 09:20:03 +0200 Subject: [PATCH 24/49] Allows logs to use local time zone instead of UTC Co-authored-by: Ludovic Fernandez --- .../accesslog/logger_formatters.go | 2 ++ .../accesslog/logger_formatters_test.go | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/pkg/middlewares/accesslog/logger_formatters.go b/pkg/middlewares/accesslog/logger_formatters.go index 6e17b17e6..554e709b3 100644 --- a/pkg/middlewares/accesslog/logger_formatters.go +++ b/pkg/middlewares/accesslog/logger_formatters.go @@ -24,6 +24,8 @@ func (f *CommonLogFormatter) Format(entry *logrus.Entry) ([]byte, error) { var timestamp = defaultValue if v, ok := entry.Data[StartUTC]; ok { timestamp = v.(time.Time).Format(commonLogTimeFormat) + } else if v, ok := entry.Data[StartLocal]; ok { + timestamp = v.(time.Time).Local().Format(commonLogTimeFormat) } var elapsedMillis int64 diff --git a/pkg/middlewares/accesslog/logger_formatters_test.go b/pkg/middlewares/accesslog/logger_formatters_test.go index 54be292ed..4817c26d9 100644 --- a/pkg/middlewares/accesslog/logger_formatters_test.go +++ b/pkg/middlewares/accesslog/logger_formatters_test.go @@ -2,6 +2,7 @@ package accesslog import ( "net/http" + "os" "testing" "time" @@ -57,10 +58,34 @@ func TestCommonLogFormatter_Format(t *testing.T) { ServiceURL: "http://10.0.0.2/toto", }, expectedLog: `10.0.0.1 - Client [10/Nov/2009:23:00:00 +0000] "GET /foo http" 123 132 "referer" "agent" - "foo" "http://10.0.0.2/toto" 123000ms +`, + }, + { + name: "all data with local time", + data: map[string]interface{}{ + StartLocal: time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC), + Duration: 123 * time.Second, + ClientHost: "10.0.0.1", + ClientUsername: "Client", + RequestMethod: http.MethodGet, + RequestPath: "/foo", + RequestProtocol: "http", + OriginStatus: 123, + OriginContentSize: 132, + RequestRefererHeader: "referer", + RequestUserAgentHeader: "agent", + RequestCount: nil, + RouterName: "foo", + ServiceURL: "http://10.0.0.2/toto", + }, + expectedLog: `10.0.0.1 - Client [10/Nov/2009:14:00:00 -0900] "GET /foo http" 123 132 "referer" "agent" - "foo" "http://10.0.0.2/toto" 123000ms `, }, } + // Set timezone to Alaska to have a constant behavior + os.Setenv("TZ", "US/Alaska") + for _, test := range testCases { test := test t.Run(test.name, func(t *testing.T) { From 75aedc8e94979a06507077f2cc0e3a395f677d86 Mon Sep 17 00:00:00 2001 From: David Dymko Date: Tue, 16 Jul 2019 10:02:04 -0400 Subject: [PATCH 25/49] Fixed doc link for AlibabaCloud --- docs/content/https/acme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index 724b5375d..648304076 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -207,7 +207,7 @@ For example, `CF_API_EMAIL_FILE=/run/secrets/traefik_cf-api-email` could be used | Provider Name | Provider Code | Environment Variables | | |-------------------------------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------| | [ACME DNS](https://github.com/joohoi/acme-dns) | `acme-dns` | `ACME_DNS_API_BASE`, `ACME_DNS_STORAGE_PATH` | [Additional configuration](https://go-acme.github.io/lego/dns/acme-dns) | -| [Alibaba Cloud](https://www.vultr.com) | `alidns` | `ALICLOUD_ACCESS_KEY`, `ALICLOUD_SECRET_KEY`, `ALICLOUD_REGION_ID` | [Additional configuration](https://go-acme.github.io/lego/dns/alidns) | +| [Alibaba Cloud](https://www.alibabacloud.com) | `alidns` | `ALICLOUD_ACCESS_KEY`, `ALICLOUD_SECRET_KEY`, `ALICLOUD_REGION_ID` | [Additional configuration](https://go-acme.github.io/lego/dns/alidns) | | [Auroradns](https://www.pcextreme.com/aurora/dns) | `auroradns` | `AURORA_USER_ID`, `AURORA_KEY`, `AURORA_ENDPOINT` | [Additional configuration](https://go-acme.github.io/lego/dns/auroradns) | | [Azure](https://azure.microsoft.com/services/dns/) | `azure` | `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID`, `AZURE_RESOURCE_GROUP`, `[AZURE_METADATA_ENDPOINT]` | [Additional configuration](https://go-acme.github.io/lego/dns/azure) | | [Blue Cat](https://www.bluecatnetworks.com/) | `bluecat` | `BLUECAT_SERVER_URL`, `BLUECAT_USER_NAME`, `BLUECAT_PASSWORD`, `BLUECAT_CONFIG_NAME`, `BLUECAT_DNS_VIEW` | [Additional configuration](https://go-acme.github.io/lego/dns/bluecat) | From 68c349bbfaa1865109629c7bdcc5e32107a85469 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 18 Jul 2019 15:56:04 +0200 Subject: [PATCH 26/49] Manage status for TCP element in the endpoint overview. --- pkg/api/handler_overview.go | 16 +++++++++--- pkg/api/handler_overview_test.go | 35 ++++++++++++++++++++++++++ pkg/api/handler_tcp_test.go | 25 ++++++++++++++++++ pkg/api/testdata/overview-dynamic.json | 12 ++++----- pkg/api/testdata/tcprouters.json | 14 ++++++++++- pkg/api/testdata/tcpservices.json | 17 +++++++++++++ 6 files changed, 108 insertions(+), 11 deletions(-) diff --git a/pkg/api/handler_overview.go b/pkg/api/handler_overview.go index 6d6c51751..1d90446b9 100644 --- a/pkg/api/handler_overview.go +++ b/pkg/api/handler_overview.go @@ -115,30 +115,38 @@ func getHTTPMiddlewareSection(middlewares map[string]*runtime.MiddlewareInfo) *s func getTCPRouterSection(routers map[string]*runtime.TCPRouterInfo) *section { var countErrors int + var countWarnings int for _, rt := range routers { - if rt.Err != "" { + switch rt.Status { + case runtime.StatusDisabled: countErrors++ + case runtime.StatusWarning: + countWarnings++ } } return §ion{ Total: len(routers), - Warnings: 0, // TODO + Warnings: countWarnings, Errors: countErrors, } } func getTCPServiceSection(services map[string]*runtime.TCPServiceInfo) *section { var countErrors int + var countWarnings int for _, svc := range services { - if svc.Err != nil { + switch svc.Status { + case runtime.StatusDisabled: countErrors++ + case runtime.StatusWarning: + countWarnings++ } } return §ion{ Total: len(services), - Warnings: 0, // TODO + Warnings: countWarnings, Errors: countErrors, } } diff --git a/pkg/api/handler_overview_test.go b/pkg/api/handler_overview_test.go index 418335c40..5b08954f7 100644 --- a/pkg/api/handler_overview_test.go +++ b/pkg/api/handler_overview_test.go @@ -142,6 +142,31 @@ func TestHandler_Overview(t *testing.T) { }, }, }, + Status: runtime.StatusEnabled, + }, + "tcpbar-service@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.2", + }, + }, + }, + }, + Status: runtime.StatusWarning, + }, + "tcpfii-service@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.2", + }, + }, + }, + }, + Status: runtime.StatusDisabled, }, }, TCPRouters: map[string]*runtime.TCPRouterInfo{ @@ -151,6 +176,7 @@ func TestHandler_Overview(t *testing.T) { Service: "tcpfoo-service@myprovider", Rule: "HostSNI(`foo.bar`)", }, + Status: runtime.StatusEnabled, }, "tcptest@myprovider": { TCPRouter: &dynamic.TCPRouter{ @@ -158,6 +184,15 @@ func TestHandler_Overview(t *testing.T) { Service: "tcpfoo-service@myprovider", Rule: "HostSNI(`foo.bar.other`)", }, + Status: runtime.StatusWarning, + }, + "tcpfoo@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "tcpfoo-service@myprovider", + Rule: "HostSNI(`foo.bar.other`)", + }, + Status: runtime.StatusDisabled, }, }, }, diff --git a/pkg/api/handler_tcp_test.go b/pkg/api/handler_tcp_test.go index 9c68b0f2b..92009abc4 100644 --- a/pkg/api/handler_tcp_test.go +++ b/pkg/api/handler_tcp_test.go @@ -52,6 +52,7 @@ func TestHandler_TCP(t *testing.T) { Passthrough: false, }, }, + Status: runtime.StatusEnabled, }, "bar@myprovider": { TCPRouter: &dynamic.TCPRouter{ @@ -59,6 +60,15 @@ func TestHandler_TCP(t *testing.T) { Service: "foo-service@myprovider", Rule: "Host(`foo.bar`)", }, + Status: runtime.StatusWarning, + }, + "foo@myprovider": { + TCPRouter: &dynamic.TCPRouter{ + EntryPoints: []string{"web"}, + Service: "foo-service@myprovider", + Rule: "Host(`foo.bar`)", + }, + Status: runtime.StatusDisabled, }, }, }, @@ -173,6 +183,7 @@ func TestHandler_TCP(t *testing.T) { }, }, UsedBy: []string{"foo@myprovider", "test@myprovider"}, + Status: runtime.StatusEnabled, }, "baz@myprovider": { TCPService: &dynamic.TCPService{ @@ -185,6 +196,20 @@ func TestHandler_TCP(t *testing.T) { }, }, UsedBy: []string{"foo@myprovider"}, + Status: runtime.StatusWarning, + }, + "foz@myprovider": { + TCPService: &dynamic.TCPService{ + LoadBalancer: &dynamic.TCPLoadBalancerService{ + Servers: []dynamic.TCPServer{ + { + Address: "127.0.0.2:2345", + }, + }, + }, + }, + UsedBy: []string{"foo@myprovider"}, + Status: runtime.StatusDisabled, }, }, }, diff --git a/pkg/api/testdata/overview-dynamic.json b/pkg/api/testdata/overview-dynamic.json index c2c864386..bd553ad9c 100644 --- a/pkg/api/testdata/overview-dynamic.json +++ b/pkg/api/testdata/overview-dynamic.json @@ -23,14 +23,14 @@ }, "tcp": { "routers": { - "errors": 0, - "total": 2, - "warnings": 0 + "errors": 1, + "total": 3, + "warnings": 1 }, "services": { - "errors": 0, - "total": 1, - "warnings": 0 + "errors": 1, + "total": 3, + "warnings": 1 } } } \ No newline at end of file diff --git a/pkg/api/testdata/tcprouters.json b/pkg/api/testdata/tcprouters.json index b63a9da9c..a2bf3c401 100644 --- a/pkg/api/testdata/tcprouters.json +++ b/pkg/api/testdata/tcprouters.json @@ -6,7 +6,18 @@ "name": "bar@myprovider", "provider": "myprovider", "rule": "Host(`foo.bar`)", - "service": "foo-service@myprovider" + "service": "foo-service@myprovider", + "status": "warning" + }, + { + "entryPoints": [ + "web" + ], + "name": "foo@myprovider", + "provider": "myprovider", + "rule": "Host(`foo.bar`)", + "service": "foo-service@myprovider", + "status": "disabled" }, { "entryPoints": [ @@ -16,6 +27,7 @@ "provider": "myprovider", "rule": "Host(`foo.bar.other`)", "service": "foo-service@myprovider", + "status": "enabled", "tls": { "passthrough": false } diff --git a/pkg/api/testdata/tcpservices.json b/pkg/api/testdata/tcpservices.json index 4df6dc8b7..24320d948 100644 --- a/pkg/api/testdata/tcpservices.json +++ b/pkg/api/testdata/tcpservices.json @@ -9,6 +9,7 @@ }, "name": "bar@myprovider", "provider": "myprovider", + "status": "enabled", "usedBy": [ "foo@myprovider", "test@myprovider" @@ -24,6 +25,22 @@ }, "name": "baz@myprovider", "provider": "myprovider", + "status": "warning", + "usedBy": [ + "foo@myprovider" + ] + }, + { + "loadBalancer": { + "servers": [ + { + "address": "127.0.0.2:2345" + } + ] + }, + "name": "foz@myprovider", + "provider": "myprovider", + "status": "disabled", "usedBy": [ "foo@myprovider" ] From 4dc448056c73d3efc5e9da32dd69e3d0b85d95ed Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 18 Jul 2019 16:26:05 +0200 Subject: [PATCH 27/49] fix: TLS configuration from directory. --- pkg/provider/file/file.go | 24 +++++++++++++++- pkg/provider/file/file_test.go | 28 +++++++++++-------- .../file/fixtures/toml/dir01_file03.toml | 4 +++ .../file/fixtures/yaml/dir01_file03.yml | 4 +++ 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/pkg/provider/file/file.go b/pkg/provider/file/file.go index b70475c70..6133a6eb9 100644 --- a/pkg/provider/file/file.go +++ b/pkg/provider/file/file.go @@ -295,9 +295,31 @@ func (p *Provider) loadFileConfigFromDirectory(ctx context.Context, directory st configTLSMaps[conf] = struct{}{} } } + + for name, conf := range c.TLS.Options { + if _, exists := configuration.TLS.Options[name]; exists { + logger.Warnf("TLS options %v already configured, skipping", name) + } else { + if configuration.TLS.Options == nil { + configuration.TLS.Options = map[string]tls.Options{} + } + configuration.TLS.Options[name] = conf + } + } + + for name, conf := range c.TLS.Stores { + if _, exists := configuration.TLS.Stores[name]; exists { + logger.Warnf("TLS store %v already configured, skipping", name) + } else { + if configuration.TLS.Stores == nil { + configuration.TLS.Stores = map[string]tls.Store{} + } + configuration.TLS.Stores[name] = conf + } + } } - if len(configTLSMaps) > 0 { + if len(configTLSMaps) > 0 && configuration.TLS == nil { configuration.TLS = &dynamic.TLSConfiguration{} } diff --git a/pkg/provider/file/file_test.go b/pkg/provider/file/file_test.go index 8307d8a10..cb4131d1b 100644 --- a/pkg/provider/file/file_test.go +++ b/pkg/provider/file/file_test.go @@ -17,12 +17,13 @@ import ( ) type ProvideTestCase struct { - desc string - directoryPaths []string - filePath string - expectedNumRouter int - expectedNumService int - expectedNumTLSConf int + desc string + directoryPaths []string + filePath string + expectedNumRouter int + expectedNumService int + expectedNumTLSConf int + expectedNumTLSOptions int } func TestTLSContent(t *testing.T) { @@ -94,6 +95,7 @@ func TestProvideWithoutWatch(t *testing.T) { assert.Len(t, conf.Configuration.HTTP.Routers, test.expectedNumRouter) require.NotNil(t, conf.Configuration.TLS) assert.Len(t, conf.Configuration.TLS.Certificates, test.expectedNumTLSConf) + assert.Len(t, conf.Configuration.TLS.Options, test.expectedNumTLSOptions) case <-timeout: t.Errorf("timeout while waiting for config") } @@ -192,9 +194,10 @@ func getTestCases() []ProvideTestCase { "./fixtures/toml/dir01_file02.toml", "./fixtures/toml/dir01_file03.toml", }, - expectedNumRouter: 2, - expectedNumService: 3, - expectedNumTLSConf: 4, + expectedNumRouter: 2, + expectedNumService: 3, + expectedNumTLSConf: 4, + expectedNumTLSOptions: 1, }, { desc: "simple directory yaml", @@ -203,9 +206,10 @@ func getTestCases() []ProvideTestCase { "./fixtures/yaml/dir01_file02.yml", "./fixtures/yaml/dir01_file03.yml", }, - expectedNumRouter: 2, - expectedNumService: 3, - expectedNumTLSConf: 4, + expectedNumRouter: 2, + expectedNumService: 3, + expectedNumTLSConf: 4, + expectedNumTLSOptions: 1, }, { desc: "template in directory", diff --git a/pkg/provider/file/fixtures/toml/dir01_file03.toml b/pkg/provider/file/fixtures/toml/dir01_file03.toml index 6cfb2635c..001b7f1a8 100644 --- a/pkg/provider/file/fixtures/toml/dir01_file03.toml +++ b/pkg/provider/file/fixtures/toml/dir01_file03.toml @@ -15,3 +15,7 @@ [[tls.certificates]] certFile = "integration/fixtures/https/snitest4.com.cert" keyFile = "integration/fixtures/https/snitest4.com.key" + +[tls.options] + [tls.options.mintls13] + minVersion = "VersionTLS13" diff --git a/pkg/provider/file/fixtures/yaml/dir01_file03.yml b/pkg/provider/file/fixtures/yaml/dir01_file03.yml index bcf46ba67..d13ca3085 100644 --- a/pkg/provider/file/fixtures/yaml/dir01_file03.yml +++ b/pkg/provider/file/fixtures/yaml/dir01_file03.yml @@ -8,3 +8,7 @@ tls: keyFile: integration/fixtures/https/snitest3.com.key - certFile: integration/fixtures/https/snitest4.com.cert keyFile: integration/fixtures/https/snitest4.com.key + + options: + mintls13: + minVersion: VersionTLS13 From 8e97af8dc34ddd63e5ccc489089c8dbacb73f29e Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 18 Jul 2019 21:36:05 +0200 Subject: [PATCH 28/49] Add Metrics --- Gopkg.lock | 52 +- Gopkg.toml | 12 +- docs/content/observability/metrics/datadog.md | 106 +++ .../content/observability/metrics/influxdb.md | 225 ++++++ .../content/observability/metrics/overview.md | 26 + .../observability/metrics/prometheus.md | 139 ++++ docs/content/observability/metrics/statsd.md | 110 +++ .../reference/static-configuration/cli-ref.md | 24 + .../reference/static-configuration/env-ref.md | 24 + .../reference/static-configuration/file.toml | 8 + .../reference/static-configuration/file.yaml | 8 + docs/mkdocs.yml | 6 + pkg/metrics/datadog.go | 51 +- pkg/metrics/datadog_test.go | 32 +- pkg/metrics/influxdb.go | 61 +- pkg/metrics/influxdb_test.go | 82 +-- pkg/metrics/metrics.go | 150 ++-- pkg/metrics/metrics_test.go | 18 +- pkg/metrics/prometheus.go | 245 ++++--- pkg/metrics/prometheus_test.go | 218 +++--- pkg/metrics/statsd.go | 55 +- pkg/metrics/statsd_test.go | 30 +- pkg/middlewares/metrics/metrics.go | 158 ++++ pkg/middlewares/metrics/metrics_test.go | 58 ++ pkg/middlewares/metrics/recorder.go | 37 + pkg/server/router/router_test.go | 10 +- pkg/server/server_configuration.go | 25 +- pkg/server/service/service.go | 12 +- pkg/server/service/service_test.go | 4 +- pkg/types/metrics.go | 56 +- vendor/github.com/go-kit/kit/log/value.go | 14 +- .../go-kit/kit/metrics/dogstatsd/dogstatsd.go | 44 +- .../go-kit/kit/metrics/influx/influx.go | 16 +- .../go-kit/kit/metrics/internal/lv/space.go | 4 +- .../go-kit/kit/metrics/statsd/statsd.go | 24 +- .../go-kit/kit/util/conn/manager.go | 11 +- vendor/github.com/go-stack/stack/stack.go | 322 -------- vendor/github.com/influxdata/influxdb/LICENSE | 20 - .../influxdb/LICENSE_OF_DEPENDENCIES.md | 25 - .../influxdata/influxdb/models/consistency.go | 48 -- .../influxdb1-client/LICENSE} | 4 +- .../models/inline_fnv.go | 2 +- .../models/inline_strconv_parse.go | 8 +- .../models/points.go | 432 +++++++---- .../models/rows.go | 0 .../models/statistic.go | 0 .../models/time.go | 0 .../influxdb1-client/models/uint_support.go | 7 + .../pkg/escape/bytes.go | 8 +- .../pkg/escape/strings.go | 0 .../client => influxdb1-client}/v2/client.go | 213 ++++-- .../client => influxdb1-client}/v2/udp.go | 4 + .../client_golang/prometheus/build_info.go | 29 + .../prometheus/build_info_pre_1.12.go | 22 + .../client_golang/prometheus/collector.go | 73 +- .../client_golang/prometheus/counter.go | 179 ++++- .../client_golang/prometheus/desc.go | 40 +- .../client_golang/prometheus/doc.go | 41 +- .../client_golang/prometheus/fnv.go | 13 + .../client_golang/prometheus/gauge.go | 191 ++++- .../client_golang/prometheus/go_collector.go | 146 +++- .../client_golang/prometheus/histogram.go | 282 +++++-- .../client_golang/prometheus/http.go | 526 ------------- .../prometheus/internal/metric.go | 85 +++ .../client_golang/prometheus/labels.go | 87 +++ .../client_golang/prometheus/metric.go | 90 +-- .../client_golang/prometheus/observer.go | 52 ++ .../prometheus/process_collector.go | 123 ++-- .../prometheus/process_collector_other.go | 65 ++ .../prometheus/process_collector_windows.go | 112 +++ .../prometheus/promhttp/delegator.go | 357 +++++++++ .../client_golang/prometheus/promhttp/http.go | 298 ++++++-- .../prometheus/promhttp/instrument_client.go | 219 ++++++ .../prometheus/promhttp/instrument_server.go | 447 +++++++++++ .../client_golang/prometheus/registry.go | 692 +++++++++++------- .../client_golang/prometheus/summary.go | 325 ++++++-- .../client_golang/prometheus/timer.go | 40 +- .../client_golang/prometheus/untyped.go | 107 +-- .../client_golang/prometheus/value.go | 99 +-- .../client_golang/prometheus/vec.go | 516 +++++++------ .../client_golang/prometheus/wrap.go | 200 +++++ .../prometheus/common/expfmt/decode.go | 4 +- .../prometheus/common/expfmt/expfmt.go | 2 +- .../prometheus/common/expfmt/text_create.go | 385 +++++++--- .../prometheus/common/expfmt/text_parse.go | 10 +- .../bitbucket.org/ww/goautoneg/autoneg.go | 6 +- .../prometheus/common/model/metric.go | 1 - .../prometheus/common/model/silence.go | 4 +- .../prometheus/common/model/time.go | 27 +- .../prometheus/common/model/value.go | 4 +- .../github.com/prometheus/procfs/buddyinfo.go | 16 +- vendor/github.com/prometheus/procfs/fs.go | 63 +- .../prometheus/procfs/internal/fs/fs.go | 55 ++ vendor/github.com/prometheus/procfs/ipvs.go | 101 +-- vendor/github.com/prometheus/procfs/mdstat.go | 158 ++-- .../github.com/prometheus/procfs/mountinfo.go | 178 +++++ .../prometheus/procfs/mountstats.go | 115 ++- .../github.com/prometheus/procfs/net_dev.go | 206 ++++++ .../github.com/prometheus/procfs/net_unix.go | 275 +++++++ vendor/github.com/prometheus/procfs/proc.go | 77 +- .../prometheus/procfs/proc_environ.go | 43 ++ .../github.com/prometheus/procfs/proc_io.go | 22 +- .../prometheus/procfs/proc_limits.go | 58 +- .../github.com/prometheus/procfs/proc_ns.go | 68 ++ .../github.com/prometheus/procfs/proc_psi.go | 101 +++ .../github.com/prometheus/procfs/proc_stat.go | 33 +- .../prometheus/procfs/proc_status.go | 162 ++++ vendor/github.com/prometheus/procfs/stat.go | 230 +++++- vendor/github.com/prometheus/procfs/xfrm.go | 187 +++++ .../github.com/prometheus/procfs/xfs/parse.go | 361 --------- .../github.com/prometheus/procfs/xfs/xfs.go | 158 ---- .../DataDog/dd-trace-go.v1/ddtrace/ddtrace.go | 6 + .../dd-trace-go.v1/ddtrace/tracer/errors.go | 69 -- .../dd-trace-go.v1/ddtrace/tracer/option.go | 15 +- .../dd-trace-go.v1/ddtrace/tracer/rand.go | 5 +- .../ddtrace/tracer/spancontext.go | 6 +- .../ddtrace/tracer/time_windows.go | 6 +- .../dd-trace-go.v1/ddtrace/tracer/tracer.go | 77 +- .../ddtrace/tracer/transport.go | 8 +- .../dd-trace-go.v1/internal/log/log.go | 163 +++++ .../internal/version/version.go | 6 + 121 files changed, 8364 insertions(+), 3811 deletions(-) create mode 100644 docs/content/observability/metrics/datadog.md create mode 100644 docs/content/observability/metrics/influxdb.md create mode 100644 docs/content/observability/metrics/overview.md create mode 100644 docs/content/observability/metrics/prometheus.md create mode 100644 docs/content/observability/metrics/statsd.md create mode 100644 pkg/middlewares/metrics/metrics.go create mode 100644 pkg/middlewares/metrics/metrics_test.go create mode 100644 pkg/middlewares/metrics/recorder.go delete mode 100644 vendor/github.com/go-stack/stack/stack.go delete mode 100644 vendor/github.com/influxdata/influxdb/LICENSE delete mode 100644 vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md delete mode 100644 vendor/github.com/influxdata/influxdb/models/consistency.go rename vendor/github.com/{go-stack/stack/LICENSE.md => influxdata/influxdb1-client/LICENSE} (95%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/inline_fnv.go (91%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/inline_strconv_parse.go (77%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/points.go (86%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/rows.go (100%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/statistic.go (100%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/models/time.go (100%) create mode 100644 vendor/github.com/influxdata/influxdb1-client/models/uint_support.go rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/pkg/escape/bytes.go (87%) rename vendor/github.com/influxdata/{influxdb => influxdb1-client}/pkg/escape/strings.go (100%) rename vendor/github.com/influxdata/{influxdb/client => influxdb1-client}/v2/client.go (77%) rename vendor/github.com/influxdata/{influxdb/client => influxdb1-client}/v2/udp.go (94%) create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/http.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/labels.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/observer.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/wrap.go create mode 100644 vendor/github.com/prometheus/procfs/internal/fs/fs.go create mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go create mode 100644 vendor/github.com/prometheus/procfs/net_dev.go create mode 100644 vendor/github.com/prometheus/procfs/net_unix.go create mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go create mode 100644 vendor/github.com/prometheus/procfs/proc_ns.go create mode 100644 vendor/github.com/prometheus/procfs/proc_psi.go create mode 100644 vendor/github.com/prometheus/procfs/proc_status.go create mode 100644 vendor/github.com/prometheus/procfs/xfrm.go delete mode 100644 vendor/github.com/prometheus/procfs/xfs/parse.go delete mode 100644 vendor/github.com/prometheus/procfs/xfs/xfs.go delete mode 100644 vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/errors.go create mode 100644 vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/log/log.go create mode 100644 vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/version/version.go diff --git a/Gopkg.lock b/Gopkg.lock index b2da47f6a..a5af15a42 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -701,7 +701,7 @@ version = "v1.41.0" [[projects]] - digest = "1:9e53c5e9ee65a2c587d6ade11761ef2f976abfcd9599c5016b7046e63c1f7fb2" + digest = "1:bed40e7a58536b77890de9fc4911a1322a31cd2495bbcad8446d182063eb1ae4" name = "github.com/go-kit/kit" packages = [ "log", @@ -716,8 +716,8 @@ "util/conn", ] pruneopts = "NUT" - revision = "ca4112baa34cb55091301bdc13b1420a122b1b9e" - version = "v0.7.0" + revision = "150a65a7ec6156b4b640c1fd55f26fd3d475d656" + version = "v0.9.0" [[projects]] digest = "1:341a7df38da99fe91ed40e4008c13cc5d02dcc98ed1a094360cb7d5df26d6d26" @@ -735,14 +735,6 @@ revision = "d4920dcf5b7689548a6db640278a9b35a5b48ec6" version = "v1.9.1" -[[projects]] - digest = "1:8cf58169eb0a8c009ed3a4c36486980d602ab4cc4e478130493d6cd0404f889b" - name = "github.com/go-stack/stack" - packages = ["."] - pruneopts = "NUT" - revision = "54be5f394ed2c3e19dac9134a40a95ba5a017f7b" - version = "v1.5.4" - [[projects]] digest = "1:6689652ec1f6e30455551da19c707f2bfac75e4df5c7bbe3f0ad7b49b9aa2cfc" name = "github.com/gogo/protobuf" @@ -938,16 +930,16 @@ version = "0.2.4" [[projects]] - digest = "1:9813d5a93abcc5690fa5830bf7186c835493516986be7a2b11b46e7b12e13317" - name = "github.com/influxdata/influxdb" + branch = "master" + digest = "1:50708c8fc92aec981df5c446581cf9f90ba9e2a5692118e0ce75d4534aaa14a2" + name = "github.com/influxdata/influxdb1-client" packages = [ - "client/v2", "models", "pkg/escape", + "v2", ] pruneopts = "NUT" - revision = "2d474a3089bcfce6b472779be9470a1f0ef3d5e4" - version = "v1.3.7" + revision = "8ff2fc3824fcb533795f9a2f233275f0bb18d6c5" [[projects]] digest = "1:78efd72f12ed0244e5fbe82bd0ecdbaf3e21402ee9176525ef1138a2fc0d3b17" @@ -1362,14 +1354,16 @@ version = "v1.0.0" [[projects]] - digest = "1:d05ebef91c056e176dc4dfe905002bd3dd7b1dc8703b53bf6e88761053236a75" + digest = "1:097cc61836050f45cbb712ae3bb45d66fba464c16b8fac09907fa3c1f753eff6" name = "github.com/prometheus/client_golang" packages = [ "prometheus", + "prometheus/internal", "prometheus/promhttp", ] pruneopts = "NUT" - revision = "08fd2e12372a66e68e30523c7642e0cbc3e4fbde" + revision = "4ab88e80c249ed361d3299e2930427d9ac43ef8d" + version = "v1.0.0" [[projects]] digest = "1:32d10bdfa8f09ecf13598324dba86ab891f11db3c538b6a34d1c3b5b99d7c36b" @@ -1379,7 +1373,7 @@ revision = "6f3806018612930941127f2a7c6c453ba2c527d2" [[projects]] - digest = "1:65f12bb82877d6e049a41b5feec5f79f11e3e0ea5748f677d68f206ac408c403" + digest = "1:d03ca24670416dc8fccc78b05d6736ec655416ca7db0a028e8fb92cfdfe3b55e" name = "github.com/prometheus/common" packages = [ "expfmt", @@ -1387,17 +1381,19 @@ "model", ] pruneopts = "NUT" - revision = "49fee292b27bfff7f354ee0f64e1bc4850462edf" + revision = "31bed53e4047fd6c510e43a941f90cb31be0972a" + version = "v0.6.0" [[projects]] - digest = "1:60d19aad385900a8aa4a755524e68965fcb31b444ec30e673812e06c98674f2e" + digest = "1:19305fc369377c111c865a7a01e11c675c57c52a932353bbd4ea360bd5b72d99" name = "github.com/prometheus/procfs" packages = [ ".", - "xfs", + "internal/fs", ] pruneopts = "NUT" - revision = "a1dba9ce8baed984a2495b658c82687f8157b98f" + revision = "3f98efb27840a48a7a2898ec80be07674d19f9c8" + version = "v0.0.3" [[projects]] branch = "containous-fork" @@ -1857,7 +1853,7 @@ version = "v1.20.1" [[projects]] - digest = "1:b49eceff862a3048ec28dad1fce40bcbdc1703119dbad35d7e5f1beb4f9a4527" + digest = "1:d732242a429138da899dfecea82b3c65b4157bdf0b5317c229d9c559b6c3450e" name = "gopkg.in/DataDog/dd-trace-go.v1" packages = [ "ddtrace", @@ -1866,10 +1862,12 @@ "ddtrace/opentracer", "ddtrace/tracer", "internal/globalconfig", + "internal/log", + "internal/version", ] pruneopts = "NUT" - revision = "c19e9e56d5b5b71b6507ce1b0ec06d85aa3705a1" - version = "v1.14.0" + revision = "8d2998bc69008aa4553846ac9a044aa730bd4ce4" + version = "v1.15.0" [[projects]] digest = "1:c970218a20933dd0a2eb2006de922217fa9276f57d25009b2a934eb1c50031cc" @@ -2263,7 +2261,7 @@ "github.com/google/go-github/github", "github.com/gorilla/websocket", "github.com/hashicorp/go-version", - "github.com/influxdata/influxdb/client/v2", + "github.com/influxdata/influxdb1-client/v2", "github.com/instana/go-sensor", "github.com/libkermit/compose/check", "github.com/libkermit/docker", diff --git a/Gopkg.toml b/Gopkg.toml index 918ec36be..e1d4de9f4 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -111,7 +111,11 @@ required = [ [[constraint]] name = "github.com/go-kit/kit" - version = "0.7.0" + version = "v0.9.0" + +[[constraint]] + name = "github.com/prometheus/client_golang" + version = "v1.0.0" [[constraint]] branch = "master" @@ -121,10 +125,6 @@ required = [ # name = "github.com/hashicorp/consul" # version = "1.0.6" -[[constraint]] - name = "github.com/influxdata/influxdb" - version = "1.3.7" - #[[constraint]] # branch = "master" # name = "github.com/jjcollinge/servicefabric" @@ -273,7 +273,7 @@ required = [ [[constraint]] name = "gopkg.in/DataDog/dd-trace-go.v1" - version = "1.13.0" + version = "1.15.0" [[constraint]] name = "github.com/instana/go-sensor" diff --git a/docs/content/observability/metrics/datadog.md b/docs/content/observability/metrics/datadog.md new file mode 100644 index 000000000..242103d3b --- /dev/null +++ b/docs/content/observability/metrics/datadog.md @@ -0,0 +1,106 @@ +# DataDog + +To enable the DataDog: + +```toml tab="File (TOML)" +[metrics] + [metrics.dataDog] +``` + +```bash tab="CLI" +--metrics +--metrics.datadog +``` + +#### `address` + +_Required, Default="127.0.0.1:8125"_ + +Address instructs exporter to send metrics to datadog-agent at this address. + +```toml tab="File (TOML)" +[metrics] + [metrics.dataDog] + address = "127.0.0.1:8125" +``` + +```yaml tab="File (TOML)" +metrics: + dataDog: + address: 127.0.0.1:8125 +``` + +```bash tab="CLI" +--metrics +--metrics.datadog.address="127.0.0.1:8125" +``` + +#### `addEntryPointsLabels` + +_Optional, Default=true_ + +Enable metrics on entry points. + +```toml tab="File (TOML)" +[metrics] + [metrics.dataDog] + addEntryPointsLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + dataDog: + addEntryPointsLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.datadog.addEntryPointsLabels=true +``` + +#### `addServicesLabels` + +_Optional, Default=true_ + +Enable metrics on services. + +```toml tab="File (TOML)" +[metrics] + [metrics.dataDog] + addServicesLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + dataDog: + addServicesLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.datadog.addServicesLabels=true +``` + +#### `pushInterval` + +_Optional, Default=10s_ + +The interval used by the exporter to push metrics to datadog-agent. + +```toml tab="File (TOML)" +[metrics] + [metrics.dataDog] + pushInterval = 10s +``` + +```yaml tab="File (TOML)" +metrics: + dataDog: + pushInterval: 10s +``` + +```bash tab="CLI" +--metrics +--metrics.datadog.pushInterval=10s +``` + diff --git a/docs/content/observability/metrics/influxdb.md b/docs/content/observability/metrics/influxdb.md new file mode 100644 index 000000000..7fa367630 --- /dev/null +++ b/docs/content/observability/metrics/influxdb.md @@ -0,0 +1,225 @@ +# InfluxDB + +To enable the InfluxDB: + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: {} +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb +``` + +#### `address` + +_Required, Default="localhost:8089"_ + +Address instructs exporter to send metrics to influxdb at this address. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + address = "localhost:8089" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + address: localhost:8089 +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.address="localhost:8089" +``` + +#### `protocol` + +_Required, Default="udp"_ + +InfluxDB's address protocol (udp or http). + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + protocol = "upd" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + protocol: udp +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.protocol="udp" +``` + +#### `database` + +_Optional, Default=""_ + +InfluxDB database used when protocol is http. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + database = "" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + database: "" +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.database="" +``` + +#### `retentionPolicy` + +_Optional, Default=""_ + +InfluxDB retention policy used when protocol is http. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + retentionPolicy = "" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + retentionPolicy: "" +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.retentionPolicy="" +``` + +#### `username` + +_Optional, Default=""_ + +InfluxDB username (only with http). + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + username = "" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + username: "" +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.username="" +``` + +#### `password` + +_Optional, Default=""_ + +InfluxDB password (only with http). + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + password = "" +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + password: "" +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.password="" +``` + +#### `addEntryPointsLabels` + +_Optional, Default=true_ + +Enable metrics on entry points. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + addEntryPointsLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + addEntryPointsLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.addEntryPointsLabels=true +``` + +#### `addServicesLabels` + +_Optional, Default=true_ + +Enable metrics on services. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + addServicesLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + addServicesLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.addServicesLabels=true +``` + +#### `pushInterval` + +_Optional, Default=10s_ + +The interval used by the exporter to push metrics to influxdb. + +```toml tab="File (TOML)" +[metrics] + [metrics.influxdb] + pushInterval = 10s +``` + +```yaml tab="File (TOML)" +metrics: + influxdb: + pushInterval: 10s +``` + +```bash tab="CLI" +--metrics +--metrics.influxdb.pushInterval=10s +``` diff --git a/docs/content/observability/metrics/overview.md b/docs/content/observability/metrics/overview.md new file mode 100644 index 000000000..f266c6b8c --- /dev/null +++ b/docs/content/observability/metrics/overview.md @@ -0,0 +1,26 @@ +# Metrics +Metrics system +{: .subtitle } + +Traefik supports 4 metrics backends: + +- [DataDog](./datadog.md) +- [InfluxDB](./influxdb.md) +- [Prometheus](./prometheus.md) +- [StatsD](./statsd.md) + +## Configuration + +To enable metrics: + +```toml tab="File (TOML)" +[metrics] +``` + +```yaml tab="File (TOML)" +metrics: {} +``` + +```bash tab="CLI" +--metrics +``` diff --git a/docs/content/observability/metrics/prometheus.md b/docs/content/observability/metrics/prometheus.md new file mode 100644 index 000000000..d409f05de --- /dev/null +++ b/docs/content/observability/metrics/prometheus.md @@ -0,0 +1,139 @@ +# Prometheus + +To enable the Prometheus: + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: {} +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus +``` + +#### `buckets` + +_Optional, Default="0.100000, 0.300000, 1.200000, 5.000000"_ + +Buckets for latency metrics. + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] + buckets = [0.1,0.3,1.2,5.0] +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: + buckets: + - 0.1 + - 0.3 + - 1.2 + - 5.0 +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000 +``` + +#### `entryPoint` + +_Optional, Default=traefik_ + +Entry-point used by prometheus to expose metrics. + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] + entryPoint = traefik +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: + entryPoint: traefik +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus.entryPoint=traefik +``` + +#### `middlewares` + +_Optional, Default=""_ + +Middlewares. + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] + middlewares = ["xxx", "yyy"] +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: + middlewares: + - xxx + - yyy +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus.middlewares="xxx,yyy" +``` + +#### `addEntryPointsLabels` + +_Optional, Default=true_ + +Enable metrics on entry points. + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] + addEntryPointsLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: + addEntryPointsLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus.addEntryPointsLabels=true +``` + +#### `addServicesLabels` + +_Optional, Default=true_ + +Enable metrics on services. + +```toml tab="File (TOML)" +[metrics] + [metrics.prometheus] + addServicesLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + prometheus: + addServicesLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.prometheus.addServicesLabels=true +``` diff --git a/docs/content/observability/metrics/statsd.md b/docs/content/observability/metrics/statsd.md new file mode 100644 index 000000000..f4160878d --- /dev/null +++ b/docs/content/observability/metrics/statsd.md @@ -0,0 +1,110 @@ +# StatsD + +To enable the Statsd: + +```toml tab="File (TOML)" +[metrics] + [metrics.statsd] +``` + +```yaml tab="File (TOML)" +metrics: + statsd: {} +``` + +```bash tab="CLI" +--metrics +--metrics.statsd +``` + +#### `address` + +_Required, Default="localhost:8125"_ + +Address instructs exporter to send metrics to statsd at this address. + +```toml tab="File (TOML)" +[metrics] + [metrics.statsd] + address = "localhost:8125" +``` + +```yaml tab="File (TOML)" +metrics: + statsd: + address: localhost:8125 +``` + +```bash tab="CLI" +--metrics +--metrics.statsd.address="localhost:8125" +``` + +#### `addEntryPointsLabels` + +_Optional, Default=true_ + +Enable metrics on entry points. + +```toml tab="File (TOML)" +[metrics] + [metrics.statsd] + addEntryPointsLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + statsd: + addEntryPointsLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.statsd.addEntryPointsLabels=true +``` + +#### `addServicesLabels` + +_Optional, Default=true_ + +Enable metrics on services. + +```toml tab="File (TOML)" +[metrics] + [metrics.statsd] + addServicesLabels = true +``` + +```yaml tab="File (TOML)" +metrics: + statsd: + addServicesLabels: true +``` + +```bash tab="CLI" +--metrics +--metrics.statsd.addServicesLabels=true +``` + +#### `pushInterval` + +_Optional, Default=10s_ + +The interval used by the exporter to push metrics to statsD. + +```toml tab="File (TOML)" +[metrics] + [metrics.statsd] + pushInterval = 10s +``` + +```yaml tab="File (TOML)" +metrics: + statsd: + pushInterval: 10s +``` + +```bash tab="CLI" +--metrics +--metrics.statsd.pushInterval=10s +``` diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index b65592f29..e33c5e4ca 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -180,18 +180,30 @@ Log level set to traefik logs. (Default: ```ERROR```) `--metrics.datadog`: DataDog metrics exporter type. (Default: ```false```) +`--metrics.datadog.addentrypointslabels`: +Enable metrics on entry points. (Default: ```true```) + `--metrics.datadog.address`: DataDog's address. (Default: ```localhost:8125```) +`--metrics.datadog.addserviceslabels`: +Enable metrics on services. (Default: ```true```) + `--metrics.datadog.pushinterval`: DataDog push interval. (Default: ```10```) `--metrics.influxdb`: InfluxDB metrics exporter type. (Default: ```false```) +`--metrics.influxdb.addentrypointslabels`: +Enable metrics on entry points. (Default: ```true```) + `--metrics.influxdb.address`: InfluxDB address. (Default: ```localhost:8089```) +`--metrics.influxdb.addserviceslabels`: +Enable metrics on services. (Default: ```true```) + `--metrics.influxdb.database`: InfluxDB database used when protocol is http. @@ -213,6 +225,12 @@ InfluxDB username (only with http). `--metrics.prometheus`: Prometheus metrics exporter type. (Default: ```false```) +`--metrics.prometheus.addentrypointslabels`: +Enable metrics on entry points. (Default: ```true```) + +`--metrics.prometheus.addserviceslabels`: +Enable metrics on services. (Default: ```true```) + `--metrics.prometheus.buckets`: Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) @@ -225,9 +243,15 @@ Middlewares. `--metrics.statsd`: StatsD metrics exporter type. (Default: ```false```) +`--metrics.statsd.addentrypointslabels`: +Enable metrics on entry points. (Default: ```true```) + `--metrics.statsd.address`: StatsD address. (Default: ```localhost:8125```) +`--metrics.statsd.addserviceslabels`: +Enable metrics on services. (Default: ```true```) + `--metrics.statsd.pushinterval`: StatsD push interval. (Default: ```10```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index dff7024e4..52f921d1b 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -180,18 +180,30 @@ Log level set to traefik logs. (Default: ```ERROR```) `TRAEFIK_METRICS_DATADOG`: DataDog metrics exporter type. (Default: ```false```) +`TRAEFIK_METRICS_DATADOG_ADDENTRYPOINTSLABELS`: +Enable metrics on entry points. (Default: ```true```) + `TRAEFIK_METRICS_DATADOG_ADDRESS`: DataDog's address. (Default: ```localhost:8125```) +`TRAEFIK_METRICS_DATADOG_ADDSERVICESLABELS`: +Enable metrics on services. (Default: ```true```) + `TRAEFIK_METRICS_DATADOG_PUSHINTERVAL`: DataDog push interval. (Default: ```10```) `TRAEFIK_METRICS_INFLUXDB`: InfluxDB metrics exporter type. (Default: ```false```) +`TRAEFIK_METRICS_INFLUXDB_ADDENTRYPOINTSLABELS`: +Enable metrics on entry points. (Default: ```true```) + `TRAEFIK_METRICS_INFLUXDB_ADDRESS`: InfluxDB address. (Default: ```localhost:8089```) +`TRAEFIK_METRICS_INFLUXDB_ADDSERVICESLABELS`: +Enable metrics on services. (Default: ```true```) + `TRAEFIK_METRICS_INFLUXDB_DATABASE`: InfluxDB database used when protocol is http. @@ -213,6 +225,12 @@ InfluxDB username (only with http). `TRAEFIK_METRICS_PROMETHEUS`: Prometheus metrics exporter type. (Default: ```false```) +`TRAEFIK_METRICS_PROMETHEUS_ADDENTRYPOINTSLABELS`: +Enable metrics on entry points. (Default: ```true```) + +`TRAEFIK_METRICS_PROMETHEUS_ADDSERVICESLABELS`: +Enable metrics on services. (Default: ```true```) + `TRAEFIK_METRICS_PROMETHEUS_BUCKETS`: Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) @@ -225,9 +243,15 @@ Middlewares. `TRAEFIK_METRICS_STATSD`: StatsD metrics exporter type. (Default: ```false```) +`TRAEFIK_METRICS_STATSD_ADDENTRYPOINTSLABELS`: +Enable metrics on entry points. (Default: ```true```) + `TRAEFIK_METRICS_STATSD_ADDRESS`: StatsD address. (Default: ```localhost:8125```) +`TRAEFIK_METRICS_STATSD_ADDSERVICESLABELS`: +Enable metrics on services. (Default: ```true```) + `TRAEFIK_METRICS_STATSD_PUSHINTERVAL`: StatsD push interval. (Default: ```10```) diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index 029088fab..4301d8d56 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -120,12 +120,18 @@ buckets = [42.0, 42.0] entryPoint = "foobar" middlewares = ["foobar", "foobar"] + addEntryPointsLabels = true + addServicesLabels = true [metrics.dataDog] address = "foobar" pushInterval = "10s" + addEntryPointsLabels = true + addServicesLabels = true [metrics.statsD] address = "foobar" pushInterval = "10s" + addEntryPointsLabels = true + addServicesLabels = true [metrics.influxDB] address = "foobar" protocol = "foobar" @@ -134,6 +140,8 @@ retentionPolicy = "foobar" username = "foobar" password = "foobar" + addEntryPointsLabels = true + addServicesLabels = true [ping] entryPoint = "foobar" diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index 533400bde..0f415c348 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -131,12 +131,18 @@ metrics: middlewares: - foobar - foobar + addEntryPointsLabels: true + addServicesLabels: true dataDog: address: foobar pushInterval: 42 + addEntryPointsLabels: true + addServicesLabels: true statsD: address: foobar pushInterval: 42 + addEntryPointsLabels: true + addServicesLabels: true influxDB: address: foobar protocol: foobar @@ -145,6 +151,8 @@ metrics: retentionPolicy: foobar username: foobar password: foobar + addEntryPointsLabels: true + addServicesLabels: true ping: entryPoint: foobar middlewares: diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index a6398a2be..3ed6b287d 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -119,6 +119,12 @@ nav: - 'Observability': - 'Logs': 'observability/logs.md' - 'Access Logs': 'observability/access-logs.md' + - 'Metrics': + - 'Overview': 'observability/metrics/overview.md' + - 'DataDog': 'observability/metrics/datadog.md' + - 'InfluxDB': 'observability/metrics/influxdb.md' + - 'Prometheus': 'observability/metrics/prometheus.md' + - 'StatsD': 'observability/metrics/statsd.md' - 'Tracing': - 'Overview': 'observability/tracing/overview.md' - 'Jaeger': 'observability/tracing/jaeger.md' diff --git a/pkg/metrics/datadog.go b/pkg/metrics/datadog.go index 5e3567059..f2f9b026d 100644 --- a/pkg/metrics/datadog.go +++ b/pkg/metrics/datadog.go @@ -20,18 +20,18 @@ var datadogTicker *time.Ticker // Metric names consistent with https://github.com/DataDog/integrations-extras/pull/64 const ( - ddMetricsBackendReqsName = "backend.request.total" - ddMetricsBackendLatencyName = "backend.request.duration" - ddRetriesTotalName = "backend.retries.total" + ddMetricsServiceReqsName = "service.request.total" + ddMetricsServiceLatencyName = "service.request.duration" + ddRetriesTotalName = "service.retries.total" ddConfigReloadsName = "config.reload.total" ddConfigReloadsFailureTagName = "failure" ddLastConfigReloadSuccessName = "config.reload.lastSuccessTimestamp" ddLastConfigReloadFailureName = "config.reload.lastFailureTimestamp" - ddEntrypointReqsName = "entrypoint.request.total" - ddEntrypointReqDurationName = "entrypoint.request.duration" - ddEntrypointOpenConnsName = "entrypoint.connections.open" - ddOpenConnsName = "backend.connections.open" - ddServerUpName = "backend.server.up" + ddEntryPointReqsName = "entrypoint.request.total" + ddEntryPointReqDurationName = "entrypoint.request.duration" + ddEntryPointOpenConnsName = "entrypoint.connections.open" + ddOpenConnsName = "service.connections.open" + ddServerUpName = "service.server.up" ) // RegisterDatadog registers the metrics pusher if this didn't happen yet and creates a datadog Registry instance. @@ -41,19 +41,26 @@ func RegisterDatadog(ctx context.Context, config *types.DataDog) Registry { } registry := &standardRegistry{ - enabled: true, - configReloadsCounter: datadogClient.NewCounter(ddConfigReloadsName, 1.0), - configReloadsFailureCounter: datadogClient.NewCounter(ddConfigReloadsName, 1.0).With(ddConfigReloadsFailureTagName, "true"), - lastConfigReloadSuccessGauge: datadogClient.NewGauge(ddLastConfigReloadSuccessName), - lastConfigReloadFailureGauge: datadogClient.NewGauge(ddLastConfigReloadFailureName), - entrypointReqsCounter: datadogClient.NewCounter(ddEntrypointReqsName, 1.0), - entrypointReqDurationHistogram: datadogClient.NewHistogram(ddEntrypointReqDurationName, 1.0), - entrypointOpenConnsGauge: datadogClient.NewGauge(ddEntrypointOpenConnsName), - backendReqsCounter: datadogClient.NewCounter(ddMetricsBackendReqsName, 1.0), - backendReqDurationHistogram: datadogClient.NewHistogram(ddMetricsBackendLatencyName, 1.0), - backendRetriesCounter: datadogClient.NewCounter(ddRetriesTotalName, 1.0), - backendOpenConnsGauge: datadogClient.NewGauge(ddOpenConnsName), - backendServerUpGauge: datadogClient.NewGauge(ddServerUpName), + configReloadsCounter: datadogClient.NewCounter(ddConfigReloadsName, 1.0), + configReloadsFailureCounter: datadogClient.NewCounter(ddConfigReloadsName, 1.0).With(ddConfigReloadsFailureTagName, "true"), + lastConfigReloadSuccessGauge: datadogClient.NewGauge(ddLastConfigReloadSuccessName), + lastConfigReloadFailureGauge: datadogClient.NewGauge(ddLastConfigReloadFailureName), + } + + if config.AddEntryPointsLabels { + registry.epEnabled = config.AddEntryPointsLabels + registry.entryPointReqsCounter = datadogClient.NewCounter(ddEntryPointReqsName, 1.0) + registry.entryPointReqDurationHistogram = datadogClient.NewHistogram(ddEntryPointReqDurationName, 1.0) + registry.entryPointOpenConnsGauge = datadogClient.NewGauge(ddEntryPointOpenConnsName) + } + + if config.AddServicesLabels { + registry.svcEnabled = config.AddServicesLabels + registry.serviceReqsCounter = datadogClient.NewCounter(ddMetricsServiceReqsName, 1.0) + registry.serviceReqDurationHistogram = datadogClient.NewHistogram(ddMetricsServiceLatencyName, 1.0) + registry.serviceRetriesCounter = datadogClient.NewCounter(ddRetriesTotalName, 1.0) + registry.serviceOpenConnsGauge = datadogClient.NewGauge(ddOpenConnsName) + registry.serviceServerUpGauge = datadogClient.NewGauge(ddServerUpName) } return registry @@ -68,7 +75,7 @@ func initDatadogClient(ctx context.Context, config *types.DataDog) *time.Ticker report := time.NewTicker(time.Duration(config.PushInterval)) safe.Go(func() { - datadogClient.SendLoop(report.C, "udp", address) + datadogClient.SendLoop(ctx, report.C, "udp", address) }) return report diff --git a/pkg/metrics/datadog_test.go b/pkg/metrics/datadog_test.go index c8618c01b..a01252fe4 100644 --- a/pkg/metrics/datadog_test.go +++ b/pkg/metrics/datadog_test.go @@ -16,38 +16,38 @@ 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), AddEntryPointsLabels: true, AddServicesLabels: true}) defer StopDatadog() - if !datadogRegistry.IsEnabled() { + if !datadogRegistry.IsEpEnabled() || !datadogRegistry.IsSvcEnabled() { t.Errorf("DatadogRegistry should return true for IsEnabled()") } expected := []string{ // We are only validating counts, as it is nearly impossible to validate latency, since it varies every run - "traefik.backend.request.total:1.000000|c|#service:test,code:404,method:GET\n", - "traefik.backend.request.total:1.000000|c|#service:test,code:200,method:GET\n", - "traefik.backend.retries.total:2.000000|c|#service:test\n", - "traefik.backend.request.duration:10000.000000|h|#service:test,code:200\n", + "traefik.service.request.total:1.000000|c|#service:test,code:404,method:GET\n", + "traefik.service.request.total:1.000000|c|#service:test,code:200,method:GET\n", + "traefik.service.retries.total:2.000000|c|#service:test\n", + "traefik.service.request.duration:10000.000000|h|#service:test,code:200\n", "traefik.config.reload.total:1.000000|c\n", "traefik.config.reload.total:1.000000|c|#failure:true\n", "traefik.entrypoint.request.total:1.000000|c|#entrypoint:test\n", "traefik.entrypoint.request.duration:10000.000000|h|#entrypoint:test\n", "traefik.entrypoint.connections.open:1.000000|g|#entrypoint:test\n", - "traefik.backend.server.up:1.000000|g|#backend:test,url:http://127.0.0.1,one:two\n", + "traefik.service.server.up:1.000000|g|#service:test,url:http://127.0.0.1,one:two\n", } udp.ShouldReceiveAll(t, expected, func() { - datadogRegistry.BackendReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) - datadogRegistry.BackendReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) - datadogRegistry.BackendReqDurationHistogram().With("service", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) - datadogRegistry.BackendRetriesCounter().With("service", "test").Add(1) - datadogRegistry.BackendRetriesCounter().With("service", "test").Add(1) + datadogRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) + datadogRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) + datadogRegistry.ServiceReqDurationHistogram().With("service", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) + datadogRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + datadogRegistry.ServiceRetriesCounter().With("service", "test").Add(1) datadogRegistry.ConfigReloadsCounter().Add(1) datadogRegistry.ConfigReloadsFailureCounter().Add(1) - datadogRegistry.EntrypointReqsCounter().With("entrypoint", "test").Add(1) - datadogRegistry.EntrypointReqDurationHistogram().With("entrypoint", "test").Observe(10000) - datadogRegistry.EntrypointOpenConnsGauge().With("entrypoint", "test").Set(1) - datadogRegistry.BackendServerUpGauge().With("backend", "test", "url", "http://127.0.0.1", "one", "two").Set(1) + datadogRegistry.EntryPointReqsCounter().With("entrypoint", "test").Add(1) + datadogRegistry.EntryPointReqDurationHistogram().With("entrypoint", "test").Observe(10000) + datadogRegistry.EntryPointOpenConnsGauge().With("entrypoint", "test").Set(1) + datadogRegistry.ServiceServerUpGauge().With("service", "test", "url", "http://127.0.0.1", "one", "two").Set(1) }) } diff --git a/pkg/metrics/influxdb.go b/pkg/metrics/influxdb.go index 795158033..eae96d123 100644 --- a/pkg/metrics/influxdb.go +++ b/pkg/metrics/influxdb.go @@ -13,7 +13,7 @@ import ( "github.com/containous/traefik/pkg/types" kitlog "github.com/go-kit/kit/log" "github.com/go-kit/kit/metrics/influx" - influxdb "github.com/influxdata/influxdb/client/v2" + influxdb "github.com/influxdata/influxdb1-client/v2" ) var influxDBClient *influx.Influx @@ -26,18 +26,18 @@ type influxDBWriter struct { var influxDBTicker *time.Ticker const ( - influxDBMetricsBackendReqsName = "traefik.backend.requests.total" - influxDBMetricsBackendLatencyName = "traefik.backend.request.duration" - influxDBRetriesTotalName = "traefik.backend.retries.total" + influxDBMetricsServiceReqsName = "traefik.service.requests.total" + influxDBMetricsServiceLatencyName = "traefik.service.request.duration" + influxDBRetriesTotalName = "traefik.service.retries.total" influxDBConfigReloadsName = "traefik.config.reload.total" influxDBConfigReloadsFailureName = influxDBConfigReloadsName + ".failure" influxDBLastConfigReloadSuccessName = "traefik.config.reload.lastSuccessTimestamp" influxDBLastConfigReloadFailureName = "traefik.config.reload.lastFailureTimestamp" - influxDBEntrypointReqsName = "traefik.entrypoint.requests.total" - influxDBEntrypointReqDurationName = "traefik.entrypoint.request.duration" - influxDBEntrypointOpenConnsName = "traefik.entrypoint.connections.open" - influxDBOpenConnsName = "traefik.backend.connections.open" - influxDBServerUpName = "traefik.backend.server.up" + influxDBEntryPointReqsName = "traefik.entrypoint.requests.total" + influxDBEntryPointReqDurationName = "traefik.entrypoint.request.duration" + influxDBEntryPointOpenConnsName = "traefik.entrypoint.connections.open" + influxDBOpenConnsName = "traefik.service.connections.open" + influxDBServerUpName = "traefik.service.server.up" ) const ( @@ -51,24 +51,33 @@ func RegisterInfluxDB(ctx context.Context, config *types.InfluxDB) Registry { influxDBClient = initInfluxDBClient(ctx, config) } if influxDBTicker == nil { - influxDBTicker = initInfluxDBTicker(config) + influxDBTicker = initInfluxDBTicker(ctx, config) } - return &standardRegistry{ - enabled: true, - configReloadsCounter: influxDBClient.NewCounter(influxDBConfigReloadsName), - configReloadsFailureCounter: influxDBClient.NewCounter(influxDBConfigReloadsFailureName), - lastConfigReloadSuccessGauge: influxDBClient.NewGauge(influxDBLastConfigReloadSuccessName), - lastConfigReloadFailureGauge: influxDBClient.NewGauge(influxDBLastConfigReloadFailureName), - entrypointReqsCounter: influxDBClient.NewCounter(influxDBEntrypointReqsName), - entrypointReqDurationHistogram: influxDBClient.NewHistogram(influxDBEntrypointReqDurationName), - entrypointOpenConnsGauge: influxDBClient.NewGauge(influxDBEntrypointOpenConnsName), - backendReqsCounter: influxDBClient.NewCounter(influxDBMetricsBackendReqsName), - backendReqDurationHistogram: influxDBClient.NewHistogram(influxDBMetricsBackendLatencyName), - backendRetriesCounter: influxDBClient.NewCounter(influxDBRetriesTotalName), - backendOpenConnsGauge: influxDBClient.NewGauge(influxDBOpenConnsName), - backendServerUpGauge: influxDBClient.NewGauge(influxDBServerUpName), + registry := &standardRegistry{ + configReloadsCounter: influxDBClient.NewCounter(influxDBConfigReloadsName), + configReloadsFailureCounter: influxDBClient.NewCounter(influxDBConfigReloadsFailureName), + lastConfigReloadSuccessGauge: influxDBClient.NewGauge(influxDBLastConfigReloadSuccessName), + lastConfigReloadFailureGauge: influxDBClient.NewGauge(influxDBLastConfigReloadFailureName), } + + if config.AddEntryPointsLabels { + registry.epEnabled = config.AddEntryPointsLabels + registry.entryPointReqsCounter = influxDBClient.NewCounter(influxDBEntryPointReqsName) + registry.entryPointReqDurationHistogram = influxDBClient.NewHistogram(influxDBEntryPointReqDurationName) + registry.entryPointOpenConnsGauge = influxDBClient.NewGauge(influxDBEntryPointOpenConnsName) + } + + if config.AddServicesLabels { + registry.svcEnabled = config.AddServicesLabels + registry.serviceReqsCounter = influxDBClient.NewCounter(influxDBMetricsServiceReqsName) + registry.serviceReqDurationHistogram = influxDBClient.NewHistogram(influxDBMetricsServiceLatencyName) + registry.serviceRetriesCounter = influxDBClient.NewCounter(influxDBRetriesTotalName) + registry.serviceOpenConnsGauge = influxDBClient.NewGauge(influxDBOpenConnsName) + registry.serviceServerUpGauge = influxDBClient.NewGauge(influxDBServerUpName) + } + + return registry } // initInfluxDBTicker creates a influxDBClient @@ -115,12 +124,12 @@ func initInfluxDBClient(ctx context.Context, config *types.InfluxDB) *influx.Inf } // initInfluxDBTicker initializes metrics pusher -func initInfluxDBTicker(config *types.InfluxDB) *time.Ticker { +func initInfluxDBTicker(ctx context.Context, config *types.InfluxDB) *time.Ticker { report := time.NewTicker(time.Duration(config.PushInterval)) safe.Go(func() { var buf bytes.Buffer - influxDBClient.WriteLoop(report.C, &influxDBWriter{buf: buf, config: config}) + influxDBClient.WriteLoop(ctx, report.C, &influxDBWriter{buf: buf, config: config}) }) return report diff --git a/pkg/metrics/influxdb_test.go b/pkg/metrics/influxdb_test.go index 7c2fb1bed..5b72fc632 100644 --- a/pkg/metrics/influxdb_test.go +++ b/pkg/metrics/influxdb_test.go @@ -20,35 +20,35 @@ func TestInfluxDB(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 - influxDBRegistry := RegisterInfluxDB(context.Background(), &types.InfluxDB{Address: ":8089", PushInterval: types.Duration(time.Second)}) + influxDBRegistry := RegisterInfluxDB(context.Background(), &types.InfluxDB{Address: ":8089", PushInterval: types.Duration(time.Second), AddEntryPointsLabels: true, AddServicesLabels: true}) defer StopInfluxDB() - if !influxDBRegistry.IsEnabled() { - t.Fatalf("InfluxDB registry must be enabled") + if !influxDBRegistry.IsEpEnabled() || !influxDBRegistry.IsSvcEnabled() { + t.Fatalf("InfluxDB registry must be epEnabled") } - expectedBackend := []string{ - `(traefik\.backend\.requests\.total,backend=test,code=200,method=GET count=1) [\d]{19}`, - `(traefik\.backend\.requests\.total,backend=test,code=404,method=GET count=1) [\d]{19}`, - `(traefik\.backend\.request\.duration,backend=test,code=200 p50=10000,p90=10000,p95=10000,p99=10000) [\d]{19}`, - `(traefik\.backend\.retries\.total(?:,code=[\d]{3},method=GET)?,backend=test count=2) [\d]{19}`, + expectedService := []string{ + `(traefik\.service\.requests\.total,code=200,method=GET,service=test count=1) [\d]{19}`, + `(traefik\.service\.requests\.total,code=404,method=GET,service=test count=1) [\d]{19}`, + `(traefik\.service\.request\.duration,code=200,service=test p50=10000,p90=10000,p95=10000,p99=10000) [\d]{19}`, + `(traefik\.service\.retries\.total(?:,code=[\d]{3},method=GET)?,service=test count=2) [\d]{19}`, `(traefik\.config\.reload\.total(?:[a-z=0-9A-Z,]+)? count=1) [\d]{19}`, `(traefik\.config\.reload\.total\.failure(?:[a-z=0-9A-Z,]+)? count=1) [\d]{19}`, - `(traefik\.backend\.server\.up,backend=test(?:[a-z=0-9A-Z,]+)?,url=http://127.0.0.1 value=1) [\d]{19}`, + `(traefik\.service\.server\.up,service=test(?:[a-z=0-9A-Z,]+)?,url=http://127.0.0.1 value=1) [\d]{19}`, } - msgBackend := udp.ReceiveString(t, func() { - influxDBRegistry.BackendReqsCounter().With("backend", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) - influxDBRegistry.BackendReqsCounter().With("backend", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) - influxDBRegistry.BackendRetriesCounter().With("backend", "test").Add(1) - influxDBRegistry.BackendRetriesCounter().With("backend", "test").Add(1) - influxDBRegistry.BackendReqDurationHistogram().With("backend", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) + msgService := udp.ReceiveString(t, func() { + influxDBRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) + influxDBRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) + influxDBRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + influxDBRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + influxDBRegistry.ServiceReqDurationHistogram().With("service", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) influxDBRegistry.ConfigReloadsCounter().Add(1) influxDBRegistry.ConfigReloadsFailureCounter().Add(1) - influxDBRegistry.BackendServerUpGauge().With("backend", "test", "url", "http://127.0.0.1").Set(1) + influxDBRegistry.ServiceServerUpGauge().With("service", "test", "url", "http://127.0.0.1").Set(1) }) - assertMessage(t, msgBackend, expectedBackend) + assertMessage(t, msgService, expectedService) expectedEntrypoint := []string{ `(traefik\.entrypoint\.requests\.total,entrypoint=test(?:[a-z=0-9A-Z,:/.]+)? count=1) [\d]{19}`, @@ -57,9 +57,9 @@ func TestInfluxDB(t *testing.T) { } msgEntrypoint := udp.ReceiveString(t, func() { - influxDBRegistry.EntrypointReqsCounter().With("entrypoint", "test").Add(1) - influxDBRegistry.EntrypointReqDurationHistogram().With("entrypoint", "test").Observe(10000) - influxDBRegistry.EntrypointOpenConnsGauge().With("entrypoint", "test").Set(1) + influxDBRegistry.EntryPointReqsCounter().With("entrypoint", "test").Add(1) + influxDBRegistry.EntryPointReqDurationHistogram().With("entrypoint", "test").Observe(10000) + influxDBRegistry.EntryPointOpenConnsGauge().With("entrypoint", "test").Set(1) }) @@ -76,38 +76,38 @@ func TestInfluxDBHTTP(t *testing.T) { } bodyStr := string(body) c <- &bodyStr - fmt.Fprintln(w, "ok") + _, _ = fmt.Fprintln(w, "ok") })) defer ts.Close() - influxDBRegistry := RegisterInfluxDB(context.Background(), &types.InfluxDB{Address: ts.URL, Protocol: "http", PushInterval: types.Duration(time.Second), Database: "test", RetentionPolicy: "autogen"}) + influxDBRegistry := RegisterInfluxDB(context.Background(), &types.InfluxDB{Address: ts.URL, Protocol: "http", PushInterval: types.Duration(time.Second), Database: "test", RetentionPolicy: "autogen", AddEntryPointsLabels: true, AddServicesLabels: true}) defer StopInfluxDB() - if !influxDBRegistry.IsEnabled() { - t.Fatalf("InfluxDB registry must be enabled") + if !influxDBRegistry.IsEpEnabled() || !influxDBRegistry.IsSvcEnabled() { + t.Fatalf("InfluxDB registry must be epEnabled") } - expectedBackend := []string{ - `(traefik\.backend\.requests\.total,backend=test,code=200,method=GET count=1) [\d]{19}`, - `(traefik\.backend\.requests\.total,backend=test,code=404,method=GET count=1) [\d]{19}`, - `(traefik\.backend\.request\.duration,backend=test,code=200 p50=10000,p90=10000,p95=10000,p99=10000) [\d]{19}`, - `(traefik\.backend\.retries\.total(?:,code=[\d]{3},method=GET)?,backend=test count=2) [\d]{19}`, + expectedService := []string{ + `(traefik\.service\.requests\.total,code=200,method=GET,service=test count=1) [\d]{19}`, + `(traefik\.service\.requests\.total,code=404,method=GET,service=test count=1) [\d]{19}`, + `(traefik\.service\.request\.duration,code=200,service=test p50=10000,p90=10000,p95=10000,p99=10000) [\d]{19}`, + `(traefik\.service\.retries\.total(?:,code=[\d]{3},method=GET)?,service=test count=2) [\d]{19}`, `(traefik\.config\.reload\.total(?:[a-z=0-9A-Z,]+)? count=1) [\d]{19}`, `(traefik\.config\.reload\.total\.failure(?:[a-z=0-9A-Z,]+)? count=1) [\d]{19}`, - `(traefik\.backend\.server\.up,backend=test(?:[a-z=0-9A-Z,]+)?,url=http://127.0.0.1 value=1) [\d]{19}`, + `(traefik\.service\.server\.up,service=test(?:[a-z=0-9A-Z,]+)?,url=http://127.0.0.1 value=1) [\d]{19}`, } - influxDBRegistry.BackendReqsCounter().With("backend", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) - influxDBRegistry.BackendReqsCounter().With("backend", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) - influxDBRegistry.BackendRetriesCounter().With("backend", "test").Add(1) - influxDBRegistry.BackendRetriesCounter().With("backend", "test").Add(1) - influxDBRegistry.BackendReqDurationHistogram().With("backend", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) + influxDBRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet).Add(1) + influxDBRegistry.ServiceReqsCounter().With("service", "test", "code", strconv.Itoa(http.StatusNotFound), "method", http.MethodGet).Add(1) + influxDBRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + influxDBRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + influxDBRegistry.ServiceReqDurationHistogram().With("service", "test", "code", strconv.Itoa(http.StatusOK)).Observe(10000) influxDBRegistry.ConfigReloadsCounter().Add(1) influxDBRegistry.ConfigReloadsFailureCounter().Add(1) - influxDBRegistry.BackendServerUpGauge().With("backend", "test", "url", "http://127.0.0.1").Set(1) - msgBackend := <-c + influxDBRegistry.ServiceServerUpGauge().With("service", "test", "url", "http://127.0.0.1").Set(1) + msgService := <-c - assertMessage(t, *msgBackend, expectedBackend) + assertMessage(t, *msgService, expectedService) expectedEntrypoint := []string{ `(traefik\.entrypoint\.requests\.total,entrypoint=test(?:[a-z=0-9A-Z,:/.]+)? count=1) [\d]{19}`, @@ -115,9 +115,9 @@ func TestInfluxDBHTTP(t *testing.T) { `(traefik\.entrypoint\.connections\.open,entrypoint=test value=1) [\d]{19}`, } - influxDBRegistry.EntrypointReqsCounter().With("entrypoint", "test").Add(1) - influxDBRegistry.EntrypointReqDurationHistogram().With("entrypoint", "test").Observe(10000) - influxDBRegistry.EntrypointOpenConnsGauge().With("entrypoint", "test").Set(1) + influxDBRegistry.EntryPointReqsCounter().With("entrypoint", "test").Add(1) + influxDBRegistry.EntryPointReqDurationHistogram().With("entrypoint", "test").Observe(10000) + influxDBRegistry.EntryPointOpenConnsGauge().With("entrypoint", "test").Set(1) msgEntrypoint := <-c assertMessage(t, *msgEntrypoint, expectedEntrypoint) diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index a233ec791..8cdb1eae9 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -7,8 +7,10 @@ import ( // Registry has to implemented by any system that wants to monitor and expose metrics. type Registry interface { - // IsEnabled shows whether metrics instrumentation is enabled. - IsEnabled() bool + // IsEpEnabled shows whether metrics instrumentation is enabled on entry points. + IsEpEnabled() bool + // IsSvcEnabled shows whether metrics instrumentation is enabled on services. + IsSvcEnabled() bool // server metrics ConfigReloadsCounter() metrics.Counter @@ -17,16 +19,16 @@ type Registry interface { LastConfigReloadFailureGauge() metrics.Gauge // entry point metrics - EntrypointReqsCounter() metrics.Counter - EntrypointReqDurationHistogram() metrics.Histogram - EntrypointOpenConnsGauge() metrics.Gauge + EntryPointReqsCounter() metrics.Counter + EntryPointReqDurationHistogram() metrics.Histogram + EntryPointOpenConnsGauge() metrics.Gauge - // backend metrics - BackendReqsCounter() metrics.Counter - BackendReqDurationHistogram() metrics.Histogram - BackendOpenConnsGauge() metrics.Gauge - BackendRetriesCounter() metrics.Counter - BackendServerUpGauge() metrics.Gauge + // service metrics + ServiceReqsCounter() metrics.Counter + ServiceReqDurationHistogram() metrics.Histogram + ServiceOpenConnsGauge() metrics.Gauge + ServiceRetriesCounter() metrics.Counter + ServiceServerUpGauge() metrics.Gauge } // NewVoidRegistry is a noop implementation of metrics.Registry. @@ -43,14 +45,14 @@ func NewMultiRegistry(registries []Registry) Registry { var configReloadsFailureCounter []metrics.Counter var lastConfigReloadSuccessGauge []metrics.Gauge var lastConfigReloadFailureGauge []metrics.Gauge - var entrypointReqsCounter []metrics.Counter - var entrypointReqDurationHistogram []metrics.Histogram - var entrypointOpenConnsGauge []metrics.Gauge - var backendReqsCounter []metrics.Counter - var backendReqDurationHistogram []metrics.Histogram - var backendOpenConnsGauge []metrics.Gauge - var backendRetriesCounter []metrics.Counter - var backendServerUpGauge []metrics.Gauge + var entryPointReqsCounter []metrics.Counter + var entryPointReqDurationHistogram []metrics.Histogram + var entryPointOpenConnsGauge []metrics.Gauge + var serviceReqsCounter []metrics.Counter + var serviceReqDurationHistogram []metrics.Histogram + var serviceOpenConnsGauge []metrics.Gauge + var serviceRetriesCounter []metrics.Counter + var serviceServerUpGauge []metrics.Gauge for _, r := range registries { if r.ConfigReloadsCounter() != nil { @@ -65,67 +67,73 @@ func NewMultiRegistry(registries []Registry) Registry { if r.LastConfigReloadFailureGauge() != nil { lastConfigReloadFailureGauge = append(lastConfigReloadFailureGauge, r.LastConfigReloadFailureGauge()) } - if r.EntrypointReqsCounter() != nil { - entrypointReqsCounter = append(entrypointReqsCounter, r.EntrypointReqsCounter()) + if r.EntryPointReqsCounter() != nil { + entryPointReqsCounter = append(entryPointReqsCounter, r.EntryPointReqsCounter()) } - if r.EntrypointReqDurationHistogram() != nil { - entrypointReqDurationHistogram = append(entrypointReqDurationHistogram, r.EntrypointReqDurationHistogram()) + if r.EntryPointReqDurationHistogram() != nil { + entryPointReqDurationHistogram = append(entryPointReqDurationHistogram, r.EntryPointReqDurationHistogram()) } - if r.EntrypointOpenConnsGauge() != nil { - entrypointOpenConnsGauge = append(entrypointOpenConnsGauge, r.EntrypointOpenConnsGauge()) + if r.EntryPointOpenConnsGauge() != nil { + entryPointOpenConnsGauge = append(entryPointOpenConnsGauge, r.EntryPointOpenConnsGauge()) } - if r.BackendReqsCounter() != nil { - backendReqsCounter = append(backendReqsCounter, r.BackendReqsCounter()) + if r.ServiceReqsCounter() != nil { + serviceReqsCounter = append(serviceReqsCounter, r.ServiceReqsCounter()) } - if r.BackendReqDurationHistogram() != nil { - backendReqDurationHistogram = append(backendReqDurationHistogram, r.BackendReqDurationHistogram()) + if r.ServiceReqDurationHistogram() != nil { + serviceReqDurationHistogram = append(serviceReqDurationHistogram, r.ServiceReqDurationHistogram()) } - if r.BackendOpenConnsGauge() != nil { - backendOpenConnsGauge = append(backendOpenConnsGauge, r.BackendOpenConnsGauge()) + if r.ServiceOpenConnsGauge() != nil { + serviceOpenConnsGauge = append(serviceOpenConnsGauge, r.ServiceOpenConnsGauge()) } - if r.BackendRetriesCounter() != nil { - backendRetriesCounter = append(backendRetriesCounter, r.BackendRetriesCounter()) + if r.ServiceRetriesCounter() != nil { + serviceRetriesCounter = append(serviceRetriesCounter, r.ServiceRetriesCounter()) } - if r.BackendServerUpGauge() != nil { - backendServerUpGauge = append(backendServerUpGauge, r.BackendServerUpGauge()) + if r.ServiceServerUpGauge() != nil { + serviceServerUpGauge = append(serviceServerUpGauge, r.ServiceServerUpGauge()) } } return &standardRegistry{ - enabled: len(registries) > 0, + epEnabled: len(entryPointReqsCounter) > 0 || len(entryPointReqDurationHistogram) > 0 || len(entryPointOpenConnsGauge) > 0, + svcEnabled: len(serviceReqsCounter) > 0 || len(serviceReqDurationHistogram) > 0 || len(serviceOpenConnsGauge) > 0 || len(serviceRetriesCounter) > 0 || len(serviceServerUpGauge) > 0, configReloadsCounter: multi.NewCounter(configReloadsCounter...), configReloadsFailureCounter: multi.NewCounter(configReloadsFailureCounter...), lastConfigReloadSuccessGauge: multi.NewGauge(lastConfigReloadSuccessGauge...), lastConfigReloadFailureGauge: multi.NewGauge(lastConfigReloadFailureGauge...), - entrypointReqsCounter: multi.NewCounter(entrypointReqsCounter...), - entrypointReqDurationHistogram: multi.NewHistogram(entrypointReqDurationHistogram...), - entrypointOpenConnsGauge: multi.NewGauge(entrypointOpenConnsGauge...), - backendReqsCounter: multi.NewCounter(backendReqsCounter...), - backendReqDurationHistogram: multi.NewHistogram(backendReqDurationHistogram...), - backendOpenConnsGauge: multi.NewGauge(backendOpenConnsGauge...), - backendRetriesCounter: multi.NewCounter(backendRetriesCounter...), - backendServerUpGauge: multi.NewGauge(backendServerUpGauge...), + entryPointReqsCounter: multi.NewCounter(entryPointReqsCounter...), + entryPointReqDurationHistogram: multi.NewHistogram(entryPointReqDurationHistogram...), + entryPointOpenConnsGauge: multi.NewGauge(entryPointOpenConnsGauge...), + serviceReqsCounter: multi.NewCounter(serviceReqsCounter...), + serviceReqDurationHistogram: multi.NewHistogram(serviceReqDurationHistogram...), + serviceOpenConnsGauge: multi.NewGauge(serviceOpenConnsGauge...), + serviceRetriesCounter: multi.NewCounter(serviceRetriesCounter...), + serviceServerUpGauge: multi.NewGauge(serviceServerUpGauge...), } } type standardRegistry struct { - enabled bool + epEnabled bool + svcEnabled bool configReloadsCounter metrics.Counter configReloadsFailureCounter metrics.Counter lastConfigReloadSuccessGauge metrics.Gauge lastConfigReloadFailureGauge metrics.Gauge - entrypointReqsCounter metrics.Counter - entrypointReqDurationHistogram metrics.Histogram - entrypointOpenConnsGauge metrics.Gauge - backendReqsCounter metrics.Counter - backendReqDurationHistogram metrics.Histogram - backendOpenConnsGauge metrics.Gauge - backendRetriesCounter metrics.Counter - backendServerUpGauge metrics.Gauge + entryPointReqsCounter metrics.Counter + entryPointReqDurationHistogram metrics.Histogram + entryPointOpenConnsGauge metrics.Gauge + serviceReqsCounter metrics.Counter + serviceReqDurationHistogram metrics.Histogram + serviceOpenConnsGauge metrics.Gauge + serviceRetriesCounter metrics.Counter + serviceServerUpGauge metrics.Gauge } -func (r *standardRegistry) IsEnabled() bool { - return r.enabled +func (r *standardRegistry) IsEpEnabled() bool { + return r.epEnabled +} + +func (r *standardRegistry) IsSvcEnabled() bool { + return r.svcEnabled } func (r *standardRegistry) ConfigReloadsCounter() metrics.Counter { @@ -144,34 +152,34 @@ func (r *standardRegistry) LastConfigReloadFailureGauge() metrics.Gauge { return r.lastConfigReloadFailureGauge } -func (r *standardRegistry) EntrypointReqsCounter() metrics.Counter { - return r.entrypointReqsCounter +func (r *standardRegistry) EntryPointReqsCounter() metrics.Counter { + return r.entryPointReqsCounter } -func (r *standardRegistry) EntrypointReqDurationHistogram() metrics.Histogram { - return r.entrypointReqDurationHistogram +func (r *standardRegistry) EntryPointReqDurationHistogram() metrics.Histogram { + return r.entryPointReqDurationHistogram } -func (r *standardRegistry) EntrypointOpenConnsGauge() metrics.Gauge { - return r.entrypointOpenConnsGauge +func (r *standardRegistry) EntryPointOpenConnsGauge() metrics.Gauge { + return r.entryPointOpenConnsGauge } -func (r *standardRegistry) BackendReqsCounter() metrics.Counter { - return r.backendReqsCounter +func (r *standardRegistry) ServiceReqsCounter() metrics.Counter { + return r.serviceReqsCounter } -func (r *standardRegistry) BackendReqDurationHistogram() metrics.Histogram { - return r.backendReqDurationHistogram +func (r *standardRegistry) ServiceReqDurationHistogram() metrics.Histogram { + return r.serviceReqDurationHistogram } -func (r *standardRegistry) BackendOpenConnsGauge() metrics.Gauge { - return r.backendOpenConnsGauge +func (r *standardRegistry) ServiceOpenConnsGauge() metrics.Gauge { + return r.serviceOpenConnsGauge } -func (r *standardRegistry) BackendRetriesCounter() metrics.Counter { - return r.backendRetriesCounter +func (r *standardRegistry) ServiceRetriesCounter() metrics.Counter { + return r.serviceRetriesCounter } -func (r *standardRegistry) BackendServerUpGauge() metrics.Gauge { - return r.backendServerUpGauge +func (r *standardRegistry) ServiceServerUpGauge() metrics.Gauge { + return r.serviceServerUpGauge } diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go index 1e1b159f0..6477aac96 100644 --- a/pkg/metrics/metrics_test.go +++ b/pkg/metrics/metrics_test.go @@ -11,14 +11,14 @@ func TestNewMultiRegistry(t *testing.T) { registries := []Registry{newCollectingRetryMetrics(), newCollectingRetryMetrics()} registry := NewMultiRegistry(registries) - registry.BackendReqsCounter().With("key", "requests").Add(1) - registry.BackendReqDurationHistogram().With("key", "durations").Observe(2) - registry.BackendRetriesCounter().With("key", "retries").Add(3) + registry.ServiceReqsCounter().With("key", "requests").Add(1) + registry.ServiceReqDurationHistogram().With("key", "durations").Observe(2) + registry.ServiceRetriesCounter().With("key", "retries").Add(3) for _, collectingRegistry := range registries { - cReqsCounter := collectingRegistry.BackendReqsCounter().(*counterMock) - cReqDurationHistogram := collectingRegistry.BackendReqDurationHistogram().(*histogramMock) - cRetriesCounter := collectingRegistry.BackendRetriesCounter().(*counterMock) + cReqsCounter := collectingRegistry.ServiceReqsCounter().(*counterMock) + cReqDurationHistogram := collectingRegistry.ServiceReqDurationHistogram().(*histogramMock) + cRetriesCounter := collectingRegistry.ServiceRetriesCounter().(*counterMock) wantCounterValue := float64(1) if cReqsCounter.counterValue != wantCounterValue { @@ -41,9 +41,9 @@ func TestNewMultiRegistry(t *testing.T) { func newCollectingRetryMetrics() Registry { return &standardRegistry{ - backendReqsCounter: &counterMock{}, - backendReqDurationHistogram: &histogramMock{}, - backendRetriesCounter: &counterMock{}, + serviceReqsCounter: &counterMock{}, + serviceReqDurationHistogram: &histogramMock{}, + serviceRetriesCounter: &counterMock{}, } } diff --git a/pkg/metrics/prometheus.go b/pkg/metrics/prometheus.go index e70b7d54e..bfca5489e 100644 --- a/pkg/metrics/prometheus.go +++ b/pkg/metrics/prometheus.go @@ -2,6 +2,7 @@ package metrics import ( "context" + "fmt" "net/http" "sort" "strings" @@ -28,43 +29,45 @@ const ( configLastReloadSuccessName = metricConfigPrefix + "last_reload_success" configLastReloadFailureName = metricConfigPrefix + "last_reload_failure" - // entrypoint + // entry point metricEntryPointPrefix = MetricNamePrefix + "entrypoint_" - entrypointReqsTotalName = metricEntryPointPrefix + "requests_total" - entrypointReqDurationName = metricEntryPointPrefix + "request_duration_seconds" - entrypointOpenConnsName = metricEntryPointPrefix + "open_connections" + entryPointReqsTotalName = metricEntryPointPrefix + "requests_total" + entryPointReqDurationName = metricEntryPointPrefix + "request_duration_seconds" + entryPointOpenConnsName = metricEntryPointPrefix + "open_connections" - // backend level. + // service level. - // MetricBackendPrefix prefix of all backend metric names - MetricBackendPrefix = MetricNamePrefix + "backend_" - backendReqsTotalName = MetricBackendPrefix + "requests_total" - backendReqDurationName = MetricBackendPrefix + "request_duration_seconds" - backendOpenConnsName = MetricBackendPrefix + "open_connections" - backendRetriesTotalName = MetricBackendPrefix + "retries_total" - backendServerUpName = MetricBackendPrefix + "server_up" + // MetricServicePrefix prefix of all service metric names + MetricServicePrefix = MetricNamePrefix + "service_" + serviceReqsTotalName = MetricServicePrefix + "requests_total" + serviceReqDurationName = MetricServicePrefix + "request_duration_seconds" + serviceOpenConnsName = MetricServicePrefix + "open_connections" + serviceRetriesTotalName = MetricServicePrefix + "retries_total" + serviceServerUpName = MetricServicePrefix + "server_up" ) // promState holds all metric state internally and acts as the only Collector we register for Prometheus. // // This enables control to remove metrics that belong to outdated configuration. // As an example why this is required, consider Traefik learns about a new service. -// It populates the 'traefik_server_backend_up' metric for it with a value of 1 (alive). -// When the backend is undeployed now the metric is still there in the client library +// It populates the 'traefik_server_service_up' metric for it with a value of 1 (alive). +// When the service is undeployed now the metric is still there in the client library // and will be returned on the metrics endpoint until Traefik would be restarted. // // To solve this problem promState keeps track of Traefik's dynamic configuration. -// Metrics that "belong" to a dynamic configuration part like backends or entrypoints +// Metrics that "belong" to a dynamic configuration part like services or entryPoints // are removed after they were scraped at least once when the corresponding object // doesn't exist anymore. var promState = newPrometheusState() +var promRegistry = stdprometheus.NewRegistry() + // PrometheusHandler exposes Prometheus routes. type PrometheusHandler struct{} // Append adds Prometheus routes on a router. func (h PrometheusHandler) Append(router *mux.Router) { - router.Methods(http.MethodGet).Path("/metrics").Handler(promhttp.Handler()) + router.Methods(http.MethodGet).Path("/metrics").Handler(promhttp.HandlerFor(promRegistry, promhttp.HandlerOpts{})) } // RegisterPrometheus registers all Prometheus metrics. @@ -72,6 +75,17 @@ func (h PrometheusHandler) Append(router *mux.Router) { func RegisterPrometheus(ctx context.Context, config *types.Prometheus) Registry { standardRegistry := initStandardRegistry(config) + if err := promRegistry.Register(stdprometheus.NewProcessCollector(stdprometheus.ProcessCollectorOpts{})); err != nil { + if _, ok := err.(stdprometheus.AlreadyRegisteredError); !ok { + log.FromContext(ctx).Warn("ProcessCollector is already registered") + } + } + if err := promRegistry.Register(stdprometheus.NewGoCollector()); err != nil { + if _, ok := err.(stdprometheus.AlreadyRegisteredError); !ok { + log.FromContext(ctx).Warn("GoCollector is already registered") + } + } + if !registerPromState(ctx) { return nil } @@ -106,76 +120,89 @@ func initStandardRegistry(config *types.Prometheus) Registry { Help: "Last config reload failure", }, []string{}) - entrypointReqs := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ - Name: entrypointReqsTotalName, - Help: "How many HTTP requests processed on an entrypoint, partitioned by status code, protocol, and method.", - }, []string{"code", "method", "protocol", "entrypoint"}) - entrypointReqDurations := newHistogramFrom(promState.collectors, stdprometheus.HistogramOpts{ - Name: entrypointReqDurationName, - Help: "How long it took to process the request on an entrypoint, partitioned by status code, protocol, and method.", - Buckets: buckets, - }, []string{"code", "method", "protocol", "entrypoint"}) - entrypointOpenConns := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ - Name: entrypointOpenConnsName, - Help: "How many open connections exist on an entrypoint, partitioned by method and protocol.", - }, []string{"method", "protocol", "entrypoint"}) - - backendReqs := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ - Name: backendReqsTotalName, - Help: "How many HTTP requests processed on a backend, partitioned by status code, protocol, and method.", - }, []string{"code", "method", "protocol", "backend"}) - backendReqDurations := newHistogramFrom(promState.collectors, stdprometheus.HistogramOpts{ - Name: backendReqDurationName, - Help: "How long it took to process the request on a backend, partitioned by status code, protocol, and method.", - Buckets: buckets, - }, []string{"code", "method", "protocol", "backend"}) - backendOpenConns := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ - Name: backendOpenConnsName, - Help: "How many open connections exist on a backend, partitioned by method and protocol.", - }, []string{"method", "protocol", "backend"}) - backendRetries := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ - Name: backendRetriesTotalName, - Help: "How many request retries happened on a backend.", - }, []string{"backend"}) - backendServerUp := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ - Name: backendServerUpName, - Help: "Backend server is up, described by gauge value of 0 or 1.", - }, []string{"backend", "url"}) - promState.describers = []func(chan<- *stdprometheus.Desc){ configReloads.cv.Describe, configReloadsFailures.cv.Describe, lastConfigReloadSuccess.gv.Describe, lastConfigReloadFailure.gv.Describe, - entrypointReqs.cv.Describe, - entrypointReqDurations.hv.Describe, - entrypointOpenConns.gv.Describe, - backendReqs.cv.Describe, - backendReqDurations.hv.Describe, - backendOpenConns.gv.Describe, - backendRetries.cv.Describe, - backendServerUp.gv.Describe, } - return &standardRegistry{ - enabled: true, - configReloadsCounter: configReloads, - configReloadsFailureCounter: configReloadsFailures, - lastConfigReloadSuccessGauge: lastConfigReloadSuccess, - lastConfigReloadFailureGauge: lastConfigReloadFailure, - entrypointReqsCounter: entrypointReqs, - entrypointReqDurationHistogram: entrypointReqDurations, - entrypointOpenConnsGauge: entrypointOpenConns, - backendReqsCounter: backendReqs, - backendReqDurationHistogram: backendReqDurations, - backendOpenConnsGauge: backendOpenConns, - backendRetriesCounter: backendRetries, - backendServerUpGauge: backendServerUp, + reg := &standardRegistry{ + epEnabled: config.AddEntryPointsLabels, + svcEnabled: config.AddServicesLabels, + configReloadsCounter: configReloads, + configReloadsFailureCounter: configReloadsFailures, + lastConfigReloadSuccessGauge: lastConfigReloadSuccess, + lastConfigReloadFailureGauge: lastConfigReloadFailure, } + + if config.AddEntryPointsLabels { + entryPointReqs := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ + Name: entryPointReqsTotalName, + Help: "How many HTTP requests processed on an entrypoint, partitioned by status code, protocol, and method.", + }, []string{"code", "method", "protocol", "entrypoint"}) + entryPointReqDurations := newHistogramFrom(promState.collectors, stdprometheus.HistogramOpts{ + Name: entryPointReqDurationName, + Help: "How long it took to process the request on an entrypoint, partitioned by status code, protocol, and method.", + Buckets: buckets, + }, []string{"code", "method", "protocol", "entrypoint"}) + entryPointOpenConns := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ + Name: entryPointOpenConnsName, + Help: "How many open connections exist on an entrypoint, partitioned by method and protocol.", + }, []string{"method", "protocol", "entrypoint"}) + + promState.describers = append(promState.describers, []func(chan<- *stdprometheus.Desc){ + entryPointReqs.cv.Describe, + entryPointReqDurations.hv.Describe, + entryPointOpenConns.gv.Describe, + }...) + reg.entryPointReqsCounter = entryPointReqs + reg.entryPointReqDurationHistogram = entryPointReqDurations + reg.entryPointOpenConnsGauge = entryPointOpenConns + } + if config.AddServicesLabels { + serviceReqs := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ + Name: serviceReqsTotalName, + Help: "How many HTTP requests processed on a service, partitioned by status code, protocol, and method.", + }, []string{"code", "method", "protocol", "service"}) + serviceReqDurations := newHistogramFrom(promState.collectors, stdprometheus.HistogramOpts{ + Name: serviceReqDurationName, + Help: "How long it took to process the request on a service, partitioned by status code, protocol, and method.", + Buckets: buckets, + }, []string{"code", "method", "protocol", "service"}) + serviceOpenConns := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ + Name: serviceOpenConnsName, + Help: "How many open connections exist on a service, partitioned by method and protocol.", + }, []string{"method", "protocol", "service"}) + serviceRetries := newCounterFrom(promState.collectors, stdprometheus.CounterOpts{ + Name: serviceRetriesTotalName, + Help: "How many request retries happened on a service.", + }, []string{"service"}) + serviceServerUp := newGaugeFrom(promState.collectors, stdprometheus.GaugeOpts{ + Name: serviceServerUpName, + Help: "service server is up, described by gauge value of 0 or 1.", + }, []string{"service", "url"}) + + promState.describers = append(promState.describers, []func(chan<- *stdprometheus.Desc){ + serviceReqs.cv.Describe, + serviceReqDurations.hv.Describe, + serviceOpenConns.gv.Describe, + serviceRetries.cv.Describe, + serviceServerUp.gv.Describe, + }...) + + reg.serviceReqsCounter = serviceReqs + reg.serviceReqDurationHistogram = serviceReqDurations + reg.serviceOpenConnsGauge = serviceOpenConns + reg.serviceRetriesCounter = serviceRetries + reg.serviceServerUpGauge = serviceServerUp + } + + return reg } func registerPromState(ctx context.Context) bool { - if err := stdprometheus.Register(promState); err != nil { + if err := promRegistry.Register(promState); err != nil { logger := log.FromContext(ctx) if _, ok := err.(stdprometheus.AlreadyRegisteredError); !ok { logger.Errorf("Unable to register Traefik to Prometheus: %v", err) @@ -189,24 +216,24 @@ func registerPromState(ctx context.Context) bool { // OnConfigurationUpdate receives the current configuration from Traefik. // It then converts the configuration to the optimized package internal format // and sets it to the promState. -func OnConfigurationUpdate(configurations dynamic.Configurations) { +func OnConfigurationUpdate(dynConf dynamic.Configurations, entryPoints []string) { dynamicConfig := newDynamicConfig() - // FIXME metrics - // for _, config := range configurations { - // for _, frontend := range config.Frontends { - // for _, entrypointName := range frontend.EntryPoints { - // dynamicConfig.entrypoints[entrypointName] = true - // } - // } - // - // for backendName, backend := range config.Backends { - // dynamicConfig.backends[backendName] = make(map[string]bool) - // for _, server := range backend.Servers { - // dynamicConfig.backends[backendName][server.URL] = true - // } - // } - // } + for _, value := range entryPoints { + dynamicConfig.entryPoints[value] = true + } + for key, config := range dynConf { + for name := range config.HTTP.Routers { + dynamicConfig.routers[fmt.Sprintf("%s@%s", name, key)] = true + } + + for serviceName, service := range config.HTTP.Services { + dynamicConfig.services[fmt.Sprintf("%s@%s", serviceName, key)] = make(map[string]bool) + for _, server := range service.LoadBalancer.Servers { + dynamicConfig.services[fmt.Sprintf("%s@%s", serviceName, key)][server.URL] = true + } + } + } promState.SetDynamicConfig(dynamicConfig) } @@ -279,15 +306,15 @@ func (ps *prometheusState) Collect(ch chan<- stdprometheus.Metric) { func (ps *prometheusState) isOutdated(collector *collector) bool { labels := collector.labels - if entrypointName, ok := labels["entrypoint"]; ok && !ps.dynamicConfig.hasEntrypoint(entrypointName) { + if entrypointName, ok := labels["entrypoint"]; ok && !ps.dynamicConfig.hasEntryPoint(entrypointName) { return true } - if backendName, ok := labels["backend"]; ok { - if !ps.dynamicConfig.hasBackend(backendName) { + if serviceName, ok := labels["service"]; ok { + if !ps.dynamicConfig.hasService(serviceName) { return true } - if url, ok := labels["url"]; ok && !ps.dynamicConfig.hasServerURL(backendName, url) { + if url, ok := labels["url"]; ok && !ps.dynamicConfig.hasServerURL(serviceName, url) { return true } } @@ -297,33 +324,35 @@ func (ps *prometheusState) isOutdated(collector *collector) bool { func newDynamicConfig() *dynamicConfig { return &dynamicConfig{ - entrypoints: make(map[string]bool), - backends: make(map[string]map[string]bool), + entryPoints: make(map[string]bool), + routers: make(map[string]bool), + services: make(map[string]map[string]bool), } } -// dynamicConfig holds the current configuration for entrypoints, backends, +// dynamicConfig holds the current configuration for entryPoints, services, // and server URLs in an optimized way to check for existence. This provides // a performant way to check whether the collected metrics belong to the // current configuration or to an outdated one. type dynamicConfig struct { - entrypoints map[string]bool - backends map[string]map[string]bool + entryPoints map[string]bool + routers map[string]bool + services map[string]map[string]bool } -func (d *dynamicConfig) hasEntrypoint(entrypointName string) bool { - _, ok := d.entrypoints[entrypointName] +func (d *dynamicConfig) hasEntryPoint(entrypointName string) bool { + _, ok := d.entryPoints[entrypointName] return ok } -func (d *dynamicConfig) hasBackend(backendName string) bool { - _, ok := d.backends[backendName] +func (d *dynamicConfig) hasService(serviceName string) bool { + _, ok := d.services[serviceName] return ok } -func (d *dynamicConfig) hasServerURL(backendName, serverURL string) bool { - if backend, hasBackend := d.backends[backendName]; hasBackend { - _, ok := backend[serverURL] +func (d *dynamicConfig) hasServerURL(serviceName, serverURL string) bool { + if service, hasService := d.services[serviceName]; hasService { + _, ok := service[serverURL] return ok } return false @@ -479,7 +508,7 @@ func (h *histogram) Observe(value float64) { labels := h.labelNamesValues.ToLabels() collector := h.hv.With(labels) collector.Observe(value) - h.collectors <- newCollector(h.name, labels, collector, func() { + h.collectors <- newCollector(h.name, labels, h.hv, func() { h.hv.Delete(labels) }) } diff --git a/pkg/metrics/prometheus_test.go b/pkg/metrics/prometheus_test.go index 73f9b427d..36a6fc970 100644 --- a/pkg/metrics/prometheus_test.go +++ b/pkg/metrics/prometheus_test.go @@ -30,61 +30,61 @@ func TestRegisterPromState(t *testing.T) { { desc: "Register once", prometheusSlice: []*types.Prometheus{{}}, - expectedNbRegistries: 1, initPromState: true, + unregisterPromState: false, + expectedNbRegistries: 1, }, { desc: "Register once with no promState init", prometheusSlice: []*types.Prometheus{{}}, - expectedNbRegistries: 0, + initPromState: false, + unregisterPromState: false, + expectedNbRegistries: 1, }, { desc: "Register twice", prometheusSlice: []*types.Prometheus{{}, {}}, - expectedNbRegistries: 2, initPromState: true, + unregisterPromState: false, + expectedNbRegistries: 2, }, { desc: "Register twice with no promstate init", prometheusSlice: []*types.Prometheus{{}, {}}, - expectedNbRegistries: 0, + initPromState: false, + unregisterPromState: false, + expectedNbRegistries: 2, }, { desc: "Register twice with unregister", prometheusSlice: []*types.Prometheus{{}, {}}, + initPromState: true, unregisterPromState: true, expectedNbRegistries: 2, - initPromState: true, - }, - { - desc: "Register twice with unregister but no promstate init", - prometheusSlice: []*types.Prometheus{{}, {}}, - unregisterPromState: true, - expectedNbRegistries: 0, }, } for _, test := range testCases { - actualNbRegistries := 0 - for _, prom := range test.prometheusSlice { - if test.initPromState { - initStandardRegistry(prom) + test := test + t.Run(test.desc, func(t *testing.T) { + actualNbRegistries := 0 + for _, prom := range test.prometheusSlice { + if test.initPromState { + initStandardRegistry(prom) + } + if registerPromState(context.Background()) { + actualNbRegistries++ + } + if test.unregisterPromState { + promRegistry.Unregister(promState) + } + + promState.reset() } - if registerPromState(context.Background()) { - actualNbRegistries++ - } - - if test.unregisterPromState { - prometheus.Unregister(promState) - } - - promState.reset() - } - - prometheus.Unregister(promState) - - assert.Equal(t, test.expectedNbRegistries, actualNbRegistries) + promRegistry.Unregister(promState) + assert.Equal(t, test.expectedNbRegistries, actualNbRegistries) + }) } } @@ -99,13 +99,15 @@ func (ps *prometheusState) reset() { } func TestPrometheus(t *testing.T) { + promState = newPrometheusState() + promRegistry = prometheus.NewRegistry() // Reset state of global promState. defer promState.reset() - prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{}) - defer prometheus.Unregister(promState) + prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true}) + defer promRegistry.Unregister(promState) - if !prometheusRegistry.IsEnabled() { + if !prometheusRegistry.IsEpEnabled() || !prometheusRegistry.IsSvcEnabled() { t.Errorf("PrometheusRegistry should return true for IsEnabled()") } @@ -115,44 +117,44 @@ func TestPrometheus(t *testing.T) { prometheusRegistry.LastConfigReloadFailureGauge().Set(float64(time.Now().Unix())) prometheusRegistry. - EntrypointReqsCounter(). + EntryPointReqsCounter(). With("code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http", "entrypoint", "http"). Add(1) prometheusRegistry. - EntrypointReqDurationHistogram(). + EntryPointReqDurationHistogram(). With("code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http", "entrypoint", "http"). Observe(1) prometheusRegistry. - EntrypointOpenConnsGauge(). + EntryPointOpenConnsGauge(). With("method", http.MethodGet, "protocol", "http", "entrypoint", "http"). Set(1) prometheusRegistry. - BackendReqsCounter(). - With("backend", "backend1", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). + ServiceReqsCounter(). + With("service", "service1", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). Add(1) prometheusRegistry. - BackendReqDurationHistogram(). - With("backend", "backend1", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). + ServiceReqDurationHistogram(). + With("service", "service1", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). Observe(10000) prometheusRegistry. - BackendOpenConnsGauge(). - With("backend", "backend1", "method", http.MethodGet, "protocol", "http"). + ServiceOpenConnsGauge(). + With("service", "service1", "method", http.MethodGet, "protocol", "http"). Set(1) prometheusRegistry. - BackendRetriesCounter(). - With("backend", "backend1"). + ServiceRetriesCounter(). + With("service", "service1"). Add(1) prometheusRegistry. - BackendServerUpGauge(). - With("backend", "backend1", "url", "http://127.0.0.10:80"). + ServiceServerUpGauge(). + With("service", "service1", "url", "http://127.0.0.10:80"). Set(1) delayForTrackingCompletion() metricsFamilies := mustScrape() - tests := []struct { + testCases := []struct { name string labels map[string]string assert func(*dto.MetricFamily) @@ -174,107 +176,111 @@ func TestPrometheus(t *testing.T) { assert: buildTimestampAssert(t, configLastReloadFailureName), }, { - name: entrypointReqsTotalName, + name: entryPointReqsTotalName, labels: map[string]string{ "code": "200", "method": http.MethodGet, "protocol": "http", "entrypoint": "http", }, - assert: buildCounterAssert(t, entrypointReqsTotalName, 1), + assert: buildCounterAssert(t, entryPointReqsTotalName, 1), }, { - name: entrypointReqDurationName, + name: entryPointReqDurationName, labels: map[string]string{ "code": "200", "method": http.MethodGet, "protocol": "http", "entrypoint": "http", }, - assert: buildHistogramAssert(t, entrypointReqDurationName, 1), + assert: buildHistogramAssert(t, entryPointReqDurationName, 1), }, { - name: entrypointOpenConnsName, + name: entryPointOpenConnsName, labels: map[string]string{ "method": http.MethodGet, "protocol": "http", "entrypoint": "http", }, - assert: buildGaugeAssert(t, entrypointOpenConnsName, 1), + assert: buildGaugeAssert(t, entryPointOpenConnsName, 1), }, { - name: backendReqsTotalName, + name: serviceReqsTotalName, labels: map[string]string{ "code": "200", "method": http.MethodGet, "protocol": "http", - "backend": "backend1", + "service": "service1", }, - assert: buildCounterAssert(t, backendReqsTotalName, 1), + assert: buildCounterAssert(t, serviceReqsTotalName, 1), }, { - name: backendReqDurationName, + name: serviceReqDurationName, labels: map[string]string{ "code": "200", "method": http.MethodGet, "protocol": "http", - "backend": "backend1", + "service": "service1", }, - assert: buildHistogramAssert(t, backendReqDurationName, 1), + assert: buildHistogramAssert(t, serviceReqDurationName, 1), }, { - name: backendOpenConnsName, + name: serviceOpenConnsName, labels: map[string]string{ "method": http.MethodGet, "protocol": "http", - "backend": "backend1", + "service": "service1", }, - assert: buildGaugeAssert(t, backendOpenConnsName, 1), + assert: buildGaugeAssert(t, serviceOpenConnsName, 1), }, { - name: backendRetriesTotalName, + name: serviceRetriesTotalName, labels: map[string]string{ - "backend": "backend1", + "service": "service1", }, - assert: buildGreaterThanCounterAssert(t, backendRetriesTotalName, 1), + assert: buildGreaterThanCounterAssert(t, serviceRetriesTotalName, 1), }, { - name: backendServerUpName, + name: serviceServerUpName, labels: map[string]string{ - "backend": "backend1", + "service": "service1", "url": "http://127.0.0.10:80", }, - assert: buildGaugeAssert(t, backendServerUpName, 1), + assert: buildGaugeAssert(t, serviceServerUpName, 1), }, } - for _, test := range tests { - family := findMetricFamily(test.name, metricsFamilies) - if family == nil { - t.Errorf("gathered metrics do not contain %q", test.name) - continue - } - for _, label := range family.Metric[0].Label { - val, ok := test.labels[*label.Name] - if !ok { - t.Errorf("%q metric contains unexpected label %q", test.name, *label.Name) - } else if val != *label.Value { - t.Errorf("label %q in metric %q has wrong value %q, expected %q", *label.Name, test.name, *label.Value, val) + for _, test := range testCases { + test := test + t.Run(test.name, func(t *testing.T) { + family := findMetricFamily(test.name, metricsFamilies) + if family == nil { + t.Errorf("gathered metrics do not contain %q", test.name) + return } - } - test.assert(family) + + for _, label := range family.Metric[0].Label { + val, ok := test.labels[*label.Name] + if !ok { + t.Errorf("%q metric contains unexpected label %q", test.name, *label.Name) + } else if val != *label.Value { + t.Errorf("label %q in metric %q has wrong value %q, expected %q", *label.Name, test.name, *label.Value, val) + } + } + test.assert(family) + }) + } } func TestPrometheusMetricRemoval(t *testing.T) { - // FIXME metrics - t.Skip("waiting for metrics") - + promState = newPrometheusState() + promRegistry = prometheus.NewRegistry() // Reset state of global promState. defer promState.reset() - prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{}) - defer prometheus.Unregister(promState) + prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true}) + defer promRegistry.Unregister(promState) configurations := make(dynamic.Configurations) configurations["providerName"] = &dynamic.Configuration{ @@ -289,78 +295,78 @@ func TestPrometheusMetricRemoval(t *testing.T) { ), } - OnConfigurationUpdate(configurations) + OnConfigurationUpdate(configurations, []string{"entrypoint1"}) // Register some metrics manually that are not part of the active configuration. // Those metrics should be part of the /metrics output on the first scrape but // should be removed after that scrape. prometheusRegistry. - EntrypointReqsCounter(). + EntryPointReqsCounter(). With("entrypoint", "entrypoint2", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). Add(1) prometheusRegistry. - BackendReqsCounter(). - With("backend", "backend2", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). + ServiceReqsCounter(). + With("service", "service2", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). Add(1) prometheusRegistry. - BackendServerUpGauge(). - With("backend", "backend1", "url", "http://localhost:9999"). + ServiceServerUpGauge(). + With("service", "service1", "url", "http://localhost:9999"). Set(1) delayForTrackingCompletion() - assertMetricsExist(t, mustScrape(), entrypointReqsTotalName, backendReqsTotalName, backendServerUpName) - assertMetricsAbsent(t, mustScrape(), entrypointReqsTotalName, backendReqsTotalName, backendServerUpName) + assertMetricsExist(t, mustScrape(), entryPointReqsTotalName, serviceReqsTotalName, serviceServerUpName) + assertMetricsAbsent(t, mustScrape(), entryPointReqsTotalName, serviceReqsTotalName, serviceServerUpName) // To verify that metrics belonging to active configurations are not removed // here the counter examples. prometheusRegistry. - EntrypointReqsCounter(). + EntryPointReqsCounter(). With("entrypoint", "entrypoint1", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http"). Add(1) delayForTrackingCompletion() - assertMetricsExist(t, mustScrape(), entrypointReqsTotalName) - assertMetricsExist(t, mustScrape(), entrypointReqsTotalName) + assertMetricsExist(t, mustScrape(), entryPointReqsTotalName) + assertMetricsExist(t, mustScrape(), entryPointReqsTotalName) } func TestPrometheusRemovedMetricsReset(t *testing.T) { // Reset state of global promState. defer promState.reset() - prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{}) - defer prometheus.Unregister(promState) + prometheusRegistry := RegisterPrometheus(context.Background(), &types.Prometheus{AddEntryPointsLabels: true, AddServicesLabels: true}) + defer promRegistry.Unregister(promState) labelNamesValues := []string{ - "backend", "backend", + "service", "service", "code", strconv.Itoa(http.StatusOK), "method", http.MethodGet, "protocol", "http", } prometheusRegistry. - BackendReqsCounter(). + ServiceReqsCounter(). With(labelNamesValues...). Add(3) delayForTrackingCompletion() metricsFamilies := mustScrape() - assertCounterValue(t, 3, findMetricFamily(backendReqsTotalName, metricsFamilies), labelNamesValues...) + assertCounterValue(t, 3, findMetricFamily(serviceReqsTotalName, metricsFamilies), labelNamesValues...) // There is no dynamic configuration and so this metric will be deleted // after the first scrape. - assertMetricsAbsent(t, mustScrape(), backendReqsTotalName) + assertMetricsAbsent(t, mustScrape(), serviceReqsTotalName) prometheusRegistry. - BackendReqsCounter(). + ServiceReqsCounter(). With(labelNamesValues...). Add(1) delayForTrackingCompletion() metricsFamilies = mustScrape() - assertCounterValue(t, 1, findMetricFamily(backendReqsTotalName, metricsFamilies), labelNamesValues...) + assertCounterValue(t, 1, findMetricFamily(serviceReqsTotalName, metricsFamilies), labelNamesValues...) } // Tracking and gathering the metrics happens concurrently. @@ -374,7 +380,7 @@ func delayForTrackingCompletion() { } func mustScrape() []*dto.MetricFamily { - families, err := prometheus.DefaultGatherer.Gather() + families, err := promRegistry.Gather() if err != nil { panic(fmt.Sprintf("could not gather metrics families: %s", err)) } diff --git a/pkg/metrics/statsd.go b/pkg/metrics/statsd.go index 5d1647edc..38147ec2f 100644 --- a/pkg/metrics/statsd.go +++ b/pkg/metrics/statsd.go @@ -19,18 +19,18 @@ var statsdClient = statsd.New("traefik.", kitlog.LoggerFunc(func(keyvals ...inte var statsdTicker *time.Ticker const ( - statsdMetricsBackendReqsName = "backend.request.total" - statsdMetricsBackendLatencyName = "backend.request.duration" - statsdRetriesTotalName = "backend.retries.total" + statsdMetricsServiceReqsName = "service.request.total" + statsdMetricsServiceLatencyName = "service.request.duration" + statsdRetriesTotalName = "service.retries.total" statsdConfigReloadsName = "config.reload.total" statsdConfigReloadsFailureName = statsdConfigReloadsName + ".failure" statsdLastConfigReloadSuccessName = "config.reload.lastSuccessTimestamp" statsdLastConfigReloadFailureName = "config.reload.lastFailureTimestamp" - statsdEntrypointReqsName = "entrypoint.request.total" - statsdEntrypointReqDurationName = "entrypoint.request.duration" - statsdEntrypointOpenConnsName = "entrypoint.connections.open" - statsdOpenConnsName = "backend.connections.open" - statsdServerUpName = "backend.server.up" + statsdEntryPointReqsName = "entrypoint.request.total" + statsdEntryPointReqDurationName = "entrypoint.request.duration" + statsdEntryPointOpenConnsName = "entrypoint.connections.open" + statsdOpenConnsName = "service.connections.open" + statsdServerUpName = "service.server.up" ) // RegisterStatsd registers the metrics pusher if this didn't happen yet and creates a statsd Registry instance. @@ -39,21 +39,30 @@ func RegisterStatsd(ctx context.Context, config *types.Statsd) Registry { statsdTicker = initStatsdTicker(ctx, config) } - return &standardRegistry{ - enabled: true, - configReloadsCounter: statsdClient.NewCounter(statsdConfigReloadsName, 1.0), - configReloadsFailureCounter: statsdClient.NewCounter(statsdConfigReloadsFailureName, 1.0), - lastConfigReloadSuccessGauge: statsdClient.NewGauge(statsdLastConfigReloadSuccessName), - lastConfigReloadFailureGauge: statsdClient.NewGauge(statsdLastConfigReloadFailureName), - entrypointReqsCounter: statsdClient.NewCounter(statsdEntrypointReqsName, 1.0), - entrypointReqDurationHistogram: statsdClient.NewTiming(statsdEntrypointReqDurationName, 1.0), - entrypointOpenConnsGauge: statsdClient.NewGauge(statsdEntrypointOpenConnsName), - backendReqsCounter: statsdClient.NewCounter(statsdMetricsBackendReqsName, 1.0), - backendReqDurationHistogram: statsdClient.NewTiming(statsdMetricsBackendLatencyName, 1.0), - backendRetriesCounter: statsdClient.NewCounter(statsdRetriesTotalName, 1.0), - backendOpenConnsGauge: statsdClient.NewGauge(statsdOpenConnsName), - backendServerUpGauge: statsdClient.NewGauge(statsdServerUpName), + registry := &standardRegistry{ + configReloadsCounter: statsdClient.NewCounter(statsdConfigReloadsName, 1.0), + configReloadsFailureCounter: statsdClient.NewCounter(statsdConfigReloadsFailureName, 1.0), + lastConfigReloadSuccessGauge: statsdClient.NewGauge(statsdLastConfigReloadSuccessName), + lastConfigReloadFailureGauge: statsdClient.NewGauge(statsdLastConfigReloadFailureName), } + + if config.AddEntryPointsLabels { + registry.epEnabled = config.AddEntryPointsLabels + registry.entryPointReqsCounter = statsdClient.NewCounter(statsdEntryPointReqsName, 1.0) + registry.entryPointReqDurationHistogram = statsdClient.NewTiming(statsdEntryPointReqDurationName, 1.0) + registry.entryPointOpenConnsGauge = statsdClient.NewGauge(statsdEntryPointOpenConnsName) + } + + if config.AddServicesLabels { + registry.svcEnabled = config.AddServicesLabels + registry.serviceReqsCounter = statsdClient.NewCounter(statsdMetricsServiceReqsName, 1.0) + registry.serviceReqDurationHistogram = statsdClient.NewTiming(statsdMetricsServiceLatencyName, 1.0) + registry.serviceRetriesCounter = statsdClient.NewCounter(statsdRetriesTotalName, 1.0) + registry.serviceOpenConnsGauge = statsdClient.NewGauge(statsdOpenConnsName) + registry.serviceServerUpGauge = statsdClient.NewGauge(statsdServerUpName) + } + + return registry } // initStatsdTicker initializes metrics pusher and creates a statsdClient if not created already @@ -66,7 +75,7 @@ func initStatsdTicker(ctx context.Context, config *types.Statsd) *time.Ticker { report := time.NewTicker(time.Duration(config.PushInterval)) safe.Go(func() { - statsdClient.SendLoop(report.C, "udp", address) + statsdClient.SendLoop(ctx, report.C, "udp", address) }) return report diff --git a/pkg/metrics/statsd_test.go b/pkg/metrics/statsd_test.go index 4b4552b26..c2c6f2f33 100644 --- a/pkg/metrics/statsd_test.go +++ b/pkg/metrics/statsd_test.go @@ -15,37 +15,37 @@ func TestStatsD(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 - statsdRegistry := RegisterStatsd(context.Background(), &types.Statsd{Address: ":18125", PushInterval: types.Duration(time.Second)}) + statsdRegistry := RegisterStatsd(context.Background(), &types.Statsd{Address: ":18125", PushInterval: types.Duration(time.Second), AddEntryPointsLabels: true, AddServicesLabels: true}) defer StopStatsd() - if !statsdRegistry.IsEnabled() { + if !statsdRegistry.IsEpEnabled() || !statsdRegistry.IsSvcEnabled() { t.Errorf("Statsd registry should return true for IsEnabled()") } expected := []string{ // We are only validating counts, as it is nearly impossible to validate latency, since it varies every run - "traefik.backend.request.total:2.000000|c\n", - "traefik.backend.retries.total:2.000000|c\n", - "traefik.backend.request.duration:10000.000000|ms", + "traefik.service.request.total:2.000000|c\n", + "traefik.service.retries.total:2.000000|c\n", + "traefik.service.request.duration:10000.000000|ms", "traefik.config.reload.total:1.000000|c\n", "traefik.config.reload.total:1.000000|c\n", "traefik.entrypoint.request.total:1.000000|c\n", "traefik.entrypoint.request.duration:10000.000000|ms", "traefik.entrypoint.connections.open:1.000000|g\n", - "traefik.backend.server.up:1.000000|g\n", + "traefik.service.server.up:1.000000|g\n", } udp.ShouldReceiveAll(t, expected, func() { - statsdRegistry.BackendReqsCounter().With("service", "test", "code", string(http.StatusOK), "method", http.MethodGet).Add(1) - statsdRegistry.BackendReqsCounter().With("service", "test", "code", string(http.StatusNotFound), "method", http.MethodGet).Add(1) - statsdRegistry.BackendRetriesCounter().With("service", "test").Add(1) - statsdRegistry.BackendRetriesCounter().With("service", "test").Add(1) - statsdRegistry.BackendReqDurationHistogram().With("service", "test", "code", string(http.StatusOK)).Observe(10000) + statsdRegistry.ServiceReqsCounter().With("service", "test", "code", string(http.StatusOK), "method", http.MethodGet).Add(1) + statsdRegistry.ServiceReqsCounter().With("service", "test", "code", string(http.StatusNotFound), "method", http.MethodGet).Add(1) + statsdRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + statsdRegistry.ServiceRetriesCounter().With("service", "test").Add(1) + statsdRegistry.ServiceReqDurationHistogram().With("service", "test", "code", string(http.StatusOK)).Observe(10000) statsdRegistry.ConfigReloadsCounter().Add(1) statsdRegistry.ConfigReloadsFailureCounter().Add(1) - statsdRegistry.EntrypointReqsCounter().With("entrypoint", "test").Add(1) - statsdRegistry.EntrypointReqDurationHistogram().With("entrypoint", "test").Observe(10000) - statsdRegistry.EntrypointOpenConnsGauge().With("entrypoint", "test").Set(1) - statsdRegistry.BackendServerUpGauge().With("backend:test", "url", "http://127.0.0.1").Set(1) + statsdRegistry.EntryPointReqsCounter().With("entrypoint", "test").Add(1) + statsdRegistry.EntryPointReqDurationHistogram().With("entrypoint", "test").Observe(10000) + statsdRegistry.EntryPointOpenConnsGauge().With("entrypoint", "test").Set(1) + statsdRegistry.ServiceServerUpGauge().With("service:test", "url", "http://127.0.0.1").Set(1) }) } diff --git a/pkg/middlewares/metrics/metrics.go b/pkg/middlewares/metrics/metrics.go new file mode 100644 index 000000000..d66d3b16f --- /dev/null +++ b/pkg/middlewares/metrics/metrics.go @@ -0,0 +1,158 @@ +package metrics + +import ( + "context" + "net/http" + "strconv" + "strings" + "sync/atomic" + "time" + "unicode/utf8" + + "github.com/containous/alice" + "github.com/containous/traefik/pkg/log" + "github.com/containous/traefik/pkg/metrics" + "github.com/containous/traefik/pkg/middlewares" + "github.com/containous/traefik/pkg/middlewares/retry" + gokitmetrics "github.com/go-kit/kit/metrics" +) + +const ( + protoHTTP = "http" + protoSSE = "sse" + protoWebsocket = "websocket" + typeName = "Metrics" + nameEntrypoint = "metrics-entrypoint" + nameService = "metrics-service" +) + +type metricsMiddleware struct { + // Important: Since this int64 field is using sync/atomic, it has to be at the top of the struct due to a bug on 32-bit platform + // See: https://golang.org/pkg/sync/atomic/ for more information + openConns int64 + next http.Handler + reqsCounter gokitmetrics.Counter + reqDurationHistogram gokitmetrics.Histogram + openConnsGauge gokitmetrics.Gauge + baseLabels []string +} + +// NewEntryPointMiddleware creates a new metrics middleware for an Entrypoint. +func NewEntryPointMiddleware(ctx context.Context, next http.Handler, registry metrics.Registry, entryPointName string) http.Handler { + middlewares.GetLogger(ctx, nameEntrypoint, typeName).Debug("Creating middleware") + + return &metricsMiddleware{ + next: next, + reqsCounter: registry.EntryPointReqsCounter(), + reqDurationHistogram: registry.EntryPointReqDurationHistogram(), + openConnsGauge: registry.EntryPointOpenConnsGauge(), + baseLabels: []string{"entrypoint", entryPointName}, + } +} + +// NewServiceMiddleware creates a new metrics middleware for a Service. +func NewServiceMiddleware(ctx context.Context, next http.Handler, registry metrics.Registry, serviceName string) http.Handler { + middlewares.GetLogger(ctx, nameService, typeName).Debug("Creating middleware") + + return &metricsMiddleware{ + next: next, + reqsCounter: registry.ServiceReqsCounter(), + reqDurationHistogram: registry.ServiceReqDurationHistogram(), + openConnsGauge: registry.ServiceOpenConnsGauge(), + baseLabels: []string{"service", serviceName}, + } +} + +// WrapEntryPointHandler Wraps metrics entrypoint to alice.Constructor. +func WrapEntryPointHandler(ctx context.Context, registry metrics.Registry, entryPointName string) alice.Constructor { + return func(next http.Handler) (http.Handler, error) { + return NewEntryPointMiddleware(ctx, next, registry, entryPointName), nil + } +} + +// WrapServiceHandler Wraps metrics service to alice.Constructor. +func WrapServiceHandler(ctx context.Context, registry metrics.Registry, serviceName string) alice.Constructor { + return func(next http.Handler) (http.Handler, error) { + return NewServiceMiddleware(ctx, next, registry, serviceName), nil + } +} + +func (m *metricsMiddleware) ServeHTTP(rw http.ResponseWriter, req *http.Request) { + labels := []string{"method", getMethod(req), "protocol", getRequestProtocol(req)} + labels = append(labels, m.baseLabels...) + + openConns := atomic.AddInt64(&m.openConns, 1) + m.openConnsGauge.With(labels...).Set(float64(openConns)) + defer func(labelValues []string) { + openConns := atomic.AddInt64(&m.openConns, -1) + m.openConnsGauge.With(labelValues...).Set(float64(openConns)) + }(labels) + + start := time.Now() + recorder := &responseRecorder{rw, http.StatusOK} + m.next.ServeHTTP(recorder, req) + + labels = append(labels, "code", strconv.Itoa(recorder.statusCode)) + m.reqsCounter.With(labels...).Add(1) + m.reqDurationHistogram.With(labels...).Observe(time.Since(start).Seconds()) +} + +func getRequestProtocol(req *http.Request) string { + switch { + case isWebsocketRequest(req): + return protoWebsocket + case isSSERequest(req): + return protoSSE + default: + return protoHTTP + } +} + +// isWebsocketRequest determines if the specified HTTP request is a websocket handshake request. +func isWebsocketRequest(req *http.Request) bool { + return containsHeader(req, "Connection", "upgrade") && containsHeader(req, "Upgrade", "websocket") +} + +// isSSERequest determines if the specified HTTP request is a request for an event subscription. +func isSSERequest(req *http.Request) bool { + return containsHeader(req, "Accept", "text/event-stream") +} + +func containsHeader(req *http.Request, name, value string) bool { + items := strings.Split(req.Header.Get(name), ",") + for _, item := range items { + if value == strings.ToLower(strings.TrimSpace(item)) { + return true + } + } + return false +} + +func getMethod(r *http.Request) string { + if !utf8.ValidString(r.Method) { + log.Warnf("Invalid HTTP method encoding: %s", r.Method) + return "NON_UTF8_HTTP_METHOD" + } + return r.Method +} + +type retryMetrics interface { + ServiceRetriesCounter() gokitmetrics.Counter +} + +// NewRetryListener instantiates a MetricsRetryListener with the given retryMetrics. +func NewRetryListener(retryMetrics retryMetrics, serviceName string) retry.Listener { + return &RetryListener{retryMetrics: retryMetrics, serviceName: serviceName} +} + +// RetryListener is an implementation of the RetryListener interface to +// record RequestMetrics about retry attempts. +type RetryListener struct { + retryMetrics retryMetrics + serviceName string +} + +// Retried tracks the retry in the RequestMetrics implementation. +func (m *RetryListener) Retried(req *http.Request, attempt int) { + m.retryMetrics.ServiceRetriesCounter().With("service", m.serviceName).Add(1) +} diff --git a/pkg/middlewares/metrics/metrics_test.go b/pkg/middlewares/metrics/metrics_test.go new file mode 100644 index 000000000..9df351649 --- /dev/null +++ b/pkg/middlewares/metrics/metrics_test.go @@ -0,0 +1,58 @@ +package metrics + +import ( + "net/http" + "net/http/httptest" + "reflect" + "testing" + + "github.com/go-kit/kit/metrics" +) + +// CollectingCounter is a metrics.Counter implementation that enables access to the CounterValue and LastLabelValues. +type CollectingCounter struct { + CounterValue float64 + LastLabelValues []string +} + +// With is there to satisfy the metrics.Counter interface. +func (c *CollectingCounter) With(labelValues ...string) metrics.Counter { + c.LastLabelValues = labelValues + return c +} + +// Add is there to satisfy the metrics.Counter interface. +func (c *CollectingCounter) Add(delta float64) { + c.CounterValue += delta +} + +func TestMetricsRetryListener(t *testing.T) { + req := httptest.NewRequest(http.MethodGet, "/", nil) + retryMetrics := newCollectingRetryMetrics() + retryListener := NewRetryListener(retryMetrics, "serviceName") + retryListener.Retried(req, 1) + retryListener.Retried(req, 2) + + wantCounterValue := float64(2) + if retryMetrics.retriesCounter.CounterValue != wantCounterValue { + t.Errorf("got counter value of %f, want %f", retryMetrics.retriesCounter.CounterValue, wantCounterValue) + } + + wantLabelValues := []string{"service", "serviceName"} + if !reflect.DeepEqual(retryMetrics.retriesCounter.LastLabelValues, wantLabelValues) { + t.Errorf("wrong label values %v used, want %v", retryMetrics.retriesCounter.LastLabelValues, wantLabelValues) + } +} + +// collectingRetryMetrics is an implementation of the retryMetrics interface that can be used inside tests to collect the times Add() was called. +type collectingRetryMetrics struct { + retriesCounter *CollectingCounter +} + +func newCollectingRetryMetrics() *collectingRetryMetrics { + return &collectingRetryMetrics{retriesCounter: &CollectingCounter{}} +} + +func (m *collectingRetryMetrics) ServiceRetriesCounter() metrics.Counter { + return m.retriesCounter +} diff --git a/pkg/middlewares/metrics/recorder.go b/pkg/middlewares/metrics/recorder.go new file mode 100644 index 000000000..7e6991d47 --- /dev/null +++ b/pkg/middlewares/metrics/recorder.go @@ -0,0 +1,37 @@ +package metrics + +import ( + "bufio" + "net" + "net/http" +) + +// responseRecorder captures information from the response and preserves it for +// later analysis. +type responseRecorder struct { + http.ResponseWriter + statusCode int +} + +// WriteHeader captures the status code for later retrieval. +func (r *responseRecorder) WriteHeader(status int) { + r.ResponseWriter.WriteHeader(status) + r.statusCode = status +} + +// Hijack hijacks the connection +func (r *responseRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) { + return r.ResponseWriter.(http.Hijacker).Hijack() +} + +// CloseNotify returns a channel that receives at most a +// single value (true) when the client connection has gone +// away. +func (r *responseRecorder) CloseNotify() <-chan bool { + return r.ResponseWriter.(http.CloseNotifier).CloseNotify() +} + +// Flush sends any buffered data to the client. +func (r *responseRecorder) Flush() { + r.ResponseWriter.(http.Flusher).Flush() +} diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index 387dcbcc2..21a475aa9 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -306,7 +306,7 @@ func TestRouterManager_Get(t *testing.T) { Middlewares: test.middlewaresConfig, }, }) - serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport) + serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport, nil) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(rtConf.Middlewares) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) @@ -407,7 +407,7 @@ func TestAccessLog(t *testing.T) { Middlewares: test.middlewaresConfig, }, }) - serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport) + serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport, nil) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(rtConf.Middlewares) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) @@ -693,7 +693,7 @@ func TestRuntimeConfiguration(t *testing.T) { Middlewares: test.middlewareConfig, }, }) - serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport) + serviceManager := service.NewManager(rtConf.Services, http.DefaultTransport, nil) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(map[string]*runtime.MiddlewareInfo{}) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) @@ -767,7 +767,7 @@ func BenchmarkRouterServe(b *testing.B) { Middlewares: map[string]*dynamic.Middleware{}, }, }) - serviceManager := service.NewManager(rtConf.Services, &staticTransport{res}) + serviceManager := service.NewManager(rtConf.Services, &staticTransport{res}, nil) middlewaresBuilder := middleware.NewBuilder(rtConf.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(rtConf.Middlewares) routerManager := NewManager(rtConf, serviceManager, middlewaresBuilder, responseModifierFactory) @@ -808,7 +808,7 @@ func BenchmarkService(b *testing.B) { Services: serviceConfig, }, }) - serviceManager := service.NewManager(rtConf.Services, &staticTransport{res}) + serviceManager := service.NewManager(rtConf.Services, &staticTransport{res}, nil) w := httptest.NewRecorder() req := testhelpers.MustNewRequest(http.MethodGet, "http://foo.bar/", nil) diff --git a/pkg/server/server_configuration.go b/pkg/server/server_configuration.go index d159e4c85..84009edc5 100644 --- a/pkg/server/server_configuration.go +++ b/pkg/server/server_configuration.go @@ -12,7 +12,9 @@ import ( "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/log" + "github.com/containous/traefik/pkg/metrics" "github.com/containous/traefik/pkg/middlewares/accesslog" + metricsmiddleware "github.com/containous/traefik/pkg/middlewares/metrics" "github.com/containous/traefik/pkg/middlewares/requestdecorator" "github.com/containous/traefik/pkg/middlewares/tracing" "github.com/containous/traefik/pkg/responsemodifiers" @@ -49,7 +51,13 @@ func (s *Server) loadConfiguration(configMsg dynamic.Message) { listener(*configMsg.Configuration) } - s.postLoadConfiguration() + if s.metricsRegistry.IsEpEnabled() || s.metricsRegistry.IsSvcEnabled() { + var entrypoints []string + for key := range s.entryPointsTCP { + entrypoints = append(entrypoints, key) + } + metrics.OnConfigurationUpdate(newConfigurations, entrypoints) + } } // loadConfigurationTCP returns a new gorilla.mux Route from the specified global configuration and the dynamic @@ -89,7 +97,7 @@ func (s *Server) createTCPRouters(ctx context.Context, configuration *runtime.Co // createHTTPHandlers returns, for the given configuration and entryPoints, the HTTP handlers for non-TLS connections, and for the TLS ones. the given configuration must not be nil. its fields will get mutated. func (s *Server) createHTTPHandlers(ctx context.Context, configuration *runtime.Configuration, entryPoints []string) (map[string]http.Handler, map[string]http.Handler) { - serviceManager := service.NewManager(configuration.Services, s.defaultRoundTripper) + serviceManager := service.NewManager(configuration.Services, s.defaultRoundTripper, s.metricsRegistry) middlewaresBuilder := middleware.NewBuilder(configuration.Middlewares, serviceManager) responseModifierFactory := responsemodifiers.NewBuilder(configuration.Middlewares) routerManager := router.NewManager(configuration, serviceManager, middlewaresBuilder, responseModifierFactory) @@ -128,6 +136,10 @@ func (s *Server) createHTTPHandlers(ctx context.Context, configuration *runtime. chain = chain.Append(tracing.WrapEntryPointHandler(ctx, s.tracer, entryPointName)) } + if s.metricsRegistry.IsEpEnabled() { + chain = chain.Append(metricsmiddleware.WrapEntryPointHandler(ctx, s.metricsRegistry, entryPointName)) + } + chain = chain.Append(requestdecorator.WrapHandler(s.requestDecorator)) handler, err := chain.Then(internalMuxRouter.NotFoundHandler) @@ -266,15 +278,6 @@ func (s *Server) throttleProviderConfigReload(throttle time.Duration, publish ch } } -func (s *Server) postLoadConfiguration() { - // FIXME metrics - // if s.metricsRegistry.IsEnabled() { - // activeConfig := s.currentConfigurations.Get().(config.Configurations) - // metrics.OnConfigurationUpdate(activeConfig) - // } - -} - func buildDefaultHTTPRouter() *mux.Router { rt := mux.NewRouter() rt.NotFoundHandler = http.HandlerFunc(http.NotFound) diff --git a/pkg/server/service/service.go b/pkg/server/service/service.go index 3e9974ff7..1a8fab5a6 100644 --- a/pkg/server/service/service.go +++ b/pkg/server/service/service.go @@ -13,8 +13,10 @@ import ( "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/healthcheck" "github.com/containous/traefik/pkg/log" + "github.com/containous/traefik/pkg/metrics" "github.com/containous/traefik/pkg/middlewares/accesslog" "github.com/containous/traefik/pkg/middlewares/emptybackendhandler" + metricsMiddle "github.com/containous/traefik/pkg/middlewares/metrics" "github.com/containous/traefik/pkg/middlewares/pipelining" "github.com/containous/traefik/pkg/server/cookie" "github.com/containous/traefik/pkg/server/internal" @@ -27,8 +29,9 @@ const ( ) // NewManager creates a new Manager -func NewManager(configs map[string]*runtime.ServiceInfo, defaultRoundTripper http.RoundTripper) *Manager { +func NewManager(configs map[string]*runtime.ServiceInfo, defaultRoundTripper http.RoundTripper, metricsRegistry metrics.Registry) *Manager { return &Manager{ + metricsRegistry: metricsRegistry, bufferPool: newBufferPool(), defaultRoundTripper: defaultRoundTripper, balancers: make(map[string][]healthcheck.BalancerHandler), @@ -38,6 +41,7 @@ func NewManager(configs map[string]*runtime.ServiceInfo, defaultRoundTripper htt // Manager The service manager type Manager struct { + metricsRegistry metrics.Registry bufferPool httputil.BufferPool defaultRoundTripper http.RoundTripper balancers map[string][]healthcheck.BalancerHandler @@ -87,8 +91,12 @@ func (m *Manager) getLoadBalancerServiceHandler( alHandler := func(next http.Handler) (http.Handler, error) { return accesslog.NewFieldHandler(next, accesslog.ServiceName, serviceName, accesslog.AddServiceFields), nil } + chain := alice.New() + if m.metricsRegistry != nil && m.metricsRegistry.IsSvcEnabled() { + chain = chain.Append(metricsMiddle.WrapServiceHandler(ctx, m.metricsRegistry, serviceName)) + } - handler, err := alice.New().Append(alHandler).Then(pipelining.New(ctx, fwd, "pipelining")) + handler, err := chain.Append(alHandler).Then(pipelining.New(ctx, fwd, "pipelining")) if err != nil { return nil, err } diff --git a/pkg/server/service/service_test.go b/pkg/server/service/service_test.go index 6d96ea0db..9dd4344fd 100644 --- a/pkg/server/service/service_test.go +++ b/pkg/server/service/service_test.go @@ -80,7 +80,7 @@ func TestGetLoadBalancer(t *testing.T) { } func TestGetLoadBalancerServiceHandler(t *testing.T) { - sm := NewManager(nil, http.DefaultTransport) + sm := NewManager(nil, http.DefaultTransport, nil) server1 := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("X-From", "first") @@ -332,7 +332,7 @@ func TestManager_Build(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - manager := NewManager(test.configs, http.DefaultTransport) + manager := NewManager(test.configs, http.DefaultTransport, nil) ctx := context.Background() if len(test.providerName) > 0 { diff --git a/pkg/types/metrics.go b/pkg/types/metrics.go index 2d148ce93..3fc813955 100644 --- a/pkg/types/metrics.go +++ b/pkg/types/metrics.go @@ -4,7 +4,7 @@ import ( "time" ) -// Metrics provides options to expose and send Traefik metrics to different third party monitoring systems +// 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." 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"` @@ -12,52 +12,66 @@ type Metrics struct { 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 +// Prometheus can contain specific configuration used by the Prometheus Metrics exporter. type Prometheus struct { - 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"` + 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"` + AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` + AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"` } // SetDefaults sets the default values. func (p *Prometheus) SetDefaults() { p.Buckets = []float64{0.1, 0.3, 1.2, 5} p.EntryPoint = "traefik" + p.AddEntryPointsLabels = true + p.AddServicesLabels = true } -// DataDog contains address and metrics pushing interval configuration +// 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"` + 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"` + AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` + AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"` } // SetDefaults sets the default values. func (d *DataDog) SetDefaults() { d.Address = "localhost:8125" d.PushInterval = Duration(10 * time.Second) + d.AddEntryPointsLabels = true + d.AddServicesLabels = true } -// Statsd contains address and metrics pushing interval configuration +// Statsd contains address and metrics pushing interval configuration. type Statsd struct { - 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"` + 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"` + AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` + AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"` } // SetDefaults sets the default values. func (s *Statsd) SetDefaults() { s.Address = "localhost:8125" s.PushInterval = Duration(10 * time.Second) + s.AddEntryPointsLabels = true + s.AddServicesLabels = true } -// InfluxDB contains address, login and metrics pushing interval configuration +// InfluxDB contains address, login and metrics pushing interval configuration. type InfluxDB struct { - 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"` + 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"` + AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` + AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"` } // SetDefaults sets the default values. @@ -65,9 +79,11 @@ func (i *InfluxDB) SetDefaults() { i.Address = "localhost:8089" i.Protocol = "udp" i.PushInterval = Duration(10 * time.Second) + i.AddEntryPointsLabels = true + i.AddServicesLabels = true } -// Statistics provides options for monitoring request and response stats +// Statistics provides options for monitoring request and response stats. type Statistics struct { RecentErrors int `description:"Number of recent errors logged." json:"recentErrors,omitempty" toml:"recentErrors,omitempty" yaml:"recentErrors,omitempty" export:"true"` } diff --git a/vendor/github.com/go-kit/kit/log/value.go b/vendor/github.com/go-kit/kit/log/value.go index b56f154f8..1486f145d 100644 --- a/vendor/github.com/go-kit/kit/log/value.go +++ b/vendor/github.com/go-kit/kit/log/value.go @@ -1,9 +1,10 @@ package log import ( + "runtime" + "strconv" + "strings" "time" - - "github.com/go-stack/stack" ) // A Valuer generates a log value. When passed to With or WithPrefix in a @@ -81,7 +82,14 @@ func (tf timeFormat) MarshalText() (text []byte, err error) { // Caller returns a Valuer that returns a file and line from a specified depth // in the callstack. Users will probably want to use DefaultCaller. func Caller(depth int) Valuer { - return func() interface{} { return stack.Caller(depth) } + return func() interface{} { + _, file, line, _ := runtime.Caller(depth) + idx := strings.LastIndexByte(file, '/') + // using idx+1 below handles both of following cases: + // idx == -1 because no "/" was found, or + // idx >= 0 and we want to start at the character after the found "/". + return file[idx+1:] + ":" + strconv.Itoa(line) + } } var ( diff --git a/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go b/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go index ccdcd57b4..d9618fd25 100644 --- a/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go +++ b/vendor/github.com/go-kit/kit/metrics/dogstatsd/dogstatsd.go @@ -11,8 +11,10 @@ package dogstatsd import ( + "context" "fmt" "io" + "math/rand" "strings" "sync" "sync/atomic" @@ -72,7 +74,7 @@ func (d *Dogstatsd) NewCounter(name string, sampleRate float64) *Counter { d.rates.Set(name, sampleRate) return &Counter{ name: name, - obs: d.counters.Observe, + obs: sampleObservations(d.counters.Observe, sampleRate), } } @@ -94,7 +96,7 @@ func (d *Dogstatsd) NewTiming(name string, sampleRate float64) *Timing { d.rates.Set(name, sampleRate) return &Timing{ name: name, - obs: d.timings.Observe, + obs: sampleObservations(d.timings.Observe, sampleRate), } } @@ -104,29 +106,34 @@ func (d *Dogstatsd) NewHistogram(name string, sampleRate float64) *Histogram { d.rates.Set(name, sampleRate) return &Histogram{ name: name, - obs: d.histograms.Observe, + obs: sampleObservations(d.histograms.Observe, sampleRate), } } // WriteLoop is a helper method that invokes WriteTo to the passed writer every -// time the passed channel fires. This method blocks until the channel is -// closed, so clients probably want to run it in its own goroutine. For typical +// time the passed channel fires. This method blocks until ctx is canceled, +// so clients probably want to run it in its own goroutine. For typical // usage, create a time.Ticker and pass its C channel to this method. -func (d *Dogstatsd) WriteLoop(c <-chan time.Time, w io.Writer) { - for range c { - if _, err := d.WriteTo(w); err != nil { - d.logger.Log("during", "WriteTo", "err", err) +func (d *Dogstatsd) WriteLoop(ctx context.Context, c <-chan time.Time, w io.Writer) { + for { + select { + case <-c: + if _, err := d.WriteTo(w); err != nil { + d.logger.Log("during", "WriteTo", "err", err) + } + case <-ctx.Done(): + return } } } // SendLoop is a helper method that wraps WriteLoop, passing a managed // connection to the network and address. Like WriteLoop, this method blocks -// until the channel is closed, so clients probably want to start it in its own +// until ctx is canceled, so clients probably want to start it in its own // goroutine. For typical usage, create a time.Ticker and pass its C channel to // this method. -func (d *Dogstatsd) SendLoop(c <-chan time.Time, network, address string) { - d.WriteLoop(c, conn.NewDefaultManager(network, address, d.logger)) +func (d *Dogstatsd) SendLoop(ctx context.Context, c <-chan time.Time, network, address string) { + d.WriteLoop(ctx, c, conn.NewDefaultManager(network, address, d.logger)) } // WriteTo flushes the buffered content of the metrics to the writer, in @@ -233,6 +240,19 @@ func (d *Dogstatsd) tagValues(labelValues []string) string { type observeFunc func(name string, lvs lv.LabelValues, value float64) +// sampleObservations returns a modified observeFunc that samples observations. +func sampleObservations(obs observeFunc, sampleRate float64) observeFunc { + if sampleRate >= 1 { + return obs + } + return func(name string, lvs lv.LabelValues, value float64) { + if rand.Float64() > sampleRate { + return + } + obs(name, lvs, value) + } +} + // Counter is a DogStatsD counter. Observations are forwarded to a Dogstatsd // object, and aggregated (summed) per timeseries. type Counter struct { diff --git a/vendor/github.com/go-kit/kit/metrics/influx/influx.go b/vendor/github.com/go-kit/kit/metrics/influx/influx.go index 1ea0cc50d..a73ffd7a8 100644 --- a/vendor/github.com/go-kit/kit/metrics/influx/influx.go +++ b/vendor/github.com/go-kit/kit/metrics/influx/influx.go @@ -4,9 +4,10 @@ package influx import ( + "context" "time" - influxdb "github.com/influxdata/influxdb/client/v2" + influxdb "github.com/influxdata/influxdb1-client/v2" "github.com/go-kit/kit/log" "github.com/go-kit/kit/metrics" @@ -88,10 +89,15 @@ type BatchPointsWriter interface { // time the passed channel fires. This method blocks until the channel is // closed, so clients probably want to run it in its own goroutine. For typical // usage, create a time.Ticker and pass its C channel to this method. -func (in *Influx) WriteLoop(c <-chan time.Time, w BatchPointsWriter) { - for range c { - if err := in.WriteTo(w); err != nil { - in.logger.Log("during", "WriteTo", "err", err) +func (in *Influx) WriteLoop(ctx context.Context, c <-chan time.Time, w BatchPointsWriter) { + for { + select { + case <-c: + if err := in.WriteTo(w); err != nil { + in.logger.Log("during", "WriteTo", "err", err) + } + case <-ctx.Done(): + return } } } diff --git a/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go b/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go index 672c90074..371964a35 100644 --- a/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go +++ b/vendor/github.com/go-kit/kit/metrics/internal/lv/space.go @@ -79,7 +79,7 @@ type pair struct{ label, value string } func (n *node) observe(lvs LabelValues, value float64) { n.mtx.Lock() defer n.mtx.Unlock() - if len(lvs) == 0 { + if len(lvs) <= 0 { n.observations = append(n.observations, value) return } @@ -101,7 +101,7 @@ func (n *node) observe(lvs LabelValues, value float64) { func (n *node) add(lvs LabelValues, delta float64) { n.mtx.Lock() defer n.mtx.Unlock() - if len(lvs) == 0 { + if len(lvs) <= 0 { var value float64 if len(n.observations) > 0 { value = last(n.observations) + delta diff --git a/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go b/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go index 8dfbf6fd6..d2cfbc77b 100644 --- a/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go +++ b/vendor/github.com/go-kit/kit/metrics/statsd/statsd.go @@ -9,6 +9,7 @@ package statsd import ( + "context" "fmt" "io" "time" @@ -89,24 +90,29 @@ func (s *Statsd) NewTiming(name string, sampleRate float64) *Timing { } // WriteLoop is a helper method that invokes WriteTo to the passed writer every -// time the passed channel fires. This method blocks until the channel is -// closed, so clients probably want to run it in its own goroutine. For typical +// time the passed channel fires. This method blocks until ctx is canceled, +// so clients probably want to run it in its own goroutine. For typical // usage, create a time.Ticker and pass its C channel to this method. -func (s *Statsd) WriteLoop(c <-chan time.Time, w io.Writer) { - for range c { - if _, err := s.WriteTo(w); err != nil { - s.logger.Log("during", "WriteTo", "err", err) +func (s *Statsd) WriteLoop(ctx context.Context, c <-chan time.Time, w io.Writer) { + for { + select { + case <-c: + if _, err := s.WriteTo(w); err != nil { + s.logger.Log("during", "WriteTo", "err", err) + } + case <-ctx.Done(): + return } } } // SendLoop is a helper method that wraps WriteLoop, passing a managed // connection to the network and address. Like WriteLoop, this method blocks -// until the channel is closed, so clients probably want to start it in its own +// until ctx is canceled, so clients probably want to start it in its own // goroutine. For typical usage, create a time.Ticker and pass its C channel to // this method. -func (s *Statsd) SendLoop(c <-chan time.Time, network, address string) { - s.WriteLoop(c, conn.NewDefaultManager(network, address, s.logger)) +func (s *Statsd) SendLoop(ctx context.Context, c <-chan time.Time, network, address string) { + s.WriteLoop(ctx, c, conn.NewDefaultManager(network, address, s.logger)) } // WriteTo flushes the buffered content of the metrics to the writer, in diff --git a/vendor/github.com/go-kit/kit/util/conn/manager.go b/vendor/github.com/go-kit/kit/util/conn/manager.go index 0b7db6281..725cbbc7a 100644 --- a/vendor/github.com/go-kit/kit/util/conn/manager.go +++ b/vendor/github.com/go-kit/kit/util/conn/manager.go @@ -2,6 +2,7 @@ package conn import ( "errors" + "math/rand" "net" "time" @@ -103,7 +104,7 @@ func (m *Manager) loop() { case conn = <-connc: if conn == nil { // didn't work - backoff = exponential(backoff) // wait longer + backoff = Exponential(backoff) // wait longer reconnectc = m.after(backoff) // try again } else { // worked! @@ -132,12 +133,18 @@ func dial(d Dialer, network, address string, logger log.Logger) net.Conn { return conn } -func exponential(d time.Duration) time.Duration { +// Exponential takes a duration and returns another one that is twice as long, +/- 50%. It is +// used to provide backoff for operations that may fail and should avoid thundering herds. +// See https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ for rationale +func Exponential(d time.Duration) time.Duration { d *= 2 + jitter := rand.Float64() + 0.5 + d = time.Duration(int64(float64(d.Nanoseconds()) * jitter)) if d > time.Minute { d = time.Minute } return d + } // ErrConnectionUnavailable is returned by the Manager's Write method when the diff --git a/vendor/github.com/go-stack/stack/stack.go b/vendor/github.com/go-stack/stack/stack.go deleted file mode 100644 index 8033c4013..000000000 --- a/vendor/github.com/go-stack/stack/stack.go +++ /dev/null @@ -1,322 +0,0 @@ -// Package stack implements utilities to capture, manipulate, and format call -// stacks. It provides a simpler API than package runtime. -// -// The implementation takes care of the minutia and special cases of -// interpreting the program counter (pc) values returned by runtime.Callers. -// -// Package stack's types implement fmt.Formatter, which provides a simple and -// flexible way to declaratively configure formatting when used with logging -// or error tracking packages. -package stack - -import ( - "bytes" - "errors" - "fmt" - "io" - "runtime" - "strconv" - "strings" -) - -// Call records a single function invocation from a goroutine stack. -type Call struct { - fn *runtime.Func - pc uintptr -} - -// Caller returns a Call from the stack of the current goroutine. The argument -// skip is the number of stack frames to ascend, with 0 identifying the -// calling function. -func Caller(skip int) Call { - var pcs [2]uintptr - n := runtime.Callers(skip+1, pcs[:]) - - var c Call - - if n < 2 { - return c - } - - c.pc = pcs[1] - if runtime.FuncForPC(pcs[0]).Name() != "runtime.sigpanic" { - c.pc-- - } - c.fn = runtime.FuncForPC(c.pc) - return c -} - -// String implements fmt.Stinger. It is equivalent to fmt.Sprintf("%v", c). -func (c Call) String() string { - return fmt.Sprint(c) -} - -// MarshalText implements encoding.TextMarshaler. It formats the Call the same -// as fmt.Sprintf("%v", c). -func (c Call) MarshalText() ([]byte, error) { - if c.fn == nil { - return nil, ErrNoFunc - } - buf := bytes.Buffer{} - fmt.Fprint(&buf, c) - return buf.Bytes(), nil -} - -// ErrNoFunc means that the Call has a nil *runtime.Func. The most likely -// cause is a Call with the zero value. -var ErrNoFunc = errors.New("no call stack information") - -// Format implements fmt.Formatter with support for the following verbs. -// -// %s source file -// %d line number -// %n function name -// %v equivalent to %s:%d -// -// It accepts the '+' and '#' flags for most of the verbs as follows. -// -// %+s path of source file relative to the compile time GOPATH -// %#s full path of source file -// %+n import path qualified function name -// %+v equivalent to %+s:%d -// %#v equivalent to %#s:%d -func (c Call) Format(s fmt.State, verb rune) { - if c.fn == nil { - fmt.Fprintf(s, "%%!%c(NOFUNC)", verb) - return - } - - switch verb { - case 's', 'v': - file, line := c.fn.FileLine(c.pc) - switch { - case s.Flag('#'): - // done - case s.Flag('+'): - file = file[pkgIndex(file, c.fn.Name()):] - default: - const sep = "/" - if i := strings.LastIndex(file, sep); i != -1 { - file = file[i+len(sep):] - } - } - io.WriteString(s, file) - if verb == 'v' { - buf := [7]byte{':'} - s.Write(strconv.AppendInt(buf[:1], int64(line), 10)) - } - - case 'd': - _, line := c.fn.FileLine(c.pc) - buf := [6]byte{} - s.Write(strconv.AppendInt(buf[:0], int64(line), 10)) - - case 'n': - name := c.fn.Name() - if !s.Flag('+') { - const pathSep = "/" - if i := strings.LastIndex(name, pathSep); i != -1 { - name = name[i+len(pathSep):] - } - const pkgSep = "." - if i := strings.Index(name, pkgSep); i != -1 { - name = name[i+len(pkgSep):] - } - } - io.WriteString(s, name) - } -} - -// PC returns the program counter for this call frame; multiple frames may -// have the same PC value. -func (c Call) PC() uintptr { - return c.pc -} - -// name returns the import path qualified name of the function containing the -// call. -func (c Call) name() string { - if c.fn == nil { - return "???" - } - return c.fn.Name() -} - -func (c Call) file() string { - if c.fn == nil { - return "???" - } - file, _ := c.fn.FileLine(c.pc) - return file -} - -func (c Call) line() int { - if c.fn == nil { - return 0 - } - _, line := c.fn.FileLine(c.pc) - return line -} - -// CallStack records a sequence of function invocations from a goroutine -// stack. -type CallStack []Call - -// String implements fmt.Stinger. It is equivalent to fmt.Sprintf("%v", cs). -func (cs CallStack) String() string { - return fmt.Sprint(cs) -} - -var ( - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - spaceBytes = []byte(" ") -) - -// MarshalText implements encoding.TextMarshaler. It formats the CallStack the -// same as fmt.Sprintf("%v", cs). -func (cs CallStack) MarshalText() ([]byte, error) { - buf := bytes.Buffer{} - buf.Write(openBracketBytes) - for i, pc := range cs { - if pc.fn == nil { - return nil, ErrNoFunc - } - if i > 0 { - buf.Write(spaceBytes) - } - fmt.Fprint(&buf, pc) - } - buf.Write(closeBracketBytes) - return buf.Bytes(), nil -} - -// Format implements fmt.Formatter by printing the CallStack as square brackets -// ([, ]) surrounding a space separated list of Calls each formatted with the -// supplied verb and options. -func (cs CallStack) Format(s fmt.State, verb rune) { - s.Write(openBracketBytes) - for i, pc := range cs { - if i > 0 { - s.Write(spaceBytes) - } - pc.Format(s, verb) - } - s.Write(closeBracketBytes) -} - -// Trace returns a CallStack for the current goroutine with element 0 -// identifying the calling function. -func Trace() CallStack { - var pcs [512]uintptr - n := runtime.Callers(2, pcs[:]) - cs := make([]Call, n) - - for i, pc := range pcs[:n] { - pcFix := pc - if i > 0 && cs[i-1].fn.Name() != "runtime.sigpanic" { - pcFix-- - } - cs[i] = Call{ - fn: runtime.FuncForPC(pcFix), - pc: pcFix, - } - } - - return cs -} - -// TrimBelow returns a slice of the CallStack with all entries below c -// removed. -func (cs CallStack) TrimBelow(c Call) CallStack { - for len(cs) > 0 && cs[0].pc != c.pc { - cs = cs[1:] - } - return cs -} - -// TrimAbove returns a slice of the CallStack with all entries above c -// removed. -func (cs CallStack) TrimAbove(c Call) CallStack { - for len(cs) > 0 && cs[len(cs)-1].pc != c.pc { - cs = cs[:len(cs)-1] - } - return cs -} - -// pkgIndex returns the index that results in file[index:] being the path of -// file relative to the compile time GOPATH, and file[:index] being the -// $GOPATH/src/ portion of file. funcName must be the name of a function in -// file as returned by runtime.Func.Name. -func pkgIndex(file, funcName string) int { - // As of Go 1.6.2 there is no direct way to know the compile time GOPATH - // at runtime, but we can infer the number of path segments in the GOPATH. - // We note that runtime.Func.Name() returns the function name qualified by - // the import path, which does not include the GOPATH. Thus we can trim - // segments from the beginning of the file path until the number of path - // separators remaining is one more than the number of path separators in - // the function name. For example, given: - // - // GOPATH /home/user - // file /home/user/src/pkg/sub/file.go - // fn.Name() pkg/sub.Type.Method - // - // We want to produce: - // - // file[:idx] == /home/user/src/ - // file[idx:] == pkg/sub/file.go - // - // From this we can easily see that fn.Name() has one less path separator - // than our desired result for file[idx:]. We count separators from the - // end of the file path until it finds two more than in the function name - // and then move one character forward to preserve the initial path - // segment without a leading separator. - const sep = "/" - i := len(file) - for n := strings.Count(funcName, sep) + 2; n > 0; n-- { - i = strings.LastIndex(file[:i], sep) - if i == -1 { - i = -len(sep) - break - } - } - // get back to 0 or trim the leading separator - return i + len(sep) -} - -var runtimePath string - -func init() { - var pcs [1]uintptr - runtime.Callers(0, pcs[:]) - fn := runtime.FuncForPC(pcs[0]) - file, _ := fn.FileLine(pcs[0]) - - idx := pkgIndex(file, fn.Name()) - - runtimePath = file[:idx] - if runtime.GOOS == "windows" { - runtimePath = strings.ToLower(runtimePath) - } -} - -func inGoroot(c Call) bool { - file := c.file() - if len(file) == 0 || file[0] == '?' { - return true - } - if runtime.GOOS == "windows" { - file = strings.ToLower(file) - } - return strings.HasPrefix(file, runtimePath) || strings.HasSuffix(file, "/_testmain.go") -} - -// TrimRuntime returns a slice of the CallStack with the topmost entries from -// the go runtime removed. It considers any calls originating from unknown -// files, files under GOROOT, or _testmain.go as part of the runtime. -func (cs CallStack) TrimRuntime() CallStack { - for len(cs) > 0 && inGoroot(cs[len(cs)-1]) { - cs = cs[:len(cs)-1] - } - return cs -} diff --git a/vendor/github.com/influxdata/influxdb/LICENSE b/vendor/github.com/influxdata/influxdb/LICENSE deleted file mode 100644 index 63cef79ba..000000000 --- a/vendor/github.com/influxdata/influxdb/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2016 Errplane Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md b/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md deleted file mode 100644 index 949a7b3c8..000000000 --- a/vendor/github.com/influxdata/influxdb/LICENSE_OF_DEPENDENCIES.md +++ /dev/null @@ -1,25 +0,0 @@ -# List -- bootstrap 3.3.5 [MIT LICENSE](https://github.com/twbs/bootstrap/blob/master/LICENSE) -- collectd.org [ISC LICENSE](https://github.com/collectd/go-collectd/blob/master/LICENSE) -- github.com/BurntSushi/toml [WTFPL LICENSE](https://github.com/BurntSushi/toml/blob/master/COPYING) -- github.com/bmizerany/pat [MIT LICENSE](https://github.com/bmizerany/pat#license) -- github.com/boltdb/bolt [MIT LICENSE](https://github.com/boltdb/bolt/blob/master/LICENSE) -- github.com/cespare/xxhash [MIT LICENSE](https://github.com/cespare/xxhash/blob/master/LICENSE.txt) -- github.com/clarkduvall/hyperloglog [MIT LICENSE](https://github.com/clarkduvall/hyperloglog/blob/master/LICENSE) -- github.com/davecgh/go-spew/spew [ISC LICENSE](https://github.com/davecgh/go-spew/blob/master/LICENSE) -- github.com/dgrijalva/jwt-go [MIT LICENSE](https://github.com/dgrijalva/jwt-go/blob/master/LICENSE) -- github.com/dgryski/go-bits [MIT LICENSE](https://github.com/dgryski/go-bits/blob/master/LICENSE) -- github.com/dgryski/go-bitstream [MIT LICENSE](https://github.com/dgryski/go-bitstream/blob/master/LICENSE) -- github.com/gogo/protobuf/proto [BSD LICENSE](https://github.com/gogo/protobuf/blob/master/LICENSE) -- github.com/golang/snappy [BSD LICENSE](https://github.com/golang/snappy/blob/master/LICENSE) -- github.com/google/go-cmp [BSD LICENSE](https://github.com/google/go-cmp/blob/master/LICENSE) -- github.com/influxdata/usage-client [MIT LICENSE](https://github.com/influxdata/usage-client/blob/master/LICENSE.txt) -- github.com/jwilder/encoding [MIT LICENSE](https://github.com/jwilder/encoding/blob/master/LICENSE) -- github.com/paulbellamy/ratecounter [MIT LICENSE](https://github.com/paulbellamy/ratecounter/blob/master/LICENSE) -- github.com/peterh/liner [MIT LICENSE](https://github.com/peterh/liner/blob/master/COPYING) -- github.com/rakyll/statik [APACHE LICENSE](https://github.com/rakyll/statik/blob/master/LICENSE) -- github.com/retailnext/hllpp [BSD LICENSE](https://github.com/retailnext/hllpp/blob/master/LICENSE) -- github.com/uber-go/atomic [MIT LICENSE](https://github.com/uber-go/atomic/blob/master/LICENSE.txt) -- github.com/uber-go/zap [MIT LICENSE](https://github.com/uber-go/zap/blob/master/LICENSE.txt) -- golang.org/x/crypto [BSD LICENSE](https://github.com/golang/crypto/blob/master/LICENSE) -- jquery 2.1.4 [MIT LICENSE](https://github.com/jquery/jquery/blob/master/LICENSE.txt) diff --git a/vendor/github.com/influxdata/influxdb/models/consistency.go b/vendor/github.com/influxdata/influxdb/models/consistency.go deleted file mode 100644 index 2a3269bca..000000000 --- a/vendor/github.com/influxdata/influxdb/models/consistency.go +++ /dev/null @@ -1,48 +0,0 @@ -package models - -import ( - "errors" - "strings" -) - -// ConsistencyLevel represent a required replication criteria before a write can -// be returned as successful. -// -// The consistency level is handled in open-source InfluxDB but only applicable to clusters. -type ConsistencyLevel int - -const ( - // ConsistencyLevelAny allows for hinted handoff, potentially no write happened yet. - ConsistencyLevelAny ConsistencyLevel = iota - - // ConsistencyLevelOne requires at least one data node acknowledged a write. - ConsistencyLevelOne - - // ConsistencyLevelQuorum requires a quorum of data nodes to acknowledge a write. - ConsistencyLevelQuorum - - // ConsistencyLevelAll requires all data nodes to acknowledge a write. - ConsistencyLevelAll -) - -var ( - // ErrInvalidConsistencyLevel is returned when parsing the string version - // of a consistency level. - ErrInvalidConsistencyLevel = errors.New("invalid consistency level") -) - -// ParseConsistencyLevel converts a consistency level string to the corresponding ConsistencyLevel const. -func ParseConsistencyLevel(level string) (ConsistencyLevel, error) { - switch strings.ToLower(level) { - case "any": - return ConsistencyLevelAny, nil - case "one": - return ConsistencyLevelOne, nil - case "quorum": - return ConsistencyLevelQuorum, nil - case "all": - return ConsistencyLevelAll, nil - default: - return 0, ErrInvalidConsistencyLevel - } -} diff --git a/vendor/github.com/go-stack/stack/LICENSE.md b/vendor/github.com/influxdata/influxdb1-client/LICENSE similarity index 95% rename from vendor/github.com/go-stack/stack/LICENSE.md rename to vendor/github.com/influxdata/influxdb1-client/LICENSE index 2abf98ea8..83bafde92 100644 --- a/vendor/github.com/go-stack/stack/LICENSE.md +++ b/vendor/github.com/influxdata/influxdb1-client/LICENSE @@ -1,6 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2014 Chris Hines +Copyright (c) 2019 InfluxData Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/github.com/influxdata/influxdb/models/inline_fnv.go b/vendor/github.com/influxdata/influxdb1-client/models/inline_fnv.go similarity index 91% rename from vendor/github.com/influxdata/influxdb/models/inline_fnv.go rename to vendor/github.com/influxdata/influxdb1-client/models/inline_fnv.go index eec1ae8b0..177885d0c 100644 --- a/vendor/github.com/influxdata/influxdb/models/inline_fnv.go +++ b/vendor/github.com/influxdata/influxdb1-client/models/inline_fnv.go @@ -1,4 +1,4 @@ -package models // import "github.com/influxdata/influxdb/models" +package models // import "github.com/influxdata/influxdb1-client/models" // from stdlib hash/fnv/fnv.go const ( diff --git a/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go b/vendor/github.com/influxdata/influxdb1-client/models/inline_strconv_parse.go similarity index 77% rename from vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go rename to vendor/github.com/influxdata/influxdb1-client/models/inline_strconv_parse.go index dcc8ae402..7d171b313 100644 --- a/vendor/github.com/influxdata/influxdb/models/inline_strconv_parse.go +++ b/vendor/github.com/influxdata/influxdb1-client/models/inline_strconv_parse.go @@ -1,4 +1,4 @@ -package models // import "github.com/influxdata/influxdb/models" +package models // import "github.com/influxdata/influxdb1-client/models" import ( "reflect" @@ -12,6 +12,12 @@ func parseIntBytes(b []byte, base int, bitSize int) (i int64, err error) { return strconv.ParseInt(s, base, bitSize) } +// parseUintBytes is a zero-alloc wrapper around strconv.ParseUint. +func parseUintBytes(b []byte, base int, bitSize int) (i uint64, err error) { + s := unsafeBytesToString(b) + return strconv.ParseUint(s, base, bitSize) +} + // parseFloatBytes is a zero-alloc wrapper around strconv.ParseFloat. func parseFloatBytes(b []byte, bitSize int) (float64, error) { s := unsafeBytesToString(b) diff --git a/vendor/github.com/influxdata/influxdb/models/points.go b/vendor/github.com/influxdata/influxdb1-client/models/points.go similarity index 86% rename from vendor/github.com/influxdata/influxdb/models/points.go rename to vendor/github.com/influxdata/influxdb1-client/models/points.go index b2d234811..f51163070 100644 --- a/vendor/github.com/influxdata/influxdb/models/points.go +++ b/vendor/github.com/influxdata/influxdb1-client/models/points.go @@ -1,5 +1,5 @@ // Package models implements basic objects used throughout the TICK stack. -package models // import "github.com/influxdata/influxdb/models" +package models // import "github.com/influxdata/influxdb1-client/models" import ( "bytes" @@ -12,20 +12,27 @@ import ( "strconv" "strings" "time" + "unicode" + "unicode/utf8" - "github.com/influxdata/influxdb/pkg/escape" + "github.com/influxdata/influxdb1-client/pkg/escape" ) +type escapeSet struct { + k [1]byte + esc [2]byte +} + var ( - measurementEscapeCodes = map[byte][]byte{ - ',': []byte(`\,`), - ' ': []byte(`\ `), + measurementEscapeCodes = [...]escapeSet{ + {k: [1]byte{','}, esc: [2]byte{'\\', ','}}, + {k: [1]byte{' '}, esc: [2]byte{'\\', ' '}}, } - tagEscapeCodes = map[byte][]byte{ - ',': []byte(`\,`), - ' ': []byte(`\ `), - '=': []byte(`\=`), + tagEscapeCodes = [...]escapeSet{ + {k: [1]byte{','}, esc: [2]byte{'\\', ','}}, + {k: [1]byte{' '}, esc: [2]byte{'\\', ' '}}, + {k: [1]byte{'='}, esc: [2]byte{'\\', '='}}, } // ErrPointMustHaveAField is returned when operating on a point that does not have any fields. @@ -43,6 +50,16 @@ const ( MaxKeyLength = 65535 ) +// enableUint64Support will enable uint64 support if set to true. +var enableUint64Support = false + +// EnableUintSupport manually enables uint support for the point parser. +// This function will be removed in the future and only exists for unit tests during the +// transition. +func EnableUintSupport() { + enableUint64Support = true +} + // Point defines the values that will be written to the database. type Point interface { // Name return the measurement name for the point. @@ -54,6 +71,9 @@ type Point interface { // Tags returns the tag set for the point. Tags() Tags + // ForEachTag iterates over each tag invoking fn. If fn return false, iteration stops. + ForEachTag(fn func(k, v []byte) bool) + // AddTag adds or replaces a tag value for a point. AddTag(key, value string) @@ -137,6 +157,9 @@ const ( // Empty is used to indicate that there is no field. Empty + + // Unsigned indicates the field's type is an unsigned integer. + Unsigned ) // FieldIterator provides a low-allocation interface to iterate through a point's fields. @@ -156,6 +179,9 @@ type FieldIterator interface { // IntegerValue returns the integer value of the current field. IntegerValue() (int64, error) + // UnsignedValue returns the unsigned value of the current field. + UnsignedValue() (uint64, error) + // BooleanValue returns the boolean value of the current field. BooleanValue() (bool, error) @@ -205,6 +231,12 @@ type point struct { it fieldIterator } +// type assertions +var ( + _ Point = (*point)(nil) + _ FieldIterator = (*point)(nil) +) + const ( // the number of characters for the largest possible int64 (9223372036854775807) maxInt64Digits = 19 @@ -212,6 +244,9 @@ const ( // the number of characters for the smallest possible int64 (-9223372036854775808) minInt64Digits = 20 + // the number of characters for the largest possible uint64 (18446744073709551615) + maxUint64Digits = 20 + // the number of characters required for the largest float64 before a range check // would occur during parsing maxFloat64Digits = 25 @@ -238,31 +273,46 @@ func ParsePointsString(buf string) ([]Point, error) { // NOTE: to minimize heap allocations, the returned Tags will refer to subslices of buf. // This can have the unintended effect preventing buf from being garbage collected. func ParseKey(buf []byte) (string, Tags) { + name, tags := ParseKeyBytes(buf) + return string(name), tags +} + +func ParseKeyBytes(buf []byte) ([]byte, Tags) { + return ParseKeyBytesWithTags(buf, nil) +} + +func ParseKeyBytesWithTags(buf []byte, tags Tags) ([]byte, Tags) { // Ignore the error because scanMeasurement returns "missing fields" which we ignore // when just parsing a key state, i, _ := scanMeasurement(buf, 0) - var tags Tags + var name []byte if state == tagKeyState { - tags = parseTags(buf) + tags = parseTags(buf, tags) // scanMeasurement returns the location of the comma if there are tags, strip that off - return string(buf[:i-1]), tags + name = buf[:i-1] + } else { + name = buf[:i] } - return string(buf[:i]), tags + return unescapeMeasurement(name), tags } -func ParseTags(buf []byte) (Tags, error) { - return parseTags(buf), nil +func ParseTags(buf []byte) Tags { + return parseTags(buf, nil) } -func ParseName(buf []byte) ([]byte, error) { +func ParseName(buf []byte) []byte { // Ignore the error because scanMeasurement returns "missing fields" which we ignore // when just parsing a key state, i, _ := scanMeasurement(buf, 0) + var name []byte if state == tagKeyState { - return buf[:i-1], nil + name = buf[:i-1] + } else { + name = buf[:i] } - return buf[:i], nil + + return unescapeMeasurement(name) } // ParsePointsWithPrecision is similar to ParsePoints, but allows the @@ -285,7 +335,6 @@ func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision strin continue } - // lines which start with '#' are comments start := skipWhitespace(block, 0) // If line is all whitespace, just skip it @@ -293,6 +342,7 @@ func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision strin continue } + // lines which start with '#' are comments if block[start] == '#' { continue } @@ -318,7 +368,7 @@ func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision strin } func parsePoint(buf []byte, defaultTime time.Time, precision string) (Point, error) { - // scan the first block which is measurement[,tag1=value1,tag2=value=2...] + // scan the first block which is measurement[,tag1=value1,tag2=value2...] pos, key, err := scanKey(buf, 0) if err != nil { return nil, err @@ -345,7 +395,7 @@ func parsePoint(buf []byte, defaultTime time.Time, precision string) (Point, err } var maxKeyErr error - walkFields(fields, func(k, v []byte) bool { + err = walkFields(fields, func(k, v []byte) bool { if sz := seriesKeySize(key, k); sz > MaxKeyLength { maxKeyErr = fmt.Errorf("max key length exceeded: %v > %v", sz, MaxKeyLength) return false @@ -353,6 +403,10 @@ func parsePoint(buf []byte, defaultTime time.Time, precision string) (Point, err return true }) + if err != nil { + return nil, err + } + if maxKeyErr != nil { return nil, maxKeyErr } @@ -815,7 +869,7 @@ func isNumeric(b byte) bool { // error if a invalid number is scanned. func scanNumber(buf []byte, i int) (int, error) { start := i - var isInt bool + var isInt, isUnsigned bool // Is negative number? if i < len(buf) && buf[i] == '-' { @@ -841,10 +895,14 @@ func scanNumber(buf []byte, i int) (int, error) { break } - if buf[i] == 'i' && i > start && !isInt { + if buf[i] == 'i' && i > start && !(isInt || isUnsigned) { isInt = true i++ continue + } else if buf[i] == 'u' && i > start && !(isInt || isUnsigned) { + isUnsigned = true + i++ + continue } if buf[i] == '.' { @@ -879,7 +937,7 @@ func scanNumber(buf []byte, i int) (int, error) { i++ } - if isInt && (decimal || scientific) { + if (isInt || isUnsigned) && (decimal || scientific) { return i, ErrInvalidNumber } @@ -914,6 +972,26 @@ func scanNumber(buf []byte, i int) (int, error) { return i, fmt.Errorf("unable to parse integer %s: %s", buf[start:i-1], err) } } + } else if isUnsigned { + // Return an error if uint64 support has not been enabled. + if !enableUint64Support { + return i, ErrInvalidNumber + } + // Make sure the last char is a 'u' for unsigned + if buf[i-1] != 'u' { + return i, ErrInvalidNumber + } + // Make sure the first char is not a '-' for unsigned + if buf[start] == '-' { + return i, ErrInvalidNumber + } + // Parse the uint to check bounds the number of digits could be larger than the max range + // We subtract 1 from the index to remove the `u` from our tests + if len(buf[start:i-1]) >= maxUint64Digits { + if _, err := parseUintBytes(buf[start:i-1], 10, 64); err != nil { + return i, fmt.Errorf("unable to parse unsigned %s: %s", buf[start:i-1], err) + } + } } else { // Parse the float to check bounds if it's scientific or the number of digits could be larger than the max range if scientific || len(buf[start:i]) >= maxFloat64Digits || len(buf[start:i]) >= minFloat64Digits { @@ -1015,7 +1093,7 @@ func scanLine(buf []byte, i int) (int, []byte) { } // skip past escaped characters - if buf[i] == '\\' { + if buf[i] == '\\' && i+2 < len(buf) { i += 2 continue } @@ -1144,24 +1222,34 @@ func scanFieldValue(buf []byte, i int) (int, []byte) { return i, buf[start:i] } -func escapeMeasurement(in []byte) []byte { - for b, esc := range measurementEscapeCodes { - in = bytes.Replace(in, []byte{b}, esc, -1) +func EscapeMeasurement(in []byte) []byte { + for _, c := range measurementEscapeCodes { + if bytes.IndexByte(in, c.k[0]) != -1 { + in = bytes.Replace(in, c.k[:], c.esc[:], -1) + } } return in } func unescapeMeasurement(in []byte) []byte { - for b, esc := range measurementEscapeCodes { - in = bytes.Replace(in, esc, []byte{b}, -1) + if bytes.IndexByte(in, '\\') == -1 { + return in + } + + for i := range measurementEscapeCodes { + c := &measurementEscapeCodes[i] + if bytes.IndexByte(in, c.k[0]) != -1 { + in = bytes.Replace(in, c.esc[:], c.k[:], -1) + } } return in } func escapeTag(in []byte) []byte { - for b, esc := range tagEscapeCodes { - if bytes.IndexByte(in, b) != -1 { - in = bytes.Replace(in, []byte{b}, esc, -1) + for i := range tagEscapeCodes { + c := &tagEscapeCodes[i] + if bytes.IndexByte(in, c.k[0]) != -1 { + in = bytes.Replace(in, c.k[:], c.esc[:], -1) } } return in @@ -1172,9 +1260,10 @@ func unescapeTag(in []byte) []byte { return in } - for b, esc := range tagEscapeCodes { - if bytes.IndexByte(in, b) != -1 { - in = bytes.Replace(in, esc, []byte{b}, -1) + for i := range tagEscapeCodes { + c := &tagEscapeCodes[i] + if bytes.IndexByte(in, c.k[0]) != -1 { + in = bytes.Replace(in, c.esc[:], c.k[:], -1) } } return in @@ -1226,7 +1315,8 @@ func unescapeStringField(in string) string { } // NewPoint returns a new point with the given measurement name, tags, fields and timestamp. If -// an unsupported field value (NaN) or out of range time is passed, this function returns an error. +// an unsupported field value (NaN, or +/-Inf) or out of range time is passed, this function +// returns an error. func NewPoint(name string, tags Tags, fields Fields, t time.Time) (Point, error) { key, err := pointKey(name, tags, fields, t) if err != nil { @@ -1257,11 +1347,17 @@ func pointKey(measurement string, tags Tags, fields Fields, t time.Time) ([]byte switch value := value.(type) { case float64: // Ensure the caller validates and handles invalid field values + if math.IsInf(value, 0) { + return nil, fmt.Errorf("+/-Inf is an unsupported value for field %s", key) + } if math.IsNaN(value) { return nil, fmt.Errorf("NaN is an unsupported value for field %s", key) } case float32: // Ensure the caller validates and handles invalid field values + if math.IsInf(float64(value), 0) { + return nil, fmt.Errorf("+/-Inf is an unsupported value for field %s", key) + } if math.IsNaN(float64(value)) { return nil, fmt.Errorf("NaN is an unsupported value for field %s", key) } @@ -1315,6 +1411,11 @@ func NewPointFromBytes(b []byte) (Point, error) { if err != nil { return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err) } + case Unsigned: + _, err := iter.UnsignedValue() + if err != nil { + return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err) + } case String: // Skip since this won't return an error case Boolean: @@ -1382,10 +1483,14 @@ func (p *point) Tags() Tags { if p.cachedTags != nil { return p.cachedTags } - p.cachedTags = parseTags(p.key) + p.cachedTags = parseTags(p.key, nil) return p.cachedTags } +func (p *point) ForEachTag(fn func(k, v []byte) bool) { + walkTags(p.key, fn) +} + func (p *point) HasTag(tag []byte) bool { if len(p.key) == 0 { return false @@ -1445,11 +1550,14 @@ func walkTags(buf []byte, fn func(key, value []byte) bool) { // walkFields walks each field key and value via fn. If fn returns false, the iteration // is stopped. The values are the raw byte slices and not the converted types. -func walkFields(buf []byte, fn func(key, value []byte) bool) { +func walkFields(buf []byte, fn func(key, value []byte) bool) error { var i int var key, val []byte for len(buf) > 0 { i, key = scanTo(buf, 0, '=') + if i > len(buf)-2 { + return fmt.Errorf("invalid value: field-key=%s", key) + } buf = buf[i+1:] i, val = scanFieldValue(buf, 0) buf = buf[i:] @@ -1462,26 +1570,52 @@ func walkFields(buf []byte, fn func(key, value []byte) bool) { buf = buf[1:] } } + return nil } -func parseTags(buf []byte) Tags { +// parseTags parses buf into the provided destination tags, returning destination +// Tags, which may have a different length and capacity. +func parseTags(buf []byte, dst Tags) Tags { if len(buf) == 0 { return nil } - tags := make(Tags, 0, bytes.Count(buf, []byte(","))) + n := bytes.Count(buf, []byte(",")) + if cap(dst) < n { + dst = make(Tags, n) + } else { + dst = dst[:n] + } + + // Ensure existing behaviour when point has no tags and nil slice passed in. + if dst == nil { + dst = Tags{} + } + + // Series keys can contain escaped commas, therefore the number of commas + // in a series key only gives an estimation of the upper bound on the number + // of tags. + var i int walkTags(buf, func(key, value []byte) bool { - tags = append(tags, NewTag(key, value)) + dst[i].Key, dst[i].Value = key, value + i++ return true }) - return tags + return dst[:i] } // MakeKey creates a key for a set of tags. func MakeKey(name []byte, tags Tags) []byte { + return AppendMakeKey(nil, name, tags) +} + +// AppendMakeKey appends the key derived from name and tags to dst and returns the extended buffer. +func AppendMakeKey(dst []byte, name []byte, tags Tags) []byte { // unescape the name and then re-escape it to avoid double escaping. // The key should always be stored in escaped form. - return append(escapeMeasurement(unescapeMeasurement(name)), tags.HashKey()...) + dst = append(dst, EscapeMeasurement(unescapeMeasurement(name))...) + dst = tags.AppendHashKey(dst) + return dst } // SetTags replaces the tags for the point. @@ -1630,10 +1764,7 @@ func (p *point) UnmarshalBinary(b []byte) error { p.fields, b = b[:n], b[n:] // Read timestamp. - if err := p.time.UnmarshalBinary(b); err != nil { - return err - } - return nil + return p.time.UnmarshalBinary(b) } // PrecisionString returns a string representation of the point. If there @@ -1678,6 +1809,12 @@ func (p *point) unmarshalBinary() (Fields, error) { return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err) } fields[string(iter.FieldKey())] = v + case Unsigned: + v, err := iter.UnsignedValue() + if err != nil { + return nil, fmt.Errorf("unable to unmarshal field %s: %s", string(iter.FieldKey()), err) + } + fields[string(iter.FieldKey())] = v case String: fields[string(iter.FieldKey())] = iter.StringValue() case Boolean: @@ -1708,7 +1845,7 @@ func (p *point) UnixNano() int64 { // string representations are no longer than size. Points with a single field or // a point without a timestamp may exceed the requested size. func (p *point) Split(size int) []Point { - if p.time.IsZero() || len(p.String()) <= size { + if p.time.IsZero() || p.StringSize() <= size { return []Point{p} } @@ -1803,6 +1940,82 @@ func NewTags(m map[string]string) Tags { return a } +// HashKey hashes all of a tag's keys. +func (a Tags) HashKey() []byte { + return a.AppendHashKey(nil) +} + +func (a Tags) needsEscape() bool { + for i := range a { + t := &a[i] + for j := range tagEscapeCodes { + c := &tagEscapeCodes[j] + if bytes.IndexByte(t.Key, c.k[0]) != -1 || bytes.IndexByte(t.Value, c.k[0]) != -1 { + return true + } + } + } + return false +} + +// AppendHashKey appends the result of hashing all of a tag's keys and values to dst and returns the extended buffer. +func (a Tags) AppendHashKey(dst []byte) []byte { + // Empty maps marshal to empty bytes. + if len(a) == 0 { + return dst + } + + // Type invariant: Tags are sorted + + sz := 0 + var escaped Tags + if a.needsEscape() { + var tmp [20]Tag + if len(a) < len(tmp) { + escaped = tmp[:len(a)] + } else { + escaped = make(Tags, len(a)) + } + + for i := range a { + t := &a[i] + nt := &escaped[i] + nt.Key = escapeTag(t.Key) + nt.Value = escapeTag(t.Value) + sz += len(nt.Key) + len(nt.Value) + } + } else { + sz = a.Size() + escaped = a + } + + sz += len(escaped) + (len(escaped) * 2) // separators + + // Generate marshaled bytes. + if cap(dst)-len(dst) < sz { + nd := make([]byte, len(dst), len(dst)+sz) + copy(nd, dst) + dst = nd + } + buf := dst[len(dst) : len(dst)+sz] + idx := 0 + for i := range escaped { + k := &escaped[i] + if len(k.Value) == 0 { + continue + } + buf[idx] = ',' + idx++ + copy(buf[idx:], k.Key) + idx += len(k.Key) + buf[idx] = '=' + idx++ + copy(buf[idx:], k.Value) + idx += len(k.Value) + } + return dst[:len(dst)+idx] +} + // String returns the string representation of the tags. func (a Tags) String() string { var buf bytes.Buffer @@ -1822,8 +2035,8 @@ func (a Tags) String() string { // for data structures or delimiters for example. func (a Tags) Size() int { var total int - for _, t := range a { - total += t.Size() + for i := range a { + total += a[i].Size() } return total } @@ -1919,18 +2132,6 @@ func (a *Tags) SetString(key, value string) { a.Set([]byte(key), []byte(value)) } -// Delete removes a tag by key. -func (a *Tags) Delete(key []byte) { - for i, t := range *a { - if bytes.Equal(t.Key, key) { - copy((*a)[i:], (*a)[i+1:]) - (*a)[len(*a)-1] = Tag{} - *a = (*a)[:len(*a)-1] - return - } - } -} - // Map returns a map representation of the tags. func (a Tags) Map() map[string]string { m := make(map[string]string, len(a)) @@ -1940,60 +2141,6 @@ func (a Tags) Map() map[string]string { return m } -// Merge merges the tags combining the two. If both define a tag with the -// same key, the merged value overwrites the old value. -// A new map is returned. -func (a Tags) Merge(other map[string]string) Tags { - merged := make(map[string]string, len(a)+len(other)) - for _, t := range a { - merged[string(t.Key)] = string(t.Value) - } - for k, v := range other { - merged[k] = v - } - return NewTags(merged) -} - -// HashKey hashes all of a tag's keys. -func (a Tags) HashKey() []byte { - // Empty maps marshal to empty bytes. - if len(a) == 0 { - return nil - } - - // Type invariant: Tags are sorted - - escaped := make(Tags, 0, len(a)) - sz := 0 - for _, t := range a { - ek := escapeTag(t.Key) - ev := escapeTag(t.Value) - - if len(ev) > 0 { - escaped = append(escaped, Tag{Key: ek, Value: ev}) - sz += len(ek) + len(ev) - } - } - - sz += len(escaped) + (len(escaped) * 2) // separators - - // Generate marshaled bytes. - b := make([]byte, sz) - buf := b - idx := 0 - for _, k := range escaped { - buf[idx] = ',' - idx++ - copy(buf[idx:idx+len(k.Key)], k.Key) - idx += len(k.Key) - buf[idx] = '=' - idx++ - copy(buf[idx:idx+len(k.Value)], k.Value) - idx += len(k.Value) - } - return b[:idx] -} - // CopyTags returns a shallow copy of tags. func CopyTags(a Tags) Tags { other := make(Tags, len(a)) @@ -2071,10 +2218,13 @@ func (p *point) Next() bool { return true } - if strings.IndexByte(`0123456789-.nNiI`, c) >= 0 { + if strings.IndexByte(`0123456789-.nNiIu`, c) >= 0 { if p.it.valueBuf[len(p.it.valueBuf)-1] == 'i' { p.it.fieldType = Integer p.it.valueBuf = p.it.valueBuf[:len(p.it.valueBuf)-1] + } else if p.it.valueBuf[len(p.it.valueBuf)-1] == 'u' { + p.it.fieldType = Unsigned + p.it.valueBuf = p.it.valueBuf[:len(p.it.valueBuf)-1] } else { p.it.fieldType = Float } @@ -2110,6 +2260,15 @@ func (p *point) IntegerValue() (int64, error) { return n, nil } +// UnsignedValue returns the unsigned value of the current field. +func (p *point) UnsignedValue() (uint64, error) { + n, err := parseUintBytes(p.it.valueBuf, 10, 64) + if err != nil { + return 0, fmt.Errorf("unable to parse unsigned value %q: %v", p.it.valueBuf, err) + } + return n, nil +} + // BooleanValue returns the boolean value of the current field. func (p *point) BooleanValue() (bool, error) { b, err := parseBoolBytes(p.it.valueBuf) @@ -2192,6 +2351,9 @@ func appendField(b []byte, k string, v interface{}) []byte { case int: b = strconv.AppendInt(b, int64(v), 10) b = append(b, 'i') + case uint64: + b = strconv.AppendUint(b, v, 10) + b = append(b, 'u') case uint32: b = strconv.AppendInt(b, int64(v), 10) b = append(b, 'i') @@ -2201,10 +2363,9 @@ func appendField(b []byte, k string, v interface{}) []byte { case uint8: b = strconv.AppendInt(b, int64(v), 10) b = append(b, 'i') - // TODO: 'uint' should be considered just as "dangerous" as a uint64, - // perhaps the value should be checked and capped at MaxInt64? We could - // then include uint64 as an accepted value case uint: + // TODO: 'uint' should be converted to writing as an unsigned integer, + // but we cannot since that would break backwards compatibility. b = strconv.AppendInt(b, int64(v), 10) b = append(b, 'i') case float32: @@ -2224,8 +2385,29 @@ func appendField(b []byte, k string, v interface{}) []byte { return b } -type byteSlices [][]byte +// ValidKeyToken returns true if the token used for measurement, tag key, or tag +// value is a valid unicode string and only contains printable, non-replacement characters. +func ValidKeyToken(s string) bool { + if !utf8.ValidString(s) { + return false + } + for _, r := range s { + if !unicode.IsPrint(r) || r == unicode.ReplacementChar { + return false + } + } + return true +} -func (a byteSlices) Len() int { return len(a) } -func (a byteSlices) Less(i, j int) bool { return bytes.Compare(a[i], a[j]) == -1 } -func (a byteSlices) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +// ValidKeyTokens returns true if the measurement name and all tags are valid. +func ValidKeyTokens(name string, tags Tags) bool { + if !ValidKeyToken(name) { + return false + } + for _, tag := range tags { + if !ValidKeyToken(string(tag.Key)) || !ValidKeyToken(string(tag.Value)) { + return false + } + } + return true +} diff --git a/vendor/github.com/influxdata/influxdb/models/rows.go b/vendor/github.com/influxdata/influxdb1-client/models/rows.go similarity index 100% rename from vendor/github.com/influxdata/influxdb/models/rows.go rename to vendor/github.com/influxdata/influxdb1-client/models/rows.go diff --git a/vendor/github.com/influxdata/influxdb/models/statistic.go b/vendor/github.com/influxdata/influxdb1-client/models/statistic.go similarity index 100% rename from vendor/github.com/influxdata/influxdb/models/statistic.go rename to vendor/github.com/influxdata/influxdb1-client/models/statistic.go diff --git a/vendor/github.com/influxdata/influxdb/models/time.go b/vendor/github.com/influxdata/influxdb1-client/models/time.go similarity index 100% rename from vendor/github.com/influxdata/influxdb/models/time.go rename to vendor/github.com/influxdata/influxdb1-client/models/time.go diff --git a/vendor/github.com/influxdata/influxdb1-client/models/uint_support.go b/vendor/github.com/influxdata/influxdb1-client/models/uint_support.go new file mode 100644 index 000000000..18d1ca06e --- /dev/null +++ b/vendor/github.com/influxdata/influxdb1-client/models/uint_support.go @@ -0,0 +1,7 @@ +// +build uint uint64 + +package models + +func init() { + EnableUintSupport() +} diff --git a/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go b/vendor/github.com/influxdata/influxdb1-client/pkg/escape/bytes.go similarity index 87% rename from vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go rename to vendor/github.com/influxdata/influxdb1-client/pkg/escape/bytes.go index ac7ed5ab3..39a33f674 100644 --- a/vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go +++ b/vendor/github.com/influxdata/influxdb1-client/pkg/escape/bytes.go @@ -1,6 +1,6 @@ // Package escape contains utilities for escaping parts of InfluxQL // and InfluxDB line protocol. -package escape // import "github.com/influxdata/influxdb/pkg/escape" +package escape // import "github.com/influxdata/influxdb1-client/pkg/escape" import ( "bytes" @@ -78,7 +78,11 @@ func Unescape(in []byte) []byte { i := 0 inLen := len(in) - var out []byte + + // The output size will be no more than inLen. Preallocating the + // capacity of the output is faster and uses less memory than + // letting append() do its own (over)allocation. + out := make([]byte, 0, inLen) for { if i >= inLen { diff --git a/vendor/github.com/influxdata/influxdb/pkg/escape/strings.go b/vendor/github.com/influxdata/influxdb1-client/pkg/escape/strings.go similarity index 100% rename from vendor/github.com/influxdata/influxdb/pkg/escape/strings.go rename to vendor/github.com/influxdata/influxdb1-client/pkg/escape/strings.go diff --git a/vendor/github.com/influxdata/influxdb/client/v2/client.go b/vendor/github.com/influxdata/influxdb1-client/v2/client.go similarity index 77% rename from vendor/github.com/influxdata/influxdb/client/v2/client.go rename to vendor/github.com/influxdata/influxdb1-client/v2/client.go index 7a057c13c..0cf7b5f21 100644 --- a/vendor/github.com/influxdata/influxdb/client/v2/client.go +++ b/vendor/github.com/influxdata/influxdb1-client/v2/client.go @@ -1,5 +1,5 @@ // Package client (v2) is the current official Go client for InfluxDB. -package client // import "github.com/influxdata/influxdb/client/v2" +package client // import "github.com/influxdata/influxdb1-client/v2" import ( "bytes" @@ -9,13 +9,15 @@ import ( "fmt" "io" "io/ioutil" + "mime" "net/http" "net/url" + "path" "strconv" "strings" "time" - "github.com/influxdata/influxdb/models" + "github.com/influxdata/influxdb1-client/models" ) // HTTPConfig is the config data needed to create an HTTP Client. @@ -43,6 +45,9 @@ type HTTPConfig struct { // TLSConfig allows the user to set their own TLS config for the HTTP // Client. If set, this option overrides InsecureSkipVerify. TLSConfig *tls.Config + + // Proxy configures the Proxy function on the HTTP client. + Proxy func(req *http.Request) (*url.URL, error) } // BatchPointsConfig is the config data needed to create an instance of the BatchPoints struct. @@ -73,6 +78,10 @@ type Client interface { // the UDP client. Query(q Query) (*Response, error) + // QueryAsChunk makes an InfluxDB Query on the database. This will fail if using + // the UDP client. + QueryAsChunk(q Query) (*ChunkedResponse, error) + // Close releases any resources a Client may be using. Close() error } @@ -97,6 +106,7 @@ func NewHTTPClient(conf HTTPConfig) (Client, error) { TLSClientConfig: &tls.Config{ InsecureSkipVerify: conf.InsecureSkipVerify, }, + Proxy: conf.Proxy, } if conf.TLSConfig != nil { tr.TLSClientConfig = conf.TLSConfig @@ -118,8 +128,9 @@ func NewHTTPClient(conf HTTPConfig) (Client, error) { // Ping returns how long the request took, the version of the server it connected to, and an error if one occurred. func (c *client) Ping(timeout time.Duration) (time.Duration, string, error) { now := time.Now() + u := c.url - u.Path = "ping" + u.Path = path.Join(u.Path, "ping") req, err := http.NewRequest("GET", u.String(), nil) if err != nil { @@ -150,7 +161,7 @@ func (c *client) Ping(timeout time.Duration) (time.Duration, string, error) { } if resp.StatusCode != http.StatusNoContent { - var err = fmt.Errorf(string(body)) + var err = errors.New(string(body)) return 0, "", err } @@ -168,7 +179,7 @@ func (c *client) Close() error { // once the client is instantiated. type client struct { // N.B - if url.UserInfo is accessed in future modifications to the - // methods on client, you will need to syncronise access to url. + // methods on client, you will need to synchronize access to url. url url.URL username string password string @@ -318,8 +329,8 @@ func (p *Point) String() string { // PrecisionString returns a line-protocol string of the Point, // with the timestamp formatted for the given precision. -func (p *Point) PrecisionString(precison string) string { - return p.pt.PrecisionString(precison) +func (p *Point) PrecisionString(precision string) string { + return p.pt.PrecisionString(precision) } // Name returns the measurement name of the point. @@ -356,6 +367,9 @@ func (c *client) Write(bp BatchPoints) error { var b bytes.Buffer for _, p := range bp.Points() { + if p == nil { + continue + } if _, err := b.WriteString(p.pt.PrecisionString(bp.Precision())); err != nil { return err } @@ -366,7 +380,8 @@ func (c *client) Write(bp BatchPoints) error { } u := c.url - u.Path = "write" + u.Path = path.Join(u.Path, "write") + req, err := http.NewRequest("POST", u.String(), &b) if err != nil { return err @@ -396,7 +411,7 @@ func (c *client) Write(bp BatchPoints) error { } if resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK { - var err = fmt.Errorf(string(body)) + var err = errors.New(string(body)) return err } @@ -405,12 +420,13 @@ func (c *client) Write(bp BatchPoints) error { // Query defines a query to send to the server. type Query struct { - Command string - Database string - Precision string - Chunked bool - ChunkSize int - Parameters map[string]interface{} + Command string + Database string + RetentionPolicy string + Precision string + Chunked bool + ChunkSize int + Parameters map[string]interface{} } // NewQuery returns a query object. @@ -424,6 +440,19 @@ func NewQuery(command, database, precision string) Query { } } +// NewQueryWithRP returns a query object. +// The database, retention policy, and precision arguments can be empty strings if they are not needed +// for the query. Setting the retention policy only works on InfluxDB versions 1.6 or greater. +func NewQueryWithRP(command, database, retentionPolicy, precision string) Query { + return Query{ + Command: command, + Database: database, + RetentionPolicy: retentionPolicy, + Precision: precision, + Parameters: make(map[string]interface{}), + } +} + // NewQueryWithParameters returns a query object. // The database and precision arguments can be empty strings if they are not needed for the query. // parameters is a map of the parameter names used in the command to their values. @@ -446,11 +475,11 @@ type Response struct { // It returns nil if no errors occurred on any statements. func (r *Response) Error() error { if r.Err != "" { - return fmt.Errorf(r.Err) + return errors.New(r.Err) } for _, result := range r.Results { if result.Err != "" { - return fmt.Errorf(result.Err) + return errors.New(result.Err) } } return nil @@ -471,55 +500,37 @@ type Result struct { // Query sends a command to the server and returns the Response. func (c *client) Query(q Query) (*Response, error) { - u := c.url - u.Path = "query" - - jsonParameters, err := json.Marshal(q.Parameters) - + req, err := c.createDefaultRequest(q) if err != nil { return nil, err } - - req, err := http.NewRequest("POST", u.String(), nil) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", "") - req.Header.Set("User-Agent", c.useragent) - - if c.username != "" { - req.SetBasicAuth(c.username, c.password) - } - params := req.URL.Query() - params.Set("q", q.Command) - params.Set("db", q.Database) - params.Set("params", string(jsonParameters)) if q.Chunked { params.Set("chunked", "true") if q.ChunkSize > 0 { params.Set("chunk_size", strconv.Itoa(q.ChunkSize)) } + req.URL.RawQuery = params.Encode() } - - if q.Precision != "" { - params.Set("epoch", q.Precision) - } - req.URL.RawQuery = params.Encode() - resp, err := c.httpClient.Do(req) if err != nil { return nil, err } defer resp.Body.Close() + if err := checkResponse(resp); err != nil { + return nil, err + } + var response Response if q.Chunked { cr := NewChunkedResponse(resp.Body) for { r, err := cr.NextResponse() if err != nil { + if err == io.EOF { + break + } // If we got an error while decoding the response, send that back. return nil, err } @@ -548,19 +559,108 @@ func (c *client) Query(q Query) (*Response, error) { return nil, fmt.Errorf("unable to decode json: received status code %d err: %s", resp.StatusCode, decErr) } } + // If we don't have an error in our json response, and didn't get statusOK // then send back an error if resp.StatusCode != http.StatusOK && response.Error() == nil { - return &response, fmt.Errorf("received status code %d from server", - resp.StatusCode) + return &response, fmt.Errorf("received status code %d from server", resp.StatusCode) } return &response, nil } +// QueryAsChunk sends a command to the server and returns the Response. +func (c *client) QueryAsChunk(q Query) (*ChunkedResponse, error) { + req, err := c.createDefaultRequest(q) + if err != nil { + return nil, err + } + params := req.URL.Query() + params.Set("chunked", "true") + if q.ChunkSize > 0 { + params.Set("chunk_size", strconv.Itoa(q.ChunkSize)) + } + req.URL.RawQuery = params.Encode() + resp, err := c.httpClient.Do(req) + if err != nil { + return nil, err + } + + if err := checkResponse(resp); err != nil { + return nil, err + } + return NewChunkedResponse(resp.Body), nil +} + +func checkResponse(resp *http.Response) error { + // If we lack a X-Influxdb-Version header, then we didn't get a response from influxdb + // but instead some other service. If the error code is also a 500+ code, then some + // downstream loadbalancer/proxy/etc had an issue and we should report that. + if resp.Header.Get("X-Influxdb-Version") == "" && resp.StatusCode >= http.StatusInternalServerError { + body, err := ioutil.ReadAll(resp.Body) + if err != nil || len(body) == 0 { + return fmt.Errorf("received status code %d from downstream server", resp.StatusCode) + } + + return fmt.Errorf("received status code %d from downstream server, with response body: %q", resp.StatusCode, body) + } + + // If we get an unexpected content type, then it is also not from influx direct and therefore + // we want to know what we received and what status code was returned for debugging purposes. + if cType, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type")); cType != "application/json" { + // Read up to 1kb of the body to help identify downstream errors and limit the impact of things + // like downstream serving a large file + body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1024)) + if err != nil || len(body) == 0 { + return fmt.Errorf("expected json response, got empty body, with status: %v", resp.StatusCode) + } + + return fmt.Errorf("expected json response, got %q, with status: %v and response body: %q", cType, resp.StatusCode, body) + } + return nil +} + +func (c *client) createDefaultRequest(q Query) (*http.Request, error) { + u := c.url + u.Path = path.Join(u.Path, "query") + + jsonParameters, err := json.Marshal(q.Parameters) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", u.String(), nil) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", "") + req.Header.Set("User-Agent", c.useragent) + + if c.username != "" { + req.SetBasicAuth(c.username, c.password) + } + + params := req.URL.Query() + params.Set("q", q.Command) + params.Set("db", q.Database) + if q.RetentionPolicy != "" { + params.Set("rp", q.RetentionPolicy) + } + params.Set("params", string(jsonParameters)) + + if q.Precision != "" { + params.Set("epoch", q.Precision) + } + req.URL.RawQuery = params.Encode() + + return req, nil + +} + // duplexReader reads responses and writes it to another writer while // satisfying the reader interface. type duplexReader struct { - r io.Reader + r io.ReadCloser w io.Writer } @@ -572,6 +672,11 @@ func (r *duplexReader) Read(p []byte) (n int, err error) { return n, err } +// Close closes the response. +func (r *duplexReader) Close() error { + return r.r.Close() +} + // ChunkedResponse represents a response from the server that // uses chunking to stream the output. type ChunkedResponse struct { @@ -582,8 +687,12 @@ type ChunkedResponse struct { // NewChunkedResponse reads a stream and produces responses from the stream. func NewChunkedResponse(r io.Reader) *ChunkedResponse { + rc, ok := r.(io.ReadCloser) + if !ok { + rc = ioutil.NopCloser(r) + } resp := &ChunkedResponse{} - resp.duplex = &duplexReader{r: r, w: &resp.buf} + resp.duplex = &duplexReader{r: rc, w: &resp.buf} resp.dec = json.NewDecoder(resp.duplex) resp.dec.UseNumber() return resp @@ -592,10 +701,9 @@ func NewChunkedResponse(r io.Reader) *ChunkedResponse { // NextResponse reads the next line of the stream and returns a response. func (r *ChunkedResponse) NextResponse() (*Response, error) { var response Response - if err := r.dec.Decode(&response); err != nil { if err == io.EOF { - return nil, nil + return nil, err } // A decoding error happened. This probably means the server crashed // and sent a last-ditch error message to us. Ensure we have read the @@ -607,3 +715,8 @@ func (r *ChunkedResponse) NextResponse() (*Response, error) { r.buf.Reset() return &response, nil } + +// Close closes the response. +func (r *ChunkedResponse) Close() error { + return r.duplex.Close() +} diff --git a/vendor/github.com/influxdata/influxdb/client/v2/udp.go b/vendor/github.com/influxdata/influxdb1-client/v2/udp.go similarity index 94% rename from vendor/github.com/influxdata/influxdb/client/v2/udp.go rename to vendor/github.com/influxdata/influxdb1-client/v2/udp.go index 779a28b33..9867868b4 100644 --- a/vendor/github.com/influxdata/influxdb/client/v2/udp.go +++ b/vendor/github.com/influxdata/influxdb1-client/v2/udp.go @@ -107,6 +107,10 @@ func (uc *udpclient) Query(q Query) (*Response, error) { return nil, fmt.Errorf("Querying via UDP is not supported") } +func (uc *udpclient) QueryAsChunk(q Query) (*ChunkedResponse, error) { + return nil, fmt.Errorf("Querying via UDP is not supported") +} + func (uc *udpclient) Ping(timeout time.Duration) (time.Duration, string, error) { return 0, "", nil } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info.go new file mode 100644 index 000000000..288f0e854 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/build_info.go @@ -0,0 +1,29 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build go1.12 + +package prometheus + +import "runtime/debug" + +// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. +func readBuildInfo() (path, version, sum string) { + path, version, sum = "unknown", "unknown", "unknown" + if bi, ok := debug.ReadBuildInfo(); ok { + path = bi.Main.Path + version = bi.Main.Version + sum = bi.Main.Sum + } + return +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go new file mode 100644 index 000000000..6609e2877 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !go1.12 + +package prometheus + +// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before +// 1.12. Remove this whole file once the minimum supported Go version is 1.12. +func readBuildInfo() (path, version, sum string) { + return "unknown", "unknown", "unknown" +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/vendor/github.com/prometheus/client_golang/prometheus/collector.go index 623d3d83f..1e839650d 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/collector.go @@ -29,27 +29,72 @@ type Collector interface { // collected by this Collector to the provided channel and returns once // the last descriptor has been sent. The sent descriptors fulfill the // consistency and uniqueness requirements described in the Desc - // documentation. (It is valid if one and the same Collector sends - // duplicate descriptors. Those duplicates are simply ignored. However, - // two different Collectors must not send duplicate descriptors.) This - // method idempotently sends the same descriptors throughout the - // lifetime of the Collector. If a Collector encounters an error while - // executing this method, it must send an invalid descriptor (created - // with NewInvalidDesc) to signal the error to the registry. + // documentation. + // + // It is valid if one and the same Collector sends duplicate + // descriptors. Those duplicates are simply ignored. However, two + // different Collectors must not send duplicate descriptors. + // + // Sending no descriptor at all marks the Collector as “unchecked”, + // i.e. no checks will be performed at registration time, and the + // Collector may yield any Metric it sees fit in its Collect method. + // + // This method idempotently sends the same descriptors throughout the + // lifetime of the Collector. It may be called concurrently and + // therefore must be implemented in a concurrency safe way. + // + // If a Collector encounters an error while executing this method, it + // must send an invalid descriptor (created with NewInvalidDesc) to + // signal the error to the registry. Describe(chan<- *Desc) // Collect is called by the Prometheus registry when collecting // metrics. The implementation sends each collected metric via the // provided channel and returns once the last metric has been sent. The - // descriptor of each sent metric is one of those returned by - // Describe. Returned metrics that share the same descriptor must differ - // in their variable label values. This method may be called - // concurrently and must therefore be implemented in a concurrency safe - // way. Blocking occurs at the expense of total performance of rendering - // all registered metrics. Ideally, Collector implementations support - // concurrent readers. + // descriptor of each sent metric is one of those returned by Describe + // (unless the Collector is unchecked, see above). Returned metrics that + // share the same descriptor must differ in their variable label + // values. + // + // This method may be called concurrently and must therefore be + // implemented in a concurrency safe way. Blocking occurs at the expense + // of total performance of rendering all registered metrics. Ideally, + // Collector implementations support concurrent readers. Collect(chan<- Metric) } +// DescribeByCollect is a helper to implement the Describe method of a custom +// Collector. It collects the metrics from the provided Collector and sends +// their descriptors to the provided channel. +// +// If a Collector collects the same metrics throughout its lifetime, its +// Describe method can simply be implemented as: +// +// func (c customCollector) Describe(ch chan<- *Desc) { +// DescribeByCollect(c, ch) +// } +// +// However, this will not work if the metrics collected change dynamically over +// the lifetime of the Collector in a way that their combined set of descriptors +// changes as well. The shortcut implementation will then violate the contract +// of the Describe method. If a Collector sometimes collects no metrics at all +// (for example vectors like CounterVec, GaugeVec, etc., which only collect +// metrics after a metric with a fully specified label set has been accessed), +// it might even get registered as an unchecked Collector (cf. the Register +// method of the Registerer interface). Hence, only use this shortcut +// implementation of Describe if you are certain to fulfill the contract. +// +// The Collector example demonstrates a use of DescribeByCollect. +func DescribeByCollect(c Collector, descs chan<- *Desc) { + metrics := make(chan Metric) + go func() { + c.Collect(metrics) + close(metrics) + }() + for m := range metrics { + descs <- m.Desc() + } +} + // selfCollector implements Collector for a single Metric so that the Metric // collects itself. Add it as an anonymous field to a struct that implements // Metric, and call init with the Metric itself as an argument. diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/vendor/github.com/prometheus/client_golang/prometheus/counter.go index 72d5256a5..d463e36d3 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/counter.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/counter.go @@ -15,6 +15,10 @@ package prometheus import ( "errors" + "math" + "sync/atomic" + + dto "github.com/prometheus/client_model/go" ) // Counter is a Metric that represents a single numerical value that only ever @@ -42,6 +46,14 @@ type Counter interface { type CounterOpts Opts // NewCounter creates a new Counter based on the provided CounterOpts. +// +// The returned implementation tracks the counter value in two separate +// variables, a float64 and a uint64. The latter is used to track calls of the +// Inc method and calls of the Add method with a value that can be represented +// as a uint64. This allows atomic increments of the counter with optimal +// performance. (It is common to have an Inc call in very hot execution paths.) +// Both internal tracking values are added up in the Write method. This has to +// be taken into account when it comes to precision and overflow behavior. func NewCounter(opts CounterOpts) Counter { desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), @@ -49,20 +61,58 @@ func NewCounter(opts CounterOpts) Counter { nil, opts.ConstLabels, ) - result := &counter{value: value{desc: desc, valType: CounterValue, labelPairs: desc.constLabelPairs}} + result := &counter{desc: desc, labelPairs: desc.constLabelPairs} result.init(result) // Init self-collection. return result } type counter struct { - value + // valBits contains the bits of the represented float64 value, while + // valInt stores values that are exact integers. Both have to go first + // in the struct to guarantee alignment for atomic operations. + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + valBits uint64 + valInt uint64 + + selfCollector + desc *Desc + + labelPairs []*dto.LabelPair +} + +func (c *counter) Desc() *Desc { + return c.desc } func (c *counter) Add(v float64) { if v < 0 { panic(errors.New("counter cannot decrease in value")) } - c.value.Add(v) + ival := uint64(v) + if float64(ival) == v { + atomic.AddUint64(&c.valInt, ival) + return + } + + for { + oldBits := atomic.LoadUint64(&c.valBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + v) + if atomic.CompareAndSwapUint64(&c.valBits, oldBits, newBits) { + return + } + } +} + +func (c *counter) Inc() { + atomic.AddUint64(&c.valInt, 1) +} + +func (c *counter) Write(out *dto.Metric) error { + fval := math.Float64frombits(atomic.LoadUint64(&c.valBits)) + ival := atomic.LoadUint64(&c.valInt) + val := fval + float64(ival) + + return populateMetric(CounterValue, val, c.labelPairs, out) } // CounterVec is a Collector that bundles a set of Counters that all share the @@ -70,16 +120,12 @@ func (c *counter) Add(v float64) { // if you want to count the same thing partitioned by various dimensions // (e.g. number of HTTP requests, partitioned by response code and // method). Create instances with NewCounterVec. -// -// CounterVec embeds MetricVec. See there for a full list of methods with -// detailed documentation. type CounterVec struct { - *MetricVec + *metricVec } // NewCounterVec creates a new CounterVec based on the provided CounterOpts and -// partitioned by the given label names. At least one label name must be -// provided. +// partitioned by the given label names. func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec { desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), @@ -88,34 +134,62 @@ func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec { opts.ConstLabels, ) return &CounterVec{ - MetricVec: newMetricVec(desc, func(lvs ...string) Metric { - result := &counter{value: value{ - desc: desc, - valType: CounterValue, - labelPairs: makeLabelPairs(desc, lvs), - }} + metricVec: newMetricVec(desc, func(lvs ...string) Metric { + if len(lvs) != len(desc.variableLabels) { + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs)) + } + result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} result.init(result) // Init self-collection. return result }), } } -// GetMetricWithLabelValues replaces the method of the same name in -// MetricVec. The difference is that this method returns a Counter and not a -// Metric so that no type conversion is required. -func (m *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { - metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...) +// GetMetricWithLabelValues returns the Counter for the given slice of label +// values (same order as the VariableLabels in Desc). If that combination of +// label values is accessed for the first time, a new Counter is created. +// +// It is possible to call this method without using the returned Counter to only +// create the new Counter but leave it at its starting value 0. See also the +// SummaryVec example. +// +// Keeping the Counter for later use is possible (and should be considered if +// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// Delete can be used to delete the Counter from the CounterVec. In that case, +// the Counter will still exist, but it will not be exported anymore, even if a +// Counter with the same label values is created later. +// +// An error is returned if the number of label values is not the same as the +// number of VariableLabels in Desc (minus any curried labels). +// +// Note that for more than one label value, this method is prone to mistakes +// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as +// an alternative to avoid that type of mistake. For higher label numbers, the +// latter has a much more readable (albeit more verbose) syntax, but it comes +// with a performance overhead (for creating and processing the Labels map). +// See also the GaugeVec example. +func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Counter), err } return nil, err } -// GetMetricWith replaces the method of the same name in MetricVec. The -// difference is that this method returns a Counter and not a Metric so that no -// type conversion is required. -func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) { - metric, err := m.MetricVec.GetMetricWith(labels) +// GetMetricWith returns the Counter for the given Labels map (the label names +// must match those of the VariableLabels in Desc). If that label map is +// accessed for the first time, a new Counter is created. Implications of +// creating a Counter without using it and keeping the Counter for later use are +// the same as for GetMetricWithLabelValues. +// +// An error is returned if the number and names of the Labels are inconsistent +// with those of the VariableLabels in Desc (minus any curried labels). +// +// This method is used for the same purpose as +// GetMetricWithLabelValues(...string). See there for pros and cons of the two +// methods. +func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Counter), err } @@ -123,18 +197,57 @@ func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) { } // WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. By not returning an -// error, WithLabelValues allows shortcuts like +// GetMetricWithLabelValues would have returned an error. Not returning an +// error allows shortcuts like // myVec.WithLabelValues("404", "GET").Add(42) -func (m *CounterVec) WithLabelValues(lvs ...string) Counter { - return m.MetricVec.WithLabelValues(lvs...).(Counter) +func (v *CounterVec) WithLabelValues(lvs ...string) Counter { + c, err := v.GetMetricWithLabelValues(lvs...) + if err != nil { + panic(err) + } + return c } // With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. By not returning an error, With allows shortcuts like -// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -func (m *CounterVec) With(labels Labels) Counter { - return m.MetricVec.With(labels).(Counter) +// returned an error. Not returning an error allows shortcuts like +// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) +func (v *CounterVec) With(labels Labels) Counter { + c, err := v.GetMetricWith(labels) + if err != nil { + panic(err) + } + return c +} + +// CurryWith returns a vector curried with the provided labels, i.e. the +// returned vector has those labels pre-set for all labeled operations performed +// on it. The cardinality of the curried vector is reduced accordingly. The +// order of the remaining labels stays the same (just with the curried labels +// taken out of the sequence – which is relevant for the +// (GetMetric)WithLabelValues methods). It is possible to curry a curried +// vector, but only with labels not yet used for currying before. +// +// The metrics contained in the CounterVec are shared between the curried and +// uncurried vectors. They are just accessed differently. Curried and uncurried +// vectors behave identically in terms of collection. Only one must be +// registered with a given registry (usually the uncurried version). The Reset +// method deletes all metrics, even if called on a curried vector. +func (v *CounterVec) CurryWith(labels Labels) (*CounterVec, error) { + vec, err := v.curryWith(labels) + if vec != nil { + return &CounterVec{vec}, err + } + return nil, err +} + +// MustCurryWith works as CurryWith but panics where CurryWith would have +// returned an error. +func (v *CounterVec) MustCurryWith(labels Labels) *CounterVec { + vec, err := v.CurryWith(labels) + if err != nil { + panic(err) + } + return vec } // CounterFunc is a Counter whose value is determined at collect time by calling a diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go index 1835b16f6..1d034f871 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/desc.go @@ -25,19 +25,6 @@ import ( dto "github.com/prometheus/client_model/go" ) -// reservedLabelPrefix is a prefix which is not legal in user-supplied -// label names. -const reservedLabelPrefix = "__" - -// Labels represents a collection of label name -> value mappings. This type is -// commonly used with the With(Labels) and GetMetricWith(Labels) methods of -// metric vector Collectors, e.g.: -// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -// -// The other use-case is the specification of constant label pairs in Opts or to -// create a Desc. -type Labels map[string]string - // Desc is the descriptor used by every Prometheus Metric. It is essentially // the immutable meta-data of a Metric. The normal Metric implementations // included in this package manage their Desc under the hood. Users only have to @@ -80,24 +67,19 @@ type Desc struct { // NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc // and will be reported on registration time. variableLabels and constLabels can -// be nil if no such labels should be set. fqName and help must not be empty. +// be nil if no such labels should be set. fqName must not be empty. // // variableLabels only contain the label names. Their label values are variable // and therefore not part of the Desc. (They are managed within the Metric.) // // For constLabels, the label values are constant. Therefore, they are fully -// specified in the Desc. See the Opts documentation for the implications of -// constant labels. +// specified in the Desc. See the Collector example for a usage pattern. func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *Desc { d := &Desc{ fqName: fqName, help: help, variableLabels: variableLabels, } - if help == "" { - d.err = errors.New("empty help string") - return d - } if !model.IsValidMetricName(model.LabelValue(fqName)) { d.err = fmt.Errorf("%q is not a valid metric name", fqName) return d @@ -111,7 +93,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * // First add only the const label names and sort them... for labelName := range constLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, labelName) @@ -122,12 +104,18 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * for _, labelName := range labelNames { labelValues = append(labelValues, constLabels[labelName]) } + // Validate the const label values. They can't have a wrong cardinality, so + // use in len(labelValues) as expectedNumberOfValues. + if err := validateLabelValues(labelValues, len(labelValues)); err != nil { + d.err = err + return d + } // Now add the variable label names, but prefix them with something that // cannot be in a regular label name. That prevents matching the label // dimension with a different mix between preset and variable labels. for _, labelName := range variableLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, "$"+labelName) @@ -137,6 +125,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * d.err = errors.New("duplicate label names") return d } + vh := hashNew() for _, val := range labelValues { vh = hashAdd(vh, val) @@ -163,7 +152,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) * Value: proto.String(v), }) } - sort.Sort(LabelPairSorter(d.constLabelPairs)) + sort.Sort(labelPairSorter(d.constLabelPairs)) return d } @@ -193,8 +182,3 @@ func (d *Desc) String() string { d.variableLabels, ) } - -func checkLabelName(l string) bool { - return model.LabelName(l).IsValid() && - !strings.HasPrefix(l, reservedLabelPrefix) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go index 1fdef9edb..01977de66 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/doc.go @@ -11,10 +11,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package prometheus provides metrics primitives to instrument code for -// monitoring. It also offers a registry for metrics. Sub-packages allow to -// expose the registered metrics via HTTP (package promhttp) or push them to a -// Pushgateway (package push). +// Package prometheus is the core instrumentation package. It provides metrics +// primitives to instrument code for monitoring. It also offers a registry for +// metrics. Sub-packages allow to expose the registered metrics via HTTP +// (package promhttp) or push them to a Pushgateway (package push). There is +// also a sub-package promauto, which provides metrics constructors with +// automatic registration. // // All exported functions and methods are safe to be used concurrently unless // specified otherwise. @@ -26,6 +28,7 @@ // package main // // import ( +// "log" // "net/http" // // "github.com/prometheus/client_golang/prometheus" @@ -59,7 +62,7 @@ // // The Handler function provides a default handler to expose metrics // // via an HTTP server. "/metrics" is the usual endpoint for that. // http.Handle("/metrics", promhttp.Handler()) -// log.Fatal(http.ListenAndServe(":8080", nil)) +// log.Fatal(http.ListenAndServe(":8080", nil)) // } // // @@ -71,7 +74,10 @@ // The number of exported identifiers in this package might appear a bit // overwhelming. However, in addition to the basic plumbing shown in the example // above, you only need to understand the different metric types and their -// vector versions for basic usage. +// vector versions for basic usage. Furthermore, if you are not concerned with +// fine-grained control of when and how to register metrics with the registry, +// have a look at the promauto package, which will effectively allow you to +// ignore registration altogether in simple cases. // // Above, you have already touched the Counter and the Gauge. There are two more // advanced metric types: the Summary and Histogram. A more thorough description @@ -115,7 +121,17 @@ // NewConstSummary (and their respective Must… versions). That will happen in // the Collect method. The Describe method has to return separate Desc // instances, representative of the “throw-away” metrics to be created later. -// NewDesc comes in handy to create those Desc instances. +// NewDesc comes in handy to create those Desc instances. Alternatively, you +// could return no Desc at all, which will mark the Collector “unchecked”. No +// checks are performed at registration time, but metric consistency will still +// be ensured at scrape time, i.e. any inconsistencies will lead to scrape +// errors. Thus, with unchecked Collectors, the responsibility to not collect +// metrics that lead to inconsistencies in the total scrape result lies with the +// implementer of the Collector. While this is not a desirable state, it is +// sometimes necessary. The typical use case is a situation where the exact +// metrics to be returned by a Collector cannot be predicted at registration +// time, but the implementer has sufficient knowledge of the whole system to +// guarantee metric consistency. // // The Collector example illustrates the use case. You can also look at the // source code of the processCollector (mirroring process metrics), the @@ -144,7 +160,7 @@ // registry. // // So far, everything we did operated on the so-called default registry, as it -// can be found in the global DefaultRegistry variable. With NewRegistry, you +// can be found in the global DefaultRegisterer variable. With NewRegistry, you // can create a custom registry, or you can even implement the Registerer or // Gatherer interfaces yourself. The methods Register and Unregister work in the // same way on a custom registry as the global functions Register and Unregister @@ -152,11 +168,11 @@ // // There are a number of uses for custom registries: You can use registries with // special properties, see NewPedanticRegistry. You can avoid global state, as -// it is imposed by the DefaultRegistry. You can use multiple registries at the -// same time to expose different metrics in different ways. You can use separate -// registries for testing purposes. +// it is imposed by the DefaultRegisterer. You can use multiple registries at +// the same time to expose different metrics in different ways. You can use +// separate registries for testing purposes. // -// Also note that the DefaultRegistry comes registered with a Collector for Go +// Also note that the DefaultRegisterer comes registered with a Collector for Go // runtime metrics (via NewGoCollector) and a Collector for process metrics (via // NewProcessCollector). With a custom registry, you are in control and decide // yourself about the Collectors to register. @@ -167,7 +183,6 @@ // method can then expose the gathered metrics in some way. Usually, the metrics // are served via HTTP on the /metrics endpoint. That's happening in the example // above. The tools to expose metrics via HTTP are in the promhttp sub-package. -// (The top-level functions in the prometheus package are deprecated.) // // Pushing to the Pushgateway // diff --git a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go b/vendor/github.com/prometheus/client_golang/prometheus/fnv.go index e3b67df8a..3d383a735 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/fnv.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus // Inline and byte-free variant of hash/fnv's fnv64a. diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go index 9ab5a3d62..71d406bd9 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go @@ -13,6 +13,14 @@ package prometheus +import ( + "math" + "sync/atomic" + "time" + + dto "github.com/prometheus/client_model/go" +) + // Gauge is a Metric that represents a single numerical value that can // arbitrarily go up and down. // @@ -48,13 +56,74 @@ type Gauge interface { type GaugeOpts Opts // NewGauge creates a new Gauge based on the provided GaugeOpts. +// +// The returned implementation is optimized for a fast Set method. If you have a +// choice for managing the value of a Gauge via Set vs. Inc/Dec/Add/Sub, pick +// the former. For example, the Inc method of the returned Gauge is slower than +// the Inc method of a Counter returned by NewCounter. This matches the typical +// scenarios for Gauges and Counters, where the former tends to be Set-heavy and +// the latter Inc-heavy. func NewGauge(opts GaugeOpts) Gauge { - return newValue(NewDesc( + desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), opts.Help, nil, opts.ConstLabels, - ), GaugeValue, 0) + ) + result := &gauge{desc: desc, labelPairs: desc.constLabelPairs} + result.init(result) // Init self-collection. + return result +} + +type gauge struct { + // valBits contains the bits of the represented float64 value. It has + // to go first in the struct to guarantee alignment for atomic + // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG + valBits uint64 + + selfCollector + + desc *Desc + labelPairs []*dto.LabelPair +} + +func (g *gauge) Desc() *Desc { + return g.desc +} + +func (g *gauge) Set(val float64) { + atomic.StoreUint64(&g.valBits, math.Float64bits(val)) +} + +func (g *gauge) SetToCurrentTime() { + g.Set(float64(time.Now().UnixNano()) / 1e9) +} + +func (g *gauge) Inc() { + g.Add(1) +} + +func (g *gauge) Dec() { + g.Add(-1) +} + +func (g *gauge) Add(val float64) { + for { + oldBits := atomic.LoadUint64(&g.valBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + val) + if atomic.CompareAndSwapUint64(&g.valBits, oldBits, newBits) { + return + } + } +} + +func (g *gauge) Sub(val float64) { + g.Add(val * -1) +} + +func (g *gauge) Write(out *dto.Metric) error { + val := math.Float64frombits(atomic.LoadUint64(&g.valBits)) + return populateMetric(GaugeValue, val, g.labelPairs, out) } // GaugeVec is a Collector that bundles a set of Gauges that all share the same @@ -63,12 +132,11 @@ func NewGauge(opts GaugeOpts) Gauge { // (e.g. number of operations queued, partitioned by user and operation // type). Create instances with NewGaugeVec. type GaugeVec struct { - *MetricVec + *metricVec } // NewGaugeVec creates a new GaugeVec based on the provided GaugeOpts and -// partitioned by the given label names. At least one label name must be -// provided. +// partitioned by the given label names. func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec { desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), @@ -77,28 +145,62 @@ func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec { opts.ConstLabels, ) return &GaugeVec{ - MetricVec: newMetricVec(desc, func(lvs ...string) Metric { - return newValue(desc, GaugeValue, 0, lvs...) + metricVec: newMetricVec(desc, func(lvs ...string) Metric { + if len(lvs) != len(desc.variableLabels) { + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs)) + } + result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} + result.init(result) // Init self-collection. + return result }), } } -// GetMetricWithLabelValues replaces the method of the same name in -// MetricVec. The difference is that this method returns a Gauge and not a -// Metric so that no type conversion is required. -func (m *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { - metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...) +// GetMetricWithLabelValues returns the Gauge for the given slice of label +// values (same order as the VariableLabels in Desc). If that combination of +// label values is accessed for the first time, a new Gauge is created. +// +// It is possible to call this method without using the returned Gauge to only +// create the new Gauge but leave it at its starting value 0. See also the +// SummaryVec example. +// +// Keeping the Gauge for later use is possible (and should be considered if +// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// Delete can be used to delete the Gauge from the GaugeVec. In that case, the +// Gauge will still exist, but it will not be exported anymore, even if a +// Gauge with the same label values is created later. See also the CounterVec +// example. +// +// An error is returned if the number of label values is not the same as the +// number of VariableLabels in Desc (minus any curried labels). +// +// Note that for more than one label value, this method is prone to mistakes +// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as +// an alternative to avoid that type of mistake. For higher label numbers, the +// latter has a much more readable (albeit more verbose) syntax, but it comes +// with a performance overhead (for creating and processing the Labels map). +func (v *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Gauge), err } return nil, err } -// GetMetricWith replaces the method of the same name in MetricVec. The -// difference is that this method returns a Gauge and not a Metric so that no -// type conversion is required. -func (m *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { - metric, err := m.MetricVec.GetMetricWith(labels) +// GetMetricWith returns the Gauge for the given Labels map (the label names +// must match those of the VariableLabels in Desc). If that label map is +// accessed for the first time, a new Gauge is created. Implications of +// creating a Gauge without using it and keeping the Gauge for later use are +// the same as for GetMetricWithLabelValues. +// +// An error is returned if the number and names of the Labels are inconsistent +// with those of the VariableLabels in Desc (minus any curried labels). +// +// This method is used for the same purpose as +// GetMetricWithLabelValues(...string). See there for pros and cons of the two +// methods. +func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Gauge), err } @@ -106,18 +208,57 @@ func (m *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { } // WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. By not returning an -// error, WithLabelValues allows shortcuts like +// GetMetricWithLabelValues would have returned an error. Not returning an +// error allows shortcuts like // myVec.WithLabelValues("404", "GET").Add(42) -func (m *GaugeVec) WithLabelValues(lvs ...string) Gauge { - return m.MetricVec.WithLabelValues(lvs...).(Gauge) +func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge { + g, err := v.GetMetricWithLabelValues(lvs...) + if err != nil { + panic(err) + } + return g } // With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. By not returning an error, With allows shortcuts like -// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -func (m *GaugeVec) With(labels Labels) Gauge { - return m.MetricVec.With(labels).(Gauge) +// returned an error. Not returning an error allows shortcuts like +// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) +func (v *GaugeVec) With(labels Labels) Gauge { + g, err := v.GetMetricWith(labels) + if err != nil { + panic(err) + } + return g +} + +// CurryWith returns a vector curried with the provided labels, i.e. the +// returned vector has those labels pre-set for all labeled operations performed +// on it. The cardinality of the curried vector is reduced accordingly. The +// order of the remaining labels stays the same (just with the curried labels +// taken out of the sequence – which is relevant for the +// (GetMetric)WithLabelValues methods). It is possible to curry a curried +// vector, but only with labels not yet used for currying before. +// +// The metrics contained in the GaugeVec are shared between the curried and +// uncurried vectors. They are just accessed differently. Curried and uncurried +// vectors behave identically in terms of collection. Only one must be +// registered with a given registry (usually the uncurried version). The Reset +// method deletes all metrics, even if called on a curried vector. +func (v *GaugeVec) CurryWith(labels Labels) (*GaugeVec, error) { + vec, err := v.curryWith(labels) + if vec != nil { + return &GaugeVec{vec}, err + } + return nil, err +} + +// MustCurryWith works as CurryWith but panics where CurryWith would have +// returned an error. +func (v *GaugeVec) MustCurryWith(labels Labels) *GaugeVec { + vec, err := v.CurryWith(labels) + if err != nil { + panic(err) + } + return vec } // GaugeFunc is a Gauge whose value is determined at collect time by calling a diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go index f96764559..dc9247fed 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go @@ -1,9 +1,22 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package prometheus import ( - "fmt" "runtime" "runtime/debug" + "sync" "time" ) @@ -11,13 +24,43 @@ type goCollector struct { goroutinesDesc *Desc threadsDesc *Desc gcDesc *Desc + goInfoDesc *Desc - // metrics to describe and collect - metrics memStatsMetrics + // ms... are memstats related. + msLast *runtime.MemStats // Previously collected memstats. + msLastTimestamp time.Time + msMtx sync.Mutex // Protects msLast and msLastTimestamp. + msMetrics memStatsMetrics + msRead func(*runtime.MemStats) // For mocking in tests. + msMaxWait time.Duration // Wait time for fresh memstats. + msMaxAge time.Duration // Maximum allowed age of old memstats. } -// NewGoCollector returns a collector which exports metrics about the current -// go process. +// NewGoCollector returns a collector that exports metrics about the current Go +// process. This includes memory stats. To collect those, runtime.ReadMemStats +// is called. This requires to “stop the world”, which usually only happens for +// garbage collection (GC). Take the following implications into account when +// deciding whether to use the Go collector: +// +// 1. The performance impact of stopping the world is the more relevant the more +// frequently metrics are collected. However, with Go1.9 or later the +// stop-the-world time per metrics collection is very short (~25µs) so that the +// performance impact will only matter in rare cases. However, with older Go +// versions, the stop-the-world duration depends on the heap size and can be +// quite significant (~1.7 ms/GiB as per +// https://go-review.googlesource.com/c/go/+/34937). +// +// 2. During an ongoing GC, nothing else can stop the world. Therefore, if the +// metrics collection happens to coincide with GC, it will only complete after +// GC has finished. Usually, GC is fast enough to not cause problems. However, +// with a very large heap, GC might take multiple seconds, which is enough to +// cause scrape timeouts in common setups. To avoid this problem, the Go +// collector will use the memstats from a previous collection if +// runtime.ReadMemStats takes more than 1s. However, if there are no previously +// collected memstats, or their collection is more than 5m ago, the collection +// will block until runtime.ReadMemStats succeeds. (The problem might be solved +// in Go1.13, see https://github.com/golang/go/issues/19812 for the related Go +// issue.) func NewGoCollector() Collector { return &goCollector{ goroutinesDesc: NewDesc( @@ -26,13 +69,21 @@ func NewGoCollector() Collector { nil, nil), threadsDesc: NewDesc( "go_threads", - "Number of OS threads created", + "Number of OS threads created.", nil, nil), gcDesc: NewDesc( "go_gc_duration_seconds", "A summary of the GC invocation durations.", nil, nil), - metrics: memStatsMetrics{ + goInfoDesc: NewDesc( + "go_info", + "Information about the Go environment.", + nil, Labels{"version": runtime.Version()}), + msLast: &runtime.MemStats{}, + msRead: runtime.ReadMemStats, + msMaxWait: time.Second, + msMaxAge: 5 * time.Minute, + msMetrics: memStatsMetrics{ { desc: NewDesc( memstatNamespace("alloc_bytes"), @@ -231,7 +282,7 @@ func NewGoCollector() Collector { } func memstatNamespace(s string) string { - return fmt.Sprintf("go_memstats_%s", s) + return "go_memstats_" + s } // Describe returns all descriptions of the collector. @@ -239,13 +290,28 @@ func (c *goCollector) Describe(ch chan<- *Desc) { ch <- c.goroutinesDesc ch <- c.threadsDesc ch <- c.gcDesc - for _, i := range c.metrics { + ch <- c.goInfoDesc + for _, i := range c.msMetrics { ch <- i.desc } } // Collect returns the current state of all metrics of the collector. func (c *goCollector) Collect(ch chan<- Metric) { + var ( + ms = &runtime.MemStats{} + done = make(chan struct{}) + ) + // Start reading memstats first as it might take a while. + go func() { + c.msRead(ms) + c.msMtx.Lock() + c.msLast = ms + c.msLastTimestamp = time.Now() + c.msMtx.Unlock() + close(done) + }() + ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine())) n, _ := runtime.ThreadCreateProfile(nil) ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, float64(n)) @@ -259,11 +325,35 @@ func (c *goCollector) Collect(ch chan<- Metric) { quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds() } quantiles[0.0] = stats.PauseQuantiles[0].Seconds() - ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), float64(stats.PauseTotal.Seconds()), quantiles) + ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), stats.PauseTotal.Seconds(), quantiles) - ms := &runtime.MemStats{} - runtime.ReadMemStats(ms) - for _, i := range c.metrics { + ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1) + + timer := time.NewTimer(c.msMaxWait) + select { + case <-done: // Our own ReadMemStats succeeded in time. Use it. + timer.Stop() // Important for high collection frequencies to not pile up timers. + c.msCollect(ch, ms) + return + case <-timer.C: // Time out, use last memstats if possible. Continue below. + } + c.msMtx.Lock() + if time.Since(c.msLastTimestamp) < c.msMaxAge { + // Last memstats are recent enough. Collect from them under the lock. + c.msCollect(ch, c.msLast) + c.msMtx.Unlock() + return + } + // If we are here, the last memstats are too old or don't exist. We have + // to wait until our own ReadMemStats finally completes. For that to + // happen, we have to release the lock. + c.msMtx.Unlock() + <-done + c.msCollect(ch, ms) +} + +func (c *goCollector) msCollect(ch chan<- Metric, ms *runtime.MemStats) { + for _, i := range c.msMetrics { ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms)) } } @@ -274,3 +364,33 @@ type memStatsMetrics []struct { eval func(*runtime.MemStats) float64 valType ValueType } + +// NewBuildInfoCollector returns a collector collecting a single metric +// "go_build_info" with the constant value 1 and three labels "path", "version", +// and "checksum". Their label values contain the main module path, version, and +// checksum, respectively. The labels will only have meaningful values if the +// binary is built with Go module support and from source code retrieved from +// the source repository (rather than the local file system). This is usually +// accomplished by building from outside of GOPATH, specifying the full address +// of the main package, e.g. "GO111MODULE=on go run +// github.com/prometheus/client_golang/examples/random". If built without Go +// module support, all label values will be "unknown". If built with Go module +// support but using the source code from the local file system, the "path" will +// be set appropriately, but "checksum" will be empty and "version" will be +// "(devel)". +// +// This collector uses only the build information for the main module. See +// https://github.com/povilasv/prommod for an example of a collector for the +// module dependencies. +func NewBuildInfoCollector() Collector { + path, version, sum := readBuildInfo() + c := &selfCollector{MustNewConstMetric( + NewDesc( + "go_build_info", + "Build information about the main Go module.", + nil, Labels{"path": path, "version": version, "checksum": sum}, + ), + GaugeValue, 1)} + c.init(c.self) + return c +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go index 9719e8fac..d7ea67bd2 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go @@ -16,7 +16,9 @@ package prometheus import ( "fmt" "math" + "runtime" "sort" + "sync" "sync/atomic" "github.com/golang/protobuf/proto" @@ -108,8 +110,9 @@ func ExponentialBuckets(start, factor float64, count int) []float64 { } // HistogramOpts bundles the options for creating a Histogram metric. It is -// mandatory to set Name and Help to a non-empty string. All other fields are -// optional and can safely be left at their zero value. +// mandatory to set Name to a non-empty string. All other fields are optional +// and can safely be left at their zero value, although it is strongly +// encouraged to set a Help string. type HistogramOpts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Histogram (created by joining these components with @@ -120,29 +123,22 @@ type HistogramOpts struct { Subsystem string Name string - // Help provides information about this Histogram. Mandatory! + // Help provides information about this Histogram. // // Metrics with the same fully-qualified name must have the same Help // string. Help string - // ConstLabels are used to attach fixed labels to this - // Histogram. Histograms with the same fully-qualified name must have the - // same label names in their ConstLabels. + // ConstLabels are used to attach fixed labels to this metric. Metrics + // with the same fully-qualified name must have the same label names in + // their ConstLabels. // - // Note that in most cases, labels have a value that varies during the - // lifetime of a process. Those labels are usually managed with a - // HistogramVec. ConstLabels serve only special purposes. One is for the - // special case where the value of a label does not change during the - // lifetime of a process, e.g. if the revision of the running binary is - // put into a label. Another, more advanced purpose is if more than one - // Collector needs to collect Histograms with the same fully-qualified - // name. In that case, those Summaries must differ in the values of - // their ConstLabels. See the Collector examples. - // - // If the value of a label never changes (not even between binaries), - // that label most likely should not be a label at all (but part of the - // metric name). + // ConstLabels are only used rarely. In particular, do not use them to + // attach the same labels to all your metrics. Those use cases are + // better covered by target labels set by the scraping Prometheus + // server, or by one specific metric (e.g. a build_info or a + // machine_role metric). See also + // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels ConstLabels Labels // Buckets defines the buckets into which observations are counted. Each @@ -169,7 +165,7 @@ func NewHistogram(opts HistogramOpts) Histogram { func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram { if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues)) } for _, n := range desc.variableLabels { @@ -191,6 +187,7 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr desc: desc, upperBounds: opts.Buckets, labelPairs: makeLabelPairs(desc, labelValues), + counts: [2]*histogramCounts{&histogramCounts{}, &histogramCounts{}}, } for i, upperBound := range h.upperBounds { if i < len(h.upperBounds)-1 { @@ -207,30 +204,56 @@ func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogr } } } - // Finally we know the final length of h.upperBounds and can make counts. - h.counts = make([]uint64, len(h.upperBounds)) + // Finally we know the final length of h.upperBounds and can make buckets + // for both counts: + h.counts[0].buckets = make([]uint64, len(h.upperBounds)) + h.counts[1].buckets = make([]uint64, len(h.upperBounds)) h.init(h) // Init self-collection. return h } -type histogram struct { +type histogramCounts struct { // sumBits contains the bits of the float64 representing the sum of all // observations. sumBits and count have to go first in the struct to // guarantee alignment for atomic operations. // http://golang.org/pkg/sync/atomic/#pkg-note-BUG sumBits uint64 count uint64 + buckets []uint64 +} + +type histogram struct { + // countAndHotIdx enables lock-free writes with use of atomic updates. + // The most significant bit is the hot index [0 or 1] of the count field + // below. Observe calls update the hot one. All remaining bits count the + // number of Observe calls. Observe starts by incrementing this counter, + // and finish by incrementing the count field in the respective + // histogramCounts, as a marker for completion. + // + // Calls of the Write method (which are non-mutating reads from the + // perspective of the histogram) swap the hot–cold under the writeMtx + // lock. A cooldown is awaited (while locked) by comparing the number of + // observations with the initiation count. Once they match, then the + // last observation on the now cool one has completed. All cool fields must + // be merged into the new hot before releasing writeMtx. + // + // Fields with atomic access first! See alignment constraint: + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + countAndHotIdx uint64 selfCollector - // Note that there is no mutex required. + desc *Desc + writeMtx sync.Mutex // Only used in the Write method. - desc *Desc + // Two counts, one is "hot" for lock-free observations, the other is + // "cold" for writing out a dto.Metric. It has to be an array of + // pointers to guarantee 64bit alignment of the histogramCounts, see + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. + counts [2]*histogramCounts upperBounds []float64 - counts []uint64 - - labelPairs []*dto.LabelPair + labelPairs []*dto.LabelPair } func (h *histogram) Desc() *Desc { @@ -248,36 +271,84 @@ func (h *histogram) Observe(v float64) { // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op // 300 buckets: 154 ns/op linear - binary 61.6 ns/op i := sort.SearchFloat64s(h.upperBounds, v) - if i < len(h.counts) { - atomic.AddUint64(&h.counts[i], 1) + + // We increment h.countAndHotIdx so that the counter in the lower + // 63 bits gets incremented. At the same time, we get the new value + // back, which we can use to find the currently-hot counts. + n := atomic.AddUint64(&h.countAndHotIdx, 1) + hotCounts := h.counts[n>>63] + + if i < len(h.upperBounds) { + atomic.AddUint64(&hotCounts.buckets[i], 1) } - atomic.AddUint64(&h.count, 1) for { - oldBits := atomic.LoadUint64(&h.sumBits) + oldBits := atomic.LoadUint64(&hotCounts.sumBits) newBits := math.Float64bits(math.Float64frombits(oldBits) + v) - if atomic.CompareAndSwapUint64(&h.sumBits, oldBits, newBits) { + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { break } } + // Increment count last as we take it as a signal that the observation + // is complete. + atomic.AddUint64(&hotCounts.count, 1) } func (h *histogram) Write(out *dto.Metric) error { - his := &dto.Histogram{} - buckets := make([]*dto.Bucket, len(h.upperBounds)) + // For simplicity, we protect this whole method by a mutex. It is not in + // the hot path, i.e. Observe is called much more often than Write. The + // complication of making Write lock-free isn't worth it, if possible at + // all. + h.writeMtx.Lock() + defer h.writeMtx.Unlock() - his.SampleSum = proto.Float64(math.Float64frombits(atomic.LoadUint64(&h.sumBits))) - his.SampleCount = proto.Uint64(atomic.LoadUint64(&h.count)) - var count uint64 + // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0) + // without touching the count bits. See the struct comments for a full + // description of the algorithm. + n := atomic.AddUint64(&h.countAndHotIdx, 1<<63) + // count is contained unchanged in the lower 63 bits. + count := n & ((1 << 63) - 1) + // The most significant bit tells us which counts is hot. The complement + // is thus the cold one. + hotCounts := h.counts[n>>63] + coldCounts := h.counts[(^n)>>63] + + // Await cooldown. + for count != atomic.LoadUint64(&coldCounts.count) { + runtime.Gosched() // Let observations get work done. + } + + his := &dto.Histogram{ + Bucket: make([]*dto.Bucket, len(h.upperBounds)), + SampleCount: proto.Uint64(count), + SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))), + } + var cumCount uint64 for i, upperBound := range h.upperBounds { - count += atomic.LoadUint64(&h.counts[i]) - buckets[i] = &dto.Bucket{ - CumulativeCount: proto.Uint64(count), + cumCount += atomic.LoadUint64(&coldCounts.buckets[i]) + his.Bucket[i] = &dto.Bucket{ + CumulativeCount: proto.Uint64(cumCount), UpperBound: proto.Float64(upperBound), } } - his.Bucket = buckets + out.Histogram = his out.Label = h.labelPairs + + // Finally add all the cold counts to the new hot counts and reset the cold counts. + atomic.AddUint64(&hotCounts.count, count) + atomic.StoreUint64(&coldCounts.count, 0) + for { + oldBits := atomic.LoadUint64(&hotCounts.sumBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + his.GetSampleSum()) + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { + atomic.StoreUint64(&coldCounts.sumBits, 0) + break + } + } + for i := range h.upperBounds { + atomic.AddUint64(&hotCounts.buckets[i], atomic.LoadUint64(&coldCounts.buckets[i])) + atomic.StoreUint64(&coldCounts.buckets[i], 0) + } return nil } @@ -287,12 +358,11 @@ func (h *histogram) Write(out *dto.Metric) error { // (e.g. HTTP request latencies, partitioned by status code and method). Create // instances with NewHistogramVec. type HistogramVec struct { - *MetricVec + *metricVec } // NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and -// partitioned by the given label names. At least one label name must be -// provided. +// partitioned by the given label names. func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), @@ -301,47 +371,116 @@ func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { opts.ConstLabels, ) return &HistogramVec{ - MetricVec: newMetricVec(desc, func(lvs ...string) Metric { + metricVec: newMetricVec(desc, func(lvs ...string) Metric { return newHistogram(desc, opts, lvs...) }), } } -// GetMetricWithLabelValues replaces the method of the same name in -// MetricVec. The difference is that this method returns a Histogram and not a -// Metric so that no type conversion is required. -func (m *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Histogram, error) { - metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...) +// GetMetricWithLabelValues returns the Histogram for the given slice of label +// values (same order as the VariableLabels in Desc). If that combination of +// label values is accessed for the first time, a new Histogram is created. +// +// It is possible to call this method without using the returned Histogram to only +// create the new Histogram but leave it at its starting value, a Histogram without +// any observations. +// +// Keeping the Histogram for later use is possible (and should be considered if +// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// Delete can be used to delete the Histogram from the HistogramVec. In that case, the +// Histogram will still exist, but it will not be exported anymore, even if a +// Histogram with the same label values is created later. See also the CounterVec +// example. +// +// An error is returned if the number of label values is not the same as the +// number of VariableLabels in Desc (minus any curried labels). +// +// Note that for more than one label value, this method is prone to mistakes +// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as +// an alternative to avoid that type of mistake. For higher label numbers, the +// latter has a much more readable (albeit more verbose) syntax, but it comes +// with a performance overhead (for creating and processing the Labels map). +// See also the GaugeVec example. +func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { - return metric.(Histogram), err + return metric.(Observer), err } return nil, err } -// GetMetricWith replaces the method of the same name in MetricVec. The -// difference is that this method returns a Histogram and not a Metric so that no -// type conversion is required. -func (m *HistogramVec) GetMetricWith(labels Labels) (Histogram, error) { - metric, err := m.MetricVec.GetMetricWith(labels) +// GetMetricWith returns the Histogram for the given Labels map (the label names +// must match those of the VariableLabels in Desc). If that label map is +// accessed for the first time, a new Histogram is created. Implications of +// creating a Histogram without using it and keeping the Histogram for later use +// are the same as for GetMetricWithLabelValues. +// +// An error is returned if the number and names of the Labels are inconsistent +// with those of the VariableLabels in Desc (minus any curried labels). +// +// This method is used for the same purpose as +// GetMetricWithLabelValues(...string). See there for pros and cons of the two +// methods. +func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { - return metric.(Histogram), err + return metric.(Observer), err } return nil, err } // WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. By not returning an -// error, WithLabelValues allows shortcuts like +// GetMetricWithLabelValues would have returned an error. Not returning an +// error allows shortcuts like // myVec.WithLabelValues("404", "GET").Observe(42.21) -func (m *HistogramVec) WithLabelValues(lvs ...string) Histogram { - return m.MetricVec.WithLabelValues(lvs...).(Histogram) +func (v *HistogramVec) WithLabelValues(lvs ...string) Observer { + h, err := v.GetMetricWithLabelValues(lvs...) + if err != nil { + panic(err) + } + return h } -// With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. By not returning an error, With allows shortcuts like -// myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (m *HistogramVec) With(labels Labels) Histogram { - return m.MetricVec.With(labels).(Histogram) +// With works as GetMetricWith but panics where GetMetricWithLabels would have +// returned an error. Not returning an error allows shortcuts like +// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21) +func (v *HistogramVec) With(labels Labels) Observer { + h, err := v.GetMetricWith(labels) + if err != nil { + panic(err) + } + return h +} + +// CurryWith returns a vector curried with the provided labels, i.e. the +// returned vector has those labels pre-set for all labeled operations performed +// on it. The cardinality of the curried vector is reduced accordingly. The +// order of the remaining labels stays the same (just with the curried labels +// taken out of the sequence – which is relevant for the +// (GetMetric)WithLabelValues methods). It is possible to curry a curried +// vector, but only with labels not yet used for currying before. +// +// The metrics contained in the HistogramVec are shared between the curried and +// uncurried vectors. They are just accessed differently. Curried and uncurried +// vectors behave identically in terms of collection. Only one must be +// registered with a given registry (usually the uncurried version). The Reset +// method deletes all metrics, even if called on a curried vector. +func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) { + vec, err := v.curryWith(labels) + if vec != nil { + return &HistogramVec{vec}, err + } + return nil, err +} + +// MustCurryWith works as CurryWith but panics where CurryWith would have +// returned an error. +func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec { + vec, err := v.CurryWith(labels) + if err != nil { + panic(err) + } + return vec } type constHistogram struct { @@ -393,7 +532,7 @@ func (h *constHistogram) Write(out *dto.Metric) error { // bucket. // // NewConstHistogram returns an error if the length of labelValues is not -// consistent with the variable labels in Desc. +// consistent with the variable labels in Desc or if Desc is invalid. func NewConstHistogram( desc *Desc, count uint64, @@ -401,8 +540,11 @@ func NewConstHistogram( buckets map[float64]uint64, labelValues ...string, ) (Metric, error) { - if len(desc.variableLabels) != len(labelValues) { - return nil, errInconsistentCardinality + if desc.err != nil { + return nil, desc.err + } + if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { + return nil, err } return &constHistogram{ desc: desc, diff --git a/vendor/github.com/prometheus/client_golang/prometheus/http.go b/vendor/github.com/prometheus/client_golang/prometheus/http.go deleted file mode 100644 index d74fb4881..000000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/http.go +++ /dev/null @@ -1,526 +0,0 @@ -// Copyright 2014 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package prometheus - -import ( - "bufio" - "bytes" - "compress/gzip" - "fmt" - "io" - "net" - "net/http" - "strconv" - "strings" - "sync" - "time" - - "github.com/prometheus/common/expfmt" -) - -// TODO(beorn7): Remove this whole file. It is a partial mirror of -// promhttp/http.go (to avoid circular import chains) where everything HTTP -// related should live. The functions here are just for avoiding -// breakage. Everything is deprecated. - -const ( - contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" - contentEncodingHeader = "Content-Encoding" - acceptEncodingHeader = "Accept-Encoding" -) - -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) -} - -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) -} - -// Handler returns an HTTP handler for the DefaultGatherer. It is -// already instrumented with InstrumentHandler (using "prometheus" as handler -// name). -// -// Deprecated: Please note the issues described in the doc comment of -// InstrumentHandler. You might want to consider using promhttp.Handler instead -// (which is not instrumented). -func Handler() http.Handler { - return InstrumentHandler("prometheus", UninstrumentedHandler()) -} - -// UninstrumentedHandler returns an HTTP handler for the DefaultGatherer. -// -// Deprecated: Use promhttp.Handler instead. See there for further documentation. -func UninstrumentedHandler() http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - mfs, err := DefaultGatherer.Gather() - if err != nil { - http.Error(w, "An error has occurred during metrics collection:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - - contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf) - enc := expfmt.NewEncoder(writer, contentType) - var lastErr error - for _, mf := range mfs { - if err := enc.Encode(mf); err != nil { - lastErr = err - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - } - if closer, ok := writer.(io.Closer); ok { - closer.Close() - } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - w.Write(buf.Bytes()) - }) -} - -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) { - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") - for _, part := range parts { - part := strings.TrimSpace(part) - if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" - } - } - return writer, "" -} - -var instLabels = []string{"method", "code"} - -type nower interface { - Now() time.Time -} - -type nowFunc func() time.Time - -func (n nowFunc) Now() time.Time { - return n() -} - -var now nower = nowFunc(func() time.Time { - return time.Now() -}) - -func nowSeries(t ...time.Time) nower { - return nowFunc(func() time.Time { - defer func() { - t = t[1:] - }() - - return t[0] - }) -} - -// InstrumentHandler wraps the given HTTP handler for instrumentation. It -// registers four metric collectors (if not already done) and reports HTTP -// metrics to the (newly or already) registered collectors: http_requests_total -// (CounterVec), http_request_duration_microseconds (Summary), -// http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each -// has a constant label named "handler" with the provided handlerName as -// value. http_requests_total is a metric vector partitioned by HTTP method -// (label name "method") and HTTP status code (label name "code"). -// -// Deprecated: InstrumentHandler has several issues: -// -// - It uses Summaries rather than Histograms. Summaries are not useful if -// aggregation across multiple instances is required. -// -// - It uses microseconds as unit, which is deprecated and should be replaced by -// seconds. -// -// - The size of the request is calculated in a separate goroutine. Since this -// calculator requires access to the request header, it creates a race with -// any writes to the header performed during request handling. -// httputil.ReverseProxy is a prominent example for a handler -// performing such writes. -// -// - It has additional issues with HTTP/2, cf. -// https://github.com/prometheus/client_golang/issues/272. -// -// Upcoming versions of this package will provide ways of instrumenting HTTP -// handlers that are more flexible and have fewer issues. Please prefer direct -// instrumentation in the meantime. -func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFunc(handlerName, handler.ServeHTTP) -} - -// InstrumentHandlerFunc wraps the given function for instrumentation. It -// otherwise works in the same way as InstrumentHandler (and shares the same -// issues). -// -// Deprecated: InstrumentHandlerFunc is deprecated for the same reasons as -// InstrumentHandler is. -func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts( - SummaryOpts{ - Subsystem: "http", - ConstLabels: Labels{"handler": handlerName}, - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - handlerFunc, - ) -} - -// InstrumentHandlerWithOpts works like InstrumentHandler (and shares the same -// issues) but provides more flexibility (at the cost of a more complex call -// syntax). As InstrumentHandler, this function registers four metric -// collectors, but it uses the provided SummaryOpts to create them. However, the -// fields "Name" and "Help" in the SummaryOpts are ignored. "Name" is replaced -// by "requests_total", "request_duration_microseconds", "request_size_bytes", -// and "response_size_bytes", respectively. "Help" is replaced by an appropriate -// help string. The names of the variable labels of the http_requests_total -// CounterVec are "method" (get, post, etc.), and "code" (HTTP status code). -// -// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the -// behavior of InstrumentHandler: -// -// prometheus.InstrumentHandlerWithOpts( -// prometheus.SummaryOpts{ -// Subsystem: "http", -// ConstLabels: prometheus.Labels{"handler": handlerName}, -// }, -// handler, -// ) -// -// Technical detail: "requests_total" is a CounterVec, not a SummaryVec, so it -// cannot use SummaryOpts. Instead, a CounterOpts struct is created internally, -// and all its fields are set to the equally named fields in the provided -// SummaryOpts. -// -// Deprecated: InstrumentHandlerWithOpts is deprecated for the same reasons as -// InstrumentHandler is. -func InstrumentHandlerWithOpts(opts SummaryOpts, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts(opts, handler.ServeHTTP) -} - -// InstrumentHandlerFuncWithOpts works like InstrumentHandlerFunc (and shares -// the same issues) but provides more flexibility (at the cost of a more complex -// call syntax). See InstrumentHandlerWithOpts for details how the provided -// SummaryOpts are used. -// -// Deprecated: InstrumentHandlerFuncWithOpts is deprecated for the same reasons -// as InstrumentHandler is. -func InstrumentHandlerFuncWithOpts(opts SummaryOpts, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - reqCnt := NewCounterVec( - CounterOpts{ - Namespace: opts.Namespace, - Subsystem: opts.Subsystem, - Name: "requests_total", - Help: "Total number of HTTP requests made.", - ConstLabels: opts.ConstLabels, - }, - instLabels, - ) - if err := Register(reqCnt); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqCnt = are.ExistingCollector.(*CounterVec) - } else { - panic(err) - } - } - - opts.Name = "request_duration_microseconds" - opts.Help = "The HTTP request latencies in microseconds." - reqDur := NewSummary(opts) - if err := Register(reqDur); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqDur = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "request_size_bytes" - opts.Help = "The HTTP request sizes in bytes." - reqSz := NewSummary(opts) - if err := Register(reqSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "response_size_bytes" - opts.Help = "The HTTP response sizes in bytes." - resSz := NewSummary(opts) - if err := Register(resSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - resSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - - delegate := &responseWriterDelegator{ResponseWriter: w} - out := computeApproximateRequestSize(r) - - _, cn := w.(http.CloseNotifier) - _, fl := w.(http.Flusher) - _, hj := w.(http.Hijacker) - _, rf := w.(io.ReaderFrom) - var rw http.ResponseWriter - if cn && fl && hj && rf { - rw = &fancyResponseWriterDelegator{delegate} - } else { - rw = delegate - } - handlerFunc(rw, r) - - elapsed := float64(time.Since(now)) / float64(time.Microsecond) - - method := sanitizeMethod(r.Method) - code := sanitizeCode(delegate.status) - reqCnt.WithLabelValues(method, code).Inc() - reqDur.Observe(elapsed) - resSz.Observe(float64(delegate.written)) - reqSz.Observe(float64(<-out)) - }) -} - -func computeApproximateRequestSize(r *http.Request) <-chan int { - // Get URL length in current go routine for avoiding a race condition. - // HandlerFunc that runs in parallel may modify the URL. - s := 0 - if r.URL != nil { - s += len(r.URL.String()) - } - - out := make(chan int, 1) - - go func() { - s += len(r.Method) - s += len(r.Proto) - for name, values := range r.Header { - s += len(name) - for _, value := range values { - s += len(value) - } - } - s += len(r.Host) - - // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL. - - if r.ContentLength != -1 { - s += int(r.ContentLength) - } - out <- s - close(out) - }() - - return out -} - -type responseWriterDelegator struct { - http.ResponseWriter - - handler, method string - status int - written int64 - wroteHeader bool -} - -func (r *responseWriterDelegator) WriteHeader(code int) { - r.status = code - r.wroteHeader = true - r.ResponseWriter.WriteHeader(code) -} - -func (r *responseWriterDelegator) Write(b []byte) (int, error) { - if !r.wroteHeader { - r.WriteHeader(http.StatusOK) - } - n, err := r.ResponseWriter.Write(b) - r.written += int64(n) - return n, err -} - -type fancyResponseWriterDelegator struct { - *responseWriterDelegator -} - -func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool { - return f.ResponseWriter.(http.CloseNotifier).CloseNotify() -} - -func (f *fancyResponseWriterDelegator) Flush() { - f.ResponseWriter.(http.Flusher).Flush() -} - -func (f *fancyResponseWriterDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) { - return f.ResponseWriter.(http.Hijacker).Hijack() -} - -func (f *fancyResponseWriterDelegator) ReadFrom(r io.Reader) (int64, error) { - if !f.wroteHeader { - f.WriteHeader(http.StatusOK) - } - n, err := f.ResponseWriter.(io.ReaderFrom).ReadFrom(r) - f.written += n - return n, err -} - -func sanitizeMethod(m string) string { - switch m { - case "GET", "get": - return "get" - case "PUT", "put": - return "put" - case "HEAD", "head": - return "head" - case "POST", "post": - return "post" - case "DELETE", "delete": - return "delete" - case "CONNECT", "connect": - return "connect" - case "OPTIONS", "options": - return "options" - case "NOTIFY", "notify": - return "notify" - default: - return strings.ToLower(m) - } -} - -func sanitizeCode(s int) string { - switch s { - case 100: - return "100" - case 101: - return "101" - - case 200: - return "200" - case 201: - return "201" - case 202: - return "202" - case 203: - return "203" - case 204: - return "204" - case 205: - return "205" - case 206: - return "206" - - case 300: - return "300" - case 301: - return "301" - case 302: - return "302" - case 304: - return "304" - case 305: - return "305" - case 307: - return "307" - - case 400: - return "400" - case 401: - return "401" - case 402: - return "402" - case 403: - return "403" - case 404: - return "404" - case 405: - return "405" - case 406: - return "406" - case 407: - return "407" - case 408: - return "408" - case 409: - return "409" - case 410: - return "410" - case 411: - return "411" - case 412: - return "412" - case 413: - return "413" - case 414: - return "414" - case 415: - return "415" - case 416: - return "416" - case 417: - return "417" - case 418: - return "418" - - case 500: - return "500" - case 501: - return "501" - case 502: - return "502" - case 503: - return "503" - case 504: - return "504" - case 505: - return "505" - - case 428: - return "428" - case 429: - return "429" - case 431: - return "431" - case 511: - return "511" - - default: - return strconv.Itoa(s) - } -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go new file mode 100644 index 000000000..351c26e1a --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go @@ -0,0 +1,85 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "sort" + + dto "github.com/prometheus/client_model/go" +) + +// metricSorter is a sortable slice of *dto.Metric. +type metricSorter []*dto.Metric + +func (s metricSorter) Len() int { + return len(s) +} + +func (s metricSorter) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s metricSorter) Less(i, j int) bool { + if len(s[i].Label) != len(s[j].Label) { + // This should not happen. The metrics are + // inconsistent. However, we have to deal with the fact, as + // people might use custom collectors or metric family injection + // to create inconsistent metrics. So let's simply compare the + // number of labels in this case. That will still yield + // reproducible sorting. + return len(s[i].Label) < len(s[j].Label) + } + for n, lp := range s[i].Label { + vi := lp.GetValue() + vj := s[j].Label[n].GetValue() + if vi != vj { + return vi < vj + } + } + + // We should never arrive here. Multiple metrics with the same + // label set in the same scrape will lead to undefined ingestion + // behavior. However, as above, we have to provide stable sorting + // here, even for inconsistent metrics. So sort equal metrics + // by their timestamp, with missing timestamps (implying "now") + // coming last. + if s[i].TimestampMs == nil { + return false + } + if s[j].TimestampMs == nil { + return true + } + return s[i].GetTimestampMs() < s[j].GetTimestampMs() +} + +// NormalizeMetricFamilies returns a MetricFamily slice with empty +// MetricFamilies pruned and the remaining MetricFamilies sorted by name within +// the slice, with the contained Metrics sorted within each MetricFamily. +func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily { + for _, mf := range metricFamiliesByName { + sort.Sort(metricSorter(mf.Metric)) + } + names := make([]string, 0, len(metricFamiliesByName)) + for name, mf := range metricFamiliesByName { + if len(mf.Metric) > 0 { + names = append(names, name) + } + } + sort.Strings(names) + result := make([]*dto.MetricFamily, 0, len(names)) + for _, name := range names { + result = append(result, metricFamiliesByName[name]) + } + return result +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/labels.go b/vendor/github.com/prometheus/client_golang/prometheus/labels.go new file mode 100644 index 000000000..2744443ac --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/labels.go @@ -0,0 +1,87 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus + +import ( + "errors" + "fmt" + "strings" + "unicode/utf8" + + "github.com/prometheus/common/model" +) + +// Labels represents a collection of label name -> value mappings. This type is +// commonly used with the With(Labels) and GetMetricWith(Labels) methods of +// metric vector Collectors, e.g.: +// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) +// +// The other use-case is the specification of constant label pairs in Opts or to +// create a Desc. +type Labels map[string]string + +// reservedLabelPrefix is a prefix which is not legal in user-supplied +// label names. +const reservedLabelPrefix = "__" + +var errInconsistentCardinality = errors.New("inconsistent label cardinality") + +func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error { + return fmt.Errorf( + "%s: %q has %d variable labels named %q but %d values %q were provided", + errInconsistentCardinality, fqName, + len(labels), labels, + len(labelValues), labelValues, + ) +} + +func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error { + if len(labels) != expectedNumberOfValues { + return fmt.Errorf( + "%s: expected %d label values but got %d in %#v", + errInconsistentCardinality, expectedNumberOfValues, + len(labels), labels, + ) + } + + for name, val := range labels { + if !utf8.ValidString(val) { + return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val) + } + } + + return nil +} + +func validateLabelValues(vals []string, expectedNumberOfValues int) error { + if len(vals) != expectedNumberOfValues { + return fmt.Errorf( + "%s: expected %d label values but got %d in %#v", + errInconsistentCardinality, expectedNumberOfValues, + len(vals), vals, + ) + } + + for _, val := range vals { + if !utf8.ValidString(val) { + return fmt.Errorf("label value %q is not valid UTF-8", val) + } + } + + return nil +} + +func checkLabelName(l string) bool { + return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix) +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go index d4063d98f..55e6d86d5 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/metric.go @@ -15,6 +15,9 @@ package prometheus import ( "strings" + "time" + + "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" ) @@ -43,9 +46,8 @@ type Metric interface { // While populating dto.Metric, it is the responsibility of the // implementation to ensure validity of the Metric protobuf (like valid // UTF-8 strings or syntactically valid metric and label names). It is - // recommended to sort labels lexicographically. (Implementers may find - // LabelPairSorter useful for that.) Callers of Write should still make - // sure of sorting if they depend on it. + // recommended to sort labels lexicographically. Callers of Write should + // still make sure of sorting if they depend on it. Write(*dto.Metric) error // TODO(beorn7): The original rationale of passing in a pre-allocated // dto.Metric protobuf to save allocations has disappeared. The @@ -57,8 +59,9 @@ type Metric interface { // implementation XXX has its own XXXOpts type, but in most cases, it is just be // an alias of this type (which might change when the requirement arises.) // -// It is mandatory to set Name and Help to a non-empty string. All other fields -// are optional and can safely be left at their zero value. +// It is mandatory to set Name to a non-empty string. All other fields are +// optional and can safely be left at their zero value, although it is strongly +// encouraged to set a Help string. type Opts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Metric (created by joining these components with @@ -69,7 +72,7 @@ type Opts struct { Subsystem string Name string - // Help provides information about this metric. Mandatory! + // Help provides information about this metric. // // Metrics with the same fully-qualified name must have the same Help // string. @@ -79,20 +82,12 @@ type Opts struct { // with the same fully-qualified name must have the same label names in // their ConstLabels. // - // Note that in most cases, labels have a value that varies during the - // lifetime of a process. Those labels are usually managed with a metric - // vector collector (like CounterVec, GaugeVec, UntypedVec). ConstLabels - // serve only special purposes. One is for the special case where the - // value of a label does not change during the lifetime of a process, - // e.g. if the revision of the running binary is put into a - // label. Another, more advanced purpose is if more than one Collector - // needs to collect Metrics with the same fully-qualified name. In that - // case, those Metrics must differ in the values of their - // ConstLabels. See the Collector examples. - // - // If the value of a label never changes (not even between binaries), - // that label most likely should not be a label at all (but part of the - // metric name). + // ConstLabels are only used rarely. In particular, do not use them to + // attach the same labels to all your metrics. Those use cases are + // better covered by target labels set by the scraping Prometheus + // server, or by one specific metric (e.g. a build_info or a + // machine_role metric). See also + // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels ConstLabels Labels } @@ -118,37 +113,22 @@ func BuildFQName(namespace, subsystem, name string) string { return name } -// LabelPairSorter implements sort.Interface. It is used to sort a slice of -// dto.LabelPair pointers. This is useful for implementing the Write method of -// custom metrics. -type LabelPairSorter []*dto.LabelPair +// labelPairSorter implements sort.Interface. It is used to sort a slice of +// dto.LabelPair pointers. +type labelPairSorter []*dto.LabelPair -func (s LabelPairSorter) Len() int { +func (s labelPairSorter) Len() int { return len(s) } -func (s LabelPairSorter) Swap(i, j int) { +func (s labelPairSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } -func (s LabelPairSorter) Less(i, j int) bool { +func (s labelPairSorter) Less(i, j int) bool { return s[i].GetName() < s[j].GetName() } -type hashSorter []uint64 - -func (s hashSorter) Len() int { - return len(s) -} - -func (s hashSorter) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s hashSorter) Less(i, j int) bool { - return s[i] < s[j] -} - type invalidMetric struct { desc *Desc err error @@ -164,3 +144,31 @@ func NewInvalidMetric(desc *Desc, err error) Metric { func (m *invalidMetric) Desc() *Desc { return m.desc } func (m *invalidMetric) Write(*dto.Metric) error { return m.err } + +type timestampedMetric struct { + Metric + t time.Time +} + +func (m timestampedMetric) Write(pb *dto.Metric) error { + e := m.Metric.Write(pb) + pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000)) + return e +} + +// NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a +// way that it has an explicit timestamp set to the provided Time. This is only +// useful in rare cases as the timestamp of a Prometheus metric should usually +// be set by the Prometheus server during scraping. Exceptions include mirroring +// metrics with given timestamps from other metric +// sources. +// +// NewMetricWithTimestamp works best with MustNewConstMetric, +// MustNewConstHistogram, and MustNewConstSummary, see example. +// +// Currently, the exposition formats used by Prometheus are limited to +// millisecond resolution. Thus, the provided time will be rounded down to the +// next full millisecond value. +func NewMetricWithTimestamp(t time.Time, m Metric) Metric { + return timestampedMetric{Metric: m, t: t} +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/observer.go b/vendor/github.com/prometheus/client_golang/prometheus/observer.go new file mode 100644 index 000000000..5806cd09e --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/observer.go @@ -0,0 +1,52 @@ +// Copyright 2017 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus + +// Observer is the interface that wraps the Observe method, which is used by +// Histogram and Summary to add observations. +type Observer interface { + Observe(float64) +} + +// The ObserverFunc type is an adapter to allow the use of ordinary +// functions as Observers. If f is a function with the appropriate +// signature, ObserverFunc(f) is an Observer that calls f. +// +// This adapter is usually used in connection with the Timer type, and there are +// two general use cases: +// +// The most common one is to use a Gauge as the Observer for a Timer. +// See the "Gauge" Timer example. +// +// The more advanced use case is to create a function that dynamically decides +// which Observer to use for observing the duration. See the "Complex" Timer +// example. +type ObserverFunc func(float64) + +// Observe calls f(value). It implements Observer. +func (f ObserverFunc) Observe(value float64) { + f(value) +} + +// ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`. +type ObserverVec interface { + GetMetricWith(Labels) (Observer, error) + GetMetricWithLabelValues(lvs ...string) (Observer, error) + With(Labels) Observer + WithLabelValues(...string) Observer + CurryWith(Labels) (ObserverVec, error) + MustCurryWith(Labels) ObserverVec + + Collector +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go index 94b2553e1..9b8097942 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go @@ -13,46 +13,61 @@ package prometheus -import "github.com/prometheus/procfs" +import ( + "errors" + "os" +) type processCollector struct { - pid int collectFn func(chan<- Metric) pidFn func() (int, error) + reportErrors bool cpuTotal *Desc openFDs, maxFDs *Desc - vsize, rss *Desc + vsize, maxVsize *Desc + rss *Desc startTime *Desc } -// NewProcessCollector returns a collector which exports the current state of -// process metrics including cpu, memory and file descriptor usage as well as -// the process start time for the given process id under the given namespace. -func NewProcessCollector(pid int, namespace string) Collector { - return NewProcessCollectorPIDFn( - func() (int, error) { return pid, nil }, - namespace, - ) +// ProcessCollectorOpts defines the behavior of a process metrics collector +// created with NewProcessCollector. +type ProcessCollectorOpts struct { + // PidFn returns the PID of the process the collector collects metrics + // for. It is called upon each collection. By default, the PID of the + // current process is used, as determined on construction time by + // calling os.Getpid(). + PidFn func() (int, error) + // If non-empty, each of the collected metrics is prefixed by the + // provided string and an underscore ("_"). + Namespace string + // If true, any error encountered during collection is reported as an + // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored + // and the collected metrics will be incomplete. (Possibly, no metrics + // will be collected at all.) While that's usually not desired, it is + // appropriate for the common "mix-in" of process metrics, where process + // metrics are nice to have, but failing to collect them should not + // disrupt the collection of the remaining metrics. + ReportErrors bool } -// NewProcessCollectorPIDFn returns a collector which exports the current state -// of process metrics including cpu, memory and file descriptor usage as well -// as the process start time under the given namespace. The given pidFn is -// called on each collect and is used to determine the process to export -// metrics for. -func NewProcessCollectorPIDFn( - pidFn func() (int, error), - namespace string, -) Collector { +// NewProcessCollector returns a collector which exports the current state of +// process metrics including CPU, memory and file descriptor usage as well as +// the process start time. The detailed behavior is defined by the provided +// ProcessCollectorOpts. The zero value of ProcessCollectorOpts creates a +// collector for the current process with an empty namespace string and no error +// reporting. +// +// The collector only works on operating systems with a Linux-style proc +// filesystem and on Microsoft Windows. On other operating systems, it will not +// collect any metrics. +func NewProcessCollector(opts ProcessCollectorOpts) Collector { ns := "" - if len(namespace) > 0 { - ns = namespace + "_" + if len(opts.Namespace) > 0 { + ns = opts.Namespace + "_" } - c := processCollector{ - pidFn: pidFn, - collectFn: func(chan<- Metric) {}, - + c := &processCollector{ + reportErrors: opts.ReportErrors, cpuTotal: NewDesc( ns+"process_cpu_seconds_total", "Total user and system CPU time spent in seconds.", @@ -73,6 +88,11 @@ func NewProcessCollectorPIDFn( "Virtual memory size in bytes.", nil, nil, ), + maxVsize: NewDesc( + ns+"process_virtual_memory_max_bytes", + "Maximum amount of virtual memory available in bytes.", + nil, nil, + ), rss: NewDesc( ns+"process_resident_memory_bytes", "Resident memory size in bytes.", @@ -85,12 +105,23 @@ func NewProcessCollectorPIDFn( ), } - // Set up process metric collection if supported by the runtime. - if _, err := procfs.NewStat(); err == nil { - c.collectFn = c.processCollect + if opts.PidFn == nil { + pid := os.Getpid() + c.pidFn = func() (int, error) { return pid, nil } + } else { + c.pidFn = opts.PidFn } - return &c + // Set up process metric collection if supported by the runtime. + if canCollectProcess() { + c.collectFn = c.processCollect + } else { + c.collectFn = func(ch chan<- Metric) { + c.reportError(ch, nil, errors.New("process metrics not supported on this platform")) + } + } + + return c } // Describe returns all descriptions of the collector. @@ -99,6 +130,7 @@ func (c *processCollector) Describe(ch chan<- *Desc) { ch <- c.openFDs ch <- c.maxFDs ch <- c.vsize + ch <- c.maxVsize ch <- c.rss ch <- c.startTime } @@ -108,33 +140,12 @@ func (c *processCollector) Collect(ch chan<- Metric) { c.collectFn(ch) } -// TODO(ts): Bring back error reporting by reverting 7faf9e7 as soon as the -// client allows users to configure the error behavior. -func (c *processCollector) processCollect(ch chan<- Metric) { - pid, err := c.pidFn() - if err != nil { +func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) { + if !c.reportErrors { return } - - p, err := procfs.NewProc(pid) - if err != nil { - return - } - - if stat, err := p.NewStat(); err == nil { - ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) - ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) - ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) - if startTime, err := stat.StartTime(); err == nil { - ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) - } - } - - if fds, err := p.FileDescriptorsLen(); err == nil { - ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) - } - - if limits, err := p.NewLimits(); err == nil { - ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) + if desc == nil { + desc = NewInvalidDesc(err) } + ch <- NewInvalidMetric(desc, err) } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go new file mode 100644 index 000000000..3117461cd --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go @@ -0,0 +1,65 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !windows + +package prometheus + +import ( + "github.com/prometheus/procfs" +) + +func canCollectProcess() bool { + _, err := procfs.NewDefaultFS() + return err == nil +} + +func (c *processCollector) processCollect(ch chan<- Metric) { + pid, err := c.pidFn() + if err != nil { + c.reportError(ch, nil, err) + return + } + + p, err := procfs.NewProc(pid) + if err != nil { + c.reportError(ch, nil, err) + return + } + + if stat, err := p.Stat(); err == nil { + ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) + ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) + ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) + if startTime, err := stat.StartTime(); err == nil { + ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) + } else { + c.reportError(ch, c.startTime, err) + } + } else { + c.reportError(ch, nil, err) + } + + if fds, err := p.FileDescriptorsLen(); err == nil { + ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) + } else { + c.reportError(ch, c.openFDs, err) + } + + if limits, err := p.Limits(); err == nil { + ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) + ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) + } else { + c.reportError(ch, nil, err) + } +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go new file mode 100644 index 000000000..e0b935d1f --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go @@ -0,0 +1,112 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +func canCollectProcess() bool { + return true +} + +var ( + modpsapi = syscall.NewLazyDLL("psapi.dll") + modkernel32 = syscall.NewLazyDLL("kernel32.dll") + + procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo") + procGetProcessHandleCount = modkernel32.NewProc("GetProcessHandleCount") +) + +type processMemoryCounters struct { + // https://docs.microsoft.com/en-us/windows/desktop/api/psapi/ns-psapi-_process_memory_counters_ex + _ uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint64 + WorkingSetSize uint64 + QuotaPeakPagedPoolUsage uint64 + QuotaPagedPoolUsage uint64 + QuotaPeakNonPagedPoolUsage uint64 + QuotaNonPagedPoolUsage uint64 + PagefileUsage uint64 + PeakPagefileUsage uint64 + PrivateUsage uint64 +} + +func getProcessMemoryInfo(handle windows.Handle) (processMemoryCounters, error) { + mem := processMemoryCounters{} + r1, _, err := procGetProcessMemoryInfo.Call( + uintptr(handle), + uintptr(unsafe.Pointer(&mem)), + uintptr(unsafe.Sizeof(mem)), + ) + if r1 != 1 { + return mem, err + } else { + return mem, nil + } +} + +func getProcessHandleCount(handle windows.Handle) (uint32, error) { + var count uint32 + r1, _, err := procGetProcessHandleCount.Call( + uintptr(handle), + uintptr(unsafe.Pointer(&count)), + ) + if r1 != 1 { + return 0, err + } else { + return count, nil + } +} + +func (c *processCollector) processCollect(ch chan<- Metric) { + h, err := windows.GetCurrentProcess() + if err != nil { + c.reportError(ch, nil, err) + return + } + + var startTime, exitTime, kernelTime, userTime windows.Filetime + err = windows.GetProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.startTime, GaugeValue, float64(startTime.Nanoseconds()/1e9)) + ch <- MustNewConstMetric(c.cpuTotal, CounterValue, fileTimeToSeconds(kernelTime)+fileTimeToSeconds(userTime)) + + mem, err := getProcessMemoryInfo(h) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(mem.PrivateUsage)) + ch <- MustNewConstMetric(c.rss, GaugeValue, float64(mem.WorkingSetSize)) + + handles, err := getProcessHandleCount(h) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(handles)) + ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(16*1024*1024)) // Windows has a hard-coded max limit, not per-process. +} + +func fileTimeToSeconds(ft windows.Filetime) float64 { + return float64(uint64(ft.HighDateTime)<<32+uint64(ft.LowDateTime)) / 1e7 +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go new file mode 100644 index 000000000..fa535684f --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go @@ -0,0 +1,357 @@ +// Copyright 2017 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package promhttp + +import ( + "bufio" + "io" + "net" + "net/http" +) + +const ( + closeNotifier = 1 << iota + flusher + hijacker + readerFrom + pusher +) + +type delegator interface { + http.ResponseWriter + + Status() int + Written() int64 +} + +type responseWriterDelegator struct { + http.ResponseWriter + + status int + written int64 + wroteHeader bool + observeWriteHeader func(int) +} + +func (r *responseWriterDelegator) Status() int { + return r.status +} + +func (r *responseWriterDelegator) Written() int64 { + return r.written +} + +func (r *responseWriterDelegator) WriteHeader(code int) { + r.status = code + r.wroteHeader = true + r.ResponseWriter.WriteHeader(code) + if r.observeWriteHeader != nil { + r.observeWriteHeader(code) + } +} + +func (r *responseWriterDelegator) Write(b []byte) (int, error) { + if !r.wroteHeader { + r.WriteHeader(http.StatusOK) + } + n, err := r.ResponseWriter.Write(b) + r.written += int64(n) + return n, err +} + +type closeNotifierDelegator struct{ *responseWriterDelegator } +type flusherDelegator struct{ *responseWriterDelegator } +type hijackerDelegator struct{ *responseWriterDelegator } +type readerFromDelegator struct{ *responseWriterDelegator } +type pusherDelegator struct{ *responseWriterDelegator } + +func (d closeNotifierDelegator) CloseNotify() <-chan bool { + //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to + //remove support from client_golang yet. + return d.ResponseWriter.(http.CloseNotifier).CloseNotify() +} +func (d flusherDelegator) Flush() { + d.ResponseWriter.(http.Flusher).Flush() +} +func (d hijackerDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) { + return d.ResponseWriter.(http.Hijacker).Hijack() +} +func (d readerFromDelegator) ReadFrom(re io.Reader) (int64, error) { + if !d.wroteHeader { + d.WriteHeader(http.StatusOK) + } + n, err := d.ResponseWriter.(io.ReaderFrom).ReadFrom(re) + d.written += n + return n, err +} +func (d pusherDelegator) Push(target string, opts *http.PushOptions) error { + return d.ResponseWriter.(http.Pusher).Push(target, opts) +} + +var pickDelegator = make([]func(*responseWriterDelegator) delegator, 32) + +func init() { + // TODO(beorn7): Code generation would help here. + pickDelegator[0] = func(d *responseWriterDelegator) delegator { // 0 + return d + } + pickDelegator[closeNotifier] = func(d *responseWriterDelegator) delegator { // 1 + return closeNotifierDelegator{d} + } + pickDelegator[flusher] = func(d *responseWriterDelegator) delegator { // 2 + return flusherDelegator{d} + } + pickDelegator[flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 3 + return struct { + *responseWriterDelegator + http.Flusher + http.CloseNotifier + }{d, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[hijacker] = func(d *responseWriterDelegator) delegator { // 4 + return hijackerDelegator{d} + } + pickDelegator[hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 5 + return struct { + *responseWriterDelegator + http.Hijacker + http.CloseNotifier + }{d, hijackerDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 6 + return struct { + *responseWriterDelegator + http.Hijacker + http.Flusher + }{d, hijackerDelegator{d}, flusherDelegator{d}} + } + pickDelegator[hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 7 + return struct { + *responseWriterDelegator + http.Hijacker + http.Flusher + http.CloseNotifier + }{d, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[readerFrom] = func(d *responseWriterDelegator) delegator { // 8 + return readerFromDelegator{d} + } + pickDelegator[readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 9 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.CloseNotifier + }{d, readerFromDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 10 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Flusher + }{d, readerFromDelegator{d}, flusherDelegator{d}} + } + pickDelegator[readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 11 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Flusher + http.CloseNotifier + }{d, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 12 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Hijacker + }{d, readerFromDelegator{d}, hijackerDelegator{d}} + } + pickDelegator[readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 13 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Hijacker + http.CloseNotifier + }{d, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 14 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Hijacker + http.Flusher + }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} + } + pickDelegator[readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 15 + return struct { + *responseWriterDelegator + io.ReaderFrom + http.Hijacker + http.Flusher + http.CloseNotifier + }{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher] = func(d *responseWriterDelegator) delegator { // 16 + return pusherDelegator{d} + } + pickDelegator[pusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 17 + return struct { + *responseWriterDelegator + http.Pusher + http.CloseNotifier + }{d, pusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+flusher] = func(d *responseWriterDelegator) delegator { // 18 + return struct { + *responseWriterDelegator + http.Pusher + http.Flusher + }{d, pusherDelegator{d}, flusherDelegator{d}} + } + pickDelegator[pusher+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 19 + return struct { + *responseWriterDelegator + http.Pusher + http.Flusher + http.CloseNotifier + }{d, pusherDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+hijacker] = func(d *responseWriterDelegator) delegator { // 20 + return struct { + *responseWriterDelegator + http.Pusher + http.Hijacker + }{d, pusherDelegator{d}, hijackerDelegator{d}} + } + pickDelegator[pusher+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 21 + return struct { + *responseWriterDelegator + http.Pusher + http.Hijacker + http.CloseNotifier + }{d, pusherDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 22 + return struct { + *responseWriterDelegator + http.Pusher + http.Hijacker + http.Flusher + }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} + } + pickDelegator[pusher+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { //23 + return struct { + *responseWriterDelegator + http.Pusher + http.Hijacker + http.Flusher + http.CloseNotifier + }{d, pusherDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+readerFrom] = func(d *responseWriterDelegator) delegator { // 24 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + }{d, pusherDelegator{d}, readerFromDelegator{d}} + } + pickDelegator[pusher+readerFrom+closeNotifier] = func(d *responseWriterDelegator) delegator { // 25 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.CloseNotifier + }{d, pusherDelegator{d}, readerFromDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+readerFrom+flusher] = func(d *responseWriterDelegator) delegator { // 26 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Flusher + }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}} + } + pickDelegator[pusher+readerFrom+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 27 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Flusher + http.CloseNotifier + }{d, pusherDelegator{d}, readerFromDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+readerFrom+hijacker] = func(d *responseWriterDelegator) delegator { // 28 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Hijacker + }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}} + } + pickDelegator[pusher+readerFrom+hijacker+closeNotifier] = func(d *responseWriterDelegator) delegator { // 29 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Hijacker + http.CloseNotifier + }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, closeNotifierDelegator{d}} + } + pickDelegator[pusher+readerFrom+hijacker+flusher] = func(d *responseWriterDelegator) delegator { // 30 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Hijacker + http.Flusher + }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}} + } + pickDelegator[pusher+readerFrom+hijacker+flusher+closeNotifier] = func(d *responseWriterDelegator) delegator { // 31 + return struct { + *responseWriterDelegator + http.Pusher + io.ReaderFrom + http.Hijacker + http.Flusher + http.CloseNotifier + }{d, pusherDelegator{d}, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}} + } +} + +func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator { + d := &responseWriterDelegator{ + ResponseWriter: w, + observeWriteHeader: observeWriteHeaderFunc, + } + + id := 0 + //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to + //remove support from client_golang yet. + if _, ok := w.(http.CloseNotifier); ok { + id += closeNotifier + } + if _, ok := w.(http.Flusher); ok { + id += flusher + } + if _, ok := w.(http.Hijacker); ok { + id += hijacker + } + if _, ok := w.(io.ReaderFrom); ok { + id += readerFrom + } + if _, ok := w.(http.Pusher); ok { + id += pusher + } + + return pickDelegator[id](d) +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go index b6dd5a266..cea5a90fd 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go @@ -11,31 +11,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Copyright (c) 2013, The Prometheus Authors -// All rights reserved. +// Package promhttp provides tooling around HTTP servers and clients. // -// Use of this source code is governed by a BSD-style license that can be found -// in the LICENSE file. - -// Package promhttp contains functions to create http.Handler instances to -// expose Prometheus metrics via HTTP. In later versions of this package, it -// will also contain tooling to instrument instances of http.Handler and -// http.RoundTripper. +// First, the package allows the creation of http.Handler instances to expose +// Prometheus metrics via HTTP. promhttp.Handler acts on the +// prometheus.DefaultGatherer. With HandlerFor, you can create a handler for a +// custom registry or anything that implements the Gatherer interface. It also +// allows the creation of handlers that act differently on errors or allow to +// log errors. // -// promhttp.Handler acts on the prometheus.DefaultGatherer. With HandlerFor, -// you can create a handler for a custom registry or anything that implements -// the Gatherer interface. It also allows to create handlers that act -// differently on errors or allow to log errors. +// Second, the package provides tooling to instrument instances of http.Handler +// via middleware. Middleware wrappers follow the naming scheme +// InstrumentHandlerX, where X describes the intended use of the middleware. +// See each function's doc comment for specific details. +// +// Finally, the package allows for an http.RoundTripper to be instrumented via +// middleware. Middleware wrappers follow the naming scheme +// InstrumentRoundTripperX, where X describes the intended use of the +// middleware. See each function's doc comment for specific details. package promhttp import ( - "bytes" "compress/gzip" "fmt" "io" "net/http" "strings" "sync" + "time" "github.com/prometheus/common/expfmt" @@ -44,99 +47,204 @@ import ( const ( contentTypeHeader = "Content-Type" - contentLengthHeader = "Content-Length" contentEncodingHeader = "Content-Encoding" acceptEncodingHeader = "Accept-Encoding" ) -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) +var gzipPool = sync.Pool{ + New: func() interface{} { + return gzip.NewWriter(nil) + }, } -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) -} - -// Handler returns an HTTP handler for the prometheus.DefaultGatherer. The -// Handler uses the default HandlerOpts, i.e. report the first error as an HTTP -// error, no error logging, and compression if requested by the client. +// Handler returns an http.Handler for the prometheus.DefaultGatherer, using +// default HandlerOpts, i.e. it reports the first error as an HTTP error, it has +// no error logging, and it applies compression if requested by the client. // -// If you want to create a Handler for the DefaultGatherer with different -// HandlerOpts, create it with HandlerFor with prometheus.DefaultGatherer and -// your desired HandlerOpts. +// The returned http.Handler is already instrumented using the +// InstrumentMetricHandler function and the prometheus.DefaultRegisterer. If you +// create multiple http.Handlers by separate calls of the Handler function, the +// metrics used for instrumentation will be shared between them, providing +// global scrape counts. +// +// This function is meant to cover the bulk of basic use cases. If you are doing +// anything that requires more customization (including using a non-default +// Gatherer, different instrumentation, and non-default HandlerOpts), use the +// HandlerFor function. See there for details. func Handler() http.Handler { - return HandlerFor(prometheus.DefaultGatherer, HandlerOpts{}) + return InstrumentMetricHandler( + prometheus.DefaultRegisterer, HandlerFor(prometheus.DefaultGatherer, HandlerOpts{}), + ) } -// HandlerFor returns an http.Handler for the provided Gatherer. The behavior -// of the Handler is defined by the provided HandlerOpts. +// HandlerFor returns an uninstrumented http.Handler for the provided +// Gatherer. The behavior of the Handler is defined by the provided +// HandlerOpts. Thus, HandlerFor is useful to create http.Handlers for custom +// Gatherers, with non-default HandlerOpts, and/or with custom (or no) +// instrumentation. Use the InstrumentMetricHandler function to apply the same +// kind of instrumentation as it is used by the Handler function. func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + var ( + inFlightSem chan struct{} + errCnt = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "promhttp_metric_handler_errors_total", + Help: "Total number of internal errors encountered by the promhttp metric handler.", + }, + []string{"cause"}, + ) + ) + + if opts.MaxRequestsInFlight > 0 { + inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight) + } + if opts.Registry != nil { + // Initialize all possibilites that can occur below. + errCnt.WithLabelValues("gathering") + errCnt.WithLabelValues("encoding") + if err := opts.Registry.Register(errCnt); err != nil { + if are, ok := err.(prometheus.AlreadyRegisteredError); ok { + errCnt = are.ExistingCollector.(*prometheus.CounterVec) + } else { + panic(err) + } + } + } + + h := http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { + if inFlightSem != nil { + select { + case inFlightSem <- struct{}{}: // All good, carry on. + defer func() { <-inFlightSem }() + default: + http.Error(rsp, fmt.Sprintf( + "Limit of concurrent requests reached (%d), try again later.", opts.MaxRequestsInFlight, + ), http.StatusServiceUnavailable) + return + } + } mfs, err := reg.Gather() if err != nil { if opts.ErrorLog != nil { opts.ErrorLog.Println("error gathering metrics:", err) } + errCnt.WithLabelValues("gathering").Inc() switch opts.ErrorHandling { case PanicOnError: panic(err) case ContinueOnError: if len(mfs) == 0 { - http.Error(w, "No metrics gathered, last error:\n\n"+err.Error(), http.StatusInternalServerError) + // Still report the error if no metrics have been gathered. + httpError(rsp, err) return } case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics gathering:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } } contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf, opts.DisableCompression) - enc := expfmt.NewEncoder(writer, contentType) + header := rsp.Header() + header.Set(contentTypeHeader, string(contentType)) + + w := io.Writer(rsp) + if !opts.DisableCompression && gzipAccepted(req.Header) { + header.Set(contentEncodingHeader, "gzip") + gz := gzipPool.Get().(*gzip.Writer) + defer gzipPool.Put(gz) + + gz.Reset(w) + defer gz.Close() + + w = gz + } + + enc := expfmt.NewEncoder(w, contentType) + var lastErr error for _, mf := range mfs { if err := enc.Encode(mf); err != nil { lastErr = err if opts.ErrorLog != nil { - opts.ErrorLog.Println("error encoding metric family:", err) + opts.ErrorLog.Println("error encoding and sending metric family:", err) } + errCnt.WithLabelValues("encoding").Inc() switch opts.ErrorHandling { case PanicOnError: panic(err) case ContinueOnError: // Handled later. case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } } } - if closer, ok := writer.(io.Closer); ok { - closer.Close() + + if lastErr != nil { + httpError(rsp, lastErr) } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+err.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - w.Write(buf.Bytes()) - // TODO(beorn7): Consider streaming serving of metrics. }) + + if opts.Timeout <= 0 { + return h + } + return http.TimeoutHandler(h, opts.Timeout, fmt.Sprintf( + "Exceeded configured timeout of %v.\n", + opts.Timeout, + )) +} + +// InstrumentMetricHandler is usually used with an http.Handler returned by the +// HandlerFor function. It instruments the provided http.Handler with two +// metrics: A counter vector "promhttp_metric_handler_requests_total" to count +// scrapes partitioned by HTTP status code, and a gauge +// "promhttp_metric_handler_requests_in_flight" to track the number of +// simultaneous scrapes. This function idempotently registers collectors for +// both metrics with the provided Registerer. It panics if the registration +// fails. The provided metrics are useful to see how many scrapes hit the +// monitored target (which could be from different Prometheus servers or other +// scrapers), and how often they overlap (which would result in more than one +// scrape in flight at the same time). Note that the scrapes-in-flight gauge +// will contain the scrape by which it is exposed, while the scrape counter will +// only get incremented after the scrape is complete (as only then the status +// code is known). For tracking scrape durations, use the +// "scrape_duration_seconds" gauge created by the Prometheus server upon each +// scrape. +func InstrumentMetricHandler(reg prometheus.Registerer, handler http.Handler) http.Handler { + cnt := prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "promhttp_metric_handler_requests_total", + Help: "Total number of scrapes by HTTP status code.", + }, + []string{"code"}, + ) + // Initialize the most likely HTTP status codes. + cnt.WithLabelValues("200") + cnt.WithLabelValues("500") + cnt.WithLabelValues("503") + if err := reg.Register(cnt); err != nil { + if are, ok := err.(prometheus.AlreadyRegisteredError); ok { + cnt = are.ExistingCollector.(*prometheus.CounterVec) + } else { + panic(err) + } + } + + gge := prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "promhttp_metric_handler_requests_in_flight", + Help: "Current number of scrapes being served.", + }) + if err := reg.Register(gge); err != nil { + if are, ok := err.(prometheus.AlreadyRegisteredError); ok { + gge = are.ExistingCollector.(prometheus.Gauge) + } else { + panic(err) + } + } + + return InstrumentHandlerCounter(cnt, InstrumentHandlerInFlight(gge, handler)) } // HandlerErrorHandling defines how a Handler serving metrics will handle @@ -152,9 +260,12 @@ const ( // Ignore errors and try to serve as many metrics as possible. However, // if no metrics can be served, serve an HTTP status code 500 and the // last error message in the body. Only use this in deliberate "best - // effort" metrics collection scenarios. It is recommended to at least - // log errors (by providing an ErrorLog in HandlerOpts) to not mask - // errors completely. + // effort" metrics collection scenarios. In this case, it is highly + // recommended to provide other means of detecting errors: By setting an + // ErrorLog in HandlerOpts, the errors are logged. By providing a + // Registry in HandlerOpts, the exposed metrics include an error counter + // "promhttp_metric_handler_errors_total", which can be used for + // alerts. ContinueOnError // Panic upon the first error encountered (useful for "crash only" apps). PanicOnError @@ -177,25 +288,62 @@ type HandlerOpts struct { // logged regardless of the configured ErrorHandling provided ErrorLog // is not nil. ErrorHandling HandlerErrorHandling + // If Registry is not nil, it is used to register a metric + // "promhttp_metric_handler_errors_total", partitioned by "cause". A + // failed registration causes a panic. Note that this error counter is + // different from the instrumentation you get from the various + // InstrumentHandler... helpers. It counts errors that don't necessarily + // result in a non-2xx HTTP status code. There are two typical cases: + // (1) Encoding errors that only happen after streaming of the HTTP body + // has already started (and the status code 200 has been sent). This + // should only happen with custom collectors. (2) Collection errors with + // no effect on the HTTP status code because ErrorHandling is set to + // ContinueOnError. + Registry prometheus.Registerer // If DisableCompression is true, the handler will never compress the // response, even if requested by the client. DisableCompression bool + // The number of concurrent HTTP requests is limited to + // MaxRequestsInFlight. Additional requests are responded to with 503 + // Service Unavailable and a suitable message in the body. If + // MaxRequestsInFlight is 0 or negative, no limit is applied. + MaxRequestsInFlight int + // If handling a request takes longer than Timeout, it is responded to + // with 503 ServiceUnavailable and a suitable Message. No timeout is + // applied if Timeout is 0 or negative. Note that with the current + // implementation, reaching the timeout simply ends the HTTP requests as + // described above (and even that only if sending of the body hasn't + // started yet), while the bulk work of gathering all the metrics keeps + // running in the background (with the eventual result to be thrown + // away). Until the implementation is improved, it is recommended to + // implement a separate timeout in potentially slow Collectors. + Timeout time.Duration } -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled bool) (io.Writer, string) { - if compressionDisabled { - return writer, "" - } - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") +// gzipAccepted returns whether the client will accept gzip-encoded content. +func gzipAccepted(header http.Header) bool { + a := header.Get(acceptEncodingHeader) + parts := strings.Split(a, ",") for _, part := range parts { - part := strings.TrimSpace(part) + part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" + return true } } - return writer, "" + return false +} + +// httpError removes any content-encoding header and then calls http.Error with +// the provided error and http.StatusInternalServerErrer. Error contents is +// supposed to be uncompressed plain text. However, same as with a plain +// http.Error, any header settings will be void if the header has already been +// sent. The error message will still be written to the writer, but it will +// probably be of limited use. +func httpError(rsp http.ResponseWriter, err error) { + rsp.Header().Del(contentEncodingHeader) + http.Error( + rsp, + "An error has occurred while serving metrics:\n\n"+err.Error(), + http.StatusInternalServerError, + ) } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go new file mode 100644 index 000000000..83c49b66a --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go @@ -0,0 +1,219 @@ +// Copyright 2017 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package promhttp + +import ( + "crypto/tls" + "net/http" + "net/http/httptrace" + "time" + + "github.com/prometheus/client_golang/prometheus" +) + +// The RoundTripperFunc type is an adapter to allow the use of ordinary +// functions as RoundTrippers. If f is a function with the appropriate +// signature, RountTripperFunc(f) is a RoundTripper that calls f. +type RoundTripperFunc func(req *http.Request) (*http.Response, error) + +// RoundTrip implements the RoundTripper interface. +func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { + return rt(r) +} + +// InstrumentRoundTripperInFlight is a middleware that wraps the provided +// http.RoundTripper. It sets the provided prometheus.Gauge to the number of +// requests currently handled by the wrapped http.RoundTripper. +// +// See the example for ExampleInstrumentRoundTripperDuration for example usage. +func InstrumentRoundTripperInFlight(gauge prometheus.Gauge, next http.RoundTripper) RoundTripperFunc { + return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { + gauge.Inc() + defer gauge.Dec() + return next.RoundTrip(r) + }) +} + +// InstrumentRoundTripperCounter is a middleware that wraps the provided +// http.RoundTripper to observe the request result with the provided CounterVec. +// The CounterVec must have zero, one, or two non-const non-curried labels. For +// those, the only allowed label names are "code" and "method". The function +// panics otherwise. Partitioning of the CounterVec happens by HTTP status code +// and/or HTTP method if the respective instance label names are present in the +// CounterVec. For unpartitioned counting, use a CounterVec with zero labels. +// +// If the wrapped RoundTripper panics or returns a non-nil error, the Counter +// is not incremented. +// +// See the example for ExampleInstrumentRoundTripperDuration for example usage. +func InstrumentRoundTripperCounter(counter *prometheus.CounterVec, next http.RoundTripper) RoundTripperFunc { + code, method := checkLabels(counter) + + return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { + resp, err := next.RoundTrip(r) + if err == nil { + counter.With(labels(code, method, r.Method, resp.StatusCode)).Inc() + } + return resp, err + }) +} + +// InstrumentRoundTripperDuration is a middleware that wraps the provided +// http.RoundTripper to observe the request duration with the provided +// ObserverVec. The ObserverVec must have zero, one, or two non-const +// non-curried labels. For those, the only allowed label names are "code" and +// "method". The function panics otherwise. The Observe method of the Observer +// in the ObserverVec is called with the request duration in +// seconds. Partitioning happens by HTTP status code and/or HTTP method if the +// respective instance label names are present in the ObserverVec. For +// unpartitioned observations, use an ObserverVec with zero labels. Note that +// partitioning of Histograms is expensive and should be used judiciously. +// +// If the wrapped RoundTripper panics or returns a non-nil error, no values are +// reported. +// +// Note that this method is only guaranteed to never observe negative durations +// if used with Go1.9+. +func InstrumentRoundTripperDuration(obs prometheus.ObserverVec, next http.RoundTripper) RoundTripperFunc { + code, method := checkLabels(obs) + + return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { + start := time.Now() + resp, err := next.RoundTrip(r) + if err == nil { + obs.With(labels(code, method, r.Method, resp.StatusCode)).Observe(time.Since(start).Seconds()) + } + return resp, err + }) +} + +// InstrumentTrace is used to offer flexibility in instrumenting the available +// httptrace.ClientTrace hook functions. Each function is passed a float64 +// representing the time in seconds since the start of the http request. A user +// may choose to use separately buckets Histograms, or implement custom +// instance labels on a per function basis. +type InstrumentTrace struct { + GotConn func(float64) + PutIdleConn func(float64) + GotFirstResponseByte func(float64) + Got100Continue func(float64) + DNSStart func(float64) + DNSDone func(float64) + ConnectStart func(float64) + ConnectDone func(float64) + TLSHandshakeStart func(float64) + TLSHandshakeDone func(float64) + WroteHeaders func(float64) + Wait100Continue func(float64) + WroteRequest func(float64) +} + +// InstrumentRoundTripperTrace is a middleware that wraps the provided +// RoundTripper and reports times to hook functions provided in the +// InstrumentTrace struct. Hook functions that are not present in the provided +// InstrumentTrace struct are ignored. Times reported to the hook functions are +// time since the start of the request. Only with Go1.9+, those times are +// guaranteed to never be negative. (Earlier Go versions are not using a +// monotonic clock.) Note that partitioning of Histograms is expensive and +// should be used judiciously. +// +// For hook functions that receive an error as an argument, no observations are +// made in the event of a non-nil error value. +// +// See the example for ExampleInstrumentRoundTripperDuration for example usage. +func InstrumentRoundTripperTrace(it *InstrumentTrace, next http.RoundTripper) RoundTripperFunc { + return RoundTripperFunc(func(r *http.Request) (*http.Response, error) { + start := time.Now() + + trace := &httptrace.ClientTrace{ + GotConn: func(_ httptrace.GotConnInfo) { + if it.GotConn != nil { + it.GotConn(time.Since(start).Seconds()) + } + }, + PutIdleConn: func(err error) { + if err != nil { + return + } + if it.PutIdleConn != nil { + it.PutIdleConn(time.Since(start).Seconds()) + } + }, + DNSStart: func(_ httptrace.DNSStartInfo) { + if it.DNSStart != nil { + it.DNSStart(time.Since(start).Seconds()) + } + }, + DNSDone: func(_ httptrace.DNSDoneInfo) { + if it.DNSDone != nil { + it.DNSDone(time.Since(start).Seconds()) + } + }, + ConnectStart: func(_, _ string) { + if it.ConnectStart != nil { + it.ConnectStart(time.Since(start).Seconds()) + } + }, + ConnectDone: func(_, _ string, err error) { + if err != nil { + return + } + if it.ConnectDone != nil { + it.ConnectDone(time.Since(start).Seconds()) + } + }, + GotFirstResponseByte: func() { + if it.GotFirstResponseByte != nil { + it.GotFirstResponseByte(time.Since(start).Seconds()) + } + }, + Got100Continue: func() { + if it.Got100Continue != nil { + it.Got100Continue(time.Since(start).Seconds()) + } + }, + TLSHandshakeStart: func() { + if it.TLSHandshakeStart != nil { + it.TLSHandshakeStart(time.Since(start).Seconds()) + } + }, + TLSHandshakeDone: func(_ tls.ConnectionState, err error) { + if err != nil { + return + } + if it.TLSHandshakeDone != nil { + it.TLSHandshakeDone(time.Since(start).Seconds()) + } + }, + WroteHeaders: func() { + if it.WroteHeaders != nil { + it.WroteHeaders(time.Since(start).Seconds()) + } + }, + Wait100Continue: func() { + if it.Wait100Continue != nil { + it.Wait100Continue(time.Since(start).Seconds()) + } + }, + WroteRequest: func(_ httptrace.WroteRequestInfo) { + if it.WroteRequest != nil { + it.WroteRequest(time.Since(start).Seconds()) + } + }, + } + r = r.WithContext(httptrace.WithClientTrace(r.Context(), trace)) + + return next.RoundTrip(r) + }) +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go new file mode 100644 index 000000000..9db243805 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go @@ -0,0 +1,447 @@ +// Copyright 2017 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package promhttp + +import ( + "errors" + "net/http" + "strconv" + "strings" + "time" + + dto "github.com/prometheus/client_model/go" + + "github.com/prometheus/client_golang/prometheus" +) + +// magicString is used for the hacky label test in checkLabels. Remove once fixed. +const magicString = "zZgWfBxLqvG8kc8IMv3POi2Bb0tZI3vAnBx+gBaFi9FyPzB/CzKUer1yufDa" + +// InstrumentHandlerInFlight is a middleware that wraps the provided +// http.Handler. It sets the provided prometheus.Gauge to the number of +// requests currently handled by the wrapped http.Handler. +// +// See the example for InstrumentHandlerDuration for example usage. +func InstrumentHandlerInFlight(g prometheus.Gauge, next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + g.Inc() + defer g.Dec() + next.ServeHTTP(w, r) + }) +} + +// InstrumentHandlerDuration is a middleware that wraps the provided +// http.Handler to observe the request duration with the provided ObserverVec. +// The ObserverVec must have zero, one, or two non-const non-curried labels. For +// those, the only allowed label names are "code" and "method". The function +// panics otherwise. The Observe method of the Observer in the ObserverVec is +// called with the request duration in seconds. Partitioning happens by HTTP +// status code and/or HTTP method if the respective instance label names are +// present in the ObserverVec. For unpartitioned observations, use an +// ObserverVec with zero labels. Note that partitioning of Histograms is +// expensive and should be used judiciously. +// +// If the wrapped Handler does not set a status code, a status code of 200 is assumed. +// +// If the wrapped Handler panics, no values are reported. +// +// Note that this method is only guaranteed to never observe negative durations +// if used with Go1.9+. +func InstrumentHandlerDuration(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { + code, method := checkLabels(obs) + + if code { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + now := time.Now() + d := newDelegator(w, nil) + next.ServeHTTP(d, r) + + obs.With(labels(code, method, r.Method, d.Status())).Observe(time.Since(now).Seconds()) + }) + } + + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + now := time.Now() + next.ServeHTTP(w, r) + obs.With(labels(code, method, r.Method, 0)).Observe(time.Since(now).Seconds()) + }) +} + +// InstrumentHandlerCounter is a middleware that wraps the provided http.Handler +// to observe the request result with the provided CounterVec. The CounterVec +// must have zero, one, or two non-const non-curried labels. For those, the only +// allowed label names are "code" and "method". The function panics +// otherwise. Partitioning of the CounterVec happens by HTTP status code and/or +// HTTP method if the respective instance label names are present in the +// CounterVec. For unpartitioned counting, use a CounterVec with zero labels. +// +// If the wrapped Handler does not set a status code, a status code of 200 is assumed. +// +// If the wrapped Handler panics, the Counter is not incremented. +// +// See the example for InstrumentHandlerDuration for example usage. +func InstrumentHandlerCounter(counter *prometheus.CounterVec, next http.Handler) http.HandlerFunc { + code, method := checkLabels(counter) + + if code { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + d := newDelegator(w, nil) + next.ServeHTTP(d, r) + counter.With(labels(code, method, r.Method, d.Status())).Inc() + }) + } + + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + next.ServeHTTP(w, r) + counter.With(labels(code, method, r.Method, 0)).Inc() + }) +} + +// InstrumentHandlerTimeToWriteHeader is a middleware that wraps the provided +// http.Handler to observe with the provided ObserverVec the request duration +// until the response headers are written. The ObserverVec must have zero, one, +// or two non-const non-curried labels. For those, the only allowed label names +// are "code" and "method". The function panics otherwise. The Observe method of +// the Observer in the ObserverVec is called with the request duration in +// seconds. Partitioning happens by HTTP status code and/or HTTP method if the +// respective instance label names are present in the ObserverVec. For +// unpartitioned observations, use an ObserverVec with zero labels. Note that +// partitioning of Histograms is expensive and should be used judiciously. +// +// If the wrapped Handler panics before calling WriteHeader, no value is +// reported. +// +// Note that this method is only guaranteed to never observe negative durations +// if used with Go1.9+. +// +// See the example for InstrumentHandlerDuration for example usage. +func InstrumentHandlerTimeToWriteHeader(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { + code, method := checkLabels(obs) + + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + now := time.Now() + d := newDelegator(w, func(status int) { + obs.With(labels(code, method, r.Method, status)).Observe(time.Since(now).Seconds()) + }) + next.ServeHTTP(d, r) + }) +} + +// InstrumentHandlerRequestSize is a middleware that wraps the provided +// http.Handler to observe the request size with the provided ObserverVec. The +// ObserverVec must have zero, one, or two non-const non-curried labels. For +// those, the only allowed label names are "code" and "method". The function +// panics otherwise. The Observe method of the Observer in the ObserverVec is +// called with the request size in bytes. Partitioning happens by HTTP status +// code and/or HTTP method if the respective instance label names are present in +// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero +// labels. Note that partitioning of Histograms is expensive and should be used +// judiciously. +// +// If the wrapped Handler does not set a status code, a status code of 200 is assumed. +// +// If the wrapped Handler panics, no values are reported. +// +// See the example for InstrumentHandlerDuration for example usage. +func InstrumentHandlerRequestSize(obs prometheus.ObserverVec, next http.Handler) http.HandlerFunc { + code, method := checkLabels(obs) + + if code { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + d := newDelegator(w, nil) + next.ServeHTTP(d, r) + size := computeApproximateRequestSize(r) + obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(size)) + }) + } + + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + next.ServeHTTP(w, r) + size := computeApproximateRequestSize(r) + obs.With(labels(code, method, r.Method, 0)).Observe(float64(size)) + }) +} + +// InstrumentHandlerResponseSize is a middleware that wraps the provided +// http.Handler to observe the response size with the provided ObserverVec. The +// ObserverVec must have zero, one, or two non-const non-curried labels. For +// those, the only allowed label names are "code" and "method". The function +// panics otherwise. The Observe method of the Observer in the ObserverVec is +// called with the response size in bytes. Partitioning happens by HTTP status +// code and/or HTTP method if the respective instance label names are present in +// the ObserverVec. For unpartitioned observations, use an ObserverVec with zero +// labels. Note that partitioning of Histograms is expensive and should be used +// judiciously. +// +// If the wrapped Handler does not set a status code, a status code of 200 is assumed. +// +// If the wrapped Handler panics, no values are reported. +// +// See the example for InstrumentHandlerDuration for example usage. +func InstrumentHandlerResponseSize(obs prometheus.ObserverVec, next http.Handler) http.Handler { + code, method := checkLabels(obs) + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + d := newDelegator(w, nil) + next.ServeHTTP(d, r) + obs.With(labels(code, method, r.Method, d.Status())).Observe(float64(d.Written())) + }) +} + +func checkLabels(c prometheus.Collector) (code bool, method bool) { + // TODO(beorn7): Remove this hacky way to check for instance labels + // once Descriptors can have their dimensionality queried. + var ( + desc *prometheus.Desc + m prometheus.Metric + pm dto.Metric + lvs []string + ) + + // Get the Desc from the Collector. + descc := make(chan *prometheus.Desc, 1) + c.Describe(descc) + + select { + case desc = <-descc: + default: + panic("no description provided by collector") + } + select { + case <-descc: + panic("more than one description provided by collector") + default: + } + + close(descc) + + // Create a ConstMetric with the Desc. Since we don't know how many + // variable labels there are, try for as long as it needs. + for err := errors.New("dummy"); err != nil; lvs = append(lvs, magicString) { + m, err = prometheus.NewConstMetric(desc, prometheus.UntypedValue, 0, lvs...) + } + + // Write out the metric into a proto message and look at the labels. + // If the value is not the magicString, it is a constLabel, which doesn't interest us. + // If the label is curried, it doesn't interest us. + // In all other cases, only "code" or "method" is allowed. + if err := m.Write(&pm); err != nil { + panic("error checking metric for labels") + } + for _, label := range pm.Label { + name, value := label.GetName(), label.GetValue() + if value != magicString || isLabelCurried(c, name) { + continue + } + switch name { + case "code": + code = true + case "method": + method = true + default: + panic("metric partitioned with non-supported labels") + } + } + return +} + +func isLabelCurried(c prometheus.Collector, label string) bool { + // This is even hackier than the label test above. + // We essentially try to curry again and see if it works. + // But for that, we need to type-convert to the two + // types we use here, ObserverVec or *CounterVec. + switch v := c.(type) { + case *prometheus.CounterVec: + if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { + return false + } + case prometheus.ObserverVec: + if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { + return false + } + default: + panic("unsupported metric vec type") + } + return true +} + +// emptyLabels is a one-time allocation for non-partitioned metrics to avoid +// unnecessary allocations on each request. +var emptyLabels = prometheus.Labels{} + +func labels(code, method bool, reqMethod string, status int) prometheus.Labels { + if !(code || method) { + return emptyLabels + } + labels := prometheus.Labels{} + + if code { + labels["code"] = sanitizeCode(status) + } + if method { + labels["method"] = sanitizeMethod(reqMethod) + } + + return labels +} + +func computeApproximateRequestSize(r *http.Request) int { + s := 0 + if r.URL != nil { + s += len(r.URL.String()) + } + + s += len(r.Method) + s += len(r.Proto) + for name, values := range r.Header { + s += len(name) + for _, value := range values { + s += len(value) + } + } + s += len(r.Host) + + // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL. + + if r.ContentLength != -1 { + s += int(r.ContentLength) + } + return s +} + +func sanitizeMethod(m string) string { + switch m { + case "GET", "get": + return "get" + case "PUT", "put": + return "put" + case "HEAD", "head": + return "head" + case "POST", "post": + return "post" + case "DELETE", "delete": + return "delete" + case "CONNECT", "connect": + return "connect" + case "OPTIONS", "options": + return "options" + case "NOTIFY", "notify": + return "notify" + default: + return strings.ToLower(m) + } +} + +// If the wrapped http.Handler has not set a status code, i.e. the value is +// currently 0, santizeCode will return 200, for consistency with behavior in +// the stdlib. +func sanitizeCode(s int) string { + switch s { + case 100: + return "100" + case 101: + return "101" + + case 200, 0: + return "200" + case 201: + return "201" + case 202: + return "202" + case 203: + return "203" + case 204: + return "204" + case 205: + return "205" + case 206: + return "206" + + case 300: + return "300" + case 301: + return "301" + case 302: + return "302" + case 304: + return "304" + case 305: + return "305" + case 307: + return "307" + + case 400: + return "400" + case 401: + return "401" + case 402: + return "402" + case 403: + return "403" + case 404: + return "404" + case 405: + return "405" + case 406: + return "406" + case 407: + return "407" + case 408: + return "408" + case 409: + return "409" + case 410: + return "410" + case 411: + return "411" + case 412: + return "412" + case 413: + return "413" + case 414: + return "414" + case 415: + return "415" + case 416: + return "416" + case 417: + return "417" + case 418: + return "418" + + case 500: + return "500" + case 501: + return "501" + case 502: + return "502" + case 503: + return "503" + case 504: + return "504" + case 505: + return "505" + + case 428: + return "428" + case 429: + return "429" + case 431: + return "431" + case 511: + return "511" + + default: + return strconv.Itoa(s) + } +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index 8c6b5bd8e..6c32516aa 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -15,15 +15,22 @@ package prometheus import ( "bytes" - "errors" "fmt" + "io/ioutil" "os" + "path/filepath" + "runtime" "sort" + "strings" "sync" + "unicode/utf8" "github.com/golang/protobuf/proto" + "github.com/prometheus/common/expfmt" dto "github.com/prometheus/client_model/go" + + "github.com/prometheus/client_golang/prometheus/internal" ) const ( @@ -35,13 +42,14 @@ const ( // DefaultRegisterer and DefaultGatherer are the implementations of the // Registerer and Gatherer interface a number of convenience functions in this // package act on. Initially, both variables point to the same Registry, which -// has a process collector (see NewProcessCollector) and a Go collector (see -// NewGoCollector) already registered. This approach to keep default instances -// as global state mirrors the approach of other packages in the Go standard -// library. Note that there are caveats. Change the variables with caution and -// only if you understand the consequences. Users who want to avoid global state -// altogether should not use the convenience function and act on custom -// instances instead. +// has a process collector (currently on Linux only, see NewProcessCollector) +// and a Go collector (see NewGoCollector, in particular the note about +// stop-the-world implication with Go versions older than 1.9) already +// registered. This approach to keep default instances as global state mirrors +// the approach of other packages in the Go standard library. Note that there +// are caveats. Change the variables with caution and only if you understand the +// consequences. Users who want to avoid global state altogether should not use +// the convenience functions and act on custom instances instead. var ( defaultRegistry = NewRegistry() DefaultRegisterer Registerer = defaultRegistry @@ -49,7 +57,7 @@ var ( ) func init() { - MustRegister(NewProcessCollector(os.Getpid(), "")) + MustRegister(NewProcessCollector(ProcessCollectorOpts{})) MustRegister(NewGoCollector()) } @@ -65,7 +73,8 @@ func NewRegistry() *Registry { // NewPedanticRegistry returns a registry that checks during collection if each // collected Metric is consistent with its reported Desc, and if the Desc has -// actually been registered with the registry. +// actually been registered with the registry. Unchecked Collectors (those whose +// Describe methed does not yield any descriptors) are excluded from the check. // // Usually, a Registry will be happy as long as the union of all collected // Metrics is consistent and valid even if some metrics are not consistent with @@ -80,7 +89,7 @@ func NewPedanticRegistry() *Registry { // Registerer is the interface for the part of a registry in charge of // registering and unregistering. Users of custom registries should use -// Registerer as type for registration purposes (rather then the Registry type +// Registerer as type for registration purposes (rather than the Registry type // directly). In that way, they are free to use custom Registerer implementation // (e.g. for testing purposes). type Registerer interface { @@ -95,8 +104,13 @@ type Registerer interface { // returned error is an instance of AlreadyRegisteredError, which // contains the previously registered Collector. // - // It is in general not safe to register the same Collector multiple - // times concurrently. + // A Collector whose Describe method does not yield any Desc is treated + // as unchecked. Registration will always succeed. No check for + // re-registering (see previous paragraph) is performed. Thus, the + // caller is responsible for not double-registering the same unchecked + // Collector, and for providing a Collector that will not cause + // inconsistent metrics on collection. (This would lead to scrape + // errors.) Register(Collector) error // MustRegister works like Register but registers any number of // Collectors and panics upon the first registration that causes an @@ -105,7 +119,9 @@ type Registerer interface { // Unregister unregisters the Collector that equals the Collector passed // in as an argument. (Two Collectors are considered equal if their // Describe method yields the same set of descriptors.) The function - // returns whether a Collector was unregistered. + // returns whether a Collector was unregistered. Note that an unchecked + // Collector cannot be unregistered (as its Describe method does not + // yield any descriptor). // // Note that even after unregistering, it will not be possible to // register a new Collector that is inconsistent with the unregistered @@ -123,15 +139,23 @@ type Registerer interface { type Gatherer interface { // Gather calls the Collect method of the registered Collectors and then // gathers the collected metrics into a lexicographically sorted slice - // of MetricFamily protobufs. Even if an error occurs, Gather attempts - // to gather as many metrics as possible. Hence, if a non-nil error is - // returned, the returned MetricFamily slice could be nil (in case of a - // fatal error that prevented any meaningful metric collection) or - // contain a number of MetricFamily protobufs, some of which might be - // incomplete, and some might be missing altogether. The returned error - // (which might be a MultiError) explains the details. In scenarios - // where complete collection is critical, the returned MetricFamily - // protobufs should be disregarded if the returned error is non-nil. + // of uniquely named MetricFamily protobufs. Gather ensures that the + // returned slice is valid and self-consistent so that it can be used + // for valid exposition. As an exception to the strict consistency + // requirements described for metric.Desc, Gather will tolerate + // different sets of label names for metrics of the same metric family. + // + // Even if an error occurs, Gather attempts to gather as many metrics as + // possible. Hence, if a non-nil error is returned, the returned + // MetricFamily slice could be nil (in case of a fatal error that + // prevented any meaningful metric collection) or contain a number of + // MetricFamily protobufs, some of which might be incomplete, and some + // might be missing altogether. The returned error (which might be a + // MultiError) explains the details. Note that this is mostly useful for + // debugging purposes. If the gathered protobufs are to be used for + // exposition in actual monitoring, it is almost always better to not + // expose an incomplete result and instead disregard the returned + // MetricFamily protobufs in case the returned error is non-nil. Gather() ([]*dto.MetricFamily, error) } @@ -201,6 +225,13 @@ func (errs MultiError) Error() string { return buf.String() } +// Append appends the provided error if it is not nil. +func (errs *MultiError) Append(err error) { + if err != nil { + *errs = append(*errs, err) + } +} + // MaybeUnwrap returns nil if len(errs) is 0. It returns the first and only // contained error as error if len(errs is 1). In all other cases, it returns // the MultiError directly. This is helpful for returning a MultiError in a way @@ -225,6 +256,7 @@ type Registry struct { collectorsByID map[uint64]Collector // ID is a hash of the descIDs. descIDs map[uint64]struct{} dimHashesByName map[string]uint64 + uncheckedCollectors []Collector pedanticChecksEnabled bool } @@ -242,7 +274,12 @@ func (r *Registry) Register(c Collector) error { close(descChan) }() r.mtx.Lock() - defer r.mtx.Unlock() + defer func() { + // Drain channel in case of premature return to not leak a goroutine. + for range descChan { + } + r.mtx.Unlock() + }() // Conduct various tests... for desc := range descChan { @@ -282,14 +319,23 @@ func (r *Registry) Register(c Collector) error { } } } - // Did anything happen at all? + // A Collector yielding no Desc at all is considered unchecked. if len(newDescIDs) == 0 { - return errors.New("collector has no descriptors") + r.uncheckedCollectors = append(r.uncheckedCollectors, c) + return nil } if existing, exists := r.collectorsByID[collectorID]; exists { - return AlreadyRegisteredError{ - ExistingCollector: existing, - NewCollector: c, + switch e := existing.(type) { + case *wrappingCollector: + return AlreadyRegisteredError{ + ExistingCollector: e.unwrapRecursively(), + NewCollector: c, + } + default: + return AlreadyRegisteredError{ + ExistingCollector: e, + NewCollector: c, + } } } // If the collectorID is new, but at least one of the descs existed @@ -358,31 +404,25 @@ func (r *Registry) MustRegister(cs ...Collector) { // Gather implements Gatherer. func (r *Registry) Gather() ([]*dto.MetricFamily, error) { var ( - metricChan = make(chan Metric, capMetricChan) - metricHashes = map[uint64]struct{}{} - dimHashes = map[string]uint64{} - wg sync.WaitGroup - errs MultiError // The collected errors to return in the end. - registeredDescIDs map[uint64]struct{} // Only used for pedantic checks + checkedMetricChan = make(chan Metric, capMetricChan) + uncheckedMetricChan = make(chan Metric, capMetricChan) + metricHashes = map[uint64]struct{}{} + wg sync.WaitGroup + errs MultiError // The collected errors to return in the end. + registeredDescIDs map[uint64]struct{} // Only used for pedantic checks ) r.mtx.RLock() + goroutineBudget := len(r.collectorsByID) + len(r.uncheckedCollectors) metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName)) - - // Scatter. - // (Collectors could be complex and slow, so we call them all at once.) - wg.Add(len(r.collectorsByID)) - go func() { - wg.Wait() - close(metricChan) - }() + checkedCollectors := make(chan Collector, len(r.collectorsByID)) + uncheckedCollectors := make(chan Collector, len(r.uncheckedCollectors)) for _, collector := range r.collectorsByID { - go func(collector Collector) { - defer wg.Done() - collector.Collect(metricChan) - }(collector) + checkedCollectors <- collector + } + for _, collector := range r.uncheckedCollectors { + uncheckedCollectors <- collector } - // In case pedantic checks are enabled, we have to copy the map before // giving up the RLock. if r.pedanticChecksEnabled { @@ -391,133 +431,264 @@ func (r *Registry) Gather() ([]*dto.MetricFamily, error) { registeredDescIDs[id] = struct{}{} } } - r.mtx.RUnlock() - // Drain metricChan in case of premature return. + wg.Add(goroutineBudget) + + collectWorker := func() { + for { + select { + case collector := <-checkedCollectors: + collector.Collect(checkedMetricChan) + case collector := <-uncheckedCollectors: + collector.Collect(uncheckedMetricChan) + default: + return + } + wg.Done() + } + } + + // Start the first worker now to make sure at least one is running. + go collectWorker() + goroutineBudget-- + + // Close checkedMetricChan and uncheckedMetricChan once all collectors + // are collected. + go func() { + wg.Wait() + close(checkedMetricChan) + close(uncheckedMetricChan) + }() + + // Drain checkedMetricChan and uncheckedMetricChan in case of premature return. defer func() { - for range metricChan { + if checkedMetricChan != nil { + for range checkedMetricChan { + } + } + if uncheckedMetricChan != nil { + for range uncheckedMetricChan { + } } }() - // Gather. - for metric := range metricChan { - // This could be done concurrently, too, but it required locking - // of metricFamiliesByName (and of metricHashes if checks are - // enabled). Most likely not worth it. - desc := metric.Desc() - dtoMetric := &dto.Metric{} - if err := metric.Write(dtoMetric); err != nil { - errs = append(errs, fmt.Errorf( - "error collecting metric %v: %s", desc, err, + // Copy the channel references so we can nil them out later to remove + // them from the select statements below. + cmc := checkedMetricChan + umc := uncheckedMetricChan + + for { + select { + case metric, ok := <-cmc: + if !ok { + cmc = nil + break + } + errs.Append(processMetric( + metric, metricFamiliesByName, + metricHashes, + registeredDescIDs, )) - continue + case metric, ok := <-umc: + if !ok { + umc = nil + break + } + errs.Append(processMetric( + metric, metricFamiliesByName, + metricHashes, + nil, + )) + default: + if goroutineBudget <= 0 || len(checkedCollectors)+len(uncheckedCollectors) == 0 { + // All collectors are already being worked on or + // we have already as many goroutines started as + // there are collectors. Do the same as above, + // just without the default. + select { + case metric, ok := <-cmc: + if !ok { + cmc = nil + break + } + errs.Append(processMetric( + metric, metricFamiliesByName, + metricHashes, + registeredDescIDs, + )) + case metric, ok := <-umc: + if !ok { + umc = nil + break + } + errs.Append(processMetric( + metric, metricFamiliesByName, + metricHashes, + nil, + )) + } + break + } + // Start more workers. + go collectWorker() + goroutineBudget-- + runtime.Gosched() } - metricFamily, ok := metricFamiliesByName[desc.fqName] - if ok { - if metricFamily.GetHelp() != desc.help { - errs = append(errs, fmt.Errorf( - "collected metric %s %s has help %q but should have %q", - desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(), - )) - continue - } - // TODO(beorn7): Simplify switch once Desc has type. - switch metricFamily.GetType() { - case dto.MetricType_COUNTER: - if dtoMetric.Counter == nil { - errs = append(errs, fmt.Errorf( - "collected metric %s %s should be a Counter", - desc.fqName, dtoMetric, - )) - continue - } - case dto.MetricType_GAUGE: - if dtoMetric.Gauge == nil { - errs = append(errs, fmt.Errorf( - "collected metric %s %s should be a Gauge", - desc.fqName, dtoMetric, - )) - continue - } - case dto.MetricType_SUMMARY: - if dtoMetric.Summary == nil { - errs = append(errs, fmt.Errorf( - "collected metric %s %s should be a Summary", - desc.fqName, dtoMetric, - )) - continue - } - case dto.MetricType_UNTYPED: - if dtoMetric.Untyped == nil { - errs = append(errs, fmt.Errorf( - "collected metric %s %s should be Untyped", - desc.fqName, dtoMetric, - )) - continue - } - case dto.MetricType_HISTOGRAM: - if dtoMetric.Histogram == nil { - errs = append(errs, fmt.Errorf( - "collected metric %s %s should be a Histogram", - desc.fqName, dtoMetric, - )) - continue - } - default: - panic("encountered MetricFamily with invalid type") - } - } else { - metricFamily = &dto.MetricFamily{} - metricFamily.Name = proto.String(desc.fqName) - metricFamily.Help = proto.String(desc.help) - // TODO(beorn7): Simplify switch once Desc has type. - switch { - case dtoMetric.Gauge != nil: - metricFamily.Type = dto.MetricType_GAUGE.Enum() - case dtoMetric.Counter != nil: - metricFamily.Type = dto.MetricType_COUNTER.Enum() - case dtoMetric.Summary != nil: - metricFamily.Type = dto.MetricType_SUMMARY.Enum() - case dtoMetric.Untyped != nil: - metricFamily.Type = dto.MetricType_UNTYPED.Enum() - case dtoMetric.Histogram != nil: - metricFamily.Type = dto.MetricType_HISTOGRAM.Enum() - default: - errs = append(errs, fmt.Errorf( - "empty metric collected: %s", dtoMetric, - )) - continue - } - metricFamiliesByName[desc.fqName] = metricFamily + // Once both checkedMetricChan and uncheckdMetricChan are closed + // and drained, the contraption above will nil out cmc and umc, + // and then we can leave the collect loop here. + if cmc == nil && umc == nil { + break } - if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes, dimHashes); err != nil { - errs = append(errs, err) - continue - } - if r.pedanticChecksEnabled { - // Is the desc registered at all? - if _, exist := registeredDescIDs[desc.id]; !exist { - errs = append(errs, fmt.Errorf( - "collected metric %s %s with unregistered descriptor %s", - metricFamily.GetName(), dtoMetric, desc, - )) - continue - } - if err := checkDescConsistency(metricFamily, dtoMetric, desc); err != nil { - errs = append(errs, err) - continue - } - } - metricFamily.Metric = append(metricFamily.Metric, dtoMetric) } - return normalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() + return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() +} + +// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the +// Prometheus text format, and writes it to a temporary file. Upon success, the +// temporary file is renamed to the provided filename. +// +// This is intended for use with the textfile collector of the node exporter. +// Note that the node exporter expects the filename to be suffixed with ".prom". +func WriteToTextfile(filename string, g Gatherer) error { + tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename)) + if err != nil { + return err + } + defer os.Remove(tmp.Name()) + + mfs, err := g.Gather() + if err != nil { + return err + } + for _, mf := range mfs { + if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil { + return err + } + } + if err := tmp.Close(); err != nil { + return err + } + + if err := os.Chmod(tmp.Name(), 0644); err != nil { + return err + } + return os.Rename(tmp.Name(), filename) +} + +// processMetric is an internal helper method only used by the Gather method. +func processMetric( + metric Metric, + metricFamiliesByName map[string]*dto.MetricFamily, + metricHashes map[uint64]struct{}, + registeredDescIDs map[uint64]struct{}, +) error { + desc := metric.Desc() + // Wrapped metrics collected by an unchecked Collector can have an + // invalid Desc. + if desc.err != nil { + return desc.err + } + dtoMetric := &dto.Metric{} + if err := metric.Write(dtoMetric); err != nil { + return fmt.Errorf("error collecting metric %v: %s", desc, err) + } + metricFamily, ok := metricFamiliesByName[desc.fqName] + if ok { // Existing name. + if metricFamily.GetHelp() != desc.help { + return fmt.Errorf( + "collected metric %s %s has help %q but should have %q", + desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(), + ) + } + // TODO(beorn7): Simplify switch once Desc has type. + switch metricFamily.GetType() { + case dto.MetricType_COUNTER: + if dtoMetric.Counter == nil { + return fmt.Errorf( + "collected metric %s %s should be a Counter", + desc.fqName, dtoMetric, + ) + } + case dto.MetricType_GAUGE: + if dtoMetric.Gauge == nil { + return fmt.Errorf( + "collected metric %s %s should be a Gauge", + desc.fqName, dtoMetric, + ) + } + case dto.MetricType_SUMMARY: + if dtoMetric.Summary == nil { + return fmt.Errorf( + "collected metric %s %s should be a Summary", + desc.fqName, dtoMetric, + ) + } + case dto.MetricType_UNTYPED: + if dtoMetric.Untyped == nil { + return fmt.Errorf( + "collected metric %s %s should be Untyped", + desc.fqName, dtoMetric, + ) + } + case dto.MetricType_HISTOGRAM: + if dtoMetric.Histogram == nil { + return fmt.Errorf( + "collected metric %s %s should be a Histogram", + desc.fqName, dtoMetric, + ) + } + default: + panic("encountered MetricFamily with invalid type") + } + } else { // New name. + metricFamily = &dto.MetricFamily{} + metricFamily.Name = proto.String(desc.fqName) + metricFamily.Help = proto.String(desc.help) + // TODO(beorn7): Simplify switch once Desc has type. + switch { + case dtoMetric.Gauge != nil: + metricFamily.Type = dto.MetricType_GAUGE.Enum() + case dtoMetric.Counter != nil: + metricFamily.Type = dto.MetricType_COUNTER.Enum() + case dtoMetric.Summary != nil: + metricFamily.Type = dto.MetricType_SUMMARY.Enum() + case dtoMetric.Untyped != nil: + metricFamily.Type = dto.MetricType_UNTYPED.Enum() + case dtoMetric.Histogram != nil: + metricFamily.Type = dto.MetricType_HISTOGRAM.Enum() + default: + return fmt.Errorf("empty metric collected: %s", dtoMetric) + } + if err := checkSuffixCollisions(metricFamily, metricFamiliesByName); err != nil { + return err + } + metricFamiliesByName[desc.fqName] = metricFamily + } + if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes); err != nil { + return err + } + if registeredDescIDs != nil { + // Is the desc registered at all? + if _, exist := registeredDescIDs[desc.id]; !exist { + return fmt.Errorf( + "collected metric %s %s with unregistered descriptor %s", + metricFamily.GetName(), dtoMetric, desc, + ) + } + if err := checkDescConsistency(metricFamily, dtoMetric, desc); err != nil { + return err + } + } + metricFamily.Metric = append(metricFamily.Metric, dtoMetric) + return nil } // Gatherers is a slice of Gatherer instances that implements the Gatherer // interface itself. Its Gather method calls Gather on all Gatherers in the // slice in order and returns the merged results. Errors returned from the -// Gather calles are all returned in a flattened MultiError. Duplicate and +// Gather calls are all returned in a flattened MultiError. Duplicate and // inconsistent Metrics are skipped (first occurrence in slice order wins) and // reported in the returned error. // @@ -537,7 +708,6 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) { var ( metricFamiliesByName = map[string]*dto.MetricFamily{} metricHashes = map[uint64]struct{}{} - dimHashes = map[string]uint64{} errs MultiError // The collected errors to return in the end. ) @@ -574,10 +744,14 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) { existingMF.Name = mf.Name existingMF.Help = mf.Help existingMF.Type = mf.Type + if err := checkSuffixCollisions(existingMF, metricFamiliesByName); err != nil { + errs = append(errs, err) + continue + } metricFamiliesByName[mf.GetName()] = existingMF } for _, m := range mf.Metric { - if err := checkMetricConsistency(existingMF, m, metricHashes, dimHashes); err != nil { + if err := checkMetricConsistency(existingMF, m, metricHashes); err != nil { errs = append(errs, err) continue } @@ -585,88 +759,80 @@ func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) { } } } - return normalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() + return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() } -// metricSorter is a sortable slice of *dto.Metric. -type metricSorter []*dto.Metric - -func (s metricSorter) Len() int { - return len(s) -} - -func (s metricSorter) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s metricSorter) Less(i, j int) bool { - if len(s[i].Label) != len(s[j].Label) { - // This should not happen. The metrics are - // inconsistent. However, we have to deal with the fact, as - // people might use custom collectors or metric family injection - // to create inconsistent metrics. So let's simply compare the - // number of labels in this case. That will still yield - // reproducible sorting. - return len(s[i].Label) < len(s[j].Label) +// checkSuffixCollisions checks for collisions with the “magic” suffixes the +// Prometheus text format and the internal metric representation of the +// Prometheus server add while flattening Summaries and Histograms. +func checkSuffixCollisions(mf *dto.MetricFamily, mfs map[string]*dto.MetricFamily) error { + var ( + newName = mf.GetName() + newType = mf.GetType() + newNameWithoutSuffix = "" + ) + switch { + case strings.HasSuffix(newName, "_count"): + newNameWithoutSuffix = newName[:len(newName)-6] + case strings.HasSuffix(newName, "_sum"): + newNameWithoutSuffix = newName[:len(newName)-4] + case strings.HasSuffix(newName, "_bucket"): + newNameWithoutSuffix = newName[:len(newName)-7] } - for n, lp := range s[i].Label { - vi := lp.GetValue() - vj := s[j].Label[n].GetValue() - if vi != vj { - return vi < vj + if newNameWithoutSuffix != "" { + if existingMF, ok := mfs[newNameWithoutSuffix]; ok { + switch existingMF.GetType() { + case dto.MetricType_SUMMARY: + if !strings.HasSuffix(newName, "_bucket") { + return fmt.Errorf( + "collected metric named %q collides with previously collected summary named %q", + newName, newNameWithoutSuffix, + ) + } + case dto.MetricType_HISTOGRAM: + return fmt.Errorf( + "collected metric named %q collides with previously collected histogram named %q", + newName, newNameWithoutSuffix, + ) + } } } - - // We should never arrive here. Multiple metrics with the same - // label set in the same scrape will lead to undefined ingestion - // behavior. However, as above, we have to provide stable sorting - // here, even for inconsistent metrics. So sort equal metrics - // by their timestamp, with missing timestamps (implying "now") - // coming last. - if s[i].TimestampMs == nil { - return false - } - if s[j].TimestampMs == nil { - return true - } - return s[i].GetTimestampMs() < s[j].GetTimestampMs() -} - -// normalizeMetricFamilies returns a MetricFamily slice with empty -// MetricFamilies pruned and the remaining MetricFamilies sorted by name within -// the slice, with the contained Metrics sorted within each MetricFamily. -func normalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily { - for _, mf := range metricFamiliesByName { - sort.Sort(metricSorter(mf.Metric)) - } - names := make([]string, 0, len(metricFamiliesByName)) - for name, mf := range metricFamiliesByName { - if len(mf.Metric) > 0 { - names = append(names, name) + if newType == dto.MetricType_SUMMARY || newType == dto.MetricType_HISTOGRAM { + if _, ok := mfs[newName+"_count"]; ok { + return fmt.Errorf( + "collected histogram or summary named %q collides with previously collected metric named %q", + newName, newName+"_count", + ) + } + if _, ok := mfs[newName+"_sum"]; ok { + return fmt.Errorf( + "collected histogram or summary named %q collides with previously collected metric named %q", + newName, newName+"_sum", + ) } } - sort.Strings(names) - result := make([]*dto.MetricFamily, 0, len(names)) - for _, name := range names { - result = append(result, metricFamiliesByName[name]) + if newType == dto.MetricType_HISTOGRAM { + if _, ok := mfs[newName+"_bucket"]; ok { + return fmt.Errorf( + "collected histogram named %q collides with previously collected metric named %q", + newName, newName+"_bucket", + ) + } } - return result + return nil } // checkMetricConsistency checks if the provided Metric is consistent with the -// provided MetricFamily. It also hashed the Metric labels and the MetricFamily -// name. If the resulting hash is alread in the provided metricHashes, an error -// is returned. If not, it is added to metricHashes. The provided dimHashes maps -// MetricFamily names to their dimHash (hashed sorted label names). If dimHashes -// doesn't yet contain a hash for the provided MetricFamily, it is -// added. Otherwise, an error is returned if the existing dimHashes in not equal -// the calculated dimHash. +// provided MetricFamily. It also hashes the Metric labels and the MetricFamily +// name. If the resulting hash is already in the provided metricHashes, an error +// is returned. If not, it is added to metricHashes. func checkMetricConsistency( metricFamily *dto.MetricFamily, dtoMetric *dto.Metric, metricHashes map[uint64]struct{}, - dimHashes map[string]uint64, ) error { + name := metricFamily.GetName() + // Type consistency with metric family. if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil || metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil || @@ -674,41 +840,65 @@ func checkMetricConsistency( metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil || metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil { return fmt.Errorf( - "collected metric %s %s is not a %s", - metricFamily.GetName(), dtoMetric, metricFamily.GetType(), + "collected metric %q { %s} is not a %s", + name, dtoMetric, metricFamily.GetType(), ) } - // Is the metric unique (i.e. no other metric with the same name and the same label values)? + previousLabelName := "" + for _, labelPair := range dtoMetric.GetLabel() { + labelName := labelPair.GetName() + if labelName == previousLabelName { + return fmt.Errorf( + "collected metric %q { %s} has two or more labels with the same name: %s", + name, dtoMetric, labelName, + ) + } + if !checkLabelName(labelName) { + return fmt.Errorf( + "collected metric %q { %s} has a label with an invalid name: %s", + name, dtoMetric, labelName, + ) + } + if dtoMetric.Summary != nil && labelName == quantileLabel { + return fmt.Errorf( + "collected metric %q { %s} must not have an explicit %q label", + name, dtoMetric, quantileLabel, + ) + } + if !utf8.ValidString(labelPair.GetValue()) { + return fmt.Errorf( + "collected metric %q { %s} has a label named %q whose value is not utf8: %#v", + name, dtoMetric, labelName, labelPair.GetValue()) + } + previousLabelName = labelName + } + + // Is the metric unique (i.e. no other metric with the same name and the same labels)? h := hashNew() - h = hashAdd(h, metricFamily.GetName()) + h = hashAdd(h, name) h = hashAddByte(h, separatorByte) - dh := hashNew() // Make sure label pairs are sorted. We depend on it for the consistency // check. - sort.Sort(LabelPairSorter(dtoMetric.Label)) + if !sort.IsSorted(labelPairSorter(dtoMetric.Label)) { + // We cannot sort dtoMetric.Label in place as it is immutable by contract. + copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label)) + copy(copiedLabels, dtoMetric.Label) + sort.Sort(labelPairSorter(copiedLabels)) + dtoMetric.Label = copiedLabels + } for _, lp := range dtoMetric.Label { + h = hashAdd(h, lp.GetName()) + h = hashAddByte(h, separatorByte) h = hashAdd(h, lp.GetValue()) h = hashAddByte(h, separatorByte) - dh = hashAdd(dh, lp.GetName()) - dh = hashAddByte(dh, separatorByte) } if _, exists := metricHashes[h]; exists { return fmt.Errorf( - "collected metric %s %s was collected before with the same name and label values", - metricFamily.GetName(), dtoMetric, + "collected metric %q { %s} was collected before with the same name and label values", + name, dtoMetric, ) } - if dimHash, ok := dimHashes[metricFamily.GetName()]; ok { - if dimHash != dh { - return fmt.Errorf( - "collected metric %s %s has label dimensions inconsistent with previously collected metrics in the same metric family", - metricFamily.GetName(), dtoMetric, - ) - } - } else { - dimHashes[metricFamily.GetName()] = dh - } metricHashes[h] = struct{}{} return nil } @@ -727,8 +917,8 @@ func checkDescConsistency( } // Is the desc consistent with the content of the metric? - lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label)) - lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...) + lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label)) + copy(lpsFromDesc, desc.constLabelPairs) for _, l := range desc.variableLabels { lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{ Name: proto.String(l), @@ -740,7 +930,7 @@ func checkDescConsistency( metricFamily.GetName(), dtoMetric, desc, ) } - sort.Sort(LabelPairSorter(lpsFromDesc)) + sort.Sort(labelPairSorter(lpsFromDesc)) for i, lpFromDesc := range lpsFromDesc { lpFromMetric := dtoMetric.Label[i] if lpFromDesc.GetName() != lpFromMetric.GetName() || diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go index 82b885019..c970fdee0 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go @@ -16,8 +16,10 @@ package prometheus import ( "fmt" "math" + "runtime" "sort" "sync" + "sync/atomic" "time" "github.com/beorn7/perks/quantile" @@ -36,7 +38,10 @@ const quantileLabel = "quantile" // // A typical use-case is the observation of request latencies. By default, a // Summary provides the median, the 90th and the 99th percentile of the latency -// as rank estimations. +// as rank estimations. However, the default behavior will change in the +// upcoming v1.0.0 of the library. There will be no rank estimations at all by +// default. For a sane transition, it is recommended to set the desired rank +// estimations explicitly. // // Note that the rank estimations cannot be aggregated in a meaningful way with // the Prometheus query language (i.e. you cannot average or add them). If you @@ -53,16 +58,8 @@ type Summary interface { Observe(float64) } -// DefObjectives are the default Summary quantile values. -// -// Deprecated: DefObjectives will not be used as the default objectives in -// v0.10 of the library. The default Summary will have no quantiles then. -var ( - DefObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001} - - errQuantileLabelNotAllowed = fmt.Errorf( - "%q is not allowed as label name in summaries", quantileLabel, - ) +var errQuantileLabelNotAllowed = fmt.Errorf( + "%q is not allowed as label name in summaries", quantileLabel, ) // Default values for SummaryOpts. @@ -78,8 +75,10 @@ const ( ) // SummaryOpts bundles the options for creating a Summary metric. It is -// mandatory to set Name and Help to a non-empty string. All other fields are -// optional and can safely be left at their zero value. +// mandatory to set Name to a non-empty string. While all other fields are +// optional and can safely be left at their zero value, it is recommended to set +// a help string and to explicitly set the Objectives field to the desired value +// as the default value will change in the upcoming v1.0.0 of the library. type SummaryOpts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Summary (created by joining these components with @@ -90,41 +89,34 @@ type SummaryOpts struct { Subsystem string Name string - // Help provides information about this Summary. Mandatory! + // Help provides information about this Summary. // // Metrics with the same fully-qualified name must have the same Help // string. Help string - // ConstLabels are used to attach fixed labels to this - // Summary. Summaries with the same fully-qualified name must have the - // same label names in their ConstLabels. + // ConstLabels are used to attach fixed labels to this metric. Metrics + // with the same fully-qualified name must have the same label names in + // their ConstLabels. // - // Note that in most cases, labels have a value that varies during the - // lifetime of a process. Those labels are usually managed with a - // SummaryVec. ConstLabels serve only special purposes. One is for the - // special case where the value of a label does not change during the - // lifetime of a process, e.g. if the revision of the running binary is - // put into a label. Another, more advanced purpose is if more than one - // Collector needs to collect Summaries with the same fully-qualified - // name. In that case, those Summaries must differ in the values of - // their ConstLabels. See the Collector examples. + // Due to the way a Summary is represented in the Prometheus text format + // and how it is handled by the Prometheus server internally, “quantile” + // is an illegal label name. Construction of a Summary or SummaryVec + // will panic if this label name is used in ConstLabels. // - // If the value of a label never changes (not even between binaries), - // that label most likely should not be a label at all (but part of the - // metric name). + // ConstLabels are only used rarely. In particular, do not use them to + // attach the same labels to all your metrics. Those use cases are + // better covered by target labels set by the scraping Prometheus + // server, or by one specific metric (e.g. a build_info or a + // machine_role metric). See also + // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels,-not-static-scraped-labels ConstLabels Labels // Objectives defines the quantile rank estimates with their respective // absolute error. If Objectives[q] = e, then the value reported for q // will be the φ-quantile value for some φ between q-e and q+e. The - // default value is DefObjectives. It is used if Objectives is left at - // its zero value (i.e. nil). To create a Summary without Objectives, - // set it to an empty map (i.e. map[float64]float64{}). - // - // Deprecated: Note that the current value of DefObjectives is - // deprecated. It will be replaced by an empty map in v0.10 of the - // library. Please explicitly set Objectives to the desired value. + // default value is an empty map, resulting in a summary without + // quantiles. Objectives map[float64]float64 // MaxAge defines the duration for which an observation stays relevant @@ -148,7 +140,7 @@ type SummaryOpts struct { BufCap uint32 } -// Great fuck-up with the sliding-window decay algorithm... The Merge method of +// Problem with the sliding-window decay algorithm... The Merge method of // perk/quantile is actually not working as advertised - and it might be // unfixable, as the underlying algorithm is apparently not capable of merging // summaries in the first place. To avoid using Merge, we are currently adding @@ -178,7 +170,7 @@ func NewSummary(opts SummaryOpts) Summary { func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues)) } for _, n := range desc.variableLabels { @@ -193,7 +185,7 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { } if opts.Objectives == nil { - opts.Objectives = DefObjectives + opts.Objectives = map[float64]float64{} } if opts.MaxAge < 0 { @@ -211,6 +203,17 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { opts.BufCap = DefBufCap } + if len(opts.Objectives) == 0 { + // Use the lock-free implementation of a Summary without objectives. + s := &noObjectivesSummary{ + desc: desc, + labelPairs: makeLabelPairs(desc, labelValues), + counts: [2]*summaryCounts{&summaryCounts{}, &summaryCounts{}}, + } + s.init(s) // Init self-collection. + return s + } + s := &summary{ desc: desc, @@ -379,6 +382,116 @@ func (s *summary) swapBufs(now time.Time) { } } +type summaryCounts struct { + // sumBits contains the bits of the float64 representing the sum of all + // observations. sumBits and count have to go first in the struct to + // guarantee alignment for atomic operations. + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + sumBits uint64 + count uint64 +} + +type noObjectivesSummary struct { + // countAndHotIdx enables lock-free writes with use of atomic updates. + // The most significant bit is the hot index [0 or 1] of the count field + // below. Observe calls update the hot one. All remaining bits count the + // number of Observe calls. Observe starts by incrementing this counter, + // and finish by incrementing the count field in the respective + // summaryCounts, as a marker for completion. + // + // Calls of the Write method (which are non-mutating reads from the + // perspective of the summary) swap the hot–cold under the writeMtx + // lock. A cooldown is awaited (while locked) by comparing the number of + // observations with the initiation count. Once they match, then the + // last observation on the now cool one has completed. All cool fields must + // be merged into the new hot before releasing writeMtx. + + // Fields with atomic access first! See alignment constraint: + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG + countAndHotIdx uint64 + + selfCollector + desc *Desc + writeMtx sync.Mutex // Only used in the Write method. + + // Two counts, one is "hot" for lock-free observations, the other is + // "cold" for writing out a dto.Metric. It has to be an array of + // pointers to guarantee 64bit alignment of the histogramCounts, see + // http://golang.org/pkg/sync/atomic/#pkg-note-BUG. + counts [2]*summaryCounts + + labelPairs []*dto.LabelPair +} + +func (s *noObjectivesSummary) Desc() *Desc { + return s.desc +} + +func (s *noObjectivesSummary) Observe(v float64) { + // We increment h.countAndHotIdx so that the counter in the lower + // 63 bits gets incremented. At the same time, we get the new value + // back, which we can use to find the currently-hot counts. + n := atomic.AddUint64(&s.countAndHotIdx, 1) + hotCounts := s.counts[n>>63] + + for { + oldBits := atomic.LoadUint64(&hotCounts.sumBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + v) + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { + break + } + } + // Increment count last as we take it as a signal that the observation + // is complete. + atomic.AddUint64(&hotCounts.count, 1) +} + +func (s *noObjectivesSummary) Write(out *dto.Metric) error { + // For simplicity, we protect this whole method by a mutex. It is not in + // the hot path, i.e. Observe is called much more often than Write. The + // complication of making Write lock-free isn't worth it, if possible at + // all. + s.writeMtx.Lock() + defer s.writeMtx.Unlock() + + // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0) + // without touching the count bits. See the struct comments for a full + // description of the algorithm. + n := atomic.AddUint64(&s.countAndHotIdx, 1<<63) + // count is contained unchanged in the lower 63 bits. + count := n & ((1 << 63) - 1) + // The most significant bit tells us which counts is hot. The complement + // is thus the cold one. + hotCounts := s.counts[n>>63] + coldCounts := s.counts[(^n)>>63] + + // Await cooldown. + for count != atomic.LoadUint64(&coldCounts.count) { + runtime.Gosched() // Let observations get work done. + } + + sum := &dto.Summary{ + SampleCount: proto.Uint64(count), + SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))), + } + + out.Summary = sum + out.Label = s.labelPairs + + // Finally add all the cold counts to the new hot counts and reset the cold counts. + atomic.AddUint64(&hotCounts.count, count) + atomic.StoreUint64(&coldCounts.count, 0) + for { + oldBits := atomic.LoadUint64(&hotCounts.sumBits) + newBits := math.Float64bits(math.Float64frombits(oldBits) + sum.GetSampleSum()) + if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) { + atomic.StoreUint64(&coldCounts.sumBits, 0) + break + } + } + return nil +} + type quantSort []*dto.Quantile func (s quantSort) Len() int { @@ -399,13 +512,21 @@ func (s quantSort) Less(i, j int) bool { // (e.g. HTTP request latencies, partitioned by status code and method). Create // instances with NewSummaryVec. type SummaryVec struct { - *MetricVec + *metricVec } // NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and -// partitioned by the given label names. At least one label name must be -// provided. +// partitioned by the given label names. +// +// Due to the way a Summary is represented in the Prometheus text format and how +// it is handled by the Prometheus server internally, “quantile” is an illegal +// label name. NewSummaryVec will panic if this label name is used. func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec { + for _, ln := range labelNames { + if ln == quantileLabel { + panic(errQuantileLabelNotAllowed) + } + } desc := NewDesc( BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), opts.Help, @@ -413,47 +534,116 @@ func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec { opts.ConstLabels, ) return &SummaryVec{ - MetricVec: newMetricVec(desc, func(lvs ...string) Metric { + metricVec: newMetricVec(desc, func(lvs ...string) Metric { return newSummary(desc, opts, lvs...) }), } } -// GetMetricWithLabelValues replaces the method of the same name in -// MetricVec. The difference is that this method returns a Summary and not a -// Metric so that no type conversion is required. -func (m *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Summary, error) { - metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...) +// GetMetricWithLabelValues returns the Summary for the given slice of label +// values (same order as the VariableLabels in Desc). If that combination of +// label values is accessed for the first time, a new Summary is created. +// +// It is possible to call this method without using the returned Summary to only +// create the new Summary but leave it at its starting value, a Summary without +// any observations. +// +// Keeping the Summary for later use is possible (and should be considered if +// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// Delete can be used to delete the Summary from the SummaryVec. In that case, +// the Summary will still exist, but it will not be exported anymore, even if a +// Summary with the same label values is created later. See also the CounterVec +// example. +// +// An error is returned if the number of label values is not the same as the +// number of VariableLabels in Desc (minus any curried labels). +// +// Note that for more than one label value, this method is prone to mistakes +// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as +// an alternative to avoid that type of mistake. For higher label numbers, the +// latter has a much more readable (albeit more verbose) syntax, but it comes +// with a performance overhead (for creating and processing the Labels map). +// See also the GaugeVec example. +func (v *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { - return metric.(Summary), err + return metric.(Observer), err } return nil, err } -// GetMetricWith replaces the method of the same name in MetricVec. The -// difference is that this method returns a Summary and not a Metric so that no -// type conversion is required. -func (m *SummaryVec) GetMetricWith(labels Labels) (Summary, error) { - metric, err := m.MetricVec.GetMetricWith(labels) +// GetMetricWith returns the Summary for the given Labels map (the label names +// must match those of the VariableLabels in Desc). If that label map is +// accessed for the first time, a new Summary is created. Implications of +// creating a Summary without using it and keeping the Summary for later use are +// the same as for GetMetricWithLabelValues. +// +// An error is returned if the number and names of the Labels are inconsistent +// with those of the VariableLabels in Desc (minus any curried labels). +// +// This method is used for the same purpose as +// GetMetricWithLabelValues(...string). See there for pros and cons of the two +// methods. +func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { - return metric.(Summary), err + return metric.(Observer), err } return nil, err } // WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. By not returning an -// error, WithLabelValues allows shortcuts like +// GetMetricWithLabelValues would have returned an error. Not returning an +// error allows shortcuts like // myVec.WithLabelValues("404", "GET").Observe(42.21) -func (m *SummaryVec) WithLabelValues(lvs ...string) Summary { - return m.MetricVec.WithLabelValues(lvs...).(Summary) +func (v *SummaryVec) WithLabelValues(lvs ...string) Observer { + s, err := v.GetMetricWithLabelValues(lvs...) + if err != nil { + panic(err) + } + return s } // With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. By not returning an error, With allows shortcuts like -// myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (m *SummaryVec) With(labels Labels) Summary { - return m.MetricVec.With(labels).(Summary) +// returned an error. Not returning an error allows shortcuts like +// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21) +func (v *SummaryVec) With(labels Labels) Observer { + s, err := v.GetMetricWith(labels) + if err != nil { + panic(err) + } + return s +} + +// CurryWith returns a vector curried with the provided labels, i.e. the +// returned vector has those labels pre-set for all labeled operations performed +// on it. The cardinality of the curried vector is reduced accordingly. The +// order of the remaining labels stays the same (just with the curried labels +// taken out of the sequence – which is relevant for the +// (GetMetric)WithLabelValues methods). It is possible to curry a curried +// vector, but only with labels not yet used for currying before. +// +// The metrics contained in the SummaryVec are shared between the curried and +// uncurried vectors. They are just accessed differently. Curried and uncurried +// vectors behave identically in terms of collection. Only one must be +// registered with a given registry (usually the uncurried version). The Reset +// method deletes all metrics, even if called on a curried vector. +func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) { + vec, err := v.curryWith(labels) + if vec != nil { + return &SummaryVec{vec}, err + } + return nil, err +} + +// MustCurryWith works as CurryWith but panics where CurryWith would have +// returned an error. +func (v *SummaryVec) MustCurryWith(labels Labels) ObserverVec { + vec, err := v.CurryWith(labels) + if err != nil { + panic(err) + } + return vec } type constSummary struct { @@ -506,7 +696,7 @@ func (s *constSummary) Write(out *dto.Metric) error { // map[float64]float64{0.5: 0.23, 0.99: 0.56} // // NewConstSummary returns an error if the length of labelValues is not -// consistent with the variable labels in Desc. +// consistent with the variable labels in Desc or if Desc is invalid. func NewConstSummary( desc *Desc, count uint64, @@ -514,8 +704,11 @@ func NewConstSummary( quantiles map[float64]float64, labelValues ...string, ) (Metric, error) { - if len(desc.variableLabels) != len(labelValues) { - return nil, errInconsistentCardinality + if desc.err != nil { + return nil, desc.err + } + if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { + return nil, err } return &constSummary{ desc: desc, diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go index f4cac5a0a..8d5f10523 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/timer.go @@ -15,32 +15,6 @@ package prometheus import "time" -// Observer is the interface that wraps the Observe method, which is used by -// Histogram and Summary to add observations. -type Observer interface { - Observe(float64) -} - -// The ObserverFunc type is an adapter to allow the use of ordinary -// functions as Observers. If f is a function with the appropriate -// signature, ObserverFunc(f) is an Observer that calls f. -// -// This adapter is usually used in connection with the Timer type, and there are -// two general use cases: -// -// The most common one is to use a Gauge as the Observer for a Timer. -// See the "Gauge" Timer example. -// -// The more advanced use case is to create a function that dynamically decides -// which Observer to use for observing the duration. See the "Complex" Timer -// example. -type ObserverFunc func(float64) - -// Observe calls f(value). It implements Observer. -func (f ObserverFunc) Observe(value float64) { - f(value) -} - // Timer is a helper type to time functions. Use NewTimer to create new // instances. type Timer struct { @@ -65,10 +39,16 @@ func NewTimer(o Observer) *Timer { // ObserveDuration records the duration passed since the Timer was created with // NewTimer. It calls the Observe method of the Observer provided during -// construction with the duration in seconds as an argument. ObserveDuration is -// usually called with a defer statement. -func (t *Timer) ObserveDuration() { +// construction with the duration in seconds as an argument. The observed +// duration is also returned. ObserveDuration is usually called with a defer +// statement. +// +// Note that this method is only guaranteed to never observe negative durations +// if used with Go1.9+. +func (t *Timer) ObserveDuration() time.Duration { + d := time.Since(t.begin) if t.observer != nil { - t.observer.Observe(time.Since(t.begin).Seconds()) + t.observer.Observe(d.Seconds()) } + return d } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go b/vendor/github.com/prometheus/client_golang/prometheus/untyped.go index 065501d38..0f9ce63f4 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/untyped.go @@ -13,113 +13,12 @@ package prometheus -// Untyped is a Metric that represents a single numerical value that can -// arbitrarily go up and down. -// -// An Untyped metric works the same as a Gauge. The only difference is that to -// no type information is implied. -// -// To create Untyped instances, use NewUntyped. -// -// Deprecated: The Untyped type is deprecated because it doesn't make sense in -// direct instrumentation. If you need to mirror an external metric of unknown -// type (usually while writing exporters), Use MustNewConstMetric to create an -// untyped metric instance on the fly. -type Untyped interface { - Metric - Collector - - // Set sets the Untyped metric to an arbitrary value. - Set(float64) - // Inc increments the Untyped metric by 1. - Inc() - // Dec decrements the Untyped metric by 1. - Dec() - // Add adds the given value to the Untyped metric. (The value can be - // negative, resulting in a decrease.) - Add(float64) - // Sub subtracts the given value from the Untyped metric. (The value can - // be negative, resulting in an increase.) - Sub(float64) -} - // UntypedOpts is an alias for Opts. See there for doc comments. type UntypedOpts Opts -// NewUntyped creates a new Untyped metric from the provided UntypedOpts. -func NewUntyped(opts UntypedOpts) Untyped { - return newValue(NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - nil, - opts.ConstLabels, - ), UntypedValue, 0) -} - -// UntypedVec is a Collector that bundles a set of Untyped metrics that all -// share the same Desc, but have different values for their variable -// labels. This is used if you want to count the same thing partitioned by -// various dimensions. Create instances with NewUntypedVec. -type UntypedVec struct { - *MetricVec -} - -// NewUntypedVec creates a new UntypedVec based on the provided UntypedOpts and -// partitioned by the given label names. At least one label name must be -// provided. -func NewUntypedVec(opts UntypedOpts, labelNames []string) *UntypedVec { - desc := NewDesc( - BuildFQName(opts.Namespace, opts.Subsystem, opts.Name), - opts.Help, - labelNames, - opts.ConstLabels, - ) - return &UntypedVec{ - MetricVec: newMetricVec(desc, func(lvs ...string) Metric { - return newValue(desc, UntypedValue, 0, lvs...) - }), - } -} - -// GetMetricWithLabelValues replaces the method of the same name in -// MetricVec. The difference is that this method returns an Untyped and not a -// Metric so that no type conversion is required. -func (m *UntypedVec) GetMetricWithLabelValues(lvs ...string) (Untyped, error) { - metric, err := m.MetricVec.GetMetricWithLabelValues(lvs...) - if metric != nil { - return metric.(Untyped), err - } - return nil, err -} - -// GetMetricWith replaces the method of the same name in MetricVec. The -// difference is that this method returns an Untyped and not a Metric so that no -// type conversion is required. -func (m *UntypedVec) GetMetricWith(labels Labels) (Untyped, error) { - metric, err := m.MetricVec.GetMetricWith(labels) - if metric != nil { - return metric.(Untyped), err - } - return nil, err -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics where -// GetMetricWithLabelValues would have returned an error. By not returning an -// error, WithLabelValues allows shortcuts like -// myVec.WithLabelValues("404", "GET").Add(42) -func (m *UntypedVec) WithLabelValues(lvs ...string) Untyped { - return m.MetricVec.WithLabelValues(lvs...).(Untyped) -} - -// With works as GetMetricWith, but panics where GetMetricWithLabels would have -// returned an error. By not returning an error, With allows shortcuts like -// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -func (m *UntypedVec) With(labels Labels) Untyped { - return m.MetricVec.With(labels).(Untyped) -} - -// UntypedFunc is an Untyped whose value is determined at collect time by -// calling a provided function. +// UntypedFunc works like GaugeFunc but the collected metric is of type +// "Untyped". UntypedFunc is useful to mirror an external metric of unknown +// type. // // To create UntypedFunc instances, use NewUntypedFunc. type UntypedFunc interface { diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value.go b/vendor/github.com/prometheus/client_golang/prometheus/value.go index ff75ce585..eb248f108 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/value.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/value.go @@ -14,16 +14,12 @@ package prometheus import ( - "errors" "fmt" - "math" "sort" - "sync/atomic" - "time" - - dto "github.com/prometheus/client_model/go" "github.com/golang/protobuf/proto" + + dto "github.com/prometheus/client_model/go" ) // ValueType is an enumeration of metric types that represent a simple value. @@ -37,81 +33,6 @@ const ( UntypedValue ) -var errInconsistentCardinality = errors.New("inconsistent label cardinality") - -// value is a generic metric for simple values. It implements Metric, Collector, -// Counter, Gauge, and Untyped. Its effective type is determined by -// ValueType. This is a low-level building block used by the library to back the -// implementations of Counter, Gauge, and Untyped. -type value struct { - // valBits contains the bits of the represented float64 value. It has - // to go first in the struct to guarantee alignment for atomic - // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG - valBits uint64 - - selfCollector - - desc *Desc - valType ValueType - labelPairs []*dto.LabelPair -} - -// newValue returns a newly allocated value with the given Desc, ValueType, -// sample value and label values. It panics if the number of label -// values is different from the number of variable labels in Desc. -func newValue(desc *Desc, valueType ValueType, val float64, labelValues ...string) *value { - if len(labelValues) != len(desc.variableLabels) { - panic(errInconsistentCardinality) - } - result := &value{ - desc: desc, - valType: valueType, - valBits: math.Float64bits(val), - labelPairs: makeLabelPairs(desc, labelValues), - } - result.init(result) - return result -} - -func (v *value) Desc() *Desc { - return v.desc -} - -func (v *value) Set(val float64) { - atomic.StoreUint64(&v.valBits, math.Float64bits(val)) -} - -func (v *value) SetToCurrentTime() { - v.Set(float64(time.Now().UnixNano()) / 1e9) -} - -func (v *value) Inc() { - v.Add(1) -} - -func (v *value) Dec() { - v.Add(-1) -} - -func (v *value) Add(val float64) { - for { - oldBits := atomic.LoadUint64(&v.valBits) - newBits := math.Float64bits(math.Float64frombits(oldBits) + val) - if atomic.CompareAndSwapUint64(&v.valBits, oldBits, newBits) { - return - } - } -} - -func (v *value) Sub(val float64) { - v.Add(val * -1) -} - -func (v *value) Write(out *dto.Metric) error { - val := math.Float64frombits(atomic.LoadUint64(&v.valBits)) - return populateMetric(v.valType, val, v.labelPairs, out) -} - // valueFunc is a generic metric for simple values retrieved on collect time // from a function. It implements Metric and Collector. Its effective type is // determined by ValueType. This is a low-level building block used by the @@ -156,10 +77,14 @@ func (v *valueFunc) Write(out *dto.Metric) error { // operations. However, when implementing custom Collectors, it is useful as a // throw-away metric that is generated on the fly to send it to Prometheus in // the Collect method. NewConstMetric returns an error if the length of -// labelValues is not consistent with the variable labels in Desc. +// labelValues is not consistent with the variable labels in Desc or if Desc is +// invalid. func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) { - if len(desc.variableLabels) != len(labelValues) { - return nil, errInconsistentCardinality + if desc.err != nil { + return nil, desc.err + } + if err := validateLabelValues(labelValues, len(desc.variableLabels)); err != nil { + return nil, err } return &constMetric{ desc: desc, @@ -231,9 +156,7 @@ func makeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair { Value: proto.String(labelValues[i]), }) } - for _, lp := range desc.constLabelPairs { - labelPairs = append(labelPairs, lp) - } - sort.Sort(LabelPairSorter(labelPairs)) + labelPairs = append(labelPairs, desc.constLabelPairs...) + sort.Sort(labelPairSorter(labelPairs)) return labelPairs } diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go index 7f3eef9a4..14ed9e856 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/vec.go @@ -20,33 +20,180 @@ import ( "github.com/prometheus/common/model" ) -// MetricVec is a Collector to bundle metrics of the same name that -// differ in their label values. MetricVec is usually not used directly but as a -// building block for implementations of vectors of a given metric -// type. GaugeVec, CounterVec, SummaryVec, and UntypedVec are examples already -// provided in this package. -type MetricVec struct { - mtx sync.RWMutex // Protects the children. - children map[uint64][]metricWithLabelValues - desc *Desc +// metricVec is a Collector to bundle metrics of the same name that differ in +// their label values. metricVec is not used directly (and therefore +// unexported). It is used as a building block for implementations of vectors of +// a given metric type, like GaugeVec, CounterVec, SummaryVec, and HistogramVec. +// It also handles label currying. It uses basicMetricVec internally. +type metricVec struct { + *metricMap - newMetric func(labelValues ...string) Metric - hashAdd func(h uint64, s string) uint64 // replace hash function for testing collision handling + curry []curriedLabelValue + + // hashAdd and hashAddByte can be replaced for testing collision handling. + hashAdd func(h uint64, s string) uint64 hashAddByte func(h uint64, b byte) uint64 } -// newMetricVec returns an initialized MetricVec. The concrete value is -// returned for embedding into another struct. -func newMetricVec(desc *Desc, newMetric func(lvs ...string) Metric) *MetricVec { - return &MetricVec{ - children: map[uint64][]metricWithLabelValues{}, - desc: desc, - newMetric: newMetric, +// newMetricVec returns an initialized metricVec. +func newMetricVec(desc *Desc, newMetric func(lvs ...string) Metric) *metricVec { + return &metricVec{ + metricMap: &metricMap{ + metrics: map[uint64][]metricWithLabelValues{}, + desc: desc, + newMetric: newMetric, + }, hashAdd: hashAdd, hashAddByte: hashAddByte, } } +// DeleteLabelValues removes the metric where the variable labels are the same +// as those passed in as labels (same order as the VariableLabels in Desc). It +// returns true if a metric was deleted. +// +// It is not an error if the number of label values is not the same as the +// number of VariableLabels in Desc. However, such inconsistent label count can +// never match an actual metric, so the method will always return false in that +// case. +// +// Note that for more than one label value, this method is prone to mistakes +// caused by an incorrect order of arguments. Consider Delete(Labels) as an +// alternative to avoid that type of mistake. For higher label numbers, the +// latter has a much more readable (albeit more verbose) syntax, but it comes +// with a performance overhead (for creating and processing the Labels map). +// See also the CounterVec example. +func (m *metricVec) DeleteLabelValues(lvs ...string) bool { + h, err := m.hashLabelValues(lvs) + if err != nil { + return false + } + + return m.metricMap.deleteByHashWithLabelValues(h, lvs, m.curry) +} + +// Delete deletes the metric where the variable labels are the same as those +// passed in as labels. It returns true if a metric was deleted. +// +// It is not an error if the number and names of the Labels are inconsistent +// with those of the VariableLabels in Desc. However, such inconsistent Labels +// can never match an actual metric, so the method will always return false in +// that case. +// +// This method is used for the same purpose as DeleteLabelValues(...string). See +// there for pros and cons of the two methods. +func (m *metricVec) Delete(labels Labels) bool { + h, err := m.hashLabels(labels) + if err != nil { + return false + } + + return m.metricMap.deleteByHashWithLabels(h, labels, m.curry) +} + +func (m *metricVec) curryWith(labels Labels) (*metricVec, error) { + var ( + newCurry []curriedLabelValue + oldCurry = m.curry + iCurry int + ) + for i, label := range m.desc.variableLabels { + val, ok := labels[label] + if iCurry < len(oldCurry) && oldCurry[iCurry].index == i { + if ok { + return nil, fmt.Errorf("label name %q is already curried", label) + } + newCurry = append(newCurry, oldCurry[iCurry]) + iCurry++ + } else { + if !ok { + continue // Label stays uncurried. + } + newCurry = append(newCurry, curriedLabelValue{i, val}) + } + } + if l := len(oldCurry) + len(labels) - len(newCurry); l > 0 { + return nil, fmt.Errorf("%d unknown label(s) found during currying", l) + } + + return &metricVec{ + metricMap: m.metricMap, + curry: newCurry, + hashAdd: m.hashAdd, + hashAddByte: m.hashAddByte, + }, nil +} + +func (m *metricVec) getMetricWithLabelValues(lvs ...string) (Metric, error) { + h, err := m.hashLabelValues(lvs) + if err != nil { + return nil, err + } + + return m.metricMap.getOrCreateMetricWithLabelValues(h, lvs, m.curry), nil +} + +func (m *metricVec) getMetricWith(labels Labels) (Metric, error) { + h, err := m.hashLabels(labels) + if err != nil { + return nil, err + } + + return m.metricMap.getOrCreateMetricWithLabels(h, labels, m.curry), nil +} + +func (m *metricVec) hashLabelValues(vals []string) (uint64, error) { + if err := validateLabelValues(vals, len(m.desc.variableLabels)-len(m.curry)); err != nil { + return 0, err + } + + var ( + h = hashNew() + curry = m.curry + iVals, iCurry int + ) + for i := 0; i < len(m.desc.variableLabels); i++ { + if iCurry < len(curry) && curry[iCurry].index == i { + h = m.hashAdd(h, curry[iCurry].value) + iCurry++ + } else { + h = m.hashAdd(h, vals[iVals]) + iVals++ + } + h = m.hashAddByte(h, model.SeparatorByte) + } + return h, nil +} + +func (m *metricVec) hashLabels(labels Labels) (uint64, error) { + if err := validateValuesInLabels(labels, len(m.desc.variableLabels)-len(m.curry)); err != nil { + return 0, err + } + + var ( + h = hashNew() + curry = m.curry + iCurry int + ) + for i, label := range m.desc.variableLabels { + val, ok := labels[label] + if iCurry < len(curry) && curry[iCurry].index == i { + if ok { + return 0, fmt.Errorf("label name %q is already curried", label) + } + h = m.hashAdd(h, curry[iCurry].value) + iCurry++ + } else { + if !ok { + return 0, fmt.Errorf("label name %q missing in label map", label) + } + h = m.hashAdd(h, val) + } + h = m.hashAddByte(h, model.SeparatorByte) + } + return h, nil +} + // metricWithLabelValues provides the metric and its label values for // disambiguation on hash collision. type metricWithLabelValues struct { @@ -54,166 +201,72 @@ type metricWithLabelValues struct { metric Metric } -// Describe implements Collector. The length of the returned slice -// is always one. -func (m *MetricVec) Describe(ch chan<- *Desc) { +// curriedLabelValue sets the curried value for a label at the given index. +type curriedLabelValue struct { + index int + value string +} + +// metricMap is a helper for metricVec and shared between differently curried +// metricVecs. +type metricMap struct { + mtx sync.RWMutex // Protects metrics. + metrics map[uint64][]metricWithLabelValues + desc *Desc + newMetric func(labelValues ...string) Metric +} + +// Describe implements Collector. It will send exactly one Desc to the provided +// channel. +func (m *metricMap) Describe(ch chan<- *Desc) { ch <- m.desc } // Collect implements Collector. -func (m *MetricVec) Collect(ch chan<- Metric) { +func (m *metricMap) Collect(ch chan<- Metric) { m.mtx.RLock() defer m.mtx.RUnlock() - for _, metrics := range m.children { + for _, metrics := range m.metrics { for _, metric := range metrics { ch <- metric.metric } } } -// GetMetricWithLabelValues returns the Metric for the given slice of label -// values (same order as the VariableLabels in Desc). If that combination of -// label values is accessed for the first time, a new Metric is created. -// -// It is possible to call this method without using the returned Metric to only -// create the new Metric but leave it at its start value (e.g. a Summary or -// Histogram without any observations). See also the SummaryVec example. -// -// Keeping the Metric for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and -// Delete can be used to delete the Metric from the MetricVec. In that case, the -// Metric will still exist, but it will not be exported anymore, even if a -// Metric with the same label values is created later. See also the CounterVec -// example. -// -// An error is returned if the number of label values is not the same as the -// number of VariableLabels in Desc. -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as -// an alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the GaugeVec example. -func (m *MetricVec) GetMetricWithLabelValues(lvs ...string) (Metric, error) { - h, err := m.hashLabelValues(lvs) - if err != nil { - return nil, err - } - - return m.getOrCreateMetricWithLabelValues(h, lvs), nil -} - -// GetMetricWith returns the Metric for the given Labels map (the label names -// must match those of the VariableLabels in Desc). If that label map is -// accessed for the first time, a new Metric is created. Implications of -// creating a Metric without using it and keeping the Metric for later use are -// the same as for GetMetricWithLabelValues. -// -// An error is returned if the number and names of the Labels are inconsistent -// with those of the VariableLabels in Desc. -// -// This method is used for the same purpose as -// GetMetricWithLabelValues(...string). See there for pros and cons of the two -// methods. -func (m *MetricVec) GetMetricWith(labels Labels) (Metric, error) { - h, err := m.hashLabels(labels) - if err != nil { - return nil, err - } - - return m.getOrCreateMetricWithLabels(h, labels), nil -} - -// WithLabelValues works as GetMetricWithLabelValues, but panics if an error -// occurs. The method allows neat syntax like: -// httpReqs.WithLabelValues("404", "POST").Inc() -func (m *MetricVec) WithLabelValues(lvs ...string) Metric { - metric, err := m.GetMetricWithLabelValues(lvs...) - if err != nil { - panic(err) - } - return metric -} - -// With works as GetMetricWith, but panics if an error occurs. The method allows -// neat syntax like: -// httpReqs.With(Labels{"status":"404", "method":"POST"}).Inc() -func (m *MetricVec) With(labels Labels) Metric { - metric, err := m.GetMetricWith(labels) - if err != nil { - panic(err) - } - return metric -} - -// DeleteLabelValues removes the metric where the variable labels are the same -// as those passed in as labels (same order as the VariableLabels in Desc). It -// returns true if a metric was deleted. -// -// It is not an error if the number of label values is not the same as the -// number of VariableLabels in Desc. However, such inconsistent label count can -// never match an actual Metric, so the method will always return false in that -// case. -// -// Note that for more than one label value, this method is prone to mistakes -// caused by an incorrect order of arguments. Consider Delete(Labels) as an -// alternative to avoid that type of mistake. For higher label numbers, the -// latter has a much more readable (albeit more verbose) syntax, but it comes -// with a performance overhead (for creating and processing the Labels map). -// See also the CounterVec example. -func (m *MetricVec) DeleteLabelValues(lvs ...string) bool { +// Reset deletes all metrics in this vector. +func (m *metricMap) Reset() { m.mtx.Lock() defer m.mtx.Unlock() - h, err := m.hashLabelValues(lvs) - if err != nil { - return false + for h := range m.metrics { + delete(m.metrics, h) } - return m.deleteByHashWithLabelValues(h, lvs) -} - -// Delete deletes the metric where the variable labels are the same as those -// passed in as labels. It returns true if a metric was deleted. -// -// It is not an error if the number and names of the Labels are inconsistent -// with those of the VariableLabels in the Desc of the MetricVec. However, such -// inconsistent Labels can never match an actual Metric, so the method will -// always return false in that case. -// -// This method is used for the same purpose as DeleteLabelValues(...string). See -// there for pros and cons of the two methods. -func (m *MetricVec) Delete(labels Labels) bool { - m.mtx.Lock() - defer m.mtx.Unlock() - - h, err := m.hashLabels(labels) - if err != nil { - return false - } - - return m.deleteByHashWithLabels(h, labels) } // deleteByHashWithLabelValues removes the metric from the hash bucket h. If // there are multiple matches in the bucket, use lvs to select a metric and // remove only that metric. -func (m *MetricVec) deleteByHashWithLabelValues(h uint64, lvs []string) bool { - metrics, ok := m.children[h] +func (m *metricMap) deleteByHashWithLabelValues( + h uint64, lvs []string, curry []curriedLabelValue, +) bool { + m.mtx.Lock() + defer m.mtx.Unlock() + + metrics, ok := m.metrics[h] if !ok { return false } - i := m.findMetricWithLabelValues(metrics, lvs) + i := findMetricWithLabelValues(metrics, lvs, curry) if i >= len(metrics) { return false } if len(metrics) > 1 { - m.children[h] = append(metrics[:i], metrics[i+1:]...) + m.metrics[h] = append(metrics[:i], metrics[i+1:]...) } else { - delete(m.children, h) + delete(m.metrics, h) } return true } @@ -221,69 +274,38 @@ func (m *MetricVec) deleteByHashWithLabelValues(h uint64, lvs []string) bool { // deleteByHashWithLabels removes the metric from the hash bucket h. If there // are multiple matches in the bucket, use lvs to select a metric and remove // only that metric. -func (m *MetricVec) deleteByHashWithLabels(h uint64, labels Labels) bool { - metrics, ok := m.children[h] +func (m *metricMap) deleteByHashWithLabels( + h uint64, labels Labels, curry []curriedLabelValue, +) bool { + m.mtx.Lock() + defer m.mtx.Unlock() + + metrics, ok := m.metrics[h] if !ok { return false } - i := m.findMetricWithLabels(metrics, labels) + i := findMetricWithLabels(m.desc, metrics, labels, curry) if i >= len(metrics) { return false } if len(metrics) > 1 { - m.children[h] = append(metrics[:i], metrics[i+1:]...) + m.metrics[h] = append(metrics[:i], metrics[i+1:]...) } else { - delete(m.children, h) + delete(m.metrics, h) } return true } -// Reset deletes all metrics in this vector. -func (m *MetricVec) Reset() { - m.mtx.Lock() - defer m.mtx.Unlock() - - for h := range m.children { - delete(m.children, h) - } -} - -func (m *MetricVec) hashLabelValues(vals []string) (uint64, error) { - if len(vals) != len(m.desc.variableLabels) { - return 0, errInconsistentCardinality - } - h := hashNew() - for _, val := range vals { - h = m.hashAdd(h, val) - h = m.hashAddByte(h, model.SeparatorByte) - } - return h, nil -} - -func (m *MetricVec) hashLabels(labels Labels) (uint64, error) { - if len(labels) != len(m.desc.variableLabels) { - return 0, errInconsistentCardinality - } - h := hashNew() - for _, label := range m.desc.variableLabels { - val, ok := labels[label] - if !ok { - return 0, fmt.Errorf("label name %q missing in label map", label) - } - h = m.hashAdd(h, val) - h = m.hashAddByte(h, model.SeparatorByte) - } - return h, nil -} - // getOrCreateMetricWithLabelValues retrieves the metric by hash and label value // or creates it and returns the new one. // // This function holds the mutex. -func (m *MetricVec) getOrCreateMetricWithLabelValues(hash uint64, lvs []string) Metric { +func (m *metricMap) getOrCreateMetricWithLabelValues( + hash uint64, lvs []string, curry []curriedLabelValue, +) Metric { m.mtx.RLock() - metric, ok := m.getMetricWithLabelValues(hash, lvs) + metric, ok := m.getMetricWithHashAndLabelValues(hash, lvs, curry) m.mtx.RUnlock() if ok { return metric @@ -291,13 +313,11 @@ func (m *MetricVec) getOrCreateMetricWithLabelValues(hash uint64, lvs []string) m.mtx.Lock() defer m.mtx.Unlock() - metric, ok = m.getMetricWithLabelValues(hash, lvs) + metric, ok = m.getMetricWithHashAndLabelValues(hash, lvs, curry) if !ok { - // Copy to avoid allocation in case wo don't go down this code path. - copiedLVs := make([]string, len(lvs)) - copy(copiedLVs, lvs) - metric = m.newMetric(copiedLVs...) - m.children[hash] = append(m.children[hash], metricWithLabelValues{values: copiedLVs, metric: metric}) + inlinedLVs := inlineLabelValues(lvs, curry) + metric = m.newMetric(inlinedLVs...) + m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: inlinedLVs, metric: metric}) } return metric } @@ -306,9 +326,11 @@ func (m *MetricVec) getOrCreateMetricWithLabelValues(hash uint64, lvs []string) // or creates it and returns the new one. // // This function holds the mutex. -func (m *MetricVec) getOrCreateMetricWithLabels(hash uint64, labels Labels) Metric { +func (m *metricMap) getOrCreateMetricWithLabels( + hash uint64, labels Labels, curry []curriedLabelValue, +) Metric { m.mtx.RLock() - metric, ok := m.getMetricWithLabels(hash, labels) + metric, ok := m.getMetricWithHashAndLabels(hash, labels, curry) m.mtx.RUnlock() if ok { return metric @@ -316,33 +338,37 @@ func (m *MetricVec) getOrCreateMetricWithLabels(hash uint64, labels Labels) Metr m.mtx.Lock() defer m.mtx.Unlock() - metric, ok = m.getMetricWithLabels(hash, labels) + metric, ok = m.getMetricWithHashAndLabels(hash, labels, curry) if !ok { - lvs := m.extractLabelValues(labels) + lvs := extractLabelValues(m.desc, labels, curry) metric = m.newMetric(lvs...) - m.children[hash] = append(m.children[hash], metricWithLabelValues{values: lvs, metric: metric}) + m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: lvs, metric: metric}) } return metric } -// getMetricWithLabelValues gets a metric while handling possible collisions in -// the hash space. Must be called while holding read mutex. -func (m *MetricVec) getMetricWithLabelValues(h uint64, lvs []string) (Metric, bool) { - metrics, ok := m.children[h] +// getMetricWithHashAndLabelValues gets a metric while handling possible +// collisions in the hash space. Must be called while holding the read mutex. +func (m *metricMap) getMetricWithHashAndLabelValues( + h uint64, lvs []string, curry []curriedLabelValue, +) (Metric, bool) { + metrics, ok := m.metrics[h] if ok { - if i := m.findMetricWithLabelValues(metrics, lvs); i < len(metrics) { + if i := findMetricWithLabelValues(metrics, lvs, curry); i < len(metrics) { return metrics[i].metric, true } } return nil, false } -// getMetricWithLabels gets a metric while handling possible collisions in +// getMetricWithHashAndLabels gets a metric while handling possible collisions in // the hash space. Must be called while holding read mutex. -func (m *MetricVec) getMetricWithLabels(h uint64, labels Labels) (Metric, bool) { - metrics, ok := m.children[h] +func (m *metricMap) getMetricWithHashAndLabels( + h uint64, labels Labels, curry []curriedLabelValue, +) (Metric, bool) { + metrics, ok := m.metrics[h] if ok { - if i := m.findMetricWithLabels(metrics, labels); i < len(metrics) { + if i := findMetricWithLabels(m.desc, metrics, labels, curry); i < len(metrics) { return metrics[i].metric, true } } @@ -351,9 +377,11 @@ func (m *MetricVec) getMetricWithLabels(h uint64, labels Labels) (Metric, bool) // findMetricWithLabelValues returns the index of the matching metric or // len(metrics) if not found. -func (m *MetricVec) findMetricWithLabelValues(metrics []metricWithLabelValues, lvs []string) int { +func findMetricWithLabelValues( + metrics []metricWithLabelValues, lvs []string, curry []curriedLabelValue, +) int { for i, metric := range metrics { - if m.matchLabelValues(metric.values, lvs) { + if matchLabelValues(metric.values, lvs, curry) { return i } } @@ -362,32 +390,51 @@ func (m *MetricVec) findMetricWithLabelValues(metrics []metricWithLabelValues, l // findMetricWithLabels returns the index of the matching metric or len(metrics) // if not found. -func (m *MetricVec) findMetricWithLabels(metrics []metricWithLabelValues, labels Labels) int { +func findMetricWithLabels( + desc *Desc, metrics []metricWithLabelValues, labels Labels, curry []curriedLabelValue, +) int { for i, metric := range metrics { - if m.matchLabels(metric.values, labels) { + if matchLabels(desc, metric.values, labels, curry) { return i } } return len(metrics) } -func (m *MetricVec) matchLabelValues(values []string, lvs []string) bool { - if len(values) != len(lvs) { +func matchLabelValues(values []string, lvs []string, curry []curriedLabelValue) bool { + if len(values) != len(lvs)+len(curry) { return false } + var iLVs, iCurry int for i, v := range values { - if v != lvs[i] { + if iCurry < len(curry) && curry[iCurry].index == i { + if v != curry[iCurry].value { + return false + } + iCurry++ + continue + } + if v != lvs[iLVs] { return false } + iLVs++ } return true } -func (m *MetricVec) matchLabels(values []string, labels Labels) bool { - if len(labels) != len(values) { +func matchLabels(desc *Desc, values []string, labels Labels, curry []curriedLabelValue) bool { + if len(values) != len(labels)+len(curry) { return false } - for i, k := range m.desc.variableLabels { + iCurry := 0 + for i, k := range desc.variableLabels { + if iCurry < len(curry) && curry[iCurry].index == i { + if values[i] != curry[iCurry].value { + return false + } + iCurry++ + continue + } if values[i] != labels[k] { return false } @@ -395,10 +442,31 @@ func (m *MetricVec) matchLabels(values []string, labels Labels) bool { return true } -func (m *MetricVec) extractLabelValues(labels Labels) []string { - labelValues := make([]string, len(labels)) - for i, k := range m.desc.variableLabels { +func extractLabelValues(desc *Desc, labels Labels, curry []curriedLabelValue) []string { + labelValues := make([]string, len(labels)+len(curry)) + iCurry := 0 + for i, k := range desc.variableLabels { + if iCurry < len(curry) && curry[iCurry].index == i { + labelValues[i] = curry[iCurry].value + iCurry++ + continue + } labelValues[i] = labels[k] } return labelValues } + +func inlineLabelValues(lvs []string, curry []curriedLabelValue) []string { + labelValues := make([]string, len(lvs)+len(curry)) + var iCurry, iLVs int + for i := range labelValues { + if iCurry < len(curry) && curry[iCurry].index == i { + labelValues[i] = curry[iCurry].value + iCurry++ + continue + } + labelValues[i] = lvs[iLVs] + iLVs++ + } + return labelValues +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go new file mode 100644 index 000000000..e303eef6d --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go @@ -0,0 +1,200 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus + +import ( + "fmt" + "sort" + + "github.com/golang/protobuf/proto" + + dto "github.com/prometheus/client_model/go" +) + +// WrapRegistererWith returns a Registerer wrapping the provided +// Registerer. Collectors registered with the returned Registerer will be +// registered with the wrapped Registerer in a modified way. The modified +// Collector adds the provided Labels to all Metrics it collects (as +// ConstLabels). The Metrics collected by the unmodified Collector must not +// duplicate any of those labels. +// +// WrapRegistererWith provides a way to add fixed labels to a subset of +// Collectors. It should not be used to add fixed labels to all metrics exposed. +// +// Conflicts between Collectors registered through the original Registerer with +// Collectors registered through the wrapping Registerer will still be +// detected. Any AlreadyRegisteredError returned by the Register method of +// either Registerer will contain the ExistingCollector in the form it was +// provided to the respective registry. +// +// The Collector example demonstrates a use of WrapRegistererWith. +func WrapRegistererWith(labels Labels, reg Registerer) Registerer { + return &wrappingRegisterer{ + wrappedRegisterer: reg, + labels: labels, + } +} + +// WrapRegistererWithPrefix returns a Registerer wrapping the provided +// Registerer. Collectors registered with the returned Registerer will be +// registered with the wrapped Registerer in a modified way. The modified +// Collector adds the provided prefix to the name of all Metrics it collects. +// +// WrapRegistererWithPrefix is useful to have one place to prefix all metrics of +// a sub-system. To make this work, register metrics of the sub-system with the +// wrapping Registerer returned by WrapRegistererWithPrefix. It is rarely useful +// to use the same prefix for all metrics exposed. In particular, do not prefix +// metric names that are standardized across applications, as that would break +// horizontal monitoring, for example the metrics provided by the Go collector +// (see NewGoCollector) and the process collector (see NewProcessCollector). (In +// fact, those metrics are already prefixed with “go_” or “process_”, +// respectively.) +// +// Conflicts between Collectors registered through the original Registerer with +// Collectors registered through the wrapping Registerer will still be +// detected. Any AlreadyRegisteredError returned by the Register method of +// either Registerer will contain the ExistingCollector in the form it was +// provided to the respective registry. +func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer { + return &wrappingRegisterer{ + wrappedRegisterer: reg, + prefix: prefix, + } +} + +type wrappingRegisterer struct { + wrappedRegisterer Registerer + prefix string + labels Labels +} + +func (r *wrappingRegisterer) Register(c Collector) error { + return r.wrappedRegisterer.Register(&wrappingCollector{ + wrappedCollector: c, + prefix: r.prefix, + labels: r.labels, + }) +} + +func (r *wrappingRegisterer) MustRegister(cs ...Collector) { + for _, c := range cs { + if err := r.Register(c); err != nil { + panic(err) + } + } +} + +func (r *wrappingRegisterer) Unregister(c Collector) bool { + return r.wrappedRegisterer.Unregister(&wrappingCollector{ + wrappedCollector: c, + prefix: r.prefix, + labels: r.labels, + }) +} + +type wrappingCollector struct { + wrappedCollector Collector + prefix string + labels Labels +} + +func (c *wrappingCollector) Collect(ch chan<- Metric) { + wrappedCh := make(chan Metric) + go func() { + c.wrappedCollector.Collect(wrappedCh) + close(wrappedCh) + }() + for m := range wrappedCh { + ch <- &wrappingMetric{ + wrappedMetric: m, + prefix: c.prefix, + labels: c.labels, + } + } +} + +func (c *wrappingCollector) Describe(ch chan<- *Desc) { + wrappedCh := make(chan *Desc) + go func() { + c.wrappedCollector.Describe(wrappedCh) + close(wrappedCh) + }() + for desc := range wrappedCh { + ch <- wrapDesc(desc, c.prefix, c.labels) + } +} + +func (c *wrappingCollector) unwrapRecursively() Collector { + switch wc := c.wrappedCollector.(type) { + case *wrappingCollector: + return wc.unwrapRecursively() + default: + return wc + } +} + +type wrappingMetric struct { + wrappedMetric Metric + prefix string + labels Labels +} + +func (m *wrappingMetric) Desc() *Desc { + return wrapDesc(m.wrappedMetric.Desc(), m.prefix, m.labels) +} + +func (m *wrappingMetric) Write(out *dto.Metric) error { + if err := m.wrappedMetric.Write(out); err != nil { + return err + } + if len(m.labels) == 0 { + // No wrapping labels. + return nil + } + for ln, lv := range m.labels { + out.Label = append(out.Label, &dto.LabelPair{ + Name: proto.String(ln), + Value: proto.String(lv), + }) + } + sort.Sort(labelPairSorter(out.Label)) + return nil +} + +func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc { + constLabels := Labels{} + for _, lp := range desc.constLabelPairs { + constLabels[*lp.Name] = *lp.Value + } + for ln, lv := range labels { + if _, alreadyUsed := constLabels[ln]; alreadyUsed { + return &Desc{ + fqName: desc.fqName, + help: desc.help, + variableLabels: desc.variableLabels, + constLabelPairs: desc.constLabelPairs, + err: fmt.Errorf("attempted wrapping with already existing label name %q", ln), + } + } + constLabels[ln] = lv + } + // NewDesc will do remaining validations. + newDesc := NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels) + // Propagate errors if there was any. This will override any errer + // created by NewDesc above, i.e. earlier errors get precedence. + if desc.err != nil { + newDesc.err = desc.err + } + return newDesc +} diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go index a7a42d5ef..c092723e8 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ b/vendor/github.com/prometheus/common/expfmt/decode.go @@ -164,9 +164,9 @@ func (sd *SampleDecoder) Decode(s *model.Vector) error { } // ExtractSamples builds a slice of samples from the provided metric -// families. If an error occurs during sample extraction, it continues to +// families. If an error occurrs during sample extraction, it continues to // extract from the remaining metric families. The returned error is the last -// error that has occured. +// error that has occurred. func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) { var ( all model.Vector diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index 371ac7503..c71bcb981 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -26,7 +26,7 @@ const ( // The Content-Type values for the different wire protocols. FmtUnknown Format = `` - FmtText Format = `text/plain; version=` + TextVersion + FmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8` FmtProtoDelim Format = ProtoFmt + ` encoding=delimited` FmtProtoText Format = ProtoFmt + ` encoding=text` FmtProtoCompact Format = ProtoFmt + ` encoding=compact-text` diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index f11321cd0..8e473d0fe 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -14,13 +14,45 @@ package expfmt import ( + "bytes" "fmt" "io" "math" + "strconv" "strings" + "sync" + + "github.com/prometheus/common/model" dto "github.com/prometheus/client_model/go" - "github.com/prometheus/common/model" +) + +// enhancedWriter has all the enhanced write functions needed here. bytes.Buffer +// implements it. +type enhancedWriter interface { + io.Writer + WriteRune(r rune) (n int, err error) + WriteString(s string) (n int, err error) + WriteByte(c byte) error +} + +const ( + initialBufSize = 512 + initialNumBufSize = 24 +) + +var ( + bufPool = sync.Pool{ + New: func() interface{} { + return bytes.NewBuffer(make([]byte, 0, initialBufSize)) + }, + } + numBufPool = sync.Pool{ + New: func() interface{} { + b := make([]byte, 0, initialNumBufSize) + return &b + }, + } ) // MetricFamilyToText converts a MetricFamily proto message into text format and @@ -32,37 +64,92 @@ import ( // will result in invalid text format output. // // This method fulfills the type 'prometheus.encoder'. -func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { - var written int - +func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) { // Fail-fast checks. if len(in.Metric) == 0 { - return written, fmt.Errorf("MetricFamily has no metrics: %s", in) + return 0, fmt.Errorf("MetricFamily has no metrics: %s", in) } name := in.GetName() if name == "" { - return written, fmt.Errorf("MetricFamily has no name: %s", in) + return 0, fmt.Errorf("MetricFamily has no name: %s", in) } + // Try the interface upgrade. If it doesn't work, we'll use a + // bytes.Buffer from the sync.Pool and write out its content to out in a + // single go in the end. + w, ok := out.(enhancedWriter) + if !ok { + b := bufPool.Get().(*bytes.Buffer) + b.Reset() + w = b + defer func() { + bWritten, bErr := out.Write(b.Bytes()) + written = bWritten + if err == nil { + err = bErr + } + bufPool.Put(b) + }() + } + + var n int + // Comments, first HELP, then TYPE. if in.Help != nil { - n, err := fmt.Fprintf( - out, "# HELP %s %s\n", - name, escapeString(*in.Help, false), - ) + n, err = w.WriteString("# HELP ") written += n if err != nil { - return written, err + return + } + n, err = w.WriteString(name) + written += n + if err != nil { + return + } + err = w.WriteByte(' ') + written++ + if err != nil { + return + } + n, err = writeEscapedString(w, *in.Help, false) + written += n + if err != nil { + return + } + err = w.WriteByte('\n') + written++ + if err != nil { + return } } - metricType := in.GetType() - n, err := fmt.Fprintf( - out, "# TYPE %s %s\n", - name, strings.ToLower(metricType.String()), - ) + n, err = w.WriteString("# TYPE ") written += n if err != nil { - return written, err + return + } + n, err = w.WriteString(name) + written += n + if err != nil { + return + } + metricType := in.GetType() + switch metricType { + case dto.MetricType_COUNTER: + n, err = w.WriteString(" counter\n") + case dto.MetricType_GAUGE: + n, err = w.WriteString(" gauge\n") + case dto.MetricType_SUMMARY: + n, err = w.WriteString(" summary\n") + case dto.MetricType_UNTYPED: + n, err = w.WriteString(" untyped\n") + case dto.MetricType_HISTOGRAM: + n, err = w.WriteString(" histogram\n") + default: + return written, fmt.Errorf("unknown metric type %s", metricType.String()) + } + written += n + if err != nil { + return } // Finally the samples, one line for each. @@ -75,9 +162,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { ) } n, err = writeSample( - name, metric, "", "", + w, name, "", metric, "", 0, metric.Counter.GetValue(), - out, ) case dto.MetricType_GAUGE: if metric.Gauge == nil { @@ -86,9 +172,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { ) } n, err = writeSample( - name, metric, "", "", + w, name, "", metric, "", 0, metric.Gauge.GetValue(), - out, ) case dto.MetricType_UNTYPED: if metric.Untyped == nil { @@ -97,9 +182,8 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { ) } n, err = writeSample( - name, metric, "", "", + w, name, "", metric, "", 0, metric.Untyped.GetValue(), - out, ) case dto.MetricType_SUMMARY: if metric.Summary == nil { @@ -109,29 +193,26 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { } for _, q := range metric.Summary.Quantile { n, err = writeSample( - name, metric, - model.QuantileLabel, fmt.Sprint(q.GetQuantile()), + w, name, "", metric, + model.QuantileLabel, q.GetQuantile(), q.GetValue(), - out, ) written += n if err != nil { - return written, err + return } } n, err = writeSample( - name+"_sum", metric, "", "", + w, name, "_sum", metric, "", 0, metric.Summary.GetSampleSum(), - out, ) - if err != nil { - return written, err - } written += n + if err != nil { + return + } n, err = writeSample( - name+"_count", metric, "", "", + w, name, "_count", metric, "", 0, float64(metric.Summary.GetSampleCount()), - out, ) case dto.MetricType_HISTOGRAM: if metric.Histogram == nil { @@ -140,46 +221,42 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { ) } infSeen := false - for _, q := range metric.Histogram.Bucket { + for _, b := range metric.Histogram.Bucket { n, err = writeSample( - name+"_bucket", metric, - model.BucketLabel, fmt.Sprint(q.GetUpperBound()), - float64(q.GetCumulativeCount()), - out, + w, name, "_bucket", metric, + model.BucketLabel, b.GetUpperBound(), + float64(b.GetCumulativeCount()), ) written += n if err != nil { - return written, err + return } - if math.IsInf(q.GetUpperBound(), +1) { + if math.IsInf(b.GetUpperBound(), +1) { infSeen = true } } if !infSeen { n, err = writeSample( - name+"_bucket", metric, - model.BucketLabel, "+Inf", + w, name, "_bucket", metric, + model.BucketLabel, math.Inf(+1), float64(metric.Histogram.GetSampleCount()), - out, ) - if err != nil { - return written, err - } written += n + if err != nil { + return + } } n, err = writeSample( - name+"_sum", metric, "", "", + w, name, "_sum", metric, "", 0, metric.Histogram.GetSampleSum(), - out, ) - if err != nil { - return written, err - } written += n + if err != nil { + return + } n, err = writeSample( - name+"_count", metric, "", "", + w, name, "_count", metric, "", 0, float64(metric.Histogram.GetSampleCount()), - out, ) default: return written, fmt.Errorf( @@ -188,116 +265,204 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (int, error) { } written += n if err != nil { - return written, err + return } } - return written, nil + return } -// writeSample writes a single sample in text format to out, given the metric +// writeSample writes a single sample in text format to w, given the metric // name, the metric proto message itself, optionally an additional label name -// and value (use empty strings if not required), and the value. The function -// returns the number of bytes written and any error encountered. +// with a float64 value (use empty string as label name if not required), and +// the value. The function returns the number of bytes written and any error +// encountered. func writeSample( - name string, + w enhancedWriter, + name, suffix string, metric *dto.Metric, - additionalLabelName, additionalLabelValue string, + additionalLabelName string, additionalLabelValue float64, value float64, - out io.Writer, ) (int, error) { var written int - n, err := fmt.Fprint(out, name) + n, err := w.WriteString(name) written += n if err != nil { return written, err } - n, err = labelPairsToText( - metric.Label, - additionalLabelName, additionalLabelValue, - out, - ) - written += n - if err != nil { - return written, err - } - n, err = fmt.Fprintf(out, " %v", value) - written += n - if err != nil { - return written, err - } - if metric.TimestampMs != nil { - n, err = fmt.Fprintf(out, " %v", *metric.TimestampMs) + if suffix != "" { + n, err = w.WriteString(suffix) written += n if err != nil { return written, err } } - n, err = out.Write([]byte{'\n'}) + n, err = writeLabelPairs( + w, metric.Label, additionalLabelName, additionalLabelValue, + ) written += n if err != nil { return written, err } + err = w.WriteByte(' ') + written++ + if err != nil { + return written, err + } + n, err = writeFloat(w, value) + written += n + if err != nil { + return written, err + } + if metric.TimestampMs != nil { + err = w.WriteByte(' ') + written++ + if err != nil { + return written, err + } + n, err = writeInt(w, *metric.TimestampMs) + written += n + if err != nil { + return written, err + } + } + err = w.WriteByte('\n') + written++ + if err != nil { + return written, err + } return written, nil } -// labelPairsToText converts a slice of LabelPair proto messages plus the +// writeLabelPairs converts a slice of LabelPair proto messages plus the // explicitly given additional label pair into text formatted as required by the -// text format and writes it to 'out'. An empty slice in combination with an -// empty string 'additionalLabelName' results in nothing being -// written. Otherwise, the label pairs are written, escaped as required by the -// text format, and enclosed in '{...}'. The function returns the number of -// bytes written and any error encountered. -func labelPairsToText( +// text format and writes it to 'w'. An empty slice in combination with an empty +// string 'additionalLabelName' results in nothing being written. Otherwise, the +// label pairs are written, escaped as required by the text format, and enclosed +// in '{...}'. The function returns the number of bytes written and any error +// encountered. +func writeLabelPairs( + w enhancedWriter, in []*dto.LabelPair, - additionalLabelName, additionalLabelValue string, - out io.Writer, + additionalLabelName string, additionalLabelValue float64, ) (int, error) { if len(in) == 0 && additionalLabelName == "" { return 0, nil } - var written int - separator := '{' + var ( + written int + separator byte = '{' + ) for _, lp := range in { - n, err := fmt.Fprintf( - out, `%c%s="%s"`, - separator, lp.GetName(), escapeString(lp.GetValue(), true), - ) + err := w.WriteByte(separator) + written++ + if err != nil { + return written, err + } + n, err := w.WriteString(lp.GetName()) written += n if err != nil { return written, err } + n, err = w.WriteString(`="`) + written += n + if err != nil { + return written, err + } + n, err = writeEscapedString(w, lp.GetValue(), true) + written += n + if err != nil { + return written, err + } + err = w.WriteByte('"') + written++ + if err != nil { + return written, err + } separator = ',' } if additionalLabelName != "" { - n, err := fmt.Fprintf( - out, `%c%s="%s"`, - separator, additionalLabelName, - escapeString(additionalLabelValue, true), - ) + err := w.WriteByte(separator) + written++ + if err != nil { + return written, err + } + n, err := w.WriteString(additionalLabelName) written += n if err != nil { return written, err } + n, err = w.WriteString(`="`) + written += n + if err != nil { + return written, err + } + n, err = writeFloat(w, additionalLabelValue) + written += n + if err != nil { + return written, err + } + err = w.WriteByte('"') + written++ + if err != nil { + return written, err + } } - n, err := out.Write([]byte{'}'}) - written += n + err := w.WriteByte('}') + written++ if err != nil { return written, err } return written, nil } +// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if +// includeDoubleQuote is true - '"' by '\"'. var ( - escape = strings.NewReplacer("\\", `\\`, "\n", `\n`) - escapeWithDoubleQuote = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`) + escaper = strings.NewReplacer("\\", `\\`, "\n", `\n`) + quotedEscaper = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`) ) -// escapeString replaces '\' by '\\', new line character by '\n', and - if -// includeDoubleQuote is true - '"' by '\"'. -func escapeString(v string, includeDoubleQuote bool) string { +func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) { if includeDoubleQuote { - return escapeWithDoubleQuote.Replace(v) + return quotedEscaper.WriteString(w, v) + } else { + return escaper.WriteString(w, v) } - - return escape.Replace(v) +} + +// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes +// a few common cases for increased efficiency. For non-hardcoded cases, it uses +// strconv.AppendFloat to avoid allocations, similar to writeInt. +func writeFloat(w enhancedWriter, f float64) (int, error) { + switch { + case f == 1: + return 1, w.WriteByte('1') + case f == 0: + return 1, w.WriteByte('0') + case f == -1: + return w.WriteString("-1") + case math.IsNaN(f): + return w.WriteString("NaN") + case math.IsInf(f, +1): + return w.WriteString("+Inf") + case math.IsInf(f, -1): + return w.WriteString("-Inf") + default: + bp := numBufPool.Get().(*[]byte) + *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64) + written, err := w.Write(*bp) + numBufPool.Put(bp) + return written, err + } +} + +// writeInt is equivalent to fmt.Fprint with an int64 argument but uses +// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid +// allocations. +func writeInt(w enhancedWriter, i int64) (int, error) { + bp := numBufPool.Get().(*[]byte) + *bp = strconv.AppendInt((*bp)[:0], i, 10) + written, err := w.Write(*bp) + numBufPool.Put(bp) + return written, err } diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index ef9a15077..ec3d86ba7 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -315,6 +315,10 @@ func (p *TextParser) startLabelValue() stateFn { if p.readTokenAsLabelValue(); p.err != nil { return nil } + if !model.LabelValue(p.currentToken.String()).IsValid() { + p.parseError(fmt.Sprintf("invalid label value %q", p.currentToken.String())) + return nil + } p.currentLabelPair.Value = proto.String(p.currentToken.String()) // Special treatment of summaries: // - Quantile labels are special, will result in dto.Quantile later. @@ -355,7 +359,7 @@ func (p *TextParser) startLabelValue() stateFn { } return p.readingValue default: - p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.Value)) + p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue())) return nil } } @@ -552,8 +556,8 @@ func (p *TextParser) readTokenUntilWhitespace() { // byte considered is the byte already read (now in p.currentByte). The first // newline byte encountered is still copied into p.currentByte, but not into // p.currentToken. If recognizeEscapeSequence is true, two escape sequences are -// recognized: '\\' tranlates into '\', and '\n' into a line-feed character. All -// other escape sequences are invalid and cause an error. +// recognized: '\\' translates into '\', and '\n' into a line-feed character. +// All other escape sequences are invalid and cause an error. func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) { p.currentToken.Reset() escaped := false diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go index 648b38cb6..26e92288c 100644 --- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go +++ b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go @@ -1,12 +1,12 @@ /* +Copyright (c) 2011, Open Knowledge Foundation Ltd. +All rights reserved. + HTTP Content-Type Autonegotiation. The functions in this package implement the behaviour specified in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html -Copyright (c) 2011, Open Knowledge Foundation Ltd. -All rights reserved. - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go index f7250909b..00804b7fe 100644 --- a/vendor/github.com/prometheus/common/model/metric.go +++ b/vendor/github.com/prometheus/common/model/metric.go @@ -21,7 +21,6 @@ import ( ) var ( - separator = []byte{0} // MetricNameRE is a regular expression matching valid metric // names. Note that the IsValidMetricName function performs the same // check but faster than a match with this regular expression. diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go index 7538e2997..bb99889d2 100644 --- a/vendor/github.com/prometheus/common/model/silence.go +++ b/vendor/github.com/prometheus/common/model/silence.go @@ -59,8 +59,8 @@ func (m *Matcher) Validate() error { return nil } -// Silence defines the representation of a silence definiton -// in the Prometheus eco-system. +// Silence defines the representation of a silence definition in the Prometheus +// eco-system. type Silence struct { ID uint64 `json:"id,omitempty"` diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index 548968aeb..7b0064fdb 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -43,7 +43,7 @@ const ( // (1970-01-01 00:00 UTC) excluding leap seconds. type Time int64 -// Interval describes and interval between two timestamps. +// Interval describes an interval between two timestamps. type Interval struct { Start, End Time } @@ -150,7 +150,13 @@ func (t *Time) UnmarshalJSON(b []byte) error { return err } - *t = Time(v + va) + // If the value was something like -0.1 the negative is lost in the + // parsing because of the leading zero, this ensures that we capture it. + if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 { + *t = Time(v+va) * -1 + } else { + *t = Time(v + va) + } default: return fmt.Errorf("invalid time %q", string(b)) @@ -163,9 +169,21 @@ func (t *Time) UnmarshalJSON(b []byte) error { // This type should not propagate beyond the scope of input/output processing. type Duration time.Duration +// Set implements pflag/flag.Value +func (d *Duration) Set(s string) error { + var err error + *d, err = ParseDuration(s) + return err +} + +// Type implements pflag.Value +func (d *Duration) Type() string { + return "duration" +} + var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$") -// StringToDuration parses a string into a time.Duration, assuming that a year +// ParseDuration parses a string into a time.Duration, assuming that a year // always has 365d, a week always has 7d, and a day always has 24h. func ParseDuration(durationStr string) (Duration, error) { matches := durationRE.FindStringSubmatch(durationStr) @@ -202,6 +220,9 @@ func (d Duration) String() string { ms = int64(time.Duration(d) / time.Millisecond) unit = "ms" ) + if ms == 0 { + return "0s" + } factors := map[string]int64{ "y": 1000 * 60 * 60 * 24 * 365, "w": 1000 * 60 * 60 * 24 * 7, diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go index c9ed3ffd8..c9d8fb1a2 100644 --- a/vendor/github.com/prometheus/common/model/value.go +++ b/vendor/github.com/prometheus/common/model/value.go @@ -100,7 +100,7 @@ func (s *SamplePair) UnmarshalJSON(b []byte) error { } // Equal returns true if this SamplePair and o have equal Values and equal -// Timestamps. The sematics of Value equality is defined by SampleValue.Equal. +// Timestamps. The semantics of Value equality is defined by SampleValue.Equal. func (s *SamplePair) Equal(o *SamplePair) bool { return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp)) } @@ -117,7 +117,7 @@ type Sample struct { } // Equal compares first the metrics, then the timestamp, then the value. The -// sematics of value equality is defined by SampleValue.Equal. +// semantics of value equality is defined by SampleValue.Equal. func (s *Sample) Equal(o *Sample) bool { if s == o { return true diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go index 680a9842a..63d4229a4 100644 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ b/vendor/github.com/prometheus/procfs/buddyinfo.go @@ -31,19 +31,9 @@ type BuddyInfo struct { Sizes []float64 } -// NewBuddyInfo reads the buddyinfo statistics. -func NewBuddyInfo() ([]BuddyInfo, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewBuddyInfo() -} - // NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem. -func (fs FS) NewBuddyInfo() ([]BuddyInfo, error) { - file, err := os.Open(fs.Path("buddyinfo")) +func (fs FS) BuddyInfo() ([]BuddyInfo, error) { + file, err := os.Open(fs.proc.Path("buddyinfo")) if err != nil { return nil, err } @@ -62,7 +52,7 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { for scanner.Scan() { var err error line := scanner.Text() - parts := strings.Fields(string(line)) + parts := strings.Fields(line) if len(parts) < 4 { return nil, fmt.Errorf("invalid number of fields when parsing buddyinfo") diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go index 17546756b..0102ab0fd 100644 --- a/vendor/github.com/prometheus/procfs/fs.go +++ b/vendor/github.com/prometheus/procfs/fs.go @@ -1,46 +1,43 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( - "fmt" - "os" - "path" - - "github.com/prometheus/procfs/xfs" + "github.com/prometheus/procfs/internal/fs" ) -// FS represents the pseudo-filesystem proc, which provides an interface to +// FS represents the pseudo-filesystem sys, which provides an interface to // kernel data structures. -type FS string +type FS struct { + proc fs.FS +} // DefaultMountPoint is the common mount point of the proc filesystem. -const DefaultMountPoint = "/proc" +const DefaultMountPoint = fs.DefaultProcMountPoint -// NewFS returns a new FS mounted under the given mountPoint. It will error -// if the mount point can't be read. +// NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. +// It will error if the mount point directory can't be read or is a file. +func NewDefaultFS() (FS, error) { + return NewFS(DefaultMountPoint) +} + +// NewFS returns a new proc FS mounted under the given proc mountPoint. It will error +// if the mount point directory can't be read or is a file. func NewFS(mountPoint string) (FS, error) { - info, err := os.Stat(mountPoint) + fs, err := fs.NewFS(mountPoint) if err != nil { - return "", fmt.Errorf("could not read %s: %s", mountPoint, err) + return FS{}, err } - if !info.IsDir() { - return "", fmt.Errorf("mount point %s is not a directory", mountPoint) - } - - return FS(mountPoint), nil -} - -// Path returns the path of the given subsystem relative to the procfs root. -func (fs FS) Path(p ...string) string { - return path.Join(append([]string{string(fs)}, p...)...) -} - -// XFSStats retrieves XFS filesystem runtime statistics. -func (fs FS) XFSStats() (*xfs.Stats, error) { - f, err := os.Open(fs.Path("fs/xfs/stat")) - if err != nil { - return nil, err - } - defer f.Close() - - return xfs.ParseStats(f) + return FS{fs}, nil } diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go new file mode 100644 index 000000000..7ddfd6b6e --- /dev/null +++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go @@ -0,0 +1,55 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package fs + +import ( + "fmt" + "os" + "path/filepath" +) + +const ( + // DefaultProcMountPoint is the common mount point of the proc filesystem. + DefaultProcMountPoint = "/proc" + + // DefaultSysMountPoint is the common mount point of the sys filesystem. + DefaultSysMountPoint = "/sys" + + // DefaultConfigfsMountPoint is the commont mount point of the configfs + DefaultConfigfsMountPoint = "/sys/kernel/config" +) + +// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an +// interface to kernel data structures. +type FS string + +// NewFS returns a new FS mounted under the given mountPoint. It will error +// if the mount point can't be read. +func NewFS(mountPoint string) (FS, error) { + info, err := os.Stat(mountPoint) + if err != nil { + return "", fmt.Errorf("could not read %s: %s", mountPoint, err) + } + if !info.IsDir() { + return "", fmt.Errorf("mount point %s is not a directory", mountPoint) + } + + return FS(mountPoint), nil +} + +// Path appends the given path elements to the filesystem path, adding separators +// as necessary. +func (fs FS) Path(p ...string) string { + return filepath.Join(append([]string{string(fs)}, p...)...) +} diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go index e7012f732..2d6cb8d1c 100644 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ b/vendor/github.com/prometheus/procfs/ipvs.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( @@ -31,14 +44,16 @@ type IPVSStats struct { type IPVSBackendStatus struct { // The local (virtual) IP address. LocalAddress net.IP - // The local (virtual) port. - LocalPort uint16 - // The transport protocol (TCP, UDP). - Proto string // The remote (real) IP address. RemoteAddress net.IP + // The local (virtual) port. + LocalPort uint16 // The remote (real) port. RemotePort uint16 + // The local firewall mark + LocalMark string + // The transport protocol (TCP, UDP). + Proto string // The current number of active connections for this virtual/real address pair. ActiveConn uint64 // The current number of inactive connections for this virtual/real address pair. @@ -47,19 +62,9 @@ type IPVSBackendStatus struct { Weight uint64 } -// NewIPVSStats reads the IPVS statistics. -func NewIPVSStats() (IPVSStats, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return IPVSStats{}, err - } - - return fs.NewIPVSStats() -} - -// NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem. -func (fs FS) NewIPVSStats() (IPVSStats, error) { - file, err := os.Open(fs.Path("net/ip_vs_stats")) +// IPVSStats reads the IPVS statistics from the specified `proc` filesystem. +func (fs FS) IPVSStats() (IPVSStats, error) { + file, err := os.Open(fs.proc.Path("net/ip_vs_stats")) if err != nil { return IPVSStats{}, err } @@ -116,19 +121,9 @@ func parseIPVSStats(file io.Reader) (IPVSStats, error) { return stats, nil } -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs. -func NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return []IPVSBackendStatus{}, err - } - - return fs.NewIPVSBackendStatus() -} - -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. -func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { - file, err := os.Open(fs.Path("net/ip_vs")) +// IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. +func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error) { + file, err := os.Open(fs.proc.Path("net/ip_vs")) if err != nil { return nil, err } @@ -142,13 +137,14 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) { status []IPVSBackendStatus scanner = bufio.NewScanner(file) proto string + localMark string localAddress net.IP localPort uint16 err error ) for scanner.Scan() { - fields := strings.Fields(string(scanner.Text())) + fields := strings.Fields(scanner.Text()) if len(fields) == 0 { continue } @@ -160,10 +156,19 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) { continue } proto = fields[0] + localMark = "" localAddress, localPort, err = parseIPPort(fields[1]) if err != nil { return nil, err } + case fields[0] == "FWM": + if len(fields) < 2 { + continue + } + proto = fields[0] + localMark = fields[1] + localAddress = nil + localPort = 0 case fields[0] == "->": if len(fields) < 6 { continue @@ -187,6 +192,7 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) { status = append(status, IPVSBackendStatus{ LocalAddress: localAddress, LocalPort: localPort, + LocalMark: localMark, RemoteAddress: remoteAddress, RemotePort: remotePort, Proto: proto, @@ -200,22 +206,31 @@ func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) { } func parseIPPort(s string) (net.IP, uint16, error) { - tmp := strings.SplitN(s, ":", 2) + var ( + ip net.IP + err error + ) - if len(tmp) != 2 { - return nil, 0, fmt.Errorf("invalid IP:Port: %s", s) + switch len(s) { + case 13: + ip, err = hex.DecodeString(s[0:8]) + if err != nil { + return nil, 0, err + } + case 46: + ip = net.ParseIP(s[1:40]) + if ip == nil { + return nil, 0, fmt.Errorf("invalid IPv6 address: %s", s[1:40]) + } + default: + return nil, 0, fmt.Errorf("unexpected IP:Port: %s", s) } - if len(tmp[0]) != 8 && len(tmp[0]) != 32 { - return nil, 0, fmt.Errorf("invalid IP: %s", tmp[0]) + portString := s[len(s)-4:] + if len(portString) != 4 { + return nil, 0, fmt.Errorf("unexpected port string format: %s", portString) } - - ip, err := hex.DecodeString(tmp[0]) - if err != nil { - return nil, 0, err - } - - port, err := strconv.ParseUint(tmp[1], 16, 16) + port, err := strconv.ParseUint(portString, 16, 16) if err != nil { return nil, 0, err } diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go index d7a248c0d..2af3ada18 100644 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ b/vendor/github.com/prometheus/procfs/mdstat.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( @@ -9,8 +22,8 @@ import ( ) var ( - statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) - buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) + statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) + recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`) ) // MDStat holds info parsed from /proc/mdstat. @@ -21,117 +34,160 @@ type MDStat struct { ActivityState string // Number of active disks. DisksActive int64 - // Total number of disks the device consists of. + // Total number of disks the device requires. DisksTotal int64 + // Number of failed disks. + DisksFailed int64 + // Spare disks in the device. + DisksSpare int64 // Number of blocks the device holds. BlocksTotal int64 // Number of blocks on the device that are in sync. BlocksSynced int64 } -// ParseMDStat parses an mdstat-file and returns a struct with the relevant infos. -func (fs FS) ParseMDStat() (mdstates []MDStat, err error) { - mdStatusFilePath := fs.Path("mdstat") - content, err := ioutil.ReadFile(mdStatusFilePath) +// MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of +// structs containing the relevant info. More information available here: +// https://raid.wiki.kernel.org/index.php/Mdstat +func (fs FS) MDStat() ([]MDStat, error) { + data, err := ioutil.ReadFile(fs.proc.Path("mdstat")) if err != nil { - return []MDStat{}, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) } + mdstat, err := parseMDStat(data) + if err != nil { + return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) + } + return mdstat, nil +} - mdStates := []MDStat{} - lines := strings.Split(string(content), "\n") - for i, l := range lines { - if l == "" { - continue - } - if l[0] == ' ' { - continue - } - if strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { +// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of +// structs containing the relevant info. +func parseMDStat(mdStatData []byte) ([]MDStat, error) { + mdStats := []MDStat{} + lines := strings.Split(string(mdStatData), "\n") + + for i, line := range lines { + if strings.TrimSpace(line) == "" || line[0] == ' ' || + strings.HasPrefix(line, "Personalities") || + strings.HasPrefix(line, "unused") { continue } - mainLine := strings.Split(l, " ") - if len(mainLine) < 3 { - return mdStates, fmt.Errorf("error parsing mdline: %s", l) + deviceFields := strings.Fields(line) + if len(deviceFields) < 3 { + return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", line) } - mdName := mainLine[0] - activityState := mainLine[2] + mdName := deviceFields[0] // mdx + state := deviceFields[2] // active or inactive if len(lines) <= i+3 { - return mdStates, fmt.Errorf( - "error parsing %s: too few lines for md device %s", - mdStatusFilePath, + return nil, fmt.Errorf( + "error parsing %s: too few lines for md device", mdName, ) } - active, total, size, err := evalStatusline(lines[i+1]) + // Failed disks have the suffix (F) & Spare disks have the suffix (S). + fail := int64(strings.Count(line, "(F)")) + spare := int64(strings.Count(line, "(S)")) + active, total, size, err := evalStatusLine(lines[i], lines[i+1]) + if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + return nil, fmt.Errorf("error parsing md device lines: %s", err) } - // j is the line number of the syncing-line. - j := i + 2 + syncLineIdx := i + 2 if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line - j = i + 3 + syncLineIdx++ } // If device is syncing at the moment, get the number of currently // synced bytes, otherwise that number equals the size of the device. syncedBlocks := size - if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") { - syncedBlocks, err = evalBuildline(lines[j]) - if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + recovering := strings.Contains(lines[syncLineIdx], "recovery") + resyncing := strings.Contains(lines[syncLineIdx], "resync") + + // Append recovery and resyncing state info. + if recovering || resyncing { + if recovering { + state = "recovering" + } else { + state = "resyncing" + } + + // Handle case when resync=PENDING or resync=DELAYED. + if strings.Contains(lines[syncLineIdx], "PENDING") || + strings.Contains(lines[syncLineIdx], "DELAYED") { + syncedBlocks = 0 + } else { + syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) + if err != nil { + return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err) + } } } - mdStates = append(mdStates, MDStat{ + mdStats = append(mdStats, MDStat{ Name: mdName, - ActivityState: activityState, + ActivityState: state, DisksActive: active, + DisksFailed: fail, + DisksSpare: spare, DisksTotal: total, BlocksTotal: size, BlocksSynced: syncedBlocks, }) } - return mdStates, nil + return mdStats, nil } -func evalStatusline(statusline string) (active, total, size int64, err error) { - matches := statuslineRE.FindStringSubmatch(statusline) - if len(matches) != 4 { - return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline) +func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) { + + sizeStr := strings.Fields(statusLine)[0] + size, err = strconv.ParseInt(sizeStr, 10, 64) + if err != nil { + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } - size, err = strconv.ParseInt(matches[1], 10, 64) - if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") { + // In the device deviceLine, only disks have a number associated with them in []. + total = int64(strings.Count(deviceLine, "[")) + return total, total, size, nil + } + + if strings.Contains(deviceLine, "inactive") { + return 0, 0, size, nil + } + + matches := statusLineRE.FindStringSubmatch(statusLine) + if len(matches) != 4 { + return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine) } total, err = strconv.ParseInt(matches[2], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } active, err = strconv.ParseInt(matches[3], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } return active, total, size, nil } -func evalBuildline(buildline string) (syncedBlocks int64, err error) { - matches := buildlineRE.FindStringSubmatch(buildline) +func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) { + matches := recoveryLineRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return 0, fmt.Errorf("unexpected buildline: %s", buildline) + return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine) } syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) if err != nil { - return 0, fmt.Errorf("%s in buildline: %s", err, buildline) + return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine) } return syncedBlocks, nil diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go new file mode 100644 index 000000000..61fa61887 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/mountinfo.go @@ -0,0 +1,178 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "fmt" + "io" + "os" + "strconv" + "strings" +) + +var validOptionalFields = map[string]bool{ + "shared": true, + "master": true, + "propagate_from": true, + "unbindable": true, +} + +// A MountInfo is a type that describes the details, options +// for each mount, parsed from /proc/self/mountinfo. +// The fields described in each entry of /proc/self/mountinfo +// is described in the following man page. +// http://man7.org/linux/man-pages/man5/proc.5.html +type MountInfo struct { + // Unique Id for the mount + MountId int + // The Id of the parent mount + ParentId int + // The value of `st_dev` for the files on this FS + MajorMinorVer string + // The pathname of the directory in the FS that forms + // the root for this mount + Root string + // The pathname of the mount point relative to the root + MountPoint string + // Mount options + Options map[string]string + // Zero or more optional fields + OptionalFields map[string]string + // The Filesystem type + FSType string + // FS specific information or "none" + Source string + // Superblock options + SuperOptions map[string]string +} + +// Returns part of the mountinfo line, if it exists, else an empty string. +func getStringSliceElement(parts []string, idx int, defaultValue string) string { + if idx >= len(parts) { + return defaultValue + } + return parts[idx] +} + +// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs. +func parseMountInfo(r io.Reader) ([]*MountInfo, error) { + mounts := []*MountInfo{} + scanner := bufio.NewScanner(r) + for scanner.Scan() { + mountString := scanner.Text() + parsedMounts, err := parseMountInfoString(mountString) + if err != nil { + return nil, err + } + mounts = append(mounts, parsedMounts) + } + + err := scanner.Err() + return mounts, err +} + +// Parses a mountinfo file line, and converts it to a MountInfo struct. +// An important check here is to see if the hyphen separator, as if it does not exist, +// it means that the line is malformed. +func parseMountInfoString(mountString string) (*MountInfo, error) { + var err error + + // OptionalFields can be zero, hence these checks to ensure we do not populate the wrong values in the wrong spots + separatorIndex := strings.Index(mountString, "-") + if separatorIndex == -1 { + return nil, fmt.Errorf("no separator found in mountinfo string: %s", mountString) + } + beforeFields := strings.Fields(mountString[:separatorIndex]) + afterFields := strings.Fields(mountString[separatorIndex+1:]) + if (len(beforeFields) + len(afterFields)) < 7 { + return nil, fmt.Errorf("too few fields") + } + + mount := &MountInfo{ + MajorMinorVer: getStringSliceElement(beforeFields, 2, ""), + Root: getStringSliceElement(beforeFields, 3, ""), + MountPoint: getStringSliceElement(beforeFields, 4, ""), + Options: mountOptionsParser(getStringSliceElement(beforeFields, 5, "")), + OptionalFields: nil, + FSType: getStringSliceElement(afterFields, 0, ""), + Source: getStringSliceElement(afterFields, 1, ""), + SuperOptions: mountOptionsParser(getStringSliceElement(afterFields, 2, "")), + } + + mount.MountId, err = strconv.Atoi(getStringSliceElement(beforeFields, 0, "")) + if err != nil { + return nil, fmt.Errorf("failed to parse mount ID") + } + mount.ParentId, err = strconv.Atoi(getStringSliceElement(beforeFields, 1, "")) + if err != nil { + return nil, fmt.Errorf("failed to parse parent ID") + } + // Has optional fields, which is a space separated list of values. + // Example: shared:2 master:7 + if len(beforeFields) > 6 { + mount.OptionalFields = make(map[string]string) + optionalFields := beforeFields[6:] + for _, field := range optionalFields { + optionSplit := strings.Split(field, ":") + target, value := optionSplit[0], "" + if len(optionSplit) == 2 { + value = optionSplit[1] + } + // Checks if the 'keys' in the optional fields in the mountinfo line are acceptable. + // Allowed 'keys' are shared, master, propagate_from, unbindable. + if _, ok := validOptionalFields[target]; ok { + mount.OptionalFields[target] = value + } + } + } + return mount, nil +} + +// Parses the mount options, superblock options. +func mountOptionsParser(mountOptions string) map[string]string { + opts := make(map[string]string) + options := strings.Split(mountOptions, ",") + for _, opt := range options { + splitOption := strings.Split(opt, "=") + if len(splitOption) < 2 { + key := splitOption[0] + opts[key] = "" + } else { + key, value := splitOption[0], splitOption[1] + opts[key] = value + } + } + return opts +} + +// Retrieves mountinfo information from `/proc/self/mountinfo`. +func GetMounts() ([]*MountInfo, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return nil, err + } + defer f.Close() + return parseMountInfo(f) +} + +// Retrieves mountinfo information from a processes' `/proc//mountinfo`. +func GetProcMounts(pid int) ([]*MountInfo, error) { + f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid)) + if err != nil { + return nil, err + } + defer f.Close() + return parseMountInfo(f) +} diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index fe8f1f6a2..35b2ef351 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs // While implementing parsing of /proc/[pid]/mountstats, this blog was used @@ -26,8 +39,11 @@ const ( statVersion10 = "1.0" statVersion11 = "1.1" - fieldTransport10Len = 10 - fieldTransport11Len = 13 + fieldTransport10TCPLen = 10 + fieldTransport10UDPLen = 7 + + fieldTransport11TCPLen = 13 + fieldTransport11UDPLen = 10 ) // A Mount is a device mount parsed from /proc/[pid]/mountstats. @@ -53,6 +69,8 @@ type MountStats interface { type MountStatsNFS struct { // The version of statistics provided. StatVersion string + // The mount options of the NFS mount. + Opts map[string]string // The age of the NFS mount. Age time.Duration // Statistics related to byte counters for various operations. @@ -163,16 +181,18 @@ type NFSOperationStats struct { // Number of bytes received for this operation, including RPC headers and payload. BytesReceived uint64 // Duration all requests spent queued for transmission before they were sent. - CumulativeQueueTime time.Duration + CumulativeQueueMilliseconds uint64 // Duration it took to get a reply back after the request was transmitted. - CumulativeTotalResponseTime time.Duration + CumulativeTotalResponseMilliseconds uint64 // Duration from when a request was enqueued to when it was completely handled. - CumulativeTotalRequestTime time.Duration + CumulativeTotalRequestMilliseconds uint64 } // A NFSTransportStats contains statistics for the NFS mount RPC requests and // responses. type NFSTransportStats struct { + // The transport protocol used for the NFS mount. + Protocol string // The local port used for the NFS mount. Port uint64 // Number of times the client has had to establish a connection from scratch @@ -184,7 +204,7 @@ type NFSTransportStats struct { // spent waiting for connections to the server to be established. ConnectIdleTime uint64 // Duration since the NFS mount last saw any RPC traffic. - IdleTime time.Duration + IdleTimeSeconds uint64 // Number of RPC requests for this mount sent to the NFS server. Sends uint64 // Number of RPC responses for this mount received from the NFS server. @@ -299,6 +319,7 @@ func parseMount(ss []string) (*Mount, error) { func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) { // Field indicators for parsing specific types of data const ( + fieldOpts = "opts:" fieldAge = "age:" fieldBytes = "bytes:" fieldEvents = "events:" @@ -320,6 +341,18 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e } switch ss[0] { + case fieldOpts: + if stats.Opts == nil { + stats.Opts = map[string]string{} + } + for _, opt := range strings.Split(ss[1], ",") { + split := strings.Split(opt, "=") + if len(split) == 2 { + stats.Opts[split[0]] = split[1] + } else { + stats.Opts[opt] = "" + } + } case fieldAge: // Age integer is in seconds d, err := time.ParseDuration(ss[1] + "s") @@ -347,7 +380,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e return nil, fmt.Errorf("not enough information for NFS transport stats: %v", ss) } - tstats, err := parseNFSTransportStats(ss[2:], statVersion) + tstats, err := parseNFSTransportStats(ss[1:], statVersion) if err != nil { return nil, err } @@ -491,15 +524,15 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { } ops = append(ops, NFSOperationStats{ - Operation: strings.TrimSuffix(ss[0], ":"), - Requests: ns[0], - Transmissions: ns[1], - MajorTimeouts: ns[2], - BytesSent: ns[3], - BytesReceived: ns[4], - CumulativeQueueTime: time.Duration(ns[5]) * time.Millisecond, - CumulativeTotalResponseTime: time.Duration(ns[6]) * time.Millisecond, - CumulativeTotalRequestTime: time.Duration(ns[7]) * time.Millisecond, + Operation: strings.TrimSuffix(ss[0], ":"), + Requests: ns[0], + Transmissions: ns[1], + MajorTimeouts: ns[2], + BytesSent: ns[3], + BytesReceived: ns[4], + CumulativeQueueMilliseconds: ns[5], + CumulativeTotalResponseMilliseconds: ns[6], + CumulativeTotalRequestMilliseconds: ns[7], }) } @@ -509,13 +542,33 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { // parseNFSTransportStats parses a NFSTransportStats line using an input set of // integer fields matched to a specific stats version. func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) { + // Extract the protocol field. It is the only string value in the line + protocol := ss[0] + ss = ss[1:] + switch statVersion { case statVersion10: - if len(ss) != fieldTransport10Len { + var expectedLength int + if protocol == "tcp" { + expectedLength = fieldTransport10TCPLen + } else if protocol == "udp" { + expectedLength = fieldTransport10UDPLen + } else { + return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.0 statement: %v", protocol, ss) + } + if len(ss) != expectedLength { return nil, fmt.Errorf("invalid NFS transport stats 1.0 statement: %v", ss) } case statVersion11: - if len(ss) != fieldTransport11Len { + var expectedLength int + if protocol == "tcp" { + expectedLength = fieldTransport11TCPLen + } else if protocol == "udp" { + expectedLength = fieldTransport11UDPLen + } else { + return nil, fmt.Errorf("invalid NFS protocol \"%s\" in stats 1.1 statement: %v", protocol, ss) + } + if len(ss) != expectedLength { return nil, fmt.Errorf("invalid NFS transport stats 1.1 statement: %v", ss) } default: @@ -523,23 +576,39 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats } // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay - // in a v1.0 response - ns := make([]uint64, 0, fieldTransport11Len) - for _, s := range ss { + // in a v1.0 response. Since the stat length is bigger for TCP stats, we use + // the TCP length here. + // + // Note: slice length must be set to length of v1.1 stats to avoid a panic when + // only v1.0 stats are present. + // See: https://github.com/prometheus/node_exporter/issues/571. + ns := make([]uint64, fieldTransport11TCPLen) + for i, s := range ss { n, err := strconv.ParseUint(s, 10, 64) if err != nil { return nil, err } - ns = append(ns, n) + ns[i] = n + } + + // The fields differ depending on the transport protocol (TCP or UDP) + // From https://utcc.utoronto.ca/%7Ecks/space/blog/linux/NFSMountstatsXprt + // + // For the udp RPC transport there is no connection count, connect idle time, + // or idle time (fields #3, #4, and #5); all other fields are the same. So + // we set them to 0 here. + if protocol == "udp" { + ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...) } return &NFSTransportStats{ + Protocol: protocol, Port: ns[0], Bind: ns[1], Connect: ns[2], ConnectIdleTime: ns[3], - IdleTime: time.Duration(ns[4]) * time.Second, + IdleTimeSeconds: ns[4], Sends: ns[5], Receives: ns[6], BadTransactionIDs: ns[7], diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go new file mode 100644 index 000000000..a0b7a0119 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_dev.go @@ -0,0 +1,206 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "errors" + "os" + "sort" + "strconv" + "strings" +) + +// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev. +type NetDevLine struct { + Name string `json:"name"` // The name of the interface. + RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received. + RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received. + RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered. + RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving. + RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors. + RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors. + RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver. + RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver. + TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted. + TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted. + TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered. + TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting. + TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors. + TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface. + TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver. + TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver. +} + +// NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys +// are interface names. +type NetDev map[string]NetDevLine + +// NetDev returns kernel/system statistics read from /proc/net/dev. +func (fs FS) NetDev() (NetDev, error) { + return newNetDev(fs.proc.Path("net/dev")) +} + +// NetDev returns kernel/system statistics read from /proc/[pid]/net/dev. +func (p Proc) NetDev() (NetDev, error) { + return newNetDev(p.path("net/dev")) +} + +// newNetDev creates a new NetDev from the contents of the given file. +func newNetDev(file string) (NetDev, error) { + f, err := os.Open(file) + if err != nil { + return NetDev{}, err + } + defer f.Close() + + netDev := NetDev{} + s := bufio.NewScanner(f) + for n := 0; s.Scan(); n++ { + // Skip the 2 header lines. + if n < 2 { + continue + } + + line, err := netDev.parseLine(s.Text()) + if err != nil { + return netDev, err + } + + netDev[line.Name] = *line + } + + return netDev, s.Err() +} + +// parseLine parses a single line from the /proc/net/dev file. Header lines +// must be filtered prior to calling this method. +func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) { + parts := strings.SplitN(rawLine, ":", 2) + if len(parts) != 2 { + return nil, errors.New("invalid net/dev line, missing colon") + } + fields := strings.Fields(strings.TrimSpace(parts[1])) + + var err error + line := &NetDevLine{} + + // Interface Name + line.Name = strings.TrimSpace(parts[0]) + if line.Name == "" { + return nil, errors.New("invalid net/dev line, empty interface name") + } + + // RX + line.RxBytes, err = strconv.ParseUint(fields[0], 10, 64) + if err != nil { + return nil, err + } + line.RxPackets, err = strconv.ParseUint(fields[1], 10, 64) + if err != nil { + return nil, err + } + line.RxErrors, err = strconv.ParseUint(fields[2], 10, 64) + if err != nil { + return nil, err + } + line.RxDropped, err = strconv.ParseUint(fields[3], 10, 64) + if err != nil { + return nil, err + } + line.RxFIFO, err = strconv.ParseUint(fields[4], 10, 64) + if err != nil { + return nil, err + } + line.RxFrame, err = strconv.ParseUint(fields[5], 10, 64) + if err != nil { + return nil, err + } + line.RxCompressed, err = strconv.ParseUint(fields[6], 10, 64) + if err != nil { + return nil, err + } + line.RxMulticast, err = strconv.ParseUint(fields[7], 10, 64) + if err != nil { + return nil, err + } + + // TX + line.TxBytes, err = strconv.ParseUint(fields[8], 10, 64) + if err != nil { + return nil, err + } + line.TxPackets, err = strconv.ParseUint(fields[9], 10, 64) + if err != nil { + return nil, err + } + line.TxErrors, err = strconv.ParseUint(fields[10], 10, 64) + if err != nil { + return nil, err + } + line.TxDropped, err = strconv.ParseUint(fields[11], 10, 64) + if err != nil { + return nil, err + } + line.TxFIFO, err = strconv.ParseUint(fields[12], 10, 64) + if err != nil { + return nil, err + } + line.TxCollisions, err = strconv.ParseUint(fields[13], 10, 64) + if err != nil { + return nil, err + } + line.TxCarrier, err = strconv.ParseUint(fields[14], 10, 64) + if err != nil { + return nil, err + } + line.TxCompressed, err = strconv.ParseUint(fields[15], 10, 64) + if err != nil { + return nil, err + } + + return line, nil +} + +// Total aggregates the values across interfaces and returns a new NetDevLine. +// The Name field will be a sorted comma separated list of interface names. +func (netDev NetDev) Total() NetDevLine { + total := NetDevLine{} + + names := make([]string, 0, len(netDev)) + for _, ifc := range netDev { + names = append(names, ifc.Name) + total.RxBytes += ifc.RxBytes + total.RxPackets += ifc.RxPackets + total.RxPackets += ifc.RxPackets + total.RxErrors += ifc.RxErrors + total.RxDropped += ifc.RxDropped + total.RxFIFO += ifc.RxFIFO + total.RxFrame += ifc.RxFrame + total.RxCompressed += ifc.RxCompressed + total.RxMulticast += ifc.RxMulticast + total.TxBytes += ifc.TxBytes + total.TxPackets += ifc.TxPackets + total.TxErrors += ifc.TxErrors + total.TxDropped += ifc.TxDropped + total.TxFIFO += ifc.TxFIFO + total.TxCollisions += ifc.TxCollisions + total.TxCarrier += ifc.TxCarrier + total.TxCompressed += ifc.TxCompressed + } + sort.Strings(names) + total.Name = strings.Join(names, ", ") + + return total +} diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go new file mode 100644 index 000000000..240340a83 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_unix.go @@ -0,0 +1,275 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "errors" + "fmt" + "io" + "os" + "strconv" + "strings" +) + +// For the proc file format details, +// see https://elixir.bootlin.com/linux/v4.17/source/net/unix/af_unix.c#L2815 +// and https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h#L48. + +const ( + netUnixKernelPtrIdx = iota + netUnixRefCountIdx + _ + netUnixFlagsIdx + netUnixTypeIdx + netUnixStateIdx + netUnixInodeIdx + + // Inode and Path are optional. + netUnixStaticFieldsCnt = 6 +) + +const ( + netUnixTypeStream = 1 + netUnixTypeDgram = 2 + netUnixTypeSeqpacket = 5 + + netUnixFlagListen = 1 << 16 + + netUnixStateUnconnected = 1 + netUnixStateConnecting = 2 + netUnixStateConnected = 3 + netUnixStateDisconnected = 4 +) + +var errInvalidKernelPtrFmt = errors.New("Invalid Num(the kernel table slot number) format") + +// NetUnixType is the type of the type field. +type NetUnixType uint64 + +// NetUnixFlags is the type of the flags field. +type NetUnixFlags uint64 + +// NetUnixState is the type of the state field. +type NetUnixState uint64 + +// NetUnixLine represents a line of /proc/net/unix. +type NetUnixLine struct { + KernelPtr string + RefCount uint64 + Protocol uint64 + Flags NetUnixFlags + Type NetUnixType + State NetUnixState + Inode uint64 + Path string +} + +// NetUnix holds the data read from /proc/net/unix. +type NetUnix struct { + Rows []*NetUnixLine +} + +// NewNetUnix returns data read from /proc/net/unix. +func NewNetUnix() (*NetUnix, error) { + fs, err := NewFS(DefaultMountPoint) + if err != nil { + return nil, err + } + + return fs.NewNetUnix() +} + +// NewNetUnix returns data read from /proc/net/unix. +func (fs FS) NewNetUnix() (*NetUnix, error) { + return NewNetUnixByPath(fs.proc.Path("net/unix")) +} + +// NewNetUnixByPath returns data read from /proc/net/unix by file path. +// It might returns an error with partial parsed data, if an error occur after some data parsed. +func NewNetUnixByPath(path string) (*NetUnix, error) { + f, err := os.Open(path) + if err != nil { + return nil, err + } + defer f.Close() + return NewNetUnixByReader(f) +} + +// NewNetUnixByReader returns data read from /proc/net/unix by a reader. +// It might returns an error with partial parsed data, if an error occur after some data parsed. +func NewNetUnixByReader(reader io.Reader) (*NetUnix, error) { + nu := &NetUnix{ + Rows: make([]*NetUnixLine, 0, 32), + } + scanner := bufio.NewScanner(reader) + // Omit the header line. + scanner.Scan() + header := scanner.Text() + // From the man page of proc(5), it does not contain an Inode field, + // but in actually it exists. + // This code works for both cases. + hasInode := strings.Contains(header, "Inode") + + minFieldsCnt := netUnixStaticFieldsCnt + if hasInode { + minFieldsCnt++ + } + for scanner.Scan() { + line := scanner.Text() + item, err := nu.parseLine(line, hasInode, minFieldsCnt) + if err != nil { + return nu, err + } + nu.Rows = append(nu.Rows, item) + } + + return nu, scanner.Err() +} + +func (u *NetUnix) parseLine(line string, hasInode bool, minFieldsCnt int) (*NetUnixLine, error) { + fields := strings.Fields(line) + fieldsLen := len(fields) + if fieldsLen < minFieldsCnt { + return nil, fmt.Errorf( + "Parse Unix domain failed: expect at least %d fields but got %d", + minFieldsCnt, fieldsLen) + } + kernelPtr, err := u.parseKernelPtr(fields[netUnixKernelPtrIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain num(%s) failed: %s", fields[netUnixKernelPtrIdx], err) + } + users, err := u.parseUsers(fields[netUnixRefCountIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain ref count(%s) failed: %s", fields[netUnixRefCountIdx], err) + } + flags, err := u.parseFlags(fields[netUnixFlagsIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain flags(%s) failed: %s", fields[netUnixFlagsIdx], err) + } + typ, err := u.parseType(fields[netUnixTypeIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain type(%s) failed: %s", fields[netUnixTypeIdx], err) + } + state, err := u.parseState(fields[netUnixStateIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain state(%s) failed: %s", fields[netUnixStateIdx], err) + } + var inode uint64 + if hasInode { + inodeStr := fields[netUnixInodeIdx] + inode, err = u.parseInode(inodeStr) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain inode(%s) failed: %s", inodeStr, err) + } + } + + nuLine := &NetUnixLine{ + KernelPtr: kernelPtr, + RefCount: users, + Type: typ, + Flags: flags, + State: state, + Inode: inode, + } + + // Path field is optional. + if fieldsLen > minFieldsCnt { + pathIdx := netUnixInodeIdx + 1 + if !hasInode { + pathIdx-- + } + nuLine.Path = fields[pathIdx] + } + + return nuLine, nil +} + +func (u NetUnix) parseKernelPtr(str string) (string, error) { + if !strings.HasSuffix(str, ":") { + return "", errInvalidKernelPtrFmt + } + return str[:len(str)-1], nil +} + +func (u NetUnix) parseUsers(hexStr string) (uint64, error) { + return strconv.ParseUint(hexStr, 16, 32) +} + +func (u NetUnix) parseProtocol(hexStr string) (uint64, error) { + return strconv.ParseUint(hexStr, 16, 32) +} + +func (u NetUnix) parseType(hexStr string) (NetUnixType, error) { + typ, err := strconv.ParseUint(hexStr, 16, 16) + if err != nil { + return 0, err + } + return NetUnixType(typ), nil +} + +func (u NetUnix) parseFlags(hexStr string) (NetUnixFlags, error) { + flags, err := strconv.ParseUint(hexStr, 16, 32) + if err != nil { + return 0, err + } + return NetUnixFlags(flags), nil +} + +func (u NetUnix) parseState(hexStr string) (NetUnixState, error) { + st, err := strconv.ParseInt(hexStr, 16, 8) + if err != nil { + return 0, err + } + return NetUnixState(st), nil +} + +func (u NetUnix) parseInode(inodeStr string) (uint64, error) { + return strconv.ParseUint(inodeStr, 10, 64) +} + +func (t NetUnixType) String() string { + switch t { + case netUnixTypeStream: + return "stream" + case netUnixTypeDgram: + return "dgram" + case netUnixTypeSeqpacket: + return "seqpacket" + } + return "unknown" +} + +func (f NetUnixFlags) String() string { + switch f { + case netUnixFlagListen: + return "listen" + default: + return "default" + } +} + +func (s NetUnixState) String() string { + switch s { + case netUnixStateUnconnected: + return "unconnected" + case netUnixStateConnecting: + return "connecting" + case netUnixStateConnected: + return "connected" + case netUnixStateDisconnected: + return "disconnected" + } + return "unknown" +} diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index 8717e1fe0..41c148d06 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go @@ -1,11 +1,27 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( + "bytes" "fmt" "io/ioutil" "os" "strconv" "strings" + + "github.com/prometheus/procfs/internal/fs" ) // Proc provides information about a running process. @@ -13,7 +29,7 @@ type Proc struct { // The process ID. PID int - fs FS + fs fs.FS } // Procs represents a list of Proc structs. @@ -38,7 +54,7 @@ func NewProc(pid int) (Proc, error) { if err != nil { return Proc{}, err } - return fs.NewProc(pid) + return fs.Proc(pid) } // AllProcs returns a list of all currently available processes under /proc. @@ -52,28 +68,35 @@ func AllProcs() (Procs, error) { // Self returns a process for the current process. func (fs FS) Self() (Proc, error) { - p, err := os.Readlink(fs.Path("self")) + p, err := os.Readlink(fs.proc.Path("self")) if err != nil { return Proc{}, err } - pid, err := strconv.Atoi(strings.Replace(p, string(fs), "", -1)) + pid, err := strconv.Atoi(strings.Replace(p, string(fs.proc), "", -1)) if err != nil { return Proc{}, err } - return fs.NewProc(pid) + return fs.Proc(pid) } // NewProc returns a process for the given pid. +// +// Deprecated: use fs.Proc() instead func (fs FS) NewProc(pid int) (Proc, error) { - if _, err := os.Stat(fs.Path(strconv.Itoa(pid))); err != nil { + return fs.Proc(pid) +} + +// Proc returns a process for the given pid. +func (fs FS) Proc(pid int) (Proc, error) { + if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil { return Proc{}, err } - return Proc{PID: pid, fs: fs}, nil + return Proc{PID: pid, fs: fs.proc}, nil } // AllProcs returns a list of all currently available processes. func (fs FS) AllProcs() (Procs, error) { - d, err := os.Open(fs.Path()) + d, err := os.Open(fs.proc.Path()) if err != nil { return Procs{}, err } @@ -90,7 +113,7 @@ func (fs FS) AllProcs() (Procs, error) { if err != nil { continue } - p = append(p, Proc{PID: int(pid), fs: fs}) + p = append(p, Proc{PID: int(pid), fs: fs.proc}) } return p, nil @@ -113,7 +136,7 @@ func (p Proc) CmdLine() ([]string, error) { return []string{}, nil } - return strings.Split(string(data[:len(data)-1]), string(byte(0))), nil + return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil } // Comm returns the command name of a process. @@ -142,6 +165,26 @@ func (p Proc) Executable() (string, error) { return exe, err } +// Cwd returns the absolute path to the current working directory of the process. +func (p Proc) Cwd() (string, error) { + wd, err := os.Readlink(p.path("cwd")) + if os.IsNotExist(err) { + return "", nil + } + + return wd, err +} + +// RootDir returns the absolute path to the process's root directory (as set by chroot) +func (p Proc) RootDir() (string, error) { + rdir, err := os.Readlink(p.path("root")) + if os.IsNotExist(err) { + return "", nil + } + + return rdir, err +} + // FileDescriptors returns the currently open file descriptors of a process. func (p Proc) FileDescriptors() ([]uintptr, error) { names, err := p.fileDescriptors() @@ -204,6 +247,20 @@ func (p Proc) MountStats() ([]*Mount, error) { return parseMountStats(f) } +// MountInfo retrieves mount information for mount points in a +// process's namespace. +// It supplies information missing in `/proc/self/mounts` and +// fixes various other problems with that file too. +func (p Proc) MountInfo() ([]*MountInfo, error) { + f, err := os.Open(p.path("mountinfo")) + if err != nil { + return nil, err + } + defer f.Close() + + return parseMountInfo(f) +} + func (p Proc) fileDescriptors() ([]string, error) { d, err := os.Open(p.path("fd")) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go new file mode 100644 index 000000000..7172bb586 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_environ.go @@ -0,0 +1,43 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "io/ioutil" + "os" + "strings" +) + +// Environ reads process environments from /proc//environ +func (p Proc) Environ() ([]string, error) { + environments := make([]string, 0) + + f, err := os.Open(p.path("environ")) + if err != nil { + return environments, err + } + defer f.Close() + + data, err := ioutil.ReadAll(f) + if err != nil { + return environments, err + } + + environments = strings.Split(string(data), "\000") + if len(environments) > 0 { + environments = environments[:len(environments)-1] + } + + return environments, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go index b4e31d7ba..0ff89b1ce 100644 --- a/vendor/github.com/prometheus/procfs/proc_io.go +++ b/vendor/github.com/prometheus/procfs/proc_io.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( @@ -26,8 +39,8 @@ type ProcIO struct { CancelledWriteBytes int64 } -// NewIO creates a new ProcIO instance from a given Proc instance. -func (p Proc) NewIO() (ProcIO, error) { +// IO creates a new ProcIO instance from a given Proc instance. +func (p Proc) IO() (ProcIO, error) { pio := ProcIO{} f, err := os.Open(p.path("io")) @@ -47,9 +60,6 @@ func (p Proc) NewIO() (ProcIO, error) { _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR, &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes) - if err != nil { - return pio, err - } - return pio, nil + return pio, err } diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go index 2df997ce1..91ee24df8 100644 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ b/vendor/github.com/prometheus/procfs/proc_limits.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( @@ -13,46 +26,46 @@ import ( // http://man7.org/linux/man-pages/man2/getrlimit.2.html. type ProcLimits struct { // CPU time limit in seconds. - CPUTime int + CPUTime int64 // Maximum size of files that the process may create. - FileSize int + FileSize int64 // Maximum size of the process's data segment (initialized data, // uninitialized data, and heap). - DataSize int + DataSize int64 // Maximum size of the process stack in bytes. - StackSize int + StackSize int64 // Maximum size of a core file. - CoreFileSize int + CoreFileSize int64 // Limit of the process's resident set in pages. - ResidentSet int + ResidentSet int64 // Maximum number of processes that can be created for the real user ID of // the calling process. - Processes int + Processes int64 // Value one greater than the maximum file descriptor number that can be // opened by this process. - OpenFiles int + OpenFiles int64 // Maximum number of bytes of memory that may be locked into RAM. - LockedMemory int + LockedMemory int64 // Maximum size of the process's virtual memory address space in bytes. - AddressSpace int + AddressSpace int64 // Limit on the combined number of flock(2) locks and fcntl(2) leases that // this process may establish. - FileLocks int + FileLocks int64 // Limit of signals that may be queued for the real user ID of the calling // process. - PendingSignals int + PendingSignals int64 // Limit on the number of bytes that can be allocated for POSIX message // queues for the real user ID of the calling process. - MsqqueueSize int + MsqqueueSize int64 // Limit of the nice priority set using setpriority(2) or nice(2). - NicePriority int + NicePriority int64 // Limit of the real-time priority set using sched_setscheduler(2) or // sched_setparam(2). - RealtimePriority int + RealtimePriority int64 // Limit (in microseconds) on the amount of CPU time that a process // scheduled under a real-time scheduling policy may consume without making // a blocking system call. - RealtimeTimeout int + RealtimeTimeout int64 } const ( @@ -65,7 +78,14 @@ var ( ) // NewLimits returns the current soft limits of the process. +// +// Deprecated: use p.Limits() instead func (p Proc) NewLimits() (ProcLimits, error) { + return p.Limits() +} + +// Limits returns the current soft limits of the process. +func (p Proc) Limits() (ProcLimits, error) { f, err := os.Open(p.path("limits")) if err != nil { return ProcLimits{}, err @@ -125,13 +145,13 @@ func (p Proc) NewLimits() (ProcLimits, error) { return l, s.Err() } -func parseInt(s string) (int, error) { +func parseInt(s string) (int64, error) { if s == limitsUnlimited { return -1, nil } - i, err := strconv.ParseInt(s, 10, 32) + i, err := strconv.ParseInt(s, 10, 64) if err != nil { return 0, fmt.Errorf("couldn't parse value %s: %s", s, err) } - return int(i), nil + return i, nil } diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go new file mode 100644 index 000000000..c66740ff7 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_ns.go @@ -0,0 +1,68 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "fmt" + "os" + "strconv" + "strings" +) + +// Namespace represents a single namespace of a process. +type Namespace struct { + Type string // Namespace type. + Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match. +} + +// Namespaces contains all of the namespaces that the process is contained in. +type Namespaces map[string]Namespace + +// Namespaces reads from /proc//ns/* to get the namespaces of which the +// process is a member. +func (p Proc) Namespaces() (Namespaces, error) { + d, err := os.Open(p.path("ns")) + if err != nil { + return nil, err + } + defer d.Close() + + names, err := d.Readdirnames(-1) + if err != nil { + return nil, fmt.Errorf("failed to read contents of ns dir: %v", err) + } + + ns := make(Namespaces, len(names)) + for _, name := range names { + target, err := os.Readlink(p.path("ns", name)) + if err != nil { + return nil, err + } + + fields := strings.SplitN(target, ":", 2) + if len(fields) != 2 { + return nil, fmt.Errorf("failed to parse namespace type and inode from '%v'", target) + } + + typ := fields[0] + inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32) + if err != nil { + return nil, fmt.Errorf("failed to parse inode from '%v': %v", fields[1], err) + } + + ns[name] = Namespace{typ, uint32(inode)} + } + + return ns, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go new file mode 100644 index 000000000..46fe26626 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_psi.go @@ -0,0 +1,101 @@ +// Copyright 2019 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +// The PSI / pressure interface is described at +// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/accounting/psi.txt +// Each resource (cpu, io, memory, ...) is exposed as a single file. +// Each file may contain up to two lines, one for "some" pressure and one for "full" pressure. +// Each line contains several averages (over n seconds) and a total in µs. +// +// Example io pressure file: +// > some avg10=0.06 avg60=0.21 avg300=0.99 total=8537362 +// > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134 + +import ( + "fmt" + "io" + "io/ioutil" + "os" + "strings" +) + +const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d" + +// PSILine is a single line of values as returned by /proc/pressure/* +// The Avg entries are averages over n seconds, as a percentage +// The Total line is in microseconds +type PSILine struct { + Avg10 float64 + Avg60 float64 + Avg300 float64 + Total uint64 +} + +// PSIStats represent pressure stall information from /proc/pressure/* +// Some indicates the share of time in which at least some tasks are stalled +// Full indicates the share of time in which all non-idle tasks are stalled simultaneously +type PSIStats struct { + Some *PSILine + Full *PSILine +} + +// PSIStatsForResource reads pressure stall information for the specified +// resource from /proc/pressure/. At time of writing this can be +// either "cpu", "memory" or "io". +func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { + file, err := os.Open(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) + if err != nil { + return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) + } + + defer file.Close() + return parsePSIStats(resource, file) +} + +// parsePSIStats parses the specified file for pressure stall information +func parsePSIStats(resource string, file io.Reader) (PSIStats, error) { + psiStats := PSIStats{} + stats, err := ioutil.ReadAll(file) + if err != nil { + return psiStats, fmt.Errorf("psi_stats: unable to read data for %s", resource) + } + + for _, l := range strings.Split(string(stats), "\n") { + prefix := strings.Split(l, " ")[0] + switch prefix { + case "some": + psi := PSILine{} + _, err := fmt.Sscanf(l, fmt.Sprintf("some %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total) + if err != nil { + return PSIStats{}, err + } + psiStats.Some = &psi + case "full": + psi := PSILine{} + _, err := fmt.Sscanf(l, fmt.Sprintf("full %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total) + if err != nil { + return PSIStats{}, err + } + psiStats.Full = &psi + default: + // If we encounter a line with an unknown prefix, ignore it and move on + // Should new measurement types be added in the future we'll simply ignore them instead + // of erroring on retrieval + continue + } + } + + return psiStats, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index 724e271b9..dbde1fa0d 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go @@ -1,3 +1,16 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( @@ -5,6 +18,8 @@ import ( "fmt" "io/ioutil" "os" + + "github.com/prometheus/procfs/internal/fs" ) // Originally, this USER_HZ value was dynamically retrieved via a sysconf call @@ -82,15 +97,22 @@ type ProcStat struct { // in clock ticks. Starttime uint64 // Virtual memory size in bytes. - VSize int + VSize uint // Resident set size in pages. RSS int - fs FS + proc fs.FS } // NewStat returns the current status information of the process. +// +// Deprecated: use p.Stat() instead func (p Proc) NewStat() (ProcStat, error) { + return p.Stat() +} + +// Stat returns the current status information of the process. +func (p Proc) Stat() (ProcStat, error) { f, err := os.Open(p.path("stat")) if err != nil { return ProcStat{}, err @@ -105,7 +127,7 @@ func (p Proc) NewStat() (ProcStat, error) { var ( ignore int - s = ProcStat{PID: p.PID, fs: p.fs} + s = ProcStat{PID: p.PID, proc: p.fs} l = bytes.Index(data, []byte("(")) r = bytes.LastIndex(data, []byte(")")) ) @@ -151,7 +173,7 @@ func (p Proc) NewStat() (ProcStat, error) { } // VirtualMemory returns the virtual memory size in bytes. -func (s ProcStat) VirtualMemory() int { +func (s ProcStat) VirtualMemory() uint { return s.VSize } @@ -162,7 +184,8 @@ func (s ProcStat) ResidentMemory() int { // StartTime returns the unix timestamp of the process in seconds. func (s ProcStat) StartTime() (float64, error) { - stat, err := s.fs.NewStat() + fs := FS{proc: s.proc} + stat, err := fs.Stat() if err != nil { return 0, err } diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go new file mode 100644 index 000000000..6b4b61f71 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_status.go @@ -0,0 +1,162 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bytes" + "io/ioutil" + "os" + "strconv" + "strings" +) + +// ProcStat provides status information about the process, +// read from /proc/[pid]/stat. +type ProcStatus struct { + // The process ID. + PID int + // The process name. + Name string + + // Peak virtual memory size. + VmPeak uint64 + // Virtual memory size. + VmSize uint64 + // Locked memory size. + VmLck uint64 + // Pinned memory size. + VmPin uint64 + // Peak resident set size. + VmHWM uint64 + // Resident set size (sum of RssAnnon RssFile and RssShmem). + VmRSS uint64 + // Size of resident anonymous memory. + RssAnon uint64 + // Size of resident file mappings. + RssFile uint64 + // Size of resident shared memory. + RssShmem uint64 + // Size of data segments. + VmData uint64 + // Size of stack segments. + VmStk uint64 + // Size of text segments. + VmExe uint64 + // Shared library code size. + VmLib uint64 + // Page table entries size. + VmPTE uint64 + // Size of second-level page tables. + VmPMD uint64 + // Swapped-out virtual memory size by anonymous private. + VmSwap uint64 + // Size of hugetlb memory portions + HugetlbPages uint64 + + // Number of voluntary context switches. + VoluntaryCtxtSwitches uint64 + // Number of involuntary context switches. + NonVoluntaryCtxtSwitches uint64 +} + +// NewStatus returns the current status information of the process. +func (p Proc) NewStatus() (ProcStatus, error) { + f, err := os.Open(p.path("status")) + if err != nil { + return ProcStatus{}, err + } + defer f.Close() + + data, err := ioutil.ReadAll(f) + if err != nil { + return ProcStatus{}, err + } + + s := ProcStatus{PID: p.PID} + + lines := strings.Split(string(data), "\n") + for _, line := range lines { + if !bytes.Contains([]byte(line), []byte(":")) { + continue + } + + kv := strings.SplitN(line, ":", 2) + + // removes spaces + k := string(strings.TrimSpace(kv[0])) + v := string(strings.TrimSpace(kv[1])) + // removes "kB" + v = string(bytes.Trim([]byte(v), " kB")) + + // value to int when possible + // we can skip error check here, 'cause vKBytes is not used when value is a string + vKBytes, _ := strconv.ParseUint(v, 10, 64) + // convert kB to B + vBytes := vKBytes * 1024 + + s.fillStatus(k, v, vKBytes, vBytes) + } + + return s, nil +} + +func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) { + switch k { + case "Name": + s.Name = vString + case "VmPeak": + s.VmPeak = vUintBytes + case "VmSize": + s.VmSize = vUintBytes + case "VmLck": + s.VmLck = vUintBytes + case "VmPin": + s.VmPin = vUintBytes + case "VmHWM": + s.VmHWM = vUintBytes + case "VmRSS": + s.VmRSS = vUintBytes + case "RssAnon": + s.RssAnon = vUintBytes + case "RssFile": + s.RssFile = vUintBytes + case "RssShmem": + s.RssShmem = vUintBytes + case "VmData": + s.VmData = vUintBytes + case "VmStk": + s.VmStk = vUintBytes + case "VmExe": + s.VmExe = vUintBytes + case "VmLib": + s.VmLib = vUintBytes + case "VmPTE": + s.VmPTE = vUintBytes + case "VmPMD": + s.VmPMD = vUintBytes + case "VmSwap": + s.VmSwap = vUintBytes + case "HugetlbPages": + s.HugetlbPages = vUintBytes + case "voluntary_ctxt_switches": + s.VoluntaryCtxtSwitches = vUint + case "nonvoluntary_ctxt_switches": + s.NonVoluntaryCtxtSwitches = vUint + } +} + +// TotalCtxtSwitches returns the total context switch. +func (s ProcStatus) TotalCtxtSwitches() uint64 { + return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches +} diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index 1ca217e8c..6661ee03a 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go @@ -1,56 +1,244 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package procfs import ( "bufio" "fmt" + "io" "os" "strconv" "strings" + + "github.com/prometheus/procfs/internal/fs" ) +// CPUStat shows how much time the cpu spend in various stages. +type CPUStat struct { + User float64 + Nice float64 + System float64 + Idle float64 + Iowait float64 + IRQ float64 + SoftIRQ float64 + Steal float64 + Guest float64 + GuestNice float64 +} + +// SoftIRQStat represent the softirq statistics as exported in the procfs stat file. +// A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html +// It is possible to get per-cpu stats by reading /proc/softirqs +type SoftIRQStat struct { + Hi uint64 + Timer uint64 + NetTx uint64 + NetRx uint64 + Block uint64 + BlockIoPoll uint64 + Tasklet uint64 + Sched uint64 + Hrtimer uint64 + Rcu uint64 +} + // Stat represents kernel/system statistics. type Stat struct { // Boot time in seconds since the Epoch. - BootTime int64 + BootTime uint64 + // Summed up cpu statistics. + CPUTotal CPUStat + // Per-CPU statistics. + CPU []CPUStat + // Number of times interrupts were handled, which contains numbered and unnumbered IRQs. + IRQTotal uint64 + // Number of times a numbered IRQ was triggered. + IRQ []uint64 + // Number of times a context switch happened. + ContextSwitches uint64 + // Number of times a process was created. + ProcessCreated uint64 + // Number of processes currently running. + ProcessesRunning uint64 + // Number of processes currently blocked (waiting for IO). + ProcessesBlocked uint64 + // Number of times a softirq was scheduled. + SoftIRQTotal uint64 + // Detailed softirq statistics. + SoftIRQ SoftIRQStat } -// NewStat returns kernel/system statistics read from /proc/stat. +// Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum). +func parseCPUStat(line string) (CPUStat, int64, error) { + cpuStat := CPUStat{} + var cpu string + + count, err := fmt.Sscanf(line, "%s %f %f %f %f %f %f %f %f %f %f", + &cpu, + &cpuStat.User, &cpuStat.Nice, &cpuStat.System, &cpuStat.Idle, + &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal, + &cpuStat.Guest, &cpuStat.GuestNice) + + if err != nil && err != io.EOF { + return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): %s", line, err) + } + if count == 0 { + return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu): 0 elements parsed", line) + } + + cpuStat.User /= userHZ + cpuStat.Nice /= userHZ + cpuStat.System /= userHZ + cpuStat.Idle /= userHZ + cpuStat.Iowait /= userHZ + cpuStat.IRQ /= userHZ + cpuStat.SoftIRQ /= userHZ + cpuStat.Steal /= userHZ + cpuStat.Guest /= userHZ + cpuStat.GuestNice /= userHZ + + if cpu == "cpu" { + return cpuStat, -1, nil + } + + cpuID, err := strconv.ParseInt(cpu[3:], 10, 64) + if err != nil { + return CPUStat{}, -1, fmt.Errorf("couldn't parse %s (cpu/cpuid): %s", line, err) + } + + return cpuStat, cpuID, nil +} + +// Parse a softirq line. +func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { + softIRQStat := SoftIRQStat{} + var total uint64 + var prefix string + + _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d", + &prefix, &total, + &softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx, + &softIRQStat.Block, &softIRQStat.BlockIoPoll, + &softIRQStat.Tasklet, &softIRQStat.Sched, + &softIRQStat.Hrtimer, &softIRQStat.Rcu) + + if err != nil { + return SoftIRQStat{}, 0, fmt.Errorf("couldn't parse %s (softirq): %s", line, err) + } + + return softIRQStat, total, nil +} + +// NewStat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// +// Deprecated: use fs.Stat() instead func NewStat() (Stat, error) { - fs, err := NewFS(DefaultMountPoint) + fs, err := NewFS(fs.DefaultProcMountPoint) if err != nil { return Stat{}, err } - - return fs.NewStat() + return fs.Stat() } -// NewStat returns an information about current kernel/system statistics. +// NewStat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// +// Deprecated: use fs.Stat() instead func (fs FS) NewStat() (Stat, error) { - f, err := os.Open(fs.Path("stat")) + return fs.Stat() +} + +// Stat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +func (fs FS) Stat() (Stat, error) { + + f, err := os.Open(fs.proc.Path("stat")) if err != nil { return Stat{}, err } defer f.Close() - s := bufio.NewScanner(f) - for s.Scan() { - line := s.Text() - if !strings.HasPrefix(line, "btime") { + stat := Stat{} + + scanner := bufio.NewScanner(f) + for scanner.Scan() { + line := scanner.Text() + parts := strings.Fields(scanner.Text()) + // require at least + if len(parts) < 2 { continue } - fields := strings.Fields(line) - if len(fields) != 2 { - return Stat{}, fmt.Errorf("couldn't parse %s line %s", f.Name(), line) + switch { + case parts[0] == "btime": + if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (btime): %s", parts[1], err) + } + case parts[0] == "intr": + if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (intr): %s", parts[1], err) + } + numberedIRQs := parts[2:] + stat.IRQ = make([]uint64, len(numberedIRQs)) + for i, count := range numberedIRQs { + if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (intr%d): %s", count, i, err) + } + } + case parts[0] == "ctxt": + if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (ctxt): %s", parts[1], err) + } + case parts[0] == "processes": + if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (processes): %s", parts[1], err) + } + case parts[0] == "procs_running": + if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (procs_running): %s", parts[1], err) + } + case parts[0] == "procs_blocked": + if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil { + return Stat{}, fmt.Errorf("couldn't parse %s (procs_blocked): %s", parts[1], err) + } + case parts[0] == "softirq": + softIRQStats, total, err := parseSoftIRQStat(line) + if err != nil { + return Stat{}, err + } + stat.SoftIRQTotal = total + stat.SoftIRQ = softIRQStats + case strings.HasPrefix(parts[0], "cpu"): + cpuStat, cpuID, err := parseCPUStat(line) + if err != nil { + return Stat{}, err + } + if cpuID == -1 { + stat.CPUTotal = cpuStat + } else { + for int64(len(stat.CPU)) <= cpuID { + stat.CPU = append(stat.CPU, CPUStat{}) + } + stat.CPU[cpuID] = cpuStat + } } - i, err := strconv.ParseInt(fields[1], 10, 32) - if err != nil { - return Stat{}, fmt.Errorf("couldn't parse %s: %s", fields[1], err) - } - return Stat{BootTime: i}, nil } - if err := s.Err(); err != nil { + + if err := scanner.Err(); err != nil { return Stat{}, fmt.Errorf("couldn't parse %s: %s", f.Name(), err) } - return Stat{}, fmt.Errorf("couldn't parse %s, missing btime", f.Name()) + return stat, nil } diff --git a/vendor/github.com/prometheus/procfs/xfrm.go b/vendor/github.com/prometheus/procfs/xfrm.go new file mode 100644 index 000000000..30aa417d5 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/xfrm.go @@ -0,0 +1,187 @@ +// Copyright 2017 Prometheus Team +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package procfs + +import ( + "bufio" + "fmt" + "os" + "strconv" + "strings" +) + +// XfrmStat models the contents of /proc/net/xfrm_stat. +type XfrmStat struct { + // All errors which are not matched by other + XfrmInError int + // No buffer is left + XfrmInBufferError int + // Header Error + XfrmInHdrError int + // No state found + // i.e. either inbound SPI, address, or IPSEC protocol at SA is wrong + XfrmInNoStates int + // Transformation protocol specific error + // e.g. SA Key is wrong + XfrmInStateProtoError int + // Transformation mode specific error + XfrmInStateModeError int + // Sequence error + // e.g. sequence number is out of window + XfrmInStateSeqError int + // State is expired + XfrmInStateExpired int + // State has mismatch option + // e.g. UDP encapsulation type is mismatched + XfrmInStateMismatch int + // State is invalid + XfrmInStateInvalid int + // No matching template for states + // e.g. Inbound SAs are correct but SP rule is wrong + XfrmInTmplMismatch int + // No policy is found for states + // e.g. Inbound SAs are correct but no SP is found + XfrmInNoPols int + // Policy discards + XfrmInPolBlock int + // Policy error + XfrmInPolError int + // All errors which are not matched by others + XfrmOutError int + // Bundle generation error + XfrmOutBundleGenError int + // Bundle check error + XfrmOutBundleCheckError int + // No state was found + XfrmOutNoStates int + // Transformation protocol specific error + XfrmOutStateProtoError int + // Transportation mode specific error + XfrmOutStateModeError int + // Sequence error + // i.e sequence number overflow + XfrmOutStateSeqError int + // State is expired + XfrmOutStateExpired int + // Policy discads + XfrmOutPolBlock int + // Policy is dead + XfrmOutPolDead int + // Policy Error + XfrmOutPolError int + XfrmFwdHdrError int + XfrmOutStateInvalid int + XfrmAcquireError int +} + +// NewXfrmStat reads the xfrm_stat statistics. +func NewXfrmStat() (XfrmStat, error) { + fs, err := NewFS(DefaultMountPoint) + if err != nil { + return XfrmStat{}, err + } + + return fs.NewXfrmStat() +} + +// NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem. +func (fs FS) NewXfrmStat() (XfrmStat, error) { + file, err := os.Open(fs.proc.Path("net/xfrm_stat")) + if err != nil { + return XfrmStat{}, err + } + defer file.Close() + + var ( + x = XfrmStat{} + s = bufio.NewScanner(file) + ) + + for s.Scan() { + fields := strings.Fields(s.Text()) + + if len(fields) != 2 { + return XfrmStat{}, fmt.Errorf( + "couldn't parse %s line %s", file.Name(), s.Text()) + } + + name := fields[0] + value, err := strconv.Atoi(fields[1]) + if err != nil { + return XfrmStat{}, err + } + + switch name { + case "XfrmInError": + x.XfrmInError = value + case "XfrmInBufferError": + x.XfrmInBufferError = value + case "XfrmInHdrError": + x.XfrmInHdrError = value + case "XfrmInNoStates": + x.XfrmInNoStates = value + case "XfrmInStateProtoError": + x.XfrmInStateProtoError = value + case "XfrmInStateModeError": + x.XfrmInStateModeError = value + case "XfrmInStateSeqError": + x.XfrmInStateSeqError = value + case "XfrmInStateExpired": + x.XfrmInStateExpired = value + case "XfrmInStateInvalid": + x.XfrmInStateInvalid = value + case "XfrmInTmplMismatch": + x.XfrmInTmplMismatch = value + case "XfrmInNoPols": + x.XfrmInNoPols = value + case "XfrmInPolBlock": + x.XfrmInPolBlock = value + case "XfrmInPolError": + x.XfrmInPolError = value + case "XfrmOutError": + x.XfrmOutError = value + case "XfrmInStateMismatch": + x.XfrmInStateMismatch = value + case "XfrmOutBundleGenError": + x.XfrmOutBundleGenError = value + case "XfrmOutBundleCheckError": + x.XfrmOutBundleCheckError = value + case "XfrmOutNoStates": + x.XfrmOutNoStates = value + case "XfrmOutStateProtoError": + x.XfrmOutStateProtoError = value + case "XfrmOutStateModeError": + x.XfrmOutStateModeError = value + case "XfrmOutStateSeqError": + x.XfrmOutStateSeqError = value + case "XfrmOutStateExpired": + x.XfrmOutStateExpired = value + case "XfrmOutPolBlock": + x.XfrmOutPolBlock = value + case "XfrmOutPolDead": + x.XfrmOutPolDead = value + case "XfrmOutPolError": + x.XfrmOutPolError = value + case "XfrmFwdHdrError": + x.XfrmFwdHdrError = value + case "XfrmOutStateInvalid": + x.XfrmOutStateInvalid = value + case "XfrmAcquireError": + x.XfrmAcquireError = value + } + + } + + return x, s.Err() +} diff --git a/vendor/github.com/prometheus/procfs/xfs/parse.go b/vendor/github.com/prometheus/procfs/xfs/parse.go deleted file mode 100644 index d1285fa6c..000000000 --- a/vendor/github.com/prometheus/procfs/xfs/parse.go +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright 2017 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package xfs - -import ( - "bufio" - "fmt" - "io" - "log" - "strconv" - "strings" -) - -// ParseStats parses a Stats from an input io.Reader, using the format -// found in /proc/fs/xfs/stat. -func ParseStats(r io.Reader) (*Stats, error) { - const ( - // Fields parsed into stats structures. - fieldExtentAlloc = "extent_alloc" - fieldAbt = "abt" - fieldBlkMap = "blk_map" - fieldBmbt = "bmbt" - fieldDir = "dir" - fieldTrans = "trans" - fieldIg = "ig" - fieldLog = "log" - fieldRw = "rw" - fieldAttr = "attr" - fieldIcluster = "icluster" - fieldVnodes = "vnodes" - fieldBuf = "buf" - fieldXpc = "xpc" - - // Unimplemented at this time due to lack of documentation. - fieldPushAil = "push_ail" - fieldXstrat = "xstrat" - fieldAbtb2 = "abtb2" - fieldAbtc2 = "abtc2" - fieldBmbt2 = "bmbt2" - fieldIbt2 = "ibt2" - fieldFibt2 = "fibt2" - fieldQm = "qm" - fieldDebug = "debug" - ) - - var xfss Stats - - s := bufio.NewScanner(r) - for s.Scan() { - // Expect at least a string label and a single integer value, ex: - // - abt 0 - // - rw 1 2 - ss := strings.Fields(string(s.Bytes())) - if len(ss) < 2 { - continue - } - label := ss[0] - - // Extended precision counters are uint64 values. - if label == fieldXpc { - us, err := parseUint64s(ss[1:]) - if err != nil { - return nil, err - } - - xfss.ExtendedPrecision, err = extendedPrecisionStats(us) - if err != nil { - return nil, err - } - - continue - } - - // All other counters are uint32 values. - us, err := parseUint32s(ss[1:]) - if err != nil { - return nil, err - } - - switch label { - case fieldExtentAlloc: - xfss.ExtentAllocation, err = extentAllocationStats(us) - case fieldAbt: - xfss.AllocationBTree, err = btreeStats(us) - case fieldBlkMap: - xfss.BlockMapping, err = blockMappingStats(us) - case fieldBmbt: - xfss.BlockMapBTree, err = btreeStats(us) - case fieldDir: - xfss.DirectoryOperation, err = directoryOperationStats(us) - case fieldTrans: - xfss.Transaction, err = transactionStats(us) - case fieldIg: - xfss.InodeOperation, err = inodeOperationStats(us) - case fieldLog: - xfss.LogOperation, err = logOperationStats(us) - case fieldRw: - xfss.ReadWrite, err = readWriteStats(us) - case fieldAttr: - xfss.AttributeOperation, err = attributeOperationStats(us) - case fieldIcluster: - xfss.InodeClustering, err = inodeClusteringStats(us) - case fieldVnodes: - xfss.Vnode, err = vnodeStats(us) - case fieldBuf: - xfss.Buffer, err = bufferStats(us) - } - if err != nil { - return nil, err - } - } - - return &xfss, s.Err() -} - -// extentAllocationStats builds an ExtentAllocationStats from a slice of uint32s. -func extentAllocationStats(us []uint32) (ExtentAllocationStats, error) { - if l := len(us); l != 4 { - return ExtentAllocationStats{}, fmt.Errorf("incorrect number of values for XFS extent allocation stats: %d", l) - } - - return ExtentAllocationStats{ - ExtentsAllocated: us[0], - BlocksAllocated: us[1], - ExtentsFreed: us[2], - BlocksFreed: us[3], - }, nil -} - -// btreeStats builds a BTreeStats from a slice of uint32s. -func btreeStats(us []uint32) (BTreeStats, error) { - if l := len(us); l != 4 { - return BTreeStats{}, fmt.Errorf("incorrect number of values for XFS btree stats: %d", l) - } - - return BTreeStats{ - Lookups: us[0], - Compares: us[1], - RecordsInserted: us[2], - RecordsDeleted: us[3], - }, nil -} - -// BlockMappingStat builds a BlockMappingStats from a slice of uint32s. -func blockMappingStats(us []uint32) (BlockMappingStats, error) { - if l := len(us); l != 7 { - return BlockMappingStats{}, fmt.Errorf("incorrect number of values for XFS block mapping stats: %d", l) - } - - return BlockMappingStats{ - Reads: us[0], - Writes: us[1], - Unmaps: us[2], - ExtentListInsertions: us[3], - ExtentListDeletions: us[4], - ExtentListLookups: us[5], - ExtentListCompares: us[6], - }, nil -} - -// DirectoryOperationStats builds a DirectoryOperationStats from a slice of uint32s. -func directoryOperationStats(us []uint32) (DirectoryOperationStats, error) { - if l := len(us); l != 4 { - return DirectoryOperationStats{}, fmt.Errorf("incorrect number of values for XFS directory operation stats: %d", l) - } - - return DirectoryOperationStats{ - Lookups: us[0], - Creates: us[1], - Removes: us[2], - Getdents: us[3], - }, nil -} - -// TransactionStats builds a TransactionStats from a slice of uint32s. -func transactionStats(us []uint32) (TransactionStats, error) { - if l := len(us); l != 3 { - return TransactionStats{}, fmt.Errorf("incorrect number of values for XFS transaction stats: %d", l) - } - - return TransactionStats{ - Sync: us[0], - Async: us[1], - Empty: us[2], - }, nil -} - -// InodeOperationStats builds an InodeOperationStats from a slice of uint32s. -func inodeOperationStats(us []uint32) (InodeOperationStats, error) { - if l := len(us); l != 7 { - return InodeOperationStats{}, fmt.Errorf("incorrect number of values for XFS inode operation stats: %d", l) - } - - return InodeOperationStats{ - Attempts: us[0], - Found: us[1], - Recycle: us[2], - Missed: us[3], - Duplicate: us[4], - Reclaims: us[5], - AttributeChange: us[6], - }, nil -} - -// LogOperationStats builds a LogOperationStats from a slice of uint32s. -func logOperationStats(us []uint32) (LogOperationStats, error) { - if l := len(us); l != 5 { - return LogOperationStats{}, fmt.Errorf("incorrect number of values for XFS log operation stats: %d", l) - } - - return LogOperationStats{ - Writes: us[0], - Blocks: us[1], - NoInternalBuffers: us[2], - Force: us[3], - ForceSleep: us[4], - }, nil -} - -// ReadWriteStats builds a ReadWriteStats from a slice of uint32s. -func readWriteStats(us []uint32) (ReadWriteStats, error) { - if l := len(us); l != 2 { - return ReadWriteStats{}, fmt.Errorf("incorrect number of values for XFS read write stats: %d", l) - } - - return ReadWriteStats{ - Read: us[0], - Write: us[1], - }, nil -} - -// AttributeOperationStats builds an AttributeOperationStats from a slice of uint32s. -func attributeOperationStats(us []uint32) (AttributeOperationStats, error) { - if l := len(us); l != 4 { - return AttributeOperationStats{}, fmt.Errorf("incorrect number of values for XFS attribute operation stats: %d", l) - } - - return AttributeOperationStats{ - Get: us[0], - Set: us[1], - Remove: us[2], - List: us[3], - }, nil -} - -// InodeClusteringStats builds an InodeClusteringStats from a slice of uint32s. -func inodeClusteringStats(us []uint32) (InodeClusteringStats, error) { - if l := len(us); l != 3 { - return InodeClusteringStats{}, fmt.Errorf("incorrect number of values for XFS inode clustering stats: %d", l) - } - - return InodeClusteringStats{ - Iflush: us[0], - Flush: us[1], - FlushInode: us[2], - }, nil -} - -// VnodeStats builds a VnodeStats from a slice of uint32s. -func vnodeStats(us []uint32) (VnodeStats, error) { - // The attribute "Free" appears to not be available on older XFS - // stats versions. Therefore, 7 or 8 elements may appear in - // this slice. - l := len(us) - log.Println(l) - if l != 7 && l != 8 { - return VnodeStats{}, fmt.Errorf("incorrect number of values for XFS vnode stats: %d", l) - } - - s := VnodeStats{ - Active: us[0], - Allocate: us[1], - Get: us[2], - Hold: us[3], - Release: us[4], - Reclaim: us[5], - Remove: us[6], - } - - // Skip adding free, unless it is present. The zero value will - // be used in place of an actual count. - if l == 7 { - return s, nil - } - - s.Free = us[7] - return s, nil -} - -// BufferStats builds a BufferStats from a slice of uint32s. -func bufferStats(us []uint32) (BufferStats, error) { - if l := len(us); l != 9 { - return BufferStats{}, fmt.Errorf("incorrect number of values for XFS buffer stats: %d", l) - } - - return BufferStats{ - Get: us[0], - Create: us[1], - GetLocked: us[2], - GetLockedWaited: us[3], - BusyLocked: us[4], - MissLocked: us[5], - PageRetries: us[6], - PageFound: us[7], - GetRead: us[8], - }, nil -} - -// ExtendedPrecisionStats builds an ExtendedPrecisionStats from a slice of uint32s. -func extendedPrecisionStats(us []uint64) (ExtendedPrecisionStats, error) { - if l := len(us); l != 3 { - return ExtendedPrecisionStats{}, fmt.Errorf("incorrect number of values for XFS extended precision stats: %d", l) - } - - return ExtendedPrecisionStats{ - FlushBytes: us[0], - WriteBytes: us[1], - ReadBytes: us[2], - }, nil -} - -// parseUint32s parses a slice of strings into a slice of uint32s. -func parseUint32s(ss []string) ([]uint32, error) { - us := make([]uint32, 0, len(ss)) - for _, s := range ss { - u, err := strconv.ParseUint(s, 10, 32) - if err != nil { - return nil, err - } - - us = append(us, uint32(u)) - } - - return us, nil -} - -// parseUint64s parses a slice of strings into a slice of uint64s. -func parseUint64s(ss []string) ([]uint64, error) { - us := make([]uint64, 0, len(ss)) - for _, s := range ss { - u, err := strconv.ParseUint(s, 10, 64) - if err != nil { - return nil, err - } - - us = append(us, u) - } - - return us, nil -} diff --git a/vendor/github.com/prometheus/procfs/xfs/xfs.go b/vendor/github.com/prometheus/procfs/xfs/xfs.go deleted file mode 100644 index ed77d907a..000000000 --- a/vendor/github.com/prometheus/procfs/xfs/xfs.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2017 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package xfs provides access to statistics exposed by the XFS filesystem. -package xfs - -// Stats contains XFS filesystem runtime statistics, parsed from -// /proc/fs/xfs/stat. -// -// The names and meanings of each statistic were taken from -// http://xfs.org/index.php/Runtime_Stats and xfs_stats.h in the Linux -// kernel source. Most counters are uint32s (same data types used in -// xfs_stats.h), but some of the "extended precision stats" are uint64s. -type Stats struct { - ExtentAllocation ExtentAllocationStats - AllocationBTree BTreeStats - BlockMapping BlockMappingStats - BlockMapBTree BTreeStats - DirectoryOperation DirectoryOperationStats - Transaction TransactionStats - InodeOperation InodeOperationStats - LogOperation LogOperationStats - ReadWrite ReadWriteStats - AttributeOperation AttributeOperationStats - InodeClustering InodeClusteringStats - Vnode VnodeStats - Buffer BufferStats - ExtendedPrecision ExtendedPrecisionStats -} - -// ExtentAllocationStats contains statistics regarding XFS extent allocations. -type ExtentAllocationStats struct { - ExtentsAllocated uint32 - BlocksAllocated uint32 - ExtentsFreed uint32 - BlocksFreed uint32 -} - -// BTreeStats contains statistics regarding an XFS internal B-tree. -type BTreeStats struct { - Lookups uint32 - Compares uint32 - RecordsInserted uint32 - RecordsDeleted uint32 -} - -// BlockMappingStats contains statistics regarding XFS block maps. -type BlockMappingStats struct { - Reads uint32 - Writes uint32 - Unmaps uint32 - ExtentListInsertions uint32 - ExtentListDeletions uint32 - ExtentListLookups uint32 - ExtentListCompares uint32 -} - -// DirectoryOperationStats contains statistics regarding XFS directory entries. -type DirectoryOperationStats struct { - Lookups uint32 - Creates uint32 - Removes uint32 - Getdents uint32 -} - -// TransactionStats contains statistics regarding XFS metadata transactions. -type TransactionStats struct { - Sync uint32 - Async uint32 - Empty uint32 -} - -// InodeOperationStats contains statistics regarding XFS inode operations. -type InodeOperationStats struct { - Attempts uint32 - Found uint32 - Recycle uint32 - Missed uint32 - Duplicate uint32 - Reclaims uint32 - AttributeChange uint32 -} - -// LogOperationStats contains statistics regarding the XFS log buffer. -type LogOperationStats struct { - Writes uint32 - Blocks uint32 - NoInternalBuffers uint32 - Force uint32 - ForceSleep uint32 -} - -// ReadWriteStats contains statistics regarding the number of read and write -// system calls for XFS filesystems. -type ReadWriteStats struct { - Read uint32 - Write uint32 -} - -// AttributeOperationStats contains statistics regarding manipulation of -// XFS extended file attributes. -type AttributeOperationStats struct { - Get uint32 - Set uint32 - Remove uint32 - List uint32 -} - -// InodeClusteringStats contains statistics regarding XFS inode clustering -// operations. -type InodeClusteringStats struct { - Iflush uint32 - Flush uint32 - FlushInode uint32 -} - -// VnodeStats contains statistics regarding XFS vnode operations. -type VnodeStats struct { - Active uint32 - Allocate uint32 - Get uint32 - Hold uint32 - Release uint32 - Reclaim uint32 - Remove uint32 - Free uint32 -} - -// BufferStats contains statistics regarding XFS read/write I/O buffers. -type BufferStats struct { - Get uint32 - Create uint32 - GetLocked uint32 - GetLockedWaited uint32 - BusyLocked uint32 - MissLocked uint32 - PageRetries uint32 - PageFound uint32 - GetRead uint32 -} - -// ExtendedPrecisionStats contains high precision counters used to track the -// total number of bytes read, written, or flushed, during XFS operations. -type ExtendedPrecisionStats struct { - FlushBytes uint64 - WriteBytes uint64 - ReadBytes uint64 -} diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ddtrace.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ddtrace.go index 2a49bf6d0..9640beeb1 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ddtrace.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ddtrace.go @@ -119,3 +119,9 @@ type StartSpanConfig struct { // then this will also set the TraceID to the same value. SpanID uint64 } + +// Logger implementations are able to log given messages that the tracer might output. +type Logger interface { + // Log prints the given message. + Log(msg string) +} diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/errors.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/errors.go deleted file mode 100644 index 35c14c60a..000000000 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/errors.go +++ /dev/null @@ -1,69 +0,0 @@ -package tracer - -import ( - "fmt" - "log" - "strconv" -) - -var errorPrefix = fmt.Sprintf("Datadog Tracer Error (%s): ", tracerVersion) - -type traceEncodingError struct{ context error } - -func (e *traceEncodingError) Error() string { - return fmt.Sprintf("error encoding trace: %s", e.context) -} - -type spanBufferFullError struct{} - -func (e *spanBufferFullError) Error() string { - return fmt.Sprintf("trace span cap (%d) reached, dropping trace", traceMaxSize) -} - -type dataLossError struct { - count int // number of items lost - context error // any context error, if available -} - -func (e *dataLossError) Error() string { - return fmt.Sprintf("lost traces (count: %d), error: %v", e.count, e.context) -} - -type errorSummary struct { - Count int - Example string -} - -func aggregateErrors(errChan <-chan error) map[string]errorSummary { - errs := make(map[string]errorSummary, len(errChan)) - for { - select { - case err := <-errChan: - if err == nil { - break - } - key := fmt.Sprintf("%T", err) - summary := errs[key] - summary.Count++ - summary.Example = err.Error() - errs[key] = summary - default: // stop when there's no more data - return errs - } - } -} - -// logErrors logs the errors, preventing log file flooding, when there -// are many messages, it caps them and shows a quick summary. -// As of today it only logs using standard golang log package, but -// later we could send those stats to agent // TODO(ufoot). -func logErrors(errChan <-chan error) { - errs := aggregateErrors(errChan) - for _, v := range errs { - var repeat string - if v.Count > 1 { - repeat = " (repeated " + strconv.Itoa(v.Count) + " times)" - } - log.Println(errorPrefix + v.Example + repeat) - } -} diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/option.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/option.go index 5e3031f21..faea4805b 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/option.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/option.go @@ -1,7 +1,6 @@ package tracer import ( - "log" "net/http" "os" "path/filepath" @@ -10,6 +9,7 @@ import ( "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" "gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig" + "gopkg.in/DataDog/dd-trace-go.v1/internal/log" ) // config holds the tracer configuration. @@ -43,6 +43,10 @@ type config struct { // hostname is automatically assigned when the DD_TRACE_REPORT_HOSTNAME is set to true, // and is added as a special tag to the root span of traces. hostname string + + // logger specifies the logger to use when printing errors. If not specified, the "log" package + // will be used. + logger ddtrace.Logger } // StartOption represents a function that can be provided as a parameter to Start. @@ -58,11 +62,18 @@ func defaults(c *config) { var err error c.hostname, err = os.Hostname() if err != nil { - log.Printf("%sunable to look up hostname: %v\n", errorPrefix, err) + log.Warn("unable to look up hostname: %v", err) } } } +// WithLogger sets logger as the tracer's error printer. +func WithLogger(logger ddtrace.Logger) StartOption { + return func(c *config) { + c.logger = logger + } +} + // WithPrioritySampling is deprecated, and priority sampling is enabled by default. // When using distributed tracing, the priority sampling value is propagated in order to // get all the parts of a distributed trace sampled. diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/rand.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/rand.go index 356ae5497..065b0c07e 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/rand.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/rand.go @@ -2,12 +2,13 @@ package tracer import ( cryptorand "crypto/rand" - "log" "math" "math/big" "math/rand" "sync" "time" + + "gopkg.in/DataDog/dd-trace-go.v1/internal/log" ) // random holds a thread-safe source of random numbers. @@ -19,7 +20,7 @@ func init() { if err == nil { seed = n.Int64() } else { - log.Printf("%scannot generate random seed: %v; using current time\n", errorPrefix, err) + log.Warn("cannot generate random seed: %v; using current time", err) seed = time.Now().UnixNano() } random = rand.New(&safeSource{ diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/spancontext.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/spancontext.go index 29c81633a..b694a1bea 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/spancontext.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/spancontext.go @@ -5,6 +5,7 @@ import ( "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" + "gopkg.in/DataDog/dd-trace-go.v1/internal/log" ) var _ ddtrace.SpanContext = (*spanContext)(nil) @@ -199,10 +200,7 @@ func (t *trace) push(sp *span) { // capacity is reached, we will not be able to complete this trace. t.full = true t.spans = nil // GC - if tr, ok := internal.GetGlobalTracer().(*tracer); ok { - // we have a tracer we can submit errors too. - tr.pushError(&spanBufferFullError{}) - } + log.Error("trace buffer full (%d), dropping trace", traceMaxSize) return } if v, ok := sp.Metrics[keySamplingPriority]; ok { diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/time_windows.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/time_windows.go index f9c56aeb7..0943fab42 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/time_windows.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/time_windows.go @@ -1,10 +1,11 @@ package tracer import ( - "log" "time" "golang.org/x/sys/windows" + + "gopkg.in/DataDog/dd-trace-go.v1/internal/log" ) // This method is more precise than the go1.8 time.Now on Windows @@ -26,10 +27,9 @@ var now func() int64 // precise implementation based on time.Now() func init() { if err := windows.LoadGetSystemTimePreciseAsFileTime(); err != nil { - log.Printf("Unable to load high precison timer, defaulting to time.Now()") + log.Warn("Unable to load high precison timer, defaulting to time.Now()") now = lowPrecisionNow } else { - log.Printf("Using high precision timer") now = highPrecisionNow } } diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/tracer.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/tracer.go index 91812ac6c..762d99915 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/tracer.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/tracer.go @@ -1,8 +1,6 @@ package tracer import ( - "errors" - "log" "os" "strconv" "time" @@ -10,6 +8,7 @@ import ( "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext" "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/internal" + "gopkg.in/DataDog/dd-trace-go.v1/internal/log" ) var _ ddtrace.Tracer = (*tracer)(nil) @@ -28,11 +27,9 @@ type tracer struct { flushAllReq chan chan<- struct{} flushTracesReq chan struct{} - flushErrorsReq chan struct{} exitReq chan struct{} payloadQueue chan []*span - errorBuffer chan error // stopped is a channel that will be closed when the worker has exited. stopped chan struct{} @@ -75,6 +72,7 @@ func Start(opts ...StartOption) { // Stop stops the started tracer. Subsequent calls are valid but become no-op. func Stop() { internal.SetGlobalTracer(&internal.NoopTracer{}) + log.Flush() } // Span is an alias for ddtrace.Span. It is here to allow godoc to group methods returning @@ -102,13 +100,8 @@ func Inject(ctx ddtrace.SpanContext, carrier interface{}) error { return internal.GetGlobalTracer().Inject(ctx, carrier) } -const ( - // payloadQueueSize is the buffer size of the trace channel. - payloadQueueSize = 1000 - - // errorBufferSize is the buffer size of the error channel. - errorBufferSize = 200 -) +// payloadQueueSize is the buffer size of the trace channel. +const payloadQueueSize = 1000 func newTracer(opts ...StartOption) *tracer { c := new(config) @@ -122,15 +115,19 @@ func newTracer(opts ...StartOption) *tracer { if c.propagator == nil { c.propagator = NewPropagator(nil) } + if c.logger != nil { + log.UseLogger(c.logger) + } + if c.debug { + log.SetLevel(log.LevelDebug) + } t := &tracer{ config: c, payload: newPayload(), flushAllReq: make(chan chan<- struct{}), flushTracesReq: make(chan struct{}, 1), - flushErrorsReq: make(chan struct{}, 1), exitReq: make(chan struct{}), payloadQueue: make(chan []*span, payloadQueueSize), - errorBuffer: make(chan error, errorBufferSize), stopped: make(chan struct{}), prioritySampling: newPrioritySampler(), pid: strconv.Itoa(os.Getpid()), @@ -161,10 +158,7 @@ func (t *tracer) worker() { done <- struct{}{} case <-t.flushTracesReq: - t.flushTraces() - - case <-t.flushErrorsReq: - t.flushErrors() + t.flush() case <-t.exitReq: t.flush() @@ -182,10 +176,7 @@ func (t *tracer) pushTrace(trace []*span) { select { case t.payloadQueue <- trace: default: - t.pushError(&dataLossError{ - context: errors.New("payload queue full, dropping trace"), - count: len(trace), - }) + log.Error("payload queue full, dropping %d traces", len(trace)) } if t.syncPush != nil { // only in tests @@ -193,28 +184,6 @@ func (t *tracer) pushTrace(trace []*span) { } } -func (t *tracer) pushError(err error) { - select { - case <-t.stopped: - return - default: - } - if len(t.errorBuffer) >= cap(t.errorBuffer)/2 { // starts being full, anticipate, try and flush soon - select { - case t.flushErrorsReq <- struct{}{}: - default: // a flush was already requested, skip - } - } - select { - case t.errorBuffer <- err: - default: - // OK, if we get this, our error error buffer is full, - // we can assume it is filled with meaningful messages which - // are going to be logged and hopefully read, nothing better - // we can do, blocking would make things worse. - } -} - // StartSpan creates, starts, and returns a new Span with the given `operationName`. func (t *tracer) StartSpan(operationName string, options ...ddtrace.StartSpanOption) ddtrace.Span { var opts ddtrace.StartSpanConfig @@ -313,18 +282,16 @@ func (t *tracer) Extract(carrier interface{}) (ddtrace.SpanContext, error) { return t.config.propagator.Extract(carrier) } -// flushTraces will push any currently buffered traces to the server. -func (t *tracer) flushTraces() { +// flush will push any currently buffered traces to the server. +func (t *tracer) flush() { if t.payload.itemCount() == 0 { return } size, count := t.payload.size(), t.payload.itemCount() - if t.config.debug { - log.Printf("Sending payload: size: %d traces: %d\n", size, count) - } + log.Debug("Sending payload: size: %d traces: %d\n", size, count) rc, err := t.config.transport.send(t.payload) if err != nil { - t.pushError(&dataLossError{context: err, count: count}) + log.Error("lost %d traces: %v", count, err) } if err == nil { t.prioritySampling.readRatesJSON(rc) // TODO: handle error? @@ -332,16 +299,6 @@ func (t *tracer) flushTraces() { t.payload.reset() } -// flushErrors will process log messages that were queued -func (t *tracer) flushErrors() { - logErrors(t.errorBuffer) -} - -func (t *tracer) flush() { - t.flushTraces() - t.flushErrors() -} - // forceFlush forces a flush of data (traces and services) to the agent. // Flushes are done by a background task on a regular basis, so you never // need to call this manually, mostly useful for testing and debugging. @@ -355,7 +312,7 @@ func (t *tracer) forceFlush() { // larger than the threshold as a result, it sends a flush request. func (t *tracer) pushPayload(trace []*span) { if err := t.payload.push(trace); err != nil { - t.pushError(&traceEncodingError{context: err}) + log.Error("error encoding msgpack: %v", err) } if t.payload.size() > payloadSizeLimit { // getting large diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go index 8821d3de8..328f14bd7 100644 --- a/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer/transport.go @@ -10,13 +10,11 @@ import ( "strconv" "strings" "time" + + "gopkg.in/DataDog/dd-trace-go.v1/internal/version" ) var ( - // TODO(gbbr): find a more effective way to keep this up to date, - // e.g. via `go generate` - tracerVersion = "v1.13.1" - // We copy the transport to avoid using the default one, as it might be // augmented with tracing and we don't want these calls to be recorded. // See https://golang.org/pkg/net/http/#DefaultTransport . @@ -84,7 +82,7 @@ func newHTTPTransport(addr string, roundTripper http.RoundTripper) *httpTranspor "Datadog-Meta-Lang": "go", "Datadog-Meta-Lang-Version": strings.TrimPrefix(runtime.Version(), "go"), "Datadog-Meta-Lang-Interpreter": runtime.Compiler + "-" + runtime.GOARCH + "-" + runtime.GOOS, - "Datadog-Meta-Tracer-Version": tracerVersion, + "Datadog-Meta-Tracer-Version": version.Tag, "Content-Type": "application/msgpack", } return &httpTransport{ diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/log/log.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/log/log.go new file mode 100644 index 000000000..839579be0 --- /dev/null +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/log/log.go @@ -0,0 +1,163 @@ +// Package log provides logging utilities for the tracer. +package log + +import ( + "fmt" + "log" + "os" + "strconv" + "sync" + "time" + + "gopkg.in/DataDog/dd-trace-go.v1/ddtrace" + "gopkg.in/DataDog/dd-trace-go.v1/internal/version" +) + +// Level specifies the logging level that the log package prints at. +type Level int + +const ( + // LevelDebug represents debug level messages. + LevelDebug Level = iota + // LevelWarn represents warning and errors. + LevelWarn +) + +var prefixMsg = fmt.Sprintf("Datadog Tracer %s", version.Tag) + +var ( + mu sync.RWMutex // guards below fields + level = LevelWarn + logger ddtrace.Logger = &defaultLogger{l: log.New(os.Stderr, "", log.LstdFlags)} +) + +// UseLogger sets l as the active logger. +func UseLogger(l ddtrace.Logger) { + mu.Lock() + defer mu.Unlock() + logger = l +} + +// SetLevel sets the given lvl for logging. +func SetLevel(lvl Level) { + mu.Lock() + defer mu.Unlock() + level = lvl +} + +// Debug prints the given message if the level is LevelDebug. +func Debug(fmt string, a ...interface{}) { + mu.RLock() + lvl := level + mu.RUnlock() + if lvl != LevelDebug { + return + } + printMsg("DEBUG", fmt, a...) +} + +// Warn prints a warning message. +func Warn(fmt string, a ...interface{}) { + printMsg("WARN", fmt, a...) +} + +var ( + errmu sync.RWMutex // guards below fields + erragg = map[string]*errorReport{} // aggregated errors + errrate = time.Minute // the rate at which errors are reported + erron bool // true if errors are being aggregated +) + +func init() { + if v := os.Getenv("DD_LOGGING_RATE"); v != "" { + if sec, err := strconv.ParseUint(v, 10, 64); err != nil { + Warn("Invalid value for DD_LOGGING_RATE: %v", err) + } else { + errrate = time.Duration(sec) * time.Second + } + } +} + +type errorReport struct { + first time.Time // time when first error occurred + err error + count uint64 +} + +// Error reports an error. Errors get aggregated and logged periodically. The +// default is once per minute or once every DD_LOGGING_RATE number of seconds. +func Error(format string, a ...interface{}) { + key := format // format should 99.9% of the time be constant + if reachedLimit(key) { + // avoid too much lock contention on spammy errors + return + } + errmu.Lock() + defer errmu.Unlock() + report, ok := erragg[key] + if !ok { + erragg[key] = &errorReport{ + err: fmt.Errorf(format, a...), + first: time.Now(), + } + report = erragg[key] + } + report.count++ + if errrate == 0 { + flushLocked() + return + } + if !erron { + erron = true + time.AfterFunc(errrate, Flush) + } +} + +// defaultErrorLimit specifies the maximum number of errors gathered in a report. +const defaultErrorLimit = 200 + +// reachedLimit reports whether the maximum count has been reached for this key. +func reachedLimit(key string) bool { + errmu.RLock() + e, ok := erragg[key] + confirm := ok && e.count > defaultErrorLimit + errmu.RUnlock() + return confirm +} + +// Flush flushes and resets all aggregated errors to the logger. +func Flush() { + errmu.Lock() + defer errmu.Unlock() + flushLocked() +} + +func flushLocked() { + for _, report := range erragg { + msg := fmt.Sprintf("%v", report.err) + if report.count > defaultErrorLimit { + msg += fmt.Sprintf(", %d+ additional messages skipped (first occurrence: %s)", defaultErrorLimit, report.first.Format(time.RFC822)) + } else if report.count > 1 { + msg += fmt.Sprintf(", %d additional messages skipped (first occurrence: %s)", report.count-1, report.first.Format(time.RFC822)) + } else { + msg += fmt.Sprintf(" (occurred: %s)", report.first.Format(time.RFC822)) + } + printMsg("ERROR", msg) + } + for k := range erragg { + // compiler-optimized map-clearing post go1.11 (golang/go#20138) + delete(erragg, k) + } + erron = false +} + +func printMsg(lvl, format string, a ...interface{}) { + msg := fmt.Sprintf("%s %s: %s", prefixMsg, lvl, fmt.Sprintf(format, a...)) + mu.RLock() + logger.Log(msg) + mu.RUnlock() +} + +type defaultLogger struct{ l *log.Logger } + +func (p *defaultLogger) Log(msg string) { p.l.Print(msg) } diff --git a/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/version/version.go b/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/version/version.go new file mode 100644 index 000000000..76bb0afd5 --- /dev/null +++ b/vendor/gopkg.in/DataDog/dd-trace-go.v1/internal/version/version.go @@ -0,0 +1,6 @@ +package version + +// Tag specifies the current release tag. It needs to be manually +// updated. A test checks that the value of Tag never points to a +// git tag that is older than HEAD. +const Tag = "v1.15.0" From 4d8dcdc6237a44c17bedd2c7d796019c8efa7155 Mon Sep 17 00:00:00 2001 From: Antoine Caron Date: Thu, 18 Jul 2019 22:36:04 +0200 Subject: [PATCH 29/49] feat(webui/dashboard): init new dashboard --- webui/package.json | 2 + webui/src/App.vue | 12 ++ webui/src/assets/images/traefik_logo@3x.svg | 19 ++ webui/src/main.js | 2 + webui/src/router.js | 4 +- webui/src/views/Home.vue | 228 ++++++++++++++++++++ webui/src/views/WIP.vue | 39 ---- webui/yarn.lock | 38 ++++ 8 files changed, 303 insertions(+), 41 deletions(-) create mode 100644 webui/src/assets/images/traefik_logo@3x.svg create mode 100644 webui/src/views/Home.vue delete mode 100644 webui/src/views/WIP.vue diff --git a/webui/package.json b/webui/package.json index eaf4b2ac4..bd145508b 100644 --- a/webui/package.json +++ b/webui/package.json @@ -10,6 +10,8 @@ "test:unit": "vue-cli-service test:unit" }, "dependencies": { + "bulma": "^0.7.5", + "chart.js": "^2.8.0", "core-js": "^2.6.5", "vue": "^2.6.10", "vue-router": "^3.0.3", diff --git a/webui/src/App.vue b/webui/src/App.vue index 5e51fbb7d..67813ed27 100644 --- a/webui/src/App.vue +++ b/webui/src/App.vue @@ -1,5 +1,17 @@ diff --git a/webui/src/assets/images/traefik_logo@3x.svg b/webui/src/assets/images/traefik_logo@3x.svg new file mode 100644 index 000000000..aae4d7114 --- /dev/null +++ b/webui/src/assets/images/traefik_logo@3x.svg @@ -0,0 +1,19 @@ + + + + F8E5018F-A6ED-4D95-9CB0-FEDA05C16096@3x + Created with sketchtool. + + + + + + + + + + + \ No newline at end of file diff --git a/webui/src/main.js b/webui/src/main.js index 3a47006f0..0e9e1de81 100644 --- a/webui/src/main.js +++ b/webui/src/main.js @@ -3,6 +3,8 @@ import App from "./App.vue"; import router from "./router"; import store from "./store"; +import "bulma/css/bulma.min.css"; + Vue.config.productionTip = false; new Vue({ diff --git a/webui/src/router.js b/webui/src/router.js index b6c6f53a0..c21d26d28 100644 --- a/webui/src/router.js +++ b/webui/src/router.js @@ -1,6 +1,6 @@ import Vue from "vue"; import Router from "vue-router"; -import WIP from "./views/WIP.vue"; +import Home from "./views/Home.vue"; Vue.use(Router); @@ -9,7 +9,7 @@ export default new Router({ { path: "/", name: "home", - component: WIP + component: Home } ] }); diff --git a/webui/src/views/Home.vue b/webui/src/views/Home.vue new file mode 100644 index 000000000..9f618c710 --- /dev/null +++ b/webui/src/views/Home.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/webui/src/views/WIP.vue b/webui/src/views/WIP.vue deleted file mode 100644 index 763a267d8..000000000 --- a/webui/src/views/WIP.vue +++ /dev/null @@ -1,39 +0,0 @@ - - - - - diff --git a/webui/yarn.lock b/webui/yarn.lock index 3c2daf252..8c50b4c03 100644 --- a/webui/yarn.lock +++ b/webui/yarn.lock @@ -2058,6 +2058,11 @@ builtin-status-codes@^3.0.0: resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= +bulma@^0.7.5: + version "0.7.5" + resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.7.5.tgz#35066c37f82c088b68f94450be758fc00a967208" + integrity sha512-cX98TIn0I6sKba/DhW0FBjtaDpxTelU166pf7ICXpCCuplHWyu6C9LYZmL5PEsnePIeJaiorsTEzzNk3Tsm1hw== + bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -2272,6 +2277,29 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +chart.js@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.8.0.tgz#b703b10d0f4ec5079eaefdcd6ca32dc8f826e0e9" + integrity sha512-Di3wUL4BFvqI5FB5K26aQ+hvWh8wnP9A3DWGvXHVkO13D3DSnaSsdZx29cXlEsYKVkn1E2az+ZYFS4t0zi8x0w== + dependencies: + chartjs-color "^2.1.0" + moment "^2.10.2" + +chartjs-color-string@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz#1df096621c0e70720a64f4135ea171d051402f71" + integrity sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A== + dependencies: + color-name "^1.0.0" + +chartjs-color@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chartjs-color/-/chartjs-color-2.3.0.tgz#0e7e1e8dba37eae8415fd3db38bf572007dd958f" + integrity sha512-hEvVheqczsoHD+fZ+tfPUE+1+RbV6b+eksp2LwAhwRTVXEjCSEavvk+Hg3H6SZfGlPh/UfmWKGIvZbtobOEm3g== + dependencies: + chartjs-color-string "^0.6.0" + color-convert "^0.5.3" + check-types@^8.0.3: version "8.0.3" resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552" @@ -2453,6 +2481,11 @@ collection-visit@^1.0.0: map-visit "^1.0.0" object-visit "^1.0.0" +color-convert@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd" + integrity sha1-vbbGnOZg+t/+CwAHzER+G59ygr0= + color-convert@^1.9.0, color-convert@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -6513,6 +6546,11 @@ mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdi dependencies: minimist "0.0.8" +moment@^2.10.2: + version "2.24.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" + integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" From 693bd7e1102c4f578a33b02f4748d10d73ddce87 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou Date: Fri, 19 Jul 2019 09:24:04 +0200 Subject: [PATCH 30/49] Add a basic Traefik install guide --- .../getting-started/install-traefik.md | 70 +++++++++++++++++++ docs/mkdocs.yml | 1 + 2 files changed, 71 insertions(+) create mode 100644 docs/content/getting-started/install-traefik.md diff --git a/docs/content/getting-started/install-traefik.md b/docs/content/getting-started/install-traefik.md new file mode 100644 index 000000000..b468bc6d0 --- /dev/null +++ b/docs/content/getting-started/install-traefik.md @@ -0,0 +1,70 @@ +# Install Traefik + +You can install Traefik with the following flavors: + +* [Use the official Docker image](./#use-the-official-docker-image) +* [Use the binary distribution](./#use-the-binary-distribution) +* [Compile your binary from the sources](./#compile-your-binary-from-the-sources) + +## Use the Official Docker Image + +Choose one of the [official Docker images](https://hub.docker.com/_/traefik) and run it with the [sample configuration file](https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml): + +```shell +docker run -d -p 8080:8080 -p 80:80 \ + -v $PWD/traefik.toml:/etc/traefik/traefik.toml traefik:v2.0 +``` + +For more details, go to the [Docker provider documentation](../providers/docker.md) + +!!! tip + + * Prefer a fixed version than the latest that could be an unexpected version. + ex: `traefik:v2.0.0` + * Docker images comes in 2 flavors: scratch based or alpine based. + * All the orchestrator using docker images could fetch the official Traefik docker image. + +## Use the Binary Distribution + +Grab the latest binary from the [releases](https://github.com/containous/traefik/releases) page. + +??? tip "Check the integrity of the downloaded file" + + ```bash tab="Linux" + # Compare this value to the one found in traefik-${traefik_version}_checksums.txt + sha256sum ./traefik_${traefik_version}_linux_${arch}.tar.gz + ``` + + ```bash tab="macOS" + # Compare this value to the one found in traefik-${traefik_version}_checksums.txt + shasum -a256 ./traefik_${traefik_version}_darwin_amd64.tar.gz + ``` + + ```powershell tab="Windows PowerShell" + # Compare this value to the one found in traefik-${traefik_version}_checksums.txt + Get-FileHash ./traefik_${traefik_version}_windows_${arch}.zip -Algorithm SHA256 + ``` + +??? tip "Extract the downloaded archive" + + ```bash tab="Linux" + tar -zxvf traefik_${traefik_version}_linux_${arch}.tar.gz + ``` + + ```bash tab="macOS" + tar -zxvf ./traefik_${traefik_version}_darwin_amd64.tar.gz + ``` + + ```powershell tab="Windows PowerShell" + Expand-Archive traefik_${traefik_version}_windows_${arch}.zip + ``` + +And run it: + +```bash +./traefik --help +``` + +## Compile your Binary from the Sources + +All the details are available in the [Contributing Guide](../contributing/building-testing.md) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 3ed6b287d..a0426176b 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -71,6 +71,7 @@ nav: - 'Concepts' : 'getting-started/concepts.md' - 'Quick Start': 'getting-started/quick-start.md' - 'Configuration Introduction': 'getting-started/configuration-overview.md' + - 'Install Traefik': 'getting-started/install-traefik.md' - 'Configuration Discovery': - 'Overview': 'providers/overview.md' - 'Docker': 'providers/docker.md' From d5f4934acf726795b42f7a7f82f33d66926f244d Mon Sep 17 00:00:00 2001 From: mpl Date: Fri, 19 Jul 2019 09:50:04 +0200 Subject: [PATCH 31/49] Add documentation about Kubernetes Ingress provider --- docs/content/providers/kubernetes-crd.md | 7 +- docs/content/providers/kubernetes-ingress.md | 308 ++++++++++++++++++- docs/mkdocs.yml | 2 +- 3 files changed, 308 insertions(+), 9 deletions(-) diff --git a/docs/content/providers/kubernetes-crd.md b/docs/content/providers/kubernetes-crd.md index d074d41dc..a2f396ef5 100644 --- a/docs/content/providers/kubernetes-crd.md +++ b/docs/content/providers/kubernetes-crd.md @@ -3,12 +3,7 @@ The Kubernetes Ingress Controller, The Custom Resource Way. {: .subtitle } - - -The Traefik Kubernetes provider used to be a Kubernetes Ingress controller in the strict sense of the term; that is to say, -it would manage access to a cluster services by supporting the [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) specification. +Traefik used to support Kubernetes only through the [Kubernetes Ingress provider](./kubernetes-ingress.md), which is a Kubernetes Ingress controller in the strict sense of the term. However, as the community expressed the need to benefit from Traefik features without resorting to (lots of) annotations, we ended up writing a [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) (alias CRD in the following) for an IngressRoute type, defined below, in order to provide a better way to configure access to a Kubernetes cluster. diff --git a/docs/content/providers/kubernetes-ingress.md b/docs/content/providers/kubernetes-ingress.md index c08f63810..a6de09424 100644 --- a/docs/content/providers/kubernetes-ingress.md +++ b/docs/content/providers/kubernetes-ingress.md @@ -1,6 +1,310 @@ # Traefik & Kubernetes -Kubernetes Ingress. +The Kubernetes Ingress Controller. {: .subtitle } -TODO +The Traefik Kubernetes Ingress provider is a Kubernetes Ingress controller; that is to say, +it manages access to a cluster services by supporting the [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) specification. + +## Enabling and using the provider + +As usual, the provider is enabled through the static configuration: + +```toml tab="File (TOML)" +[providers.kubernetesIngress] +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: {} +``` + +```bash tab="CLI" +--providers.kubernetesingress +``` + +The provider then watches for incoming ingresses events, such as the example below, and derives the corresponding dynamic configuration from it, which in turn will create the resulting routers, services, handlers, etc. + +```yaml tab="File (YAML)" +kind: Ingress +apiVersion: extensions/v1beta1 +metadata: + name: "foo" + namespace: production + +spec: + rules: + - host: foo.com + http: + paths: + - path: /bar + backend: + serviceName: service1 + servicePort: 80 + - path: /foo + backend: + serviceName: service1 + servicePort: 80 +``` + +## Provider Configuration Options + +!!! tip "Browse the Reference" + If you're in a hurry, maybe you'd rather go through the [static](../reference/static-configuration/overview.md) configuration reference. + +### `endpoint` + +_Optional, Default=empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + endpoint = "http://localhost:8080" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + endpoint = "http://localhost:8080" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.endpoint="http://localhost:8080" +``` + +The Kubernetes server endpoint as URL, which is only used when the behavior based on environment variables described below does not apply. + +When deployed into Kubernetes, Traefik reads the environment variables `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` or `KUBECONFIG` to construct the endpoint. + +The access token is looked up in `/var/run/secrets/kubernetes.io/serviceaccount/token` and the SSL CA certificate in `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt`. +They are both provided automatically as mounts in the pod where Traefik is deployed. + +When the environment variables are not found, Traefik tries to connect to the Kubernetes API server with an external-cluster client. +In which 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. + +### `token` + +_Optional, Default=empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + token = "mytoken" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + token = "mytoken" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.token="mytoken" +``` + +Bearer token used for the Kubernetes client configuration. + +### `certAuthFilePath` + +_Optional, Default=empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + certAuthFilePath = "/my/ca.crt" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + certAuthFilePath: "/my/ca.crt" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.certauthfilepath="/my/ca.crt" +``` + +Path to the certificate authority file. +Used for the Kubernetes client configuration. + +### `disablePassHostHeaders` + +_Optional, Default=false_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + disablePassHostHeaders = true + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + disablePassHostHeaders: true + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.disablepasshostheaders=true +``` + +Whether to disable PassHost Headers. + +### `namespaces` + +_Optional, Default: all namespaces (empty array)_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + namespaces = ["default", "production"] + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + namespaces: + - "default" + - "production" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.namespaces="default,production" +``` + +Array of namespaces to watch. + +### `labelSelector` + +_Optional,Default: empty (process all Ingresses)_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + labelSelector = "A and not B" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + labelselector: "A and not B" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.labelselector="A and not B" +``` + +By default, Traefik processes all Ingress objects in the configured namespaces. +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. + +### `ingressClass` + +_Optional, Default: empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress] + ingressClass = "traefik-internal" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + ingressClass: "traefik-internal" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.ingressclass="traefik-internal" +``` + +Value of `kubernetes.io/ingress.class` annotation that identifies Ingress objects to be processed. + +If the parameter is non-empty, only Ingresses containing an annotation with the same value are processed. +Otherwise, Ingresses missing the annotation, having an empty value, or with the value `traefik` are processed. + +### `ingressEndpoint` + +#### `hostname` + +_Optional, Default: empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress.ingressEndpoint] + hostname = "foo.com" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + ingressEndpoint: + hostname: "foo.com" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.ingressendpoint.hostname="foo.com" +``` + +Hostname used for Kubernetes Ingress endpoints. + +#### `ip` + +_Optional, Default: empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress.ingressEndpoint] + ip = "1.2.3.4" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + ingressEndpoint: + ip: "1.2.3.4" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.ingressendpoint.ip="1.2.3.4" +``` + +IP used for Kubernetes Ingress endpoints. + +#### `publishedService` + +_Optional, Default: empty_ + +```toml tab="File (TOML)" +[providers.kubernetesIngress.ingressEndpoint] + publishedService = "foo-service" + # ... +``` + +```yaml tab="File (YAML)" +providers: + kubernetesIngress: + ingressEndpoint: + publishedService: "foo-service" + # ... +``` + +```bash tab="CLI" +--providers.kubernetesingress.ingressendpoint.publishedservice="foo-service" +``` + +Published Kubernetes Service to copy status from. + +## Further + +If one wants to know more about the various aspects of the Ingress spec that Traefik supports, many examples of Ingresses definitions are located in the tests [data](https://github.com/containous/traefik/tree/v2.0/pkg/provider/kubernetes/ingress/fixtures) of the Traefik repository. diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index a0426176b..15191156b 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -76,7 +76,7 @@ nav: - 'Overview': 'providers/overview.md' - 'Docker': 'providers/docker.md' - 'Kubernetes IngressRoute': 'providers/kubernetes-crd.md' -# - 'Kubernetes Ingress': 'providers/kubernetes-ingress.md' + - 'Kubernetes Ingress': 'providers/kubernetes-ingress.md' - 'Rancher': 'providers/rancher.md' - 'File': 'providers/file.md' - 'Marathon': 'providers/marathon.md' From e3627e9cbad3291116cc18cc4f17bd1000aa4653 Mon Sep 17 00:00:00 2001 From: Julien Salleyron Date: Fri, 19 Jul 2019 10:50:05 +0200 Subject: [PATCH 32/49] Disable RateLimit temporarily --- docs/content/middlewares/ratelimit.md | 3 + .../reference/dynamic-configuration/file.toml | 12 -- .../reference/dynamic-configuration/file.yaml | 12 -- .../dynamic-configuration/labels.yml | 7 - integration/access_log_test.go | 2 + integration/integration_test.go | 3 +- integration/resources/compose/access_log.yml | 25 +-- integration/tracing_test.go | 4 + pkg/config/dynamic/middlewares.go | 21 +-- pkg/config/dynamic/zz_generated.deepcopy.go | 5 - pkg/config/label/label_test.go | 154 +++++++++--------- pkg/server/middleware/middlewares.go | 18 +- 12 files changed, 122 insertions(+), 144 deletions(-) diff --git a/docs/content/middlewares/ratelimit.md b/docs/content/middlewares/ratelimit.md index 65dbc84ba..2194a6f71 100644 --- a/docs/content/middlewares/ratelimit.md +++ b/docs/content/middlewares/ratelimit.md @@ -1,5 +1,8 @@ # RateLimit +!!! warning + This middleware is disable for now. + Protection from Too Many Calls {: .subtitle } diff --git a/docs/content/reference/dynamic-configuration/file.toml b/docs/content/reference/dynamic-configuration/file.toml index bf59ba1e1..b9ada6726 100644 --- a/docs/content/reference/dynamic-configuration/file.toml +++ b/docs/content/reference/dynamic-configuration/file.toml @@ -186,18 +186,6 @@ commonName = true serialNumber = true domainComponent = true - [http.middlewares.Middleware13] - [http.middlewares.Middleware13.rateLimit] - extractorFunc = "foobar" - [http.middlewares.Middleware13.rateLimit.rateSet] - [http.middlewares.Middleware13.rateLimit.rateSet.Rate0] - period = "42ns" - average = 42 - burst = 42 - [http.middlewares.Middleware13.rateLimit.rateSet.Rate1] - period = "42ns" - average = 42 - burst = 42 [http.middlewares.Middleware14] [http.middlewares.Middleware14.redirectRegex] regex = "foobar" diff --git a/docs/content/reference/dynamic-configuration/file.yaml b/docs/content/reference/dynamic-configuration/file.yaml index 083b79c7c..b3120bb61 100644 --- a/docs/content/reference/dynamic-configuration/file.yaml +++ b/docs/content/reference/dynamic-configuration/file.yaml @@ -212,18 +212,6 @@ http: commonName: true serialNumber: true domainComponent: true - Middleware13: - rateLimit: - rateSet: - Rate0: - period: 42ns - average: 42 - burst: 42 - Rate1: - period: 42ns - average: 42 - burst: 42 - extractorFunc: foobar Middleware14: redirectRegex: regex: foobar diff --git a/docs/content/reference/dynamic-configuration/labels.yml b/docs/content/reference/dynamic-configuration/labels.yml index 01fd638ec..b62c36b2a 100644 --- a/docs/content/reference/dynamic-configuration/labels.yml +++ b/docs/content/reference/dynamic-configuration/labels.yml @@ -83,13 +83,6 @@ - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" - "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" - - "traefik.http.middlewares.middleware13.ratelimit.extractorfunc=foobar" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.average=42" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.burst=42" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate0.period=42" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.average=42" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.burst=42" - - "traefik.http.middlewares.middleware13.ratelimit.rateset.rate1.period=42" - "traefik.http.middlewares.middleware14.redirectregex.permanent=true" - "traefik.http.middlewares.middleware14.redirectregex.regex=foobar" - "traefik.http.middlewares.middleware14.redirectregex.replacement=foobar" diff --git a/integration/access_log_test.go b/integration/access_log_test.go index 807d1232b..c87daaaf3 100644 --- a/integration/access_log_test.go +++ b/integration/access_log_test.go @@ -309,6 +309,8 @@ func (s *AccessLogSuite) TestAccessLogFrontendRedirect(c *check.C) { } func (s *AccessLogSuite) TestAccessLogRateLimit(c *check.C) { + c.Skip("RateLimit is disable for now") + ensureWorkingDirectoryIsClean() expected := []accessLogValue{ diff --git a/integration/integration_test.go b/integration/integration_test.go index 3d0779f82..1ab4da6a8 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -54,7 +54,8 @@ func init() { check.Suite(&LogRotationSuite{}) check.Suite(&MarathonSuite{}) check.Suite(&MarathonSuite15{}) - check.Suite(&RateLimitSuite{}) + // TODO: disable temporarily + // check.Suite(&RateLimitSuite{}) check.Suite(&RestSuite{}) check.Suite(&RetrySuite{}) check.Suite(&SimpleSuite{}) diff --git a/integration/resources/compose/access_log.yml b/integration/resources/compose/access_log.yml index bd080630e..d07f6d8a1 100644 --- a/integration/resources/compose/access_log.yml +++ b/integration/resources/compose/access_log.yml @@ -55,18 +55,19 @@ frontendRedirect: - traefik.http.middlewares.redirecthttp.redirectScheme.scheme=http - traefik.http.middlewares.redirecthttp.redirectScheme.port=8000 - traefik.http.services.service3.loadbalancer.server.port=80 -rateLimit: - image: containous/whoami - labels: - - traefik.enable=true - - traefik.http.routers.rt-rateLimit.entryPoints=httpRateLimit - - traefik.http.routers.rt-rateLimit.rule=Host("ratelimit.docker.local") - - traefik.http.routers.rt-rateLimit.middlewares=rate - - traefik.http.middlewares.rate.ratelimit.extractorfunc=client.ip - - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.average=1 - - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.burst=2 - - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.period=10s - - traefik.http.services.service3.loadbalancer.server.port=80 +# TODO: disable temporarily (rateLimit) +#rateLimit: +# image: containous/whoami +# labels: +# - traefik.enable=true +# - traefik.http.routers.rt-rateLimit.entryPoints=httpRateLimit +# - traefik.http.routers.rt-rateLimit.rule=Host("ratelimit.docker.local") +# - traefik.http.routers.rt-rateLimit.middlewares=rate +# - traefik.http.middlewares.rate.ratelimit.extractorfunc=client.ip +# - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.average=1 +# - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.burst=2 +# - traefik.http.middlewares.rate.ratelimit.rateset.Rate0.period=10s +# - traefik.http.services.service3.loadbalancer.server.port=80 frontendWhitelist: image: containous/whoami labels: diff --git a/integration/tracing_test.go b/integration/tracing_test.go index 03e5e18b8..2d57b9e38 100644 --- a/integration/tracing_test.go +++ b/integration/tracing_test.go @@ -41,6 +41,8 @@ func (s *TracingSuite) startZipkin(c *check.C) { } func (s *TracingSuite) TestZipkinRateLimit(c *check.C) { + c.Skip("RateLimit is disable for now") + s.startZipkin(c) defer s.composeProject.Stop(c, "zipkin") file := s.adaptFile(c, "fixtures/tracing/simple-zipkin.toml", TracingTemplate{ @@ -155,6 +157,8 @@ func (s *TracingSuite) startJaeger(c *check.C) { } func (s *TracingSuite) TestJaegerRateLimit(c *check.C) { + c.Skip("RateLimit is disable for now") + s.startJaeger(c) defer s.composeProject.Stop(c, "jaeger") file := s.adaptFile(c, "fixtures/tracing/simple-jaeger.toml", TracingTemplate{ diff --git a/pkg/config/dynamic/middlewares.go b/pkg/config/dynamic/middlewares.go index 2c7482e48..b5124a822 100644 --- a/pkg/config/dynamic/middlewares.go +++ b/pkg/config/dynamic/middlewares.go @@ -15,16 +15,17 @@ import ( // Middleware holds the Middleware configuration. type Middleware struct { - 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"` + 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"` + // TODO: disable temporarily + // 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"` diff --git a/pkg/config/dynamic/zz_generated.deepcopy.go b/pkg/config/dynamic/zz_generated.deepcopy.go index 9671e61db..416865453 100644 --- a/pkg/config/dynamic/zz_generated.deepcopy.go +++ b/pkg/config/dynamic/zz_generated.deepcopy.go @@ -628,11 +628,6 @@ func (in *Middleware) DeepCopyInto(out *Middleware) { *out = new(ErrorPage) (*in).DeepCopyInto(*out) } - if in.RateLimit != nil { - in, out := &in.RateLimit, &out.RateLimit - *out = new(RateLimit) - (*in).DeepCopyInto(*out) - } if in.RedirectRegex != nil { in, out := &in.RedirectRegex, &out.RedirectRegex *out = new(RedirectRegex) diff --git a/pkg/config/label/label_test.go b/pkg/config/label/label_test.go index 76550ad08..7c2a031c5 100644 --- a/pkg/config/label/label_test.go +++ b/pkg/config/label/label_test.go @@ -3,10 +3,8 @@ package label import ( "fmt" "testing" - "time" "github.com/containous/traefik/pkg/config/dynamic" - "github.com/containous/traefik/pkg/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -97,26 +95,27 @@ func TestDecodeConfiguration(t *testing.T) { "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.province": "true", "traefik.http.middlewares.Middleware11.passtlsclientcert.info.issuer.serialnumber": "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.permanent": "true", - "traefik.http.middlewares.Middleware13.redirectregex.regex": "foobar", - "traefik.http.middlewares.Middleware13.redirectregex.replacement": "foobar", - "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", + // TODO: disable temporarily (rateLimit) + // "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.permanent": "true", + "traefik.http.middlewares.Middleware13.redirectregex.regex": "foobar", + "traefik.http.middlewares.Middleware13.redirectregex.replacement": "foobar", + "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", @@ -306,23 +305,24 @@ func TestDecodeConfiguration(t *testing.T) { }, }, }, - "Middleware12": { - RateLimit: &dynamic.RateLimit{ - RateSet: map[string]*dynamic.Rate{ - "Rate0": { - Period: types.Duration(42 * time.Second), - Average: 42, - Burst: 42, - }, - "Rate1": { - Period: types.Duration(42 * time.Second), - Average: 42, - Burst: 42, - }, - }, - ExtractorFunc: "foobar", - }, - }, + // TODO: disable temporarily (rateLimit) + // "Middleware12": { + // RateLimit: &dynamic.RateLimit{ + // RateSet: map[string]*dynamic.Rate{ + // "Rate0": { + // Period: types.Duration(42 * time.Second), + // Average: 42, + // Burst: 42, + // }, + // "Rate1": { + // Period: types.Duration(42 * time.Second), + // Average: 42, + // Burst: 42, + // }, + // }, + // ExtractorFunc: "foobar", + // }, + // }, "Middleware13": { RedirectRegex: &dynamic.RedirectRegex{ Regex: "foobar", @@ -702,23 +702,24 @@ func TestEncodeConfiguration(t *testing.T) { }, }, }, - "Middleware12": { - RateLimit: &dynamic.RateLimit{ - RateSet: map[string]*dynamic.Rate{ - "Rate0": { - Period: types.Duration(42 * time.Nanosecond), - Average: 42, - Burst: 42, - }, - "Rate1": { - Period: types.Duration(42 * time.Nanosecond), - Average: 42, - Burst: 42, - }, - }, - ExtractorFunc: "foobar", - }, - }, + // TODO: disable temporarily (rateLimit) + // "Middleware12": { + // RateLimit: &dynamic.RateLimit{ + // RateSet: map[string]*dynamic.Rate{ + // "Rate0": { + // Period: types.Duration(42 * time.Nanosecond), + // Average: 42, + // Burst: 42, + // }, + // "Rate1": { + // Period: types.Duration(42 * time.Nanosecond), + // Average: 42, + // Burst: 42, + // }, + // }, + // ExtractorFunc: "foobar", + // }, + // }, "Middleware13": { RedirectRegex: &dynamic.RedirectRegex{ Regex: "foobar", @@ -1051,26 +1052,27 @@ func TestEncodeConfiguration(t *testing.T) { "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", + // TODO: disable temporarily (rateLimit) + // "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", diff --git a/pkg/server/middleware/middlewares.go b/pkg/server/middleware/middlewares.go index 8333247bc..3d161e4f2 100644 --- a/pkg/server/middleware/middlewares.go +++ b/pkg/server/middleware/middlewares.go @@ -20,7 +20,6 @@ import ( "github.com/containous/traefik/pkg/middlewares/ipwhitelist" "github.com/containous/traefik/pkg/middlewares/maxconnection" "github.com/containous/traefik/pkg/middlewares/passtlsclientcert" - "github.com/containous/traefik/pkg/middlewares/ratelimiter" "github.com/containous/traefik/pkg/middlewares/redirect" "github.com/containous/traefik/pkg/middlewares/replacepath" "github.com/containous/traefik/pkg/middlewares/replacepathregex" @@ -232,15 +231,16 @@ func (b *Builder) buildConstructor(ctx context.Context, middlewareName string) ( } } + // TODO: disable temporarily (rateLimit) // RateLimit - if config.RateLimit != nil { - if middleware != nil { - return nil, badConf - } - middleware = func(next http.Handler) (http.Handler, error) { - return ratelimiter.New(ctx, next, *config.RateLimit, middlewareName) - } - } + // if config.RateLimit != nil { + // if middleware != nil { + // return nil, badConf + // } + // middleware = func(next http.Handler) (http.Handler, error) { + // return ratelimiter.New(ctx, next, *config.RateLimit, middlewareName) + // } + // } // RedirectRegex if config.RedirectRegex != nil { From f75f73f3d243f694bf687a51cbf193d783d966e5 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 19 Jul 2019 11:52:04 +0200 Subject: [PATCH 33/49] Certificate resolvers. Co-authored-by: Julien Salleyron Co-authored-by: Jean-Baptiste Doumenjou --- cmd/traefik/traefik.go | 85 ++-- docs/content/https/acme.md | 323 ++++++--------- docs/content/https/ref-acme.toml | 166 +++----- docs/content/https/ref-acme.txt | 89 ++++ docs/content/https/ref-acme.yaml | 196 ++++----- .../reference/static-configuration/cli-ref.md | 93 ++--- .../reference/static-configuration/env-ref.md | 93 ++--- .../reference/static-configuration/file.toml | 2 - .../reference/static-configuration/file.yaml | 2 - docs/content/routing/routers/index.md | 130 +++++- .../user-guides/crd-acme/03-deployments.yml | 13 +- .../user-guides/crd-acme/04-ingressroutes.yml | 4 +- integration/acme_test.go | 384 +++++++++++------- integration/fixtures/acme/acme_base.toml | 30 +- integration/fixtures/acme/acme_domains.toml | 58 +++ .../acme/acme_multiple_resolvers.toml | 58 +++ integration/fixtures/acme/acme_tcp.toml | 51 +++ integration/fixtures/acme/acme_tls.toml | 29 +- .../fixtures/acme/acme_tls_dynamic.toml | 31 +- .../acme/acme_tls_multiple_entrypoints.toml | 35 +- integration/https_test.go | 2 +- integration/simple_test.go | 2 +- pkg/anonymize/anonymize_config_test.go | 32 +- pkg/config/dynamic/fixtures/sample.toml | 1 - pkg/config/dynamic/http_config.go | 10 +- pkg/config/dynamic/tcp_config.go | 12 +- pkg/config/dynamic/zz_generated.deepcopy.go | 19 +- pkg/config/file/file_node_test.go | 110 +++-- pkg/config/file/fixtures/sample.toml | 17 +- pkg/config/file/fixtures/sample.yml | 47 +-- pkg/config/static/static_config.go | 80 ++-- pkg/provider/acme/challenge_http.go | 6 +- pkg/provider/acme/challenge_tls.go | 4 +- pkg/provider/acme/local_store.go | 122 +++--- pkg/provider/acme/provider.go | 207 +++++----- pkg/provider/acme/provider_test.go | 58 ++- pkg/provider/acme/store.go | 23 +- pkg/provider/kubernetes/crd/kubernetes.go | 8 +- .../crd/traefik/v1alpha1/ingressroute.go | 3 +- .../crd/traefik/v1alpha1/ingressroutetcp.go | 3 +- pkg/server/router/route_appender_factory.go | 11 +- pkg/server/router/tcp/router.go | 13 +- pkg/tls/tlsmanager.go | 20 +- pkg/tls/tlsmanager_test.go | 43 +- pkg/types/domains.go | 41 +- pkg/types/zz_generated.deepcopy.go | 50 +++ script/update-generated-crd-code.sh | 6 +- 47 files changed, 1573 insertions(+), 1249 deletions(-) create mode 100644 docs/content/https/ref-acme.txt create mode 100644 integration/fixtures/acme/acme_domains.toml create mode 100644 integration/fixtures/acme/acme_multiple_resolvers.toml create mode 100644 integration/fixtures/acme/acme_tcp.toml create mode 100644 pkg/types/zz_generated.deepcopy.go diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 1c4410681..f41b74ffd 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -20,6 +20,7 @@ import ( "github.com/containous/traefik/pkg/config/dynamic" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" + "github.com/containous/traefik/pkg/provider/acme" "github.com/containous/traefik/pkg/provider/aggregator" "github.com/containous/traefik/pkg/safe" "github.com/containous/traefik/pkg/server" @@ -88,7 +89,9 @@ func runCmd(staticConfiguration *static.Configuration) error { } staticConfiguration.SetEffectiveConfiguration() - staticConfiguration.ValidateConfiguration() + if err := staticConfiguration.ValidateConfiguration(); err != nil { + return err + } log.WithoutContext().Infof("Traefik version %s built on %s", version.Version, version.BuildDate) @@ -112,15 +115,9 @@ func runCmd(staticConfiguration *static.Configuration) error { providerAggregator := aggregator.NewProviderAggregator(*staticConfiguration.Providers) - acmeProvider, err := staticConfiguration.InitACMEProvider() - if err != nil { - log.WithoutContext().Errorf("Unable to initialize ACME provider: %v", err) - } else if acmeProvider != nil { - if err := providerAggregator.AddProvider(acmeProvider); err != nil { - log.WithoutContext().Errorf("Unable to add ACME provider to the providers list: %v", err) - acmeProvider = nil - } - } + tlsManager := traefiktls.NewManager() + + acmeProviders := initACMEProvider(staticConfiguration, &providerAggregator, tlsManager) serverEntryPointsTCP := make(server.TCPEntryPoints) for entryPointName, config := range staticConfiguration.EntryPoints { @@ -129,27 +126,31 @@ func runCmd(staticConfiguration *static.Configuration) error { if err != nil { return fmt.Errorf("error while building entryPoint %s: %v", entryPointName, err) } - serverEntryPointsTCP[entryPointName].RouteAppenderFactory = router.NewRouteAppenderFactory(*staticConfiguration, entryPointName, acmeProvider) + serverEntryPointsTCP[entryPointName].RouteAppenderFactory = router.NewRouteAppenderFactory(*staticConfiguration, entryPointName, acmeProviders) } - tlsManager := traefiktls.NewManager() - - if acmeProvider != nil { - acmeProvider.SetTLSManager(tlsManager) - if acmeProvider.TLSChallenge != nil && - acmeProvider.HTTPChallenge == nil && - acmeProvider.DNSChallenge == nil { - tlsManager.TLSAlpnGetter = acmeProvider.GetTLSALPNCertificate - } - } - svr := server.NewServer(*staticConfiguration, providerAggregator, serverEntryPointsTCP, tlsManager) - if acmeProvider != nil && acmeProvider.OnHostRule { - acmeProvider.SetConfigListenerChan(make(chan dynamic.Configuration)) - svr.AddListener(acmeProvider.ListenConfiguration) + resolverNames := map[string]struct{}{} + + for _, p := range acmeProviders { + resolverNames[p.ResolverName] = struct{}{} + svr.AddListener(p.ListenConfiguration) } + + svr.AddListener(func(config dynamic.Configuration) { + for rtName, rt := range config.HTTP.Routers { + if rt.TLS == nil || rt.TLS.CertResolver == "" { + continue + } + + if _, ok := resolverNames[rt.TLS.CertResolver]; !ok { + log.WithoutContext().Errorf("the router %s uses a non-existent resolver: %s", rtName, rt.TLS.CertResolver) + } + } + }) + ctx := cmd.ContextWithSignal(context.Background()) if staticConfiguration.Ping != nil { @@ -196,6 +197,40 @@ func runCmd(staticConfiguration *static.Configuration) error { return nil } +// initACMEProvider creates an acme provider from the ACME part of globalConfiguration +func initACMEProvider(c *static.Configuration, providerAggregator *aggregator.ProviderAggregator, tlsManager *traefiktls.Manager) []*acme.Provider { + challengeStore := acme.NewLocalChallengeStore() + localStores := map[string]*acme.LocalStore{} + + var resolvers []*acme.Provider + for name, resolver := range c.CertificatesResolvers { + if resolver.ACME != nil { + if localStores[resolver.ACME.Storage] == nil { + localStores[resolver.ACME.Storage] = acme.NewLocalStore(resolver.ACME.Storage) + } + + p := &acme.Provider{ + Configuration: resolver.ACME, + Store: localStores[resolver.ACME.Storage], + ChallengeStore: challengeStore, + ResolverName: name, + } + + if err := providerAggregator.AddProvider(p); err != nil { + log.WithoutContext().Errorf("Unable to add ACME provider to the providers list: %v", err) + continue + } + p.SetTLSManager(tlsManager) + if p.TLSChallenge != nil { + tlsManager.TLSAlpnGetter = p.GetTLSALPNCertificate + } + p.SetConfigListenerChan(make(chan dynamic.Configuration)) + resolvers = append(resolvers, p) + } + } + return resolvers +} + func configureLogging(staticConfiguration *static.Configuration) { // configure default log flags stdlog.SetFlags(stdlog.Lshortfile | stdlog.LstdFlags) diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index 648304076..e60b6d759 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -11,8 +11,8 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom ## Configuration Examples ??? example "Enabling ACME" - - ```toml tab="TOML" + + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -20,18 +20,15 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom [entryPoints.web-secure] address = ":443" - # every router with TLS enabled will now be able to use ACME for its certificates - [acme] + [certificatesResolvers.sample.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" + ```yaml tab="File (YAML)" entryPoints: web: address: ":80" @@ -39,50 +36,24 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom web-secure: 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-secure] - address = ":443" - - [acme] - email = "your-email@your-domain.org" - storage = "acme.json" - [acme.dnsChallenge] - provider = "xxx" - - [[acme.domains]] - main = "*.mydomain.com" - sans = ["mydomain.com"] + certificatesResolvers: + sample: + acme: + email: your-email@your-domain.org + storage: acme.json + httpChallenge: + # used during the challenge + entryPoint: web ``` - ```yaml tab="YAML" - entryPoints: - web-secure: - address: ":443" - - acme: - email: your-email@your-domain.org - storage: acme.json - dnsChallenge: - provide: xxx - - domains: - - main: "*.mydomain.com" - sans: - - mydomain.com + ```bash tab="CLI" + --entryPoints.web.address=":80" + --entryPoints.websecure.address=":443" + # ... + --certificatesResolvers.sample.acme.email: your-email@your-domain.org + --certificatesResolvers.sample.acme.storage: acme.json + # used during the challenge + --certificatesResolvers.sample.acme.httpChallenge.entryPoint: web ``` ??? note "Configuration Reference" @@ -90,13 +61,17 @@ You can configure Traefik to use an ACME provider (like Let's Encrypt) for autom There are many available options for ACME. For a quick glance at what's possible, browse the configuration reference: - ```toml tab="TOML" + ```toml tab="File (TOML)" --8<-- "content/https/ref-acme.toml" ``` - ```yaml tab="YAML" + ```yaml tab="File (YAML)" --8<-- "content/https/ref-acme.yaml" ``` + + ```bash tab="CLI" + --8<-- "content/https/ref-acme.txt" + ``` ## Automatic Renewals @@ -118,16 +93,25 @@ when using the `TLS-ALPN-01` challenge, Traefik must be reachable by Let's Encry ??? example "Configuring the `tlsChallenge`" - ```toml tab="TOML" - [acme] - [acme.tlsChallenge] + ```toml tab="File (TOML)" + [certificatesResolvers.sample.acme] + # ... + [certificatesResolvers.sample.acme.tlsChallenge] ``` - ```yaml tab="YAML" - acme: - tlsChallenge: {} + ```yaml tab="File (YAML)" + certificatesResolvers: + sample: + acme: + # ... + tlsChallenge: {} ``` + ```bash tab="CLI" + # ... + --certificatesResolvers.sample.acme.tlsChallenge + ``` + ### `httpChallenge` Use the `HTTP-01` challenge to generate and renew ACME certificates by provisioning an HTTP resource under a well-known URI. @@ -137,7 +121,7 @@ when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reac ??? example "Using an EntryPoint Called http for the `httpChallenge`" - ```toml tab="TOML" + ```toml tab="File (TOML)" [entryPoints] [entryPoints.web] address = ":80" @@ -145,13 +129,13 @@ when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reac [entryPoints.web-secure] address = ":443" - [acme] + [certificatesResolvers.sample.acme] # ... - [acme.httpChallenge] + [certificatesResolvers.sample.acme.httpChallenge] entryPoint = "web" ``` - ```yaml tab="YAML" + ```yaml tab="File (YAML)" entryPoints: web: address: ":80" @@ -159,10 +143,19 @@ when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reac web-secure: address: ":443" - acme: - # ... - httpChallenge: - entryPoint: web + certificatesResolvers: + sample: + acme: + # ... + httpChallenge: + entryPoint: web + ``` + + ```bash tab="CLI" + --entryPoints.web.address=":80" + --entryPoints.websecure.address=":443" + # ... + --certificatesResolvers.sample.acme.httpChallenge.entryPoint=web ``` !!! note @@ -174,21 +167,30 @@ Use the `DNS-01` challenge to generate and renew ACME certificates by provisioni ??? example "Configuring a `dnsChallenge` with the DigitalOcean Provider" - ```toml tab="TOML" - [acme] + ```toml tab="File (TOML)" + [certificatesResolvers.sample.acme] # ... - [acme.dnsChallenge] + [certificatesResolvers.sample.acme.dnsChallenge] provider = "digitalocean" delayBeforeCheck = 0 # ... ``` - ```yaml tab="YAML" - acme: - # ... - dnsChallenge: - provider: digitalocean - delayBeforeCheck: 0 + ```yaml tab="File (YAML)" + certificatesResolvers: + sample: + acme: + # ... + dnsChallenge: + provider: digitalocean + delayBeforeCheck: 0 + # ... + ``` + + ```bash tab="CLI" + # ... + --certificatesResolvers.sample.acme.dnsChallenge.provider=digitalocean + --certificatesResolvers.sample.acme.dnsChallenge.delayBeforeCheck=0 # ... ``` @@ -238,7 +240,7 @@ For example, `CF_API_EMAIL_FILE=/run/secrets/traefik_cf-api-email` could be used | [Lightsail](https://aws.amazon.com/lightsail/) | `lightsail` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `DNS_ZONE` | [Additional configuration](https://go-acme.github.io/lego/dns/lightsail) | | [Linode](https://www.linode.com) | `linode` | `LINODE_API_KEY` | [Additional configuration](https://go-acme.github.io/lego/dns/linode) | | [Linode v4](https://www.linode.com) | `linodev4` | `LINODE_TOKEN` | [Additional configuration](https://go-acme.github.io/lego/dns/linodev4) | -| manual | - | none, but you need to run Traefik interactively [^4], turn on `acmeLogging` to see instructions and press Enter. | | +| manual | - | none, but you need to run Traefik interactively [^4], turn on debug log to see instructions and press Enter. | | | [MyDNS.jp](https://www.mydns.jp/) | `mydnsjp` | `MYDNSJP_MASTER_ID`, `MYDNSJP_PASSWORD` | [Additional configuration](https://go-acme.github.io/lego/dns/mydnsjp) | | [Namecheap](https://www.namecheap.com) | `namecheap` | `NAMECHEAP_API_USER`, `NAMECHEAP_API_KEY` | [Additional configuration](https://go-acme.github.io/lego/dns/namecheap) | | [name.com](https://www.name.com/) | `namedotcom` | `NAMECOM_USERNAME`, `NAMECOM_API_TOKEN`, `NAMECOM_SERVER` | [Additional configuration](https://go-acme.github.io/lego/dns/namedotcom) | @@ -276,22 +278,29 @@ 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 tab="TOML" -[acme] +```toml tab="File (TOML)" +[certificatesResolvers.sample.acme] # ... - [acme.dnsChallenge] + [certificatesResolvers.sample.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" +```yaml tab="File (YAML)" +certificatesResolvers: + sample: + acme: + # ... + dnsChallenge: + # ... + resolvers: + - "1.1.1.1:53" + - "8.8.8.8:53" +``` + +```bash tab="CLI" +# ... +--certificatesResolvers.sample.acme.dnsChallenge.resolvers:="1.1.1.1:53,8.8.8.8:53" ``` #### Wildcard Domains @@ -299,140 +308,56 @@ acme: [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 tab="TOML" -[acme] - # ... - [[acme.domains]] - main = "*.local1.com" - sans = ["local1.com"] - -# ... -``` - -```yaml tab="YAML" -acme: - # ... - domains: - - main: "*.local1.com" - sans: - - local1.com - -# ... -``` - -!!! note "Double Wildcard Certificates" - It is not possible to request a double wildcard certificate for a domain (for example `*.*.local.com`). - -Most likely the root domain should receive a certificate too, so it needs to be specified as SAN and 2 `DNS-01` challenges are executed. -In this case the generated DNS TXT record for both domains is the same. -Even though this behavior is [DNS RFC](https://community.letsencrypt.org/t/wildcard-issuance-two-txt-records-for-the-same-name/54528/2) compliant, -it can lead to problems as all DNS providers keep DNS records cached for a given time (TTL) and this TTL can be greater than the challenge timeout making the `DNS-01` challenge fail. - -The Traefik ACME client library [LEGO](https://github.com/go-acme/lego) supports some but not all DNS providers to work around this issue. -The [Supported `provider` table](#providers) indicates if they allow generating certificates for a wildcard domain and its root domain. - -## Known Domains, SANs - -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 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"] -# ... -``` - -```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" -# ... -``` - -!!! important - The certificates for the domains listed in `acme.domains` are negotiated at Traefik startup only. - -!!! note - Wildcard certificates can only be verified through a `DNS-01` challenge. - ## `caServer` ??? example "Using the Let's Encrypt staging server" - ```toml tab="TOML" - [acme] + ```toml tab="File (TOML)" + [certificatesResolvers.sample.acme] # ... caServer = "https://acme-staging-v02.api.letsencrypt.org/directory" # ... ``` - ```yaml tab="YAML" - acme: - # ... - caServer: https://acme-staging-v02.api.letsencrypt.org/directory - # ... + ```yaml tab="File (YAML)" + certificatesResolvers: + sample: + acme: + # ... + caServer: https://acme-staging-v02.api.letsencrypt.org/directory + # ... ``` -## `onHostRule` - -Enable certificate generation on [routers](../routing/routers/index.md) `Host` & `HostSNI` rules. - -This will request a certificate from Let's Encrypt for each router with a Host rule. - -```toml tab="TOML" -[acme] - # ... - onHostRule = true - # ... -``` - -```yaml tab="YAML" -acme: - # ... - onHostRule: true - # ... -``` - -!!! note "Multiple Hosts in a Rule" - The rule `Host(test1.traefik.io,test2.traefik.io)` will request a certificate with the main domain `test1.traefik.io` and SAN `test2.traefik.io`. - -!!! warning - `onHostRule` option can not be used to generate wildcard certificates. Refer to [wildcard generation](#wildcard-domains) for further information. + ```bash tab="CLI" + # ... + --certificatesResolvers.sample.acme.caServer="https://acme-staging-v02.api.letsencrypt.org/directory" + # ... + ``` ## `storage` The `storage` option sets the location where your ACME certificates are saved to. -```toml tab="TOML" -[acme] +```toml tab="File (TOML)" +[certificatesResolvers.sample.acme] # ... storage = "acme.json" # ... ``` -```yaml tab="YAML" -acme - # ... - storage: acme.json - # ... +```toml tab="File (TOML)" +certificatesResolvers: + sample: + acme: + # ... + storage: acme.json + # ... +``` + +```bash tab="CLI" +# ... +--certificatesResolvers.sample.acme.storage=acme.json +# ... ``` The value can refer to some kinds of storage: diff --git a/docs/content/https/ref-acme.toml b/docs/content/https/ref-acme.toml index b3a1fc031..7567470f9 100644 --- a/docs/content/https/ref-acme.toml +++ b/docs/content/https/ref-acme.toml @@ -1,123 +1,89 @@ # Enable ACME (Let's Encrypt): automatic SSL. -[acme] +[certificatesResolvers.sample.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) -# -[acme.tlsChallenge] - -# Use a HTTP-01 ACME challenge. -# -# Optional -# -# [acme.httpChallenge] - - # EntryPoint to use for the HTTP-01 challenges. + # Email address used for registration. # # Required # - # entryPoint = "web" + email = "test@traefik.io" -# Use a DNS-01 ACME challenge rather than HTTP-01 challenge. -# Note: mandatory for wildcard certificate generation. -# -# Optional -# -# [acme.dnsChallenge] - - # DNS provider used. + # File or key used for certificates storage. # # Required # - # provider = "digitalocean" + storage = "acme.json" - # 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. + # CA server to use. + # Uncomment the line to use Let's Encrypt's staging server, + # leave commented to go to prod. # # Optional - # Default: 0 + # Default: "https://acme-v02.api.letsencrypt.org/directory" # - # delayBeforeCheck = 0 + # caServer = "https://acme-staging-v02.api.letsencrypt.org/directory" - # Use following DNS servers to resolve the FQDN authority. + # KeyType to use. # # Optional - # Default: empty + # Default: "RSA4096" # - # resolvers = ["1.1.1.1:53", "8.8.8.8:53"] + # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192" + # + # keyType = "RSA4096" - # Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. + # Use a TLS-ALPN-01 ACME challenge. # - # NOT RECOMMENDED: - # Increase the risk of reaching Let's Encrypt's rate limits. + # Optional (but recommended) + # + [certificatesResolvers.sample.acme.tlsChallenge] + + # Use a HTTP-01 ACME challenge. # # Optional - # Default: false # - # disablePropagationCheck = true + # [certificatesResolvers.sample.acme.httpChallenge] -# Domains list. -# Only domains defined here can generate wildcard certificates. -# The certificates for these domains are negotiated at traefik startup only. -# -# [[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"] \ No newline at end of file + # 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 + # + # [certificatesResolvers.sample.acme.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 diff --git a/docs/content/https/ref-acme.txt b/docs/content/https/ref-acme.txt new file mode 100644 index 000000000..4e9fefc3a --- /dev/null +++ b/docs/content/https/ref-acme.txt @@ -0,0 +1,89 @@ +# Enable ACME (Let's Encrypt): automatic SSL. +--certificatesResolvers.sample.acme + +# Email address used for registration. +# +# Required +# +--certificatesResolvers.sample.acme.email="test@traefik.io" + +# File or key used for certificates storage. +# +# Required +# +--certificatesResolvers.sample.acme.storage="acme.json" + +# 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" +# +--certificatesResolvers.sample.acme.caServer="https://acme-staging-v02.api.letsencrypt.org/directory" + +# KeyType to use. +# +# Optional +# Default: "RSA4096" +# +# Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192" +# +--certificatesResolvers.sample.acme.keyType=RSA4096 + +# Use a TLS-ALPN-01 ACME challenge. +# +# Optional (but recommended) +# +--certificatesResolvers.sample.acme.tlsChallenge + +# Use a HTTP-01 ACME challenge. +# +# Optional +# +--certificatesResolvers.sample.acme.httpChallenge + +# EntryPoint to use for the HTTP-01 challenges. +# +# Required +# +--certificatesResolvers.sample.acme.httpChallenge.entryPoint=web + +# Use a DNS-01 ACME challenge rather than HTTP-01 challenge. +# Note: mandatory for wildcard certificate generation. +# +# Optional +# +--certificatesResolvers.sample.acme.dnsChallenge + +# DNS provider used. +# +# Required +# +--certificatesResolvers.sample.acme.dnsChallenge.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 +# +--certificatesResolvers.sample.acme.dnsChallenge.delayBeforeCheck=0 + +# Use following DNS servers to resolve the FQDN authority. +# +# Optional +# Default: empty +# +--certificatesResolvers.sample.acme.dnsChallenge.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 +# +--certificatesResolvers.sample.acme.dnsChallenge.disablePropagationCheck=true diff --git a/docs/content/https/ref-acme.yaml b/docs/content/https/ref-acme.yaml index 23cd9b7a6..b827e6f06 100644 --- a/docs/content/https/ref-acme.yaml +++ b/docs/content/https/ref-acme.yaml @@ -1,127 +1,93 @@ -# Enable ACME (Let's Encrypt): automatic SSL. -acme: +certificatesResolvers: + sample: + # Enable ACME (Let's Encrypt): automatic SSL. + acme: - # Email address used for registration. - # - # Required - # - email: "test@traefik.io" + # Email address used for registration. + # + # Required + # + email: "test@traefik.io" - # File or key used for certificates storage. - # - # Required - # - storage: "acme.json" + # 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 + # 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" - # If true, override certificates in key-value store when using storeconfig. - # - # Optional - # Default: false - # - # overrideCertificates: true + # KeyType to use. + # + # Optional + # Default: "RSA4096" + # + # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192" + # + # keyType: RSA4096 - # Enable certificate generation on routers host rules. - # - # Optional - # Default: false - # - # onHostRule: true + # Use a TLS-ALPN-01 ACME challenge. + # + # Optional (but recommended) + # + tlsChallenge: - # 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" + # Use a HTTP-01 ACME challenge. + # + # Optional + # + # httpChallenge: - # KeyType to use. - # - # Optional - # Default: "RSA4096" - # - # Available values : "EC256", "EC384", "RSA2048", "RSA4096", "RSA8192" - # - # KeyType: RSA4096 + # EntryPoint to use for the HTTP-01 challenges. + # + # Required + # + # entryPoint: web - # Use a TLS-ALPN-01 ACME challenge. - # - # Optional (but recommended) - # - tlsChallenge: + # Use a DNS-01 ACME challenge rather than HTTP-01 challenge. + # Note: mandatory for wildcard certificate generation. + # + # Optional + # + # dnsChallenge: - # Use a HTTP-01 ACME challenge. - # - # Optional - # - # httpChallenge: + # DNS provider used. + # + # Required + # + # provider: digitalocean - # EntryPoint to use for the HTTP-01 challenges. - # - # Required - # - # entryPoint: web + # 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 a DNS-01 ACME challenge rather than HTTP-01 challenge. - # Note: mandatory for wildcard certificate generation. - # - # Optional - # - # dnsChallenge: + # Use following DNS servers to resolve the FQDN authority. + # + # Optional + # Default: empty + # + # resolvers + # - "1.1.1.1:53" + # - "8.8.8.8:53" - # 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" + # 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 diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index e33c5e4ca..2e9069e2f 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -36,60 +36,6 @@ Keep access logs with status codes in the specified range. `--accesslog.format`: Access log format: json | common (Default: ```common```) -`--acme.acmelogging`: -Enable debug logging of ACME actions. (Default: ```false```) - -`--acme.caserver`: -CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) - -`--acme.dnschallenge`: -Activate DNS-01 Challenge. (Default: ```false```) - -`--acme.dnschallenge.delaybeforecheck`: -Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) - -`--acme.dnschallenge.disablepropagationcheck`: -Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) - -`--acme.dnschallenge.provider`: -Use a DNS-01 based challenge provider rather than HTTPS. - -`--acme.dnschallenge.resolvers`: -Use following DNS servers to resolve the FQDN authority. - -`--acme.domains`: -The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge. - -`--acme.domains[n].main`: -Default subject name. - -`--acme.domains[n].sans`: -Subject alternative names. - -`--acme.email`: -Email address used for registration. - -`--acme.entrypoint`: -EntryPoint to use. - -`--acme.httpchallenge`: -Activate HTTP-01 Challenge. (Default: ```false```) - -`--acme.httpchallenge.entrypoint`: -HTTP challenge EntryPoint - -`--acme.keytype`: -KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) - -`--acme.onhostrule`: -Enable certificate generation on router Host rules. (Default: ```false```) - -`--acme.storage`: -Storage to use. (Default: ```acme.json```) - -`--acme.tlschallenge`: -Activate TLS-ALPN-01 Challenge. (Default: ```true```) - `--api`: Enable api/dashboard. (Default: ```false```) @@ -111,6 +57,45 @@ Enable more detailed statistics. (Default: ```false```) `--api.statistics.recenterrors`: Number of recent errors logged. (Default: ```10```) +`--certificatesresolvers.`: +Certificates resolvers configuration. (Default: ```false```) + +`--certificatesresolvers..acme.caserver`: +CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) + +`--certificatesresolvers..acme.dnschallenge`: +Activate DNS-01 Challenge. (Default: ```false```) + +`--certificatesresolvers..acme.dnschallenge.delaybeforecheck`: +Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) + +`--certificatesresolvers..acme.dnschallenge.disablepropagationcheck`: +Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) + +`--certificatesresolvers..acme.dnschallenge.provider`: +Use a DNS-01 based challenge provider rather than HTTPS. + +`--certificatesresolvers..acme.dnschallenge.resolvers`: +Use following DNS servers to resolve the FQDN authority. + +`--certificatesresolvers..acme.email`: +Email address used for registration. + +`--certificatesresolvers..acme.httpchallenge`: +Activate HTTP-01 Challenge. (Default: ```false```) + +`--certificatesresolvers..acme.httpchallenge.entrypoint`: +HTTP challenge EntryPoint + +`--certificatesresolvers..acme.keytype`: +KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) + +`--certificatesresolvers..acme.storage`: +Storage to use. (Default: ```acme.json```) + +`--certificatesresolvers..acme.tlschallenge`: +Activate TLS-ALPN-01 Challenge. (Default: ```true```) + `--entrypoints.`: Entry points definition. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index 52f921d1b..c1d8a8397 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -36,60 +36,6 @@ Keep access logs with status codes in the specified range. `TRAEFIK_ACCESSLOG_FORMAT`: Access log format: json | common (Default: ```common```) -`TRAEFIK_ACME_ACMELOGGING`: -Enable debug logging of ACME actions. (Default: ```false```) - -`TRAEFIK_ACME_CASERVER`: -CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) - -`TRAEFIK_ACME_DNSCHALLENGE`: -Activate DNS-01 Challenge. (Default: ```false```) - -`TRAEFIK_ACME_DNSCHALLENGE_DELAYBEFORECHECK`: -Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) - -`TRAEFIK_ACME_DNSCHALLENGE_DISABLEPROPAGATIONCHECK`: -Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) - -`TRAEFIK_ACME_DNSCHALLENGE_PROVIDER`: -Use a DNS-01 based challenge provider rather than HTTPS. - -`TRAEFIK_ACME_DNSCHALLENGE_RESOLVERS`: -Use following DNS servers to resolve the FQDN authority. - -`TRAEFIK_ACME_DOMAINS`: -The list of domains for which certificates are generated on startup. Wildcard domains only accepted with DNSChallenge. - -`TRAEFIK_ACME_DOMAINS[n]_MAIN`: -Default subject name. - -`TRAEFIK_ACME_DOMAINS[n]_SANS`: -Subject alternative names. - -`TRAEFIK_ACME_EMAIL`: -Email address used for registration. - -`TRAEFIK_ACME_ENTRYPOINT`: -EntryPoint to use. - -`TRAEFIK_ACME_HTTPCHALLENGE`: -Activate HTTP-01 Challenge. (Default: ```false```) - -`TRAEFIK_ACME_HTTPCHALLENGE_ENTRYPOINT`: -HTTP challenge EntryPoint - -`TRAEFIK_ACME_KEYTYPE`: -KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) - -`TRAEFIK_ACME_ONHOSTRULE`: -Enable certificate generation on router Host rules. (Default: ```false```) - -`TRAEFIK_ACME_STORAGE`: -Storage to use. (Default: ```acme.json```) - -`TRAEFIK_ACME_TLSCHALLENGE`: -Activate TLS-ALPN-01 Challenge. (Default: ```true```) - `TRAEFIK_API`: Enable api/dashboard. (Default: ```false```) @@ -111,6 +57,45 @@ Enable more detailed statistics. (Default: ```false```) `TRAEFIK_API_STATISTICS_RECENTERRORS`: Number of recent errors logged. (Default: ```10```) +`TRAEFIK_CERTIFICATESRESOLVERS_`: +Certificates resolvers configuration. (Default: ```false```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_CASERVER`: +CA server to use. (Default: ```https://acme-v02.api.letsencrypt.org/directory```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_DNSCHALLENGE`: +Activate DNS-01 Challenge. (Default: ```false```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_DNSCHALLENGE_DELAYBEFORECHECK`: +Assume DNS propagates after a delay in seconds rather than finding and querying nameservers. (Default: ```0```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_DNSCHALLENGE_DISABLEPROPAGATIONCHECK`: +Disable the DNS propagation checks before notifying ACME that the DNS challenge is ready. [not recommended] (Default: ```false```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_DNSCHALLENGE_PROVIDER`: +Use a DNS-01 based challenge provider rather than HTTPS. + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_DNSCHALLENGE_RESOLVERS`: +Use following DNS servers to resolve the FQDN authority. + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_EMAIL`: +Email address used for registration. + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_HTTPCHALLENGE`: +Activate HTTP-01 Challenge. (Default: ```false```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_HTTPCHALLENGE_ENTRYPOINT`: +HTTP challenge EntryPoint + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_KEYTYPE`: +KeyType used for generating certificate private key. Allow value 'EC256', 'EC384', 'RSA2048', 'RSA4096', 'RSA8192'. (Default: ```RSA4096```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_STORAGE`: +Storage to use. (Default: ```acme.json```) + +`TRAEFIK_CERTIFICATESRESOLVERS__ACME_TLSCHALLENGE`: +Activate TLS-ALPN-01 Challenge. (Default: ```true```) + `TRAEFIK_ENTRYPOINTS_`: Entry points definition. (Default: ```false```) diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index 4301d8d56..62f07e451 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -221,12 +221,10 @@ [acme] email = "foobar" - acmeLogging = true caServer = "foobar" storage = "foobar" entryPoint = "foobar" keyType = "foobar" - onHostRule = true [acme.dnsChallenge] provider = "foobar" delayBeforeCheck = 42 diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index 0f415c348..bfb44c68e 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -230,12 +230,10 @@ hostResolver: resolvDepth: 42 acme: email: foobar - acmeLogging: true caServer: foobar storage: foobar entryPoint: foobar keyType: foobar - onHostRule: true dnsChallenge: provider: foobar delayBeforeCheck: 42 diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 5a3d09987..2f23af18b 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -325,9 +325,9 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted service: service-id ``` -#### `Options` +#### `options` -The `Options` field enables fine-grained control of the TLS parameters. +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. !!! note "Server Name Association" @@ -384,13 +384,13 @@ It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied [http.routers.routerfoo] rule = "Host(`snitest.com`) && Path(`/foo`)" [http.routers.routerfoo.tls] - options="foo" + options = "foo" [http.routers] [http.routers.routerbar] rule = "Host(`snitest.com`) && Path(`/bar`)" [http.routers.routerbar.tls] - options="bar" + options = "bar" ``` ```yaml tab="YAML" @@ -409,6 +409,76 @@ It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied If that happens, both mappings are discarded, and the host name (`snitest.com` in this case) for these routers gets associated with the default TLS options instead. +#### `certResolver` + +If `certResolver` is defined, Traefik will try to generate certificates based on routers `Host` & `HostSNI` rules. + +```toml tab="TOML" +[http.routers] + [http.routers.routerfoo] + rule = "Host(`snitest.com`) && Path(`/foo`)" + [http.routers.routerfoo.tls] + certResolver = "foo" +``` + +```yaml tab="YAML" +http: + routers: + routerfoo: + rule: "Host(`snitest.com`) && Path(`/foo`)" + tls: + certResolver: foo +``` + +!!! note "Multiple Hosts in a Rule" + The rule `Host(test1.traefik.io,test2.traefik.io)` will request a certificate with the main domain `test1.traefik.io` and SAN `test2.traefik.io`. + +#### `domains` + +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 tab="TOML" +[http.routers] + [http.routers.routerbar] + rule = "Host(`snitest.com`) && Path(`/bar`)" + [http.routers.routerbar.tls] + certResolver = "bar" + [[http.routers.routerbar.tls.domains]] + main = "snitest.com" + sans = "*.snitest.com" +``` + +```yaml tab="YAML" +http: + routers: + routerbar: + rule: "Host(`snitest.com`) && Path(`/bar`)" + tls: + certResolver: "bar" + domains: + - main: "snitest.com" + sans: "*.snitest.com" +``` + +[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](./../../https/acme.md#dnschallenge). + +Most likely the root domain should receive a certificate too, so it needs to be specified as SAN and 2 `DNS-01` challenges are executed. +In this case the generated DNS TXT record for both domains is the same. +Even though this behavior is [DNS RFC](https://community.letsencrypt.org/t/wildcard-issuance-two-txt-records-for-the-same-name/54528/2) compliant, +it can lead to problems as all DNS providers keep DNS records cached for a given time (TTL) and this TTL can be greater than the challenge timeout making the `DNS-01` challenge fail. + +The Traefik ACME client library [LEGO](https://github.com/go-acme/lego) supports some but not all DNS providers to work around this issue. +The [Supported `provider` table](./../../https/acme.md#providers) indicates if they allow generating certificates for a wildcard domain and its root domain. + +!!! note + Wildcard certificates can only be verified through a `DNS-01` challenge. + +!!! note "Double Wildcard Certificates" + It is not possible to request a double wildcard certificate for a domain (for example `*.*.local.com`). + ## Configuring TCP Routers ### General @@ -593,9 +663,9 @@ Services are the target for the router. In the current version, with [ACME](../../https/acme.md) enabled, automatic certificate generation will apply to every router declaring a TLS section. -#### `Options` +#### `options` -The `Options` field enables fine-grained control of the TLS parameters. +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 `HostSNI` rule is defined. ??? example "Configuring the tls options" @@ -636,3 +706,51 @@ It refers to a [TLS Options](../../https/tls.md#tls-options) and will be applied - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" - "TLS_RSA_WITH_AES_256_GCM_SHA384" ``` + +#### `certResolver` + +See [`certResolver` for HTTP router](./index.md#certresolver) for more information. + +```toml tab="TOML" +[tcp.routers] + [tcp.routers.routerfoo] + rule = "HostSNI(`snitest.com`)" + [tcp.routers.routerfoo.tls] + certResolver = "foo" +``` + +```yaml tab="YAML" +tcp: + routers: + routerfoo: + rule: "HostSNI(`snitest.com`)" + tls: + certResolver: foo +``` + +#### `domains` + +See [`domains` for HTTP router](./index.md#domains) for more information. + +```toml tab="TOML" +[tcp.routers] + [tcp.routers.routerbar] + rule = "HostSNI(`snitest.com`)" + [tcp.routers.routerbar.tls] + certResolver = "bar" + [[tcp.routers.routerbar.tls.domains]] + main = "snitest.com" + sans = "*.snitest.com" +``` + +```yaml tab="YAML" +tcp: + routers: + routerbar: + rule: "HostSNI(`snitest.com`)" + tls: + certResolver: "bar" + domains: + - main: "snitest.com" + sans: "*.snitest.com" +``` diff --git a/docs/content/user-guides/crd-acme/03-deployments.yml b/docs/content/user-guides/crd-acme/03-deployments.yml index 822d2bf41..d3b436bcd 100644 --- a/docs/content/user-guides/crd-acme/03-deployments.yml +++ b/docs/content/user-guides/crd-acme/03-deployments.yml @@ -33,16 +33,13 @@ spec: - --entrypoints.web.Address=:8000 - --entrypoints.websecure.Address=:4443 - --providers.kubernetescrd - - --acme - - --acme.acmelogging - - --acme.tlschallenge - - --acme.onhostrule - - --acme.email=foo@you.com - - --acme.entrypoint=websecure - - --acme.storage=acme.json + - --certificatesresolvers.default.acme.tlschallenge + - --certificatesresolvers.default.acme.email=foo@you.com + - --certificatesresolvers.default.acme.entrypoint=websecure + - --certificatesresolvers.default.acme.storage=acme.json # Please note that this is the staging Let's Encrypt server. # Once you get things working, you should remove that whole line altogether. - - --acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory + - --certificatesresolvers.default.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory ports: - name: web containerPort: 8000 diff --git a/docs/content/user-guides/crd-acme/04-ingressroutes.yml b/docs/content/user-guides/crd-acme/04-ingressroutes.yml index 04baed826..dae1bce30 100644 --- a/docs/content/user-guides/crd-acme/04-ingressroutes.yml +++ b/docs/content/user-guides/crd-acme/04-ingressroutes.yml @@ -26,5 +26,5 @@ spec: services: - name: whoami port: 80 - # Please note the use of an empty TLS object to enable TLS with Let's Encrypt. - tls: {} + tls: + certResolver: default diff --git a/integration/acme_test.go b/integration/acme_test.go index 6b72a95f8..23c774b6b 100644 --- a/integration/acme_test.go +++ b/integration/acme_test.go @@ -11,6 +11,7 @@ import ( "time" "github.com/containous/traefik/integration/try" + "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/provider/acme" "github.com/containous/traefik/pkg/testhelpers" "github.com/containous/traefik/pkg/types" @@ -26,17 +27,23 @@ type AcmeSuite struct { fakeDNSServer *dns.Server } +type subCases struct { + host string + expectedCommonName string + expectedAlgorithm x509.PublicKeyAlgorithm +} + type acmeTestCase struct { template templateModel traefikConfFilePath string - expectedCommonName string - expectedAlgorithm x509.PublicKeyAlgorithm + subCases []subCases } type templateModel struct { + Domains []types.Domain PortHTTP string PortHTTPS string - Acme acme.Configuration + Acme map[string]static.CertificateResolver } const ( @@ -120,40 +127,48 @@ func (s *AcmeSuite) TearDownSuite(c *check.C) { } } -func (s *AcmeSuite) TestHTTP01DomainsAtStart(c *check.C) { - c.Skip("We need to fix DefaultCertificate at start") +func (s *AcmeSuite) TestHTTP01Domains(c *check.C) { testCase := acmeTestCase{ - traefikConfFilePath: "fixtures/acme/acme_base.toml", + traefikConfFilePath: "fixtures/acme/acme_domains.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - Domains: types.Domains{types.Domain{ - Main: "traefik.acme.wtf", + Domains: []types.Domain{{ + Main: "traefik.acme.wtf", + }}, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) } -func (s *AcmeSuite) TestHTTP01DomainsInSANAtStart(c *check.C) { - c.Skip("We need to fix DefaultCertificate at start") +func (s *AcmeSuite) TestHTTP01DomainsInSAN(c *check.C) { testCase := acmeTestCase{ - traefikConfFilePath: "fixtures/acme/acme_base.toml", + traefikConfFilePath: "fixtures/acme/acme_domains.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: "acme.wtf", + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - Domains: types.Domains{types.Domain{ - Main: "acme.wtf", - SANs: []string{"traefik.acme.wtf"}, + Domains: []types.Domain{{ + Main: "acme.wtf", + SANs: []string{"traefik.acme.wtf"}, + }}, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, }}, }, }, - expectedCommonName: "acme.wtf", - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) @@ -162,14 +177,49 @@ func (s *AcmeSuite) TestHTTP01DomainsInSANAtStart(c *check.C) { func (s *AcmeSuite) TestHTTP01OnHostRule(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_base.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + }}, + }, + }, + } + + s.retrieveAcmeCertificate(c, testCase) +} + +func (s *AcmeSuite) TestMultipleResolver(c *check.C) { + testCase := acmeTestCase{ + traefikConfFilePath: "fixtures/acme/acme_multiple_resolvers.toml", + subCases: []subCases{ + { + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }, + { + host: "tchouk.acme.wtf", + expectedCommonName: "tchouk.acme.wtf", + expectedAlgorithm: x509.ECDSA, + }, + }, + template: templateModel{ + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + }}, + "tchouk": {ACME: &acme.Configuration{ + TLSChallenge: &acme.TLSChallenge{}, + KeyType: "EC256", + }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) @@ -178,15 +228,19 @@ func (s *AcmeSuite) TestHTTP01OnHostRule(c *check.C) { func (s *AcmeSuite) TestHTTP01OnHostRuleECDSA(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_base.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.ECDSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, - KeyType: "EC384", + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + KeyType: "EC384", + }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.ECDSA, } s.retrieveAcmeCertificate(c, testCase) @@ -195,31 +249,39 @@ func (s *AcmeSuite) TestHTTP01OnHostRuleECDSA(c *check.C) { func (s *AcmeSuite) TestHTTP01OnHostRuleInvalidAlgo(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_base.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, - KeyType: "INVALID", + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + KeyType: "INVALID", + }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) } -func (s *AcmeSuite) TestHTTP01OnHostRuleStaticCertificatesWithWildcard(c *check.C) { +func (s *AcmeSuite) TestHTTP01OnHostRuleDefaultDynamicCertificatesWithWildcard(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_tls.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: wildcardDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + }}, }, }, - expectedCommonName: wildcardDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) @@ -228,14 +290,38 @@ func (s *AcmeSuite) TestHTTP01OnHostRuleStaticCertificatesWithWildcard(c *check. func (s *AcmeSuite) TestHTTP01OnHostRuleDynamicCertificatesWithWildcard(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_tls_dynamic.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: wildcardDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + }}, + }, + }, + } + + s.retrieveAcmeCertificate(c, testCase) +} + +func (s *AcmeSuite) TestTLSALPN01OnHostRuleTCP(c *check.C) { + testCase := acmeTestCase{ + traefikConfFilePath: "fixtures/acme/acme_tcp.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, + template: templateModel{ + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + TLSChallenge: &acme.TLSChallenge{}, + }}, }, }, - expectedCommonName: wildcardDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) @@ -244,72 +330,65 @@ func (s *AcmeSuite) TestHTTP01OnHostRuleDynamicCertificatesWithWildcard(c *check func (s *AcmeSuite) TestTLSALPN01OnHostRule(c *check.C) { testCase := acmeTestCase{ traefikConfFilePath: "fixtures/acme/acme_base.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - TLSChallenge: &acme.TLSChallenge{}, - OnHostRule: true, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + TLSChallenge: &acme.TLSChallenge{}, + }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) } -func (s *AcmeSuite) TestTLSALPN01DomainsAtStart(c *check.C) { - c.Skip("We need to fix DefaultCertificate at start") +func (s *AcmeSuite) TestTLSALPN01Domains(c *check.C) { testCase := acmeTestCase{ - traefikConfFilePath: "fixtures/acme/acme_base.toml", + traefikConfFilePath: "fixtures/acme/acme_domains.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: acmeDomain, + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - TLSChallenge: &acme.TLSChallenge{}, - Domains: types.Domains{types.Domain{ - Main: "traefik.acme.wtf", + Domains: []types.Domain{{ + Main: "traefik.acme.wtf", + }}, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + TLSChallenge: &acme.TLSChallenge{}, }}, }, }, - expectedCommonName: acmeDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) } -func (s *AcmeSuite) TestTLSALPN01DomainsInSANAtStart(c *check.C) { - c.Skip("We need to fix DefaultCertificate at start") +func (s *AcmeSuite) TestTLSALPN01DomainsInSAN(c *check.C) { testCase := acmeTestCase{ - traefikConfFilePath: "fixtures/acme/acme_base.toml", + traefikConfFilePath: "fixtures/acme/acme_domains.toml", + subCases: []subCases{{ + host: acmeDomain, + expectedCommonName: "acme.wtf", + expectedAlgorithm: x509.RSA, + }}, template: templateModel{ - Acme: acme.Configuration{ - TLSChallenge: &acme.TLSChallenge{}, - Domains: types.Domains{types.Domain{ - Main: "acme.wtf", - SANs: []string{"traefik.acme.wtf"}, + Domains: []types.Domain{{ + Main: "acme.wtf", + SANs: []string{"traefik.acme.wtf"}, + }}, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + TLSChallenge: &acme.TLSChallenge{}, }}, }, }, - expectedCommonName: "acme.wtf", - expectedAlgorithm: x509.RSA, - } - - s.retrieveAcmeCertificate(c, testCase) -} - -func (s *AcmeSuite) TestTLSALPN01DomainsWithProvidedWildcardDomainAtStart(c *check.C) { - c.Skip("We need to fix DefaultCertificate at start") - testCase := acmeTestCase{ - traefikConfFilePath: "fixtures/acme/acme_tls.toml", - template: templateModel{ - Acme: acme.Configuration{ - TLSChallenge: &acme.TLSChallenge{}, - Domains: types.Domains{types.Domain{ - Main: acmeDomain, - }}, - }, - }, - expectedCommonName: wildcardDomain, - expectedAlgorithm: x509.RSA, } s.retrieveAcmeCertificate(c, testCase) @@ -318,10 +397,11 @@ func (s *AcmeSuite) TestTLSALPN01DomainsWithProvidedWildcardDomainAtStart(c *che // Test Let's encrypt down func (s *AcmeSuite) TestNoValidLetsEncryptServer(c *check.C) { file := s.adaptFile(c, "fixtures/acme/acme_base.toml", templateModel{ - Acme: acme.Configuration{ - CAServer: "http://wrongurl:4001/directory", - HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, - OnHostRule: true, + Acme: map[string]static.CertificateResolver{ + "default": {ACME: &acme.Configuration{ + CAServer: "http://wrongurl:4001/directory", + HTTPChallenge: &acme.HTTPChallenge{EntryPoint: "web"}, + }}, }, }) defer os.Remove(file) @@ -347,8 +427,10 @@ func (s *AcmeSuite) retrieveAcmeCertificate(c *check.C, testCase acmeTestCase) { testCase.template.PortHTTPS = ":5001" } - if len(testCase.template.Acme.CAServer) == 0 { - testCase.template.Acme.CAServer = s.getAcmeURL() + for _, value := range testCase.template.Acme { + if len(value.ACME.CAServer) == 0 { + value.ACME.CAServer = s.getAcmeURL() + } } file := s.adaptFile(c, testCase.traefikConfFilePath, testCase.template) @@ -365,57 +447,59 @@ func (s *AcmeSuite) retrieveAcmeCertificate(c *check.C, testCase acmeTestCase) { backend := startTestServer("9010", http.StatusOK) defer backend.Close() - client := &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - }, - } - - // wait for traefik (generating acme account take some seconds) - err = try.Do(90*time.Second, func() error { - _, errGet := client.Get("https://127.0.0.1:5001") - return errGet - }) - c.Assert(err, checker.IsNil) - - client = &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - ServerName: acmeDomain, + for _, sub := range testCase.subCases { + client := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, - }, + } + + // wait for traefik (generating acme account take some seconds) + err = try.Do(60*time.Second, func() error { + _, errGet := client.Get("https://127.0.0.1:5001") + return errGet + }) + c.Assert(err, checker.IsNil) + + client = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, + ServerName: sub.host, + }, + }, + } + + req := testhelpers.MustNewRequest(http.MethodGet, "https://127.0.0.1:5001/", nil) + req.Host = sub.host + req.Header.Set("Host", sub.host) + req.Header.Set("Accept", "*/*") + + var resp *http.Response + + // Retry to send a Request which uses the LE generated certificate + err = try.Do(60*time.Second, func() error { + resp, err = client.Do(req) + + // /!\ If connection is not closed, SSLHandshake will only be done during the first trial /!\ + req.Close = true + + if err != nil { + return err + } + + cn := resp.TLS.PeerCertificates[0].Subject.CommonName + if cn != sub.expectedCommonName { + return fmt.Errorf("domain %s found instead of %s", cn, sub.expectedCommonName) + } + + return nil + }) + + c.Assert(err, checker.IsNil) + c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) + // Check Domain into response certificate + c.Assert(resp.TLS.PeerCertificates[0].Subject.CommonName, checker.Equals, sub.expectedCommonName) + c.Assert(resp.TLS.PeerCertificates[0].PublicKeyAlgorithm, checker.Equals, sub.expectedAlgorithm) } - - req := testhelpers.MustNewRequest(http.MethodGet, "https://127.0.0.1:5001/", nil) - req.Host = acmeDomain - req.Header.Set("Host", acmeDomain) - req.Header.Set("Accept", "*/*") - - var resp *http.Response - - // Retry to send a Request which uses the LE generated certificate - err = try.Do(60*time.Second, func() error { - resp, err = client.Do(req) - - // /!\ If connection is not closed, SSLHandshake will only be done during the first trial /!\ - req.Close = true - - if err != nil { - return err - } - - cn := resp.TLS.PeerCertificates[0].Subject.CommonName - if cn != testCase.expectedCommonName { - return fmt.Errorf("domain %s found instead of %s", cn, testCase.expectedCommonName) - } - - return nil - }) - - c.Assert(err, checker.IsNil) - c.Assert(resp.StatusCode, checker.Equals, http.StatusOK) - // Check Domain into response certificate - c.Assert(resp.TLS.PeerCertificates[0].Subject.CommonName, checker.Equals, testCase.expectedCommonName) - c.Assert(resp.TLS.PeerCertificates[0].PublicKeyAlgorithm, checker.Equals, testCase.expectedAlgorithm) } diff --git a/integration/fixtures/acme/acme_base.toml b/integration/fixtures/acme/acme_base.toml index ee2755545..ae8b2be83 100644 --- a/integration/fixtures/acme/acme_base.toml +++ b/integration/fixtures/acme/acme_base.toml @@ -11,31 +11,24 @@ [entryPoints.web-secure] address = "{{ .PortHTTPS }}" -[acme] +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] email = "test@traefik.io" storage = "/tmp/acme.json" - # entryPoint = "https" - acmeLogging = true - onHostRule = {{ .Acme.OnHostRule }} - keyType = "{{ .Acme.KeyType }}" - caServer = "{{ .Acme.CAServer }}" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" - {{if .Acme.HTTPChallenge }} - [acme.httpChallenge] - entryPoint = "{{ .Acme.HTTPChallenge.EntryPoint }}" + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" {{end}} - {{if .Acme.TLSChallenge }} - [acme.tlsChallenge] + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] {{end}} - {{range .Acme.Domains}} - [[acme.domains]] - main = "{{ .Main }}" - sans = [{{range .SANs }} - "{{.}}", - {{end}}] - {{end}} +{{end}} [api] @@ -55,3 +48,4 @@ rule = "Host(`traefik.acme.wtf`)" service = "test" [http.routers.test.tls] + certResolver = "default" diff --git a/integration/fixtures/acme/acme_domains.toml b/integration/fixtures/acme/acme_domains.toml new file mode 100644 index 000000000..72f047acf --- /dev/null +++ b/integration/fixtures/acme/acme_domains.toml @@ -0,0 +1,58 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web] + address = "{{ .PortHTTP }}" + [entryPoints.web-secure] + address = "{{ .PortHTTPS }}" + +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] + email = "test@traefik.io" + storage = "/tmp/acme.json" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" + + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" + {{end}} + + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] + {{end}} + +{{end}} + +[api] + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[http.services] + [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 = "PathPrefix(`/`)" + service = "test" + [http.routers.test.tls] + certResolver = "default" +{{range .Domains}} + [[http.routers.test.tls.domains]] + main = "{{ .Main }}" + sans = [{{range .SANs }} + "{{.}}", + {{end}}] +{{end}} diff --git a/integration/fixtures/acme/acme_multiple_resolvers.toml b/integration/fixtures/acme/acme_multiple_resolvers.toml new file mode 100644 index 000000000..73313d3f3 --- /dev/null +++ b/integration/fixtures/acme/acme_multiple_resolvers.toml @@ -0,0 +1,58 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web] + address = "{{ .PortHTTP }}" + [entryPoints.web-secure] + address = "{{ .PortHTTPS }}" + +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] + email = "test@traefik.io" + storage = "/tmp/acme.json" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" + + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" + {{end}} + + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] + {{end}} + +{{end}} + +[api] + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[http.services] + [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] + certResolver = "default" + + [http.routers.tchouk] + entryPoints = ["web-secure"] + rule = "Host(`tchouk.acme.wtf`)" + service = "test" + [http.routers.tchouk.tls] + certResolver = "tchouk" diff --git a/integration/fixtures/acme/acme_tcp.toml b/integration/fixtures/acme/acme_tcp.toml new file mode 100644 index 000000000..c016a4139 --- /dev/null +++ b/integration/fixtures/acme/acme_tcp.toml @@ -0,0 +1,51 @@ +[global] + checkNewVersion = false + sendAnonymousUsage = false + +[log] + level = "DEBUG" + +[entryPoints] + [entryPoints.web] + address = "{{ .PortHTTP }}" + [entryPoints.web-secure] + address = "{{ .PortHTTPS }}" + +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] + email = "test@traefik.io" + storage = "/tmp/acme.json" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" + + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" + {{end}} + + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] + {{end}} + +{{end}} + +[api] + +[providers.file] + filename = "{{ .SelfFilename }}" + +## dynamic configuration ## + +[tcp.services] + [tcp.services.test.loadBalancer] + [[tcp.services.test.loadBalancer.servers]] + address = "127.0.0.1:9010" + +[tcp.routers] + [tcp.routers.test] + entryPoints = ["web-secure"] + rule = "HostSNI(`traefik.acme.wtf`)" + service = "test" + [tcp.routers.test.tls] + certResolver = "default" diff --git a/integration/fixtures/acme/acme_tls.toml b/integration/fixtures/acme/acme_tls.toml index 7addd0731..2319974bd 100644 --- a/integration/fixtures/acme/acme_tls.toml +++ b/integration/fixtures/acme/acme_tls.toml @@ -11,31 +11,24 @@ [entryPoints.web-secure] address = "{{ .PortHTTPS }}" -[acme] +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] email = "test@traefik.io" storage = "/tmp/acme.json" -# entryPoint = "https" - acmeLogging = true - onHostRule = {{ .Acme.OnHostRule }} - keyType = "{{ .Acme.KeyType }}" - caServer = "{{ .Acme.CAServer }}" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" - {{if .Acme.HTTPChallenge }} - [acme.httpChallenge] - entryPoint = "{{ .Acme.HTTPChallenge.EntryPoint }}" + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" {{end}} - {{if .Acme.TLSChallenge }} - [acme.tlsChallenge] + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] {{end}} - {{range .Acme.Domains}} - [[acme.domains]] - main = "{{ .Main }}" - sans = [{{range .SANs }} - "{{.}}", - {{end}}] - {{end}} +{{end}} [api] diff --git a/integration/fixtures/acme/acme_tls_dynamic.toml b/integration/fixtures/acme/acme_tls_dynamic.toml index a538796ba..eac99adc1 100644 --- a/integration/fixtures/acme/acme_tls_dynamic.toml +++ b/integration/fixtures/acme/acme_tls_dynamic.toml @@ -7,32 +7,29 @@ [entryPoints] [entryPoints.web] - address = "{{ .PortHTTP }}" + address = "{{ .PortHTTP }}" [entryPoints.web-secure] - address = "{{ .PortHTTPS }}" + address = "{{ .PortHTTPS }}" -[acme] +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] email = "test@traefik.io" storage = "/tmp/acme.json" -# entryPoint = "https" - acmeLogging = true - onHostRule = {{ .Acme.OnHostRule }} - keyType = "{{ .Acme.KeyType }}" - caServer = "{{ .Acme.CAServer }}" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" - {{if .Acme.HTTPChallenge }} - [acme.httpChallenge] - entryPoint = "{{ .Acme.HTTPChallenge.EntryPoint }}" + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" {{end}} - {{range .Acme.Domains}} - [[acme.domains]] - main = "{{ .Main }}" - sans = [{{range .SANs }} - "{{.}}", - {{end}}] + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] {{end}} +{{end}} + [api] [providers] diff --git a/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml b/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml index 757414ee4..f4601b695 100644 --- a/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml +++ b/integration/fixtures/acme/acme_tls_multiple_entrypoints.toml @@ -8,42 +8,29 @@ [entryPoints] [entryPoints.web] address = "{{ .PortHTTP }}" - [entryPoints.web-secure] address = "{{ .PortHTTPS }}" [entryPoints.traefik] address = ":9000" -# FIXME -# [entryPoints.traefik.tls] -# [entryPoints.traefik.tls.defaultCertificate] -# certFile = "fixtures/acme/ssl/wildcard.crt" -# keyFile = "fixtures/acme/ssl/wildcard.key" -[acme] +{{range $name, $resolvers := .Acme }} + +[certificatesResolvers.{{ $name }}.acme] email = "test@traefik.io" storage = "/tmp/acme.json" -# entryPoint = "https" - acmeLogging = true - onHostRule = {{ .Acme.OnHostRule }} - keyType = "{{ .Acme.KeyType }}" - caServer = "{{ .Acme.CAServer }}" + keyType = "{{ $resolvers.ACME.KeyType }}" + caServer = "{{ $resolvers.ACME.CAServer }}" - {{if .Acme.HTTPChallenge }} - [acme.httpChallenge] - entryPoint = "{{ .Acme.HTTPChallenge.EntryPoint }}" + {{if $resolvers.ACME.HTTPChallenge }} + [certificatesResolvers.{{ $name }}.acme.httpChallenge] + entryPoint = "{{ $resolvers.ACME.HTTPChallenge.EntryPoint }}" {{end}} - {{if .Acme.TLSChallenge }} - [acme.tlsChallenge] + {{if $resolvers.ACME.TLSChallenge }} + [certificatesResolvers.{{ $name }}.acme.tlsChallenge] {{end}} - {{range .Acme.Domains}} - [[acme.domains]] - main = "{{ .Main }}" - sans = [{{range .SANs }} - "{{.}}", - {{end}}] - {{end}} +{{end}} [api] diff --git a/integration/https_test.go b/integration/https_test.go index 07c74f229..5da57cd61 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -265,7 +265,7 @@ func (s *HTTPSSuite) TestWithConflictingTLSOptions(c *check.C) { c.Assert(err.Error(), checker.Contains, "protocol version not supported") // with unknown tls option - err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains(fmt.Sprintf("found different TLS options for routers on the same host %v, so using the default TLS option instead", tr4.TLSClientConfig.ServerName))) + err = try.GetRequest("http://127.0.0.1:8080/api/rawdata", 1*time.Second, try.BodyContains(fmt.Sprintf("found different TLS options for routers on the same host %v, so using the default TLS options instead", tr4.TLSClientConfig.ServerName))) c.Assert(err, checker.IsNil) } diff --git a/integration/simple_test.go b/integration/simple_test.go index b7309d809..985e76eb5 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -537,7 +537,7 @@ func (s *SimpleSuite) TestRouterConfigErrors(c *check.C) { defer cmd.Process.Kill() // All errors - err = try.GetRequest("http://127.0.0.1:8080/api/http/routers", 1000*time.Millisecond, try.BodyContains(`["middleware \"unknown@file\" does not exist","found different TLS options for routers on the same host snitest.net, so using the default TLS option instead"]`)) + err = try.GetRequest("http://127.0.0.1:8080/api/http/routers", 1000*time.Millisecond, try.BodyContains(`["middleware \"unknown@file\" does not exist","found different TLS options for routers on the same host snitest.net, so using the default TLS options instead"]`)) c.Assert(err, checker.IsNil) // router4 is enabled, but in warning state because its tls options conf was messed up diff --git a/pkg/anonymize/anonymize_config_test.go b/pkg/anonymize/anonymize_config_test.go index 14b61dbd7..823217c70 100644 --- a/pkg/anonymize/anonymize_config_test.go +++ b/pkg/anonymize/anonymize_config_test.go @@ -89,23 +89,18 @@ func TestDo_globalConfiguration(t *testing.T) { }, }, } - config.ACME = &acme.Configuration{ - Email: "acme Email", - ACMELogging: true, - CAServer: "CAServer", - Storage: "Storage", - EntryPoint: "EntryPoint", - KeyType: "MyKeyType", - OnHostRule: true, - DNSChallenge: &acmeprovider.DNSChallenge{Provider: "DNSProvider"}, - HTTPChallenge: &acmeprovider.HTTPChallenge{ - EntryPoint: "MyEntryPoint", - }, - TLSChallenge: &acmeprovider.TLSChallenge{}, - Domains: []types.Domain{ - { - Main: "Domains Main", - SANs: []string{"Domains acme SANs 1", "Domains acme SANs 2", "Domains acme SANs 3"}, + config.CertificatesResolvers = map[string]static.CertificateResolver{ + "default": { + ACME: &acme.Configuration{ + Email: "acme Email", + CAServer: "CAServer", + Storage: "Storage", + KeyType: "MyKeyType", + DNSChallenge: &acmeprovider.DNSChallenge{Provider: "DNSProvider"}, + HTTPChallenge: &acmeprovider.HTTPChallenge{ + EntryPoint: "MyEntryPoint", + }, + TLSChallenge: &acmeprovider.TLSChallenge{}, }, }, } @@ -126,9 +121,6 @@ func TestDo_globalConfiguration(t *testing.T) { config.API = &static.API{ EntryPoint: "traefik", Dashboard: true, - Statistics: &types.Statistics{ - RecentErrors: 111, - }, DashboardAssets: &assetfs.AssetFS{ Asset: func(path string) ([]byte, error) { return nil, nil diff --git a/pkg/config/dynamic/fixtures/sample.toml b/pkg/config/dynamic/fixtures/sample.toml index 89e9672f7..e177d32bf 100644 --- a/pkg/config/dynamic/fixtures/sample.toml +++ b/pkg/config/dynamic/fixtures/sample.toml @@ -212,7 +212,6 @@ storage = "foobar" entryPoint = "foobar" keyType = "foobar" - onHostRule = true [acme.dnsChallenge] provider = "foobar" delayBeforeCheck = 42 diff --git a/pkg/config/dynamic/http_config.go b/pkg/config/dynamic/http_config.go index f58bd0753..5356a5503 100644 --- a/pkg/config/dynamic/http_config.go +++ b/pkg/config/dynamic/http_config.go @@ -1,6 +1,10 @@ package dynamic -import "reflect" +import ( + "reflect" + + "github.com/containous/traefik/pkg/types" +) // +k8s:deepcopy-gen=true @@ -34,7 +38,9 @@ type Router struct { // RouterTLSConfig holds the TLS configuration for a router type RouterTLSConfig struct { - Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + CertResolver string `json:"certResolver,omitempty" toml:"certResolver,omitempty" yaml:"certResolver,omitempty"` + Domains []types.Domain `json:"domains,omitempty" toml:"domains,omitempty" yaml:"domains,omitempty"` } // +k8s:deepcopy-gen=true diff --git a/pkg/config/dynamic/tcp_config.go b/pkg/config/dynamic/tcp_config.go index be2ca9b1b..e72c2fd76 100644 --- a/pkg/config/dynamic/tcp_config.go +++ b/pkg/config/dynamic/tcp_config.go @@ -1,6 +1,10 @@ package dynamic -import "reflect" +import ( + "reflect" + + "github.com/containous/traefik/pkg/types" +) // +k8s:deepcopy-gen=true @@ -31,8 +35,10 @@ type TCPRouter struct { // RouterTCPTLSConfig holds the TLS configuration for a router type RouterTCPTLSConfig struct { - Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` - Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + Passthrough bool `json:"passthrough" toml:"passthrough" yaml:"passthrough"` + Options string `json:"options,omitempty" toml:"options,omitempty" yaml:"options,omitempty"` + CertResolver string `json:"certResolver,omitempty" toml:"certResolver,omitempty" yaml:"certResolver,omitempty"` + Domains []types.Domain `json:"domains,omitempty" toml:"domains,omitempty" yaml:"domains,omitempty"` } // +k8s:deepcopy-gen=true diff --git a/pkg/config/dynamic/zz_generated.deepcopy.go b/pkg/config/dynamic/zz_generated.deepcopy.go index 416865453..46b64d071 100644 --- a/pkg/config/dynamic/zz_generated.deepcopy.go +++ b/pkg/config/dynamic/zz_generated.deepcopy.go @@ -30,6 +30,7 @@ package dynamic import ( tls "github.com/containous/traefik/pkg/tls" + types "github.com/containous/traefik/pkg/types" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -876,7 +877,7 @@ func (in *Router) DeepCopyInto(out *Router) { if in.TLS != nil { in, out := &in.TLS, &out.TLS *out = new(RouterTLSConfig) - **out = **in + (*in).DeepCopyInto(*out) } return } @@ -894,6 +895,13 @@ func (in *Router) DeepCopy() *Router { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouterTCPTLSConfig) DeepCopyInto(out *RouterTCPTLSConfig) { *out = *in + if in.Domains != nil { + in, out := &in.Domains, &out.Domains + *out = make([]types.Domain, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -910,6 +918,13 @@ func (in *RouterTCPTLSConfig) DeepCopy() *RouterTCPTLSConfig { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RouterTLSConfig) DeepCopyInto(out *RouterTLSConfig) { *out = *in + if in.Domains != nil { + in, out := &in.Domains, &out.Domains + *out = make([]types.Domain, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -1096,7 +1111,7 @@ func (in *TCPRouter) DeepCopyInto(out *TCPRouter) { if in.TLS != nil { in, out := &in.TLS, &out.TLS *out = new(RouterTCPTLSConfig) - **out = **in + (*in).DeepCopyInto(*out) } return } diff --git a/pkg/config/file/file_node_test.go b/pkg/config/file/file_node_test.go index 086af94c1..affb8513b 100644 --- a/pkg/config/file/file_node_test.go +++ b/pkg/config/file/file_node_test.go @@ -44,7 +44,7 @@ func Test_getRootFieldNames(t *testing.T) { func Test_decodeFileToNode_compare(t *testing.T) { nodeToml, err := decodeFileToNode("./fixtures/sample.toml", - "Global", "ServersTransport", "EntryPoints", "Providers", "API", "Metrics", "Ping", "Log", "AccessLog", "Tracing", "HostResolver", "ACME") + "Global", "ServersTransport", "EntryPoints", "Providers", "API", "Metrics", "Ping", "Log", "AccessLog", "Tracing", "HostResolver", "CertificatesResolvers") if err != nil { t.Fatal(err) } @@ -59,7 +59,7 @@ func Test_decodeFileToNode_compare(t *testing.T) { func Test_decodeFileToNode_Toml(t *testing.T) { node, err := decodeFileToNode("./fixtures/sample.toml", - "Global", "ServersTransport", "EntryPoints", "Providers", "API", "Metrics", "Ping", "Log", "AccessLog", "Tracing", "HostResolver", "ACME") + "Global", "ServersTransport", "EntryPoints", "Providers", "API", "Metrics", "Ping", "Log", "AccessLog", "Tracing", "HostResolver", "CertificatesResolvers") if err != nil { t.Fatal(err) } @@ -85,42 +85,35 @@ func Test_decodeFileToNode_Toml(t *testing.T) { {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: "certificatesResolvers", Children: []*parser.Node{ + {Name: "default", 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: "email", Value: "foobar"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "httpChallenge", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}, + {Name: "keyType", Value: "foobar"}, + {Name: "storage", Value: "foobar"}, + {Name: "tlsChallenge"}, + }, + }, + }}, + }}, {Name: "entryPoints", Children: []*parser.Node{ {Name: "EntryPoint0", Children: []*parser.Node{ {Name: "address", Value: "foobar"}, @@ -327,42 +320,35 @@ func Test_decodeFileToNode_Yaml(t *testing.T) { {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: "certificatesResolvers", Children: []*parser.Node{ + {Name: "default", 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: "email", Value: "foobar"}, + {Name: "entryPoint", Value: "foobar"}, + {Name: "httpChallenge", Children: []*parser.Node{ + {Name: "entryPoint", Value: "foobar"}}}, + {Name: "keyType", Value: "foobar"}, + {Name: "storage", Value: "foobar"}, + {Name: "tlsChallenge"}, + }, + }, + }}, + }}, {Name: "entryPoints", Children: []*parser.Node{ {Name: "EntryPoint0", Children: []*parser.Node{ {Name: "address", Value: "foobar"}, diff --git a/pkg/config/file/fixtures/sample.toml b/pkg/config/file/fixtures/sample.toml index e964e12ca..2ecf138d2 100644 --- a/pkg/config/file/fixtures/sample.toml +++ b/pkg/config/file/fixtures/sample.toml @@ -205,30 +205,21 @@ resolvConfig = "foobar" resolvDepth = 42 -[acme] +[certificatesResolvers.default.acme] email = "foobar" acmeLogging = true caServer = "foobar" storage = "foobar" entryPoint = "foobar" keyType = "foobar" - onHostRule = true - [acme.dnsChallenge] + [certificatesResolvers.default.acme.dnsChallenge] provider = "foobar" delayBeforeCheck = 42 resolvers = ["foobar", "foobar"] disablePropagationCheck = true - [acme.httpChallenge] + [certificatesResolvers.default.acme.httpChallenge] entryPoint = "foobar" - [acme.tlsChallenge] - - [[acme.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - - [[acme.domains]] - main = "foobar" - sans = ["foobar", "foobar"] + [certificatesResolvers.default.acme.tlsChallenge] ## Dynamic configuration diff --git a/pkg/config/file/fixtures/sample.yml b/pkg/config/file/fixtures/sample.yml index 40a8c55da..1cbd3e724 100644 --- a/pkg/config/file/fixtures/sample.yml +++ b/pkg/config/file/fixtures/sample.yml @@ -214,30 +214,23 @@ 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: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar + +certificatesResolvers: + default: + acme: + email: foobar + acmeLogging: true + caServer: foobar + storage: foobar + entryPoint: foobar + keyType: foobar + dnsChallenge: + provider: foobar + delayBeforeCheck: 42 + resolvers: + - foobar + - foobar + disablePropagationCheck: true + httpChallenge: + entryPoint: foobar + tlsChallenge: {} diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index e284e1337..e297e422e 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -1,7 +1,8 @@ package static import ( - "errors" + "fmt" + stdlog "log" "strings" "time" @@ -23,7 +24,8 @@ import ( "github.com/containous/traefik/pkg/tracing/zipkin" "github.com/containous/traefik/pkg/types" assetfs "github.com/elazarl/go-bindata-assetfs" - "github.com/go-acme/lego/challenge/dns01" + legolog "github.com/go-acme/lego/log" + "github.com/sirupsen/logrus" ) const ( @@ -59,6 +61,11 @@ type Configuration struct { HostResolver *types.HostResolverConfig `description:"Enable CNAME Flattening." json:"hostResolver,omitempty" toml:"hostResolver,omitempty" yaml:"hostResolver,omitempty" label:"allowEmpty" export:"true"` + CertificatesResolvers map[string]CertificateResolver `description:"Certificates resolvers configuration." json:"certificatesResolvers,omitempty" toml:"certificatesResolvers,omitempty" yaml:"certificatesResolvers,omitempty" export:"true"` +} + +// CertificateResolver contains the configuration for the different types of certificates resolver. +type CertificateResolver struct { ACME *acmeprovider.Configuration `description:"Enable ACME (Let's Encrypt): automatic SSL." json:"acme,omitempty" toml:"acme,omitempty" yaml:"acme,omitempty" export:"true"` } @@ -194,64 +201,35 @@ func (c *Configuration) SetEffectiveConfiguration() { c.initACMEProvider() } -// FIXME handle on new configuration ACME struct func (c *Configuration) initACMEProvider() { - if c.ACME != nil { - c.ACME.CAServer = getSafeACMECAServer(c.ACME.CAServer) - - if c.ACME.DNSChallenge != nil && c.ACME.HTTPChallenge != nil { - log.Warn("Unable to use DNS challenge and HTTP challenge at the same time. Fallback to DNS challenge.") - c.ACME.HTTPChallenge = nil - } - - if c.ACME.DNSChallenge != nil && c.ACME.TLSChallenge != nil { - log.Warn("Unable to use DNS challenge and TLS challenge at the same time. Fallback to DNS challenge.") - c.ACME.TLSChallenge = nil - } - - if c.ACME.HTTPChallenge != nil && c.ACME.TLSChallenge != nil { - log.Warn("Unable to use HTTP challenge and TLS challenge at the same time. Fallback to TLS challenge.") - c.ACME.HTTPChallenge = nil + for _, resolver := range c.CertificatesResolvers { + if resolver.ACME != nil { + resolver.ACME.CAServer = getSafeACMECAServer(resolver.ACME.CAServer) } } -} -// InitACMEProvider create an acme provider from the ACME part of globalConfiguration -func (c *Configuration) InitACMEProvider() (*acmeprovider.Provider, error) { - if c.ACME != nil { - if len(c.ACME.Storage) == 0 { - return nil, errors.New("unable to initialize ACME provider with no storage location for the certificates") - } - return &acmeprovider.Provider{ - Configuration: c.ACME, - }, nil - } - return nil, nil + legolog.Logger = stdlog.New(log.WithoutContext().WriterLevel(logrus.DebugLevel), "legolog: ", 0) } // ValidateConfiguration validate that configuration is coherent -func (c *Configuration) ValidateConfiguration() { - if c.ACME != nil { - for _, domain := range c.ACME.Domains { - if domain.Main != dns01.UnFqdn(domain.Main) { - log.Warnf("FQDN detected, please remove the trailing dot: %s", domain.Main) - } - for _, san := range domain.SANs { - if san != dns01.UnFqdn(san) { - log.Warnf("FQDN detected, please remove the trailing dot: %s", san) - } - } +func (c *Configuration) ValidateConfiguration() error { + var acmeEmail string + for name, resolver := range c.CertificatesResolvers { + if resolver.ACME == nil { + continue } + + if len(resolver.ACME.Storage) == 0 { + return fmt.Errorf("unable to initialize certificates resolver %q with no storage location for the certificates", name) + } + + if acmeEmail != "" && resolver.ACME.Email != acmeEmail { + return fmt.Errorf("unable to initialize certificates resolver %q, all the acme resolvers must use the same email", name) + } + acmeEmail = resolver.ACME.Email } - // FIXME Validate store config? - // if c.ACME != nil { - // if _, ok := c.EntryPoints[c.ACME.EntryPoint]; !ok { - // log.Fatalf("Unknown entrypoint %q for ACME configuration", c.ACME.EntryPoint) - // } - // else if c.EntryPoints[c.ACME.EntryPoint].TLS == nil { - // log.Fatalf("Entrypoint %q has no TLS configuration for ACME configuration", c.ACME.EntryPoint) - // } - // } + + return nil } func getSafeACMECAServer(caServerSrc string) string { diff --git a/pkg/provider/acme/challenge_http.go b/pkg/provider/acme/challenge_http.go index 755662fd7..669e3473a 100644 --- a/pkg/provider/acme/challenge_http.go +++ b/pkg/provider/acme/challenge_http.go @@ -17,7 +17,7 @@ import ( var _ challenge.ProviderTimeout = (*challengeHTTP)(nil) type challengeHTTP struct { - Store Store + Store ChallengeStore } // Present presents a challenge to obtain new ACME certificate. @@ -52,7 +52,7 @@ func (p *Provider) Append(router *mux.Router) { domain = req.Host } - tokenValue := getTokenValue(ctx, token, domain, p.Store) + tokenValue := getTokenValue(ctx, token, domain, p.ChallengeStore) if len(tokenValue) > 0 { rw.WriteHeader(http.StatusOK) _, err = rw.Write(tokenValue) @@ -66,7 +66,7 @@ func (p *Provider) Append(router *mux.Router) { })) } -func getTokenValue(ctx context.Context, token, domain string, store Store) []byte { +func getTokenValue(ctx context.Context, token, domain string, store ChallengeStore) []byte { logger := log.FromContext(ctx) logger.Debugf("Retrieving the ACME challenge for token %v...", token) diff --git a/pkg/provider/acme/challenge_tls.go b/pkg/provider/acme/challenge_tls.go index c0697df89..196d2d256 100644 --- a/pkg/provider/acme/challenge_tls.go +++ b/pkg/provider/acme/challenge_tls.go @@ -12,7 +12,7 @@ import ( var _ challenge.Provider = (*challengeTLSALPN)(nil) type challengeTLSALPN struct { - Store Store + Store ChallengeStore } func (c *challengeTLSALPN) Present(domain, token, keyAuth string) error { @@ -37,7 +37,7 @@ func (c *challengeTLSALPN) CleanUp(domain, token, keyAuth string) error { // GetTLSALPNCertificate Get the temp certificate for ACME TLS-ALPN-O1 challenge. func (p *Provider) GetTLSALPNCertificate(domain string) (*tls.Certificate, error) { - cert, err := p.Store.GetTLSChallenge(domain) + cert, err := p.ChallengeStore.GetTLSChallenge(domain) if err != nil { return nil, err } diff --git a/pkg/provider/acme/local_store.go b/pkg/provider/acme/local_store.go index fa5c00b13..717f30c2c 100644 --- a/pkg/provider/acme/local_store.go +++ b/pkg/provider/acme/local_store.go @@ -5,7 +5,6 @@ import ( "fmt" "io/ioutil" "os" - "regexp" "sync" "github.com/containous/traefik/pkg/log" @@ -16,25 +15,34 @@ var _ Store = (*LocalStore)(nil) // LocalStore Stores implementation for local file type LocalStore struct { + saveDataChan chan map[string]*StoredData filename string - storedData *StoredData - SaveDataChan chan *StoredData `json:"-"` - lock sync.RWMutex + + lock sync.RWMutex + storedData map[string]*StoredData } // NewLocalStore initializes a new LocalStore with a file name func NewLocalStore(filename string) *LocalStore { - store := &LocalStore{filename: filename, SaveDataChan: make(chan *StoredData)} + store := &LocalStore{filename: filename, saveDataChan: make(chan map[string]*StoredData)} store.listenSaveAction() return store } -func (s *LocalStore) get() (*StoredData, error) { +func (s *LocalStore) save(resolverName string, storedData *StoredData) { + s.lock.Lock() + defer s.lock.Unlock() + + s.storedData[resolverName] = storedData + s.saveDataChan <- s.storedData +} + +func (s *LocalStore) get(resolverName string) (*StoredData, error) { + s.lock.Lock() + defer s.lock.Unlock() + if s.storedData == nil { - s.storedData = &StoredData{ - HTTPChallenges: make(map[string]map[string][]byte), - TLSChallenges: make(map[string]*Certificate), - } + s.storedData = map[string]*StoredData{} hasData, err := CheckFile(s.filename) if err != nil { @@ -56,49 +64,40 @@ func (s *LocalStore) get() (*StoredData, error) { } if len(file) > 0 { - if err := json.Unmarshal(file, s.storedData); err != nil { + if err := json.Unmarshal(file, &s.storedData); err != nil { return nil, err } } - // Check if ACME Account is in ACME V1 format - if s.storedData.Account != nil && s.storedData.Account.Registration != nil { - isOldRegistration, err := regexp.MatchString(RegistrationURLPathV1Regexp, s.storedData.Account.Registration.URI) - if err != nil { - return nil, err - } - if isOldRegistration { - logger.Debug("Reseting ACME account.") - s.storedData.Account = nil - s.SaveDataChan <- s.storedData - } - } - // Delete all certificates with no value - var certificates []*Certificate - for _, certificate := range s.storedData.Certificates { - if len(certificate.Certificate) == 0 || len(certificate.Key) == 0 { - logger.Debugf("Deleting empty certificate %v for %v", certificate, certificate.Domain.ToStrArray()) - continue + var certificates []*CertAndStore + for _, storedData := range s.storedData { + for _, certificate := range storedData.Certificates { + if len(certificate.Certificate.Certificate) == 0 || len(certificate.Key) == 0 { + logger.Debugf("Deleting empty certificate %v for %v", certificate, certificate.Domain.ToStrArray()) + continue + } + certificates = append(certificates, certificate) + } + if len(certificates) < len(storedData.Certificates) { + storedData.Certificates = certificates + s.saveDataChan <- s.storedData } - certificates = append(certificates, certificate) - } - - if len(certificates) < len(s.storedData.Certificates) { - s.storedData.Certificates = certificates - s.SaveDataChan <- s.storedData } } } - return s.storedData, nil + if s.storedData[resolverName] == nil { + s.storedData[resolverName] = &StoredData{} + } + return s.storedData[resolverName], nil } // listenSaveAction listens to a chan to store ACME data in json format into LocalStore.filename func (s *LocalStore) listenSaveAction() { safe.Go(func() { logger := log.WithoutContext().WithField(log.ProviderName, "acme") - for object := range s.SaveDataChan { + for object := range s.saveDataChan { data, err := json.MarshalIndent(object, "", " ") if err != nil { logger.Error(err) @@ -113,8 +112,8 @@ func (s *LocalStore) listenSaveAction() { } // GetAccount returns ACME Account -func (s *LocalStore) GetAccount() (*Account, error) { - storedData, err := s.get() +func (s *LocalStore) GetAccount(resolverName string) (*Account, error) { + storedData, err := s.get(resolverName) if err != nil { return nil, err } @@ -123,21 +122,21 @@ func (s *LocalStore) GetAccount() (*Account, error) { } // SaveAccount stores ACME Account -func (s *LocalStore) SaveAccount(account *Account) error { - storedData, err := s.get() +func (s *LocalStore) SaveAccount(resolverName string, account *Account) error { + storedData, err := s.get(resolverName) if err != nil { return err } storedData.Account = account - s.SaveDataChan <- storedData + s.save(resolverName, storedData) return nil } // GetCertificates returns ACME Certificates list -func (s *LocalStore) GetCertificates() ([]*Certificate, error) { - storedData, err := s.get() +func (s *LocalStore) GetCertificates(resolverName string) ([]*CertAndStore, error) { + storedData, err := s.get(resolverName) if err != nil { return nil, err } @@ -146,20 +145,37 @@ func (s *LocalStore) GetCertificates() ([]*Certificate, error) { } // SaveCertificates stores ACME Certificates list -func (s *LocalStore) SaveCertificates(certificates []*Certificate) error { - storedData, err := s.get() +func (s *LocalStore) SaveCertificates(resolverName string, certificates []*CertAndStore) error { + storedData, err := s.get(resolverName) if err != nil { return err } storedData.Certificates = certificates - s.SaveDataChan <- storedData + s.save(resolverName, storedData) return nil } +// LocalChallengeStore is an implementation of the ChallengeStore in memory. +type LocalChallengeStore struct { + storedData *StoredChallengeData + lock sync.RWMutex +} + +// NewLocalChallengeStore initializes a new LocalChallengeStore. +func NewLocalChallengeStore() *LocalChallengeStore { + return &LocalChallengeStore{ + storedData: &StoredChallengeData{ + HTTPChallenges: make(map[string]map[string][]byte), + TLSChallenges: make(map[string]*Certificate), + }, + } + +} + // GetHTTPChallengeToken Get the http challenge token from the store -func (s *LocalStore) GetHTTPChallengeToken(token, domain string) ([]byte, error) { +func (s *LocalChallengeStore) GetHTTPChallengeToken(token, domain string) ([]byte, error) { s.lock.RLock() defer s.lock.RUnlock() @@ -179,7 +195,7 @@ func (s *LocalStore) GetHTTPChallengeToken(token, domain string) ([]byte, error) } // SetHTTPChallengeToken Set the http challenge token in the store -func (s *LocalStore) SetHTTPChallengeToken(token, domain string, keyAuth []byte) error { +func (s *LocalChallengeStore) SetHTTPChallengeToken(token, domain string, keyAuth []byte) error { s.lock.Lock() defer s.lock.Unlock() @@ -196,7 +212,7 @@ func (s *LocalStore) SetHTTPChallengeToken(token, domain string, keyAuth []byte) } // RemoveHTTPChallengeToken Remove the http challenge token in the store -func (s *LocalStore) RemoveHTTPChallengeToken(token, domain string) error { +func (s *LocalChallengeStore) RemoveHTTPChallengeToken(token, domain string) error { s.lock.Lock() defer s.lock.Unlock() @@ -214,7 +230,7 @@ func (s *LocalStore) RemoveHTTPChallengeToken(token, domain string) error { } // AddTLSChallenge Add a certificate to the ACME TLS-ALPN-01 certificates storage -func (s *LocalStore) AddTLSChallenge(domain string, cert *Certificate) error { +func (s *LocalChallengeStore) AddTLSChallenge(domain string, cert *Certificate) error { s.lock.Lock() defer s.lock.Unlock() @@ -227,7 +243,7 @@ func (s *LocalStore) AddTLSChallenge(domain string, cert *Certificate) error { } // GetTLSChallenge Get a certificate from the ACME TLS-ALPN-01 certificates storage -func (s *LocalStore) GetTLSChallenge(domain string) (*Certificate, error) { +func (s *LocalChallengeStore) GetTLSChallenge(domain string) (*Certificate, error) { s.lock.Lock() defer s.lock.Unlock() @@ -239,7 +255,7 @@ func (s *LocalStore) GetTLSChallenge(domain string) (*Certificate, error) { } // RemoveTLSChallenge Remove a certificate from the ACME TLS-ALPN-01 certificates storage -func (s *LocalStore) RemoveTLSChallenge(domain string) error { +func (s *LocalChallengeStore) RemoveTLSChallenge(domain string) error { s.lock.Lock() defer s.lock.Unlock() diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index 9d6130481..2fc2678bc 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -6,8 +6,6 @@ import ( "crypto/x509" "errors" "fmt" - "io/ioutil" - fmtlog "log" "net/url" "reflect" "strings" @@ -25,10 +23,8 @@ import ( "github.com/go-acme/lego/challenge" "github.com/go-acme/lego/challenge/dns01" "github.com/go-acme/lego/lego" - legolog "github.com/go-acme/lego/log" "github.com/go-acme/lego/providers/dns" "github.com/go-acme/lego/registration" - "github.com/sirupsen/logrus" ) var ( @@ -39,16 +35,12 @@ var ( // Configuration holds ACME configuration provided by users type Configuration struct { 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. @@ -58,6 +50,12 @@ func (a *Configuration) SetDefaults() { a.KeyType = "RSA4096" } +// CertAndStore allows mapping a TLS certificate to a TLS store. +type CertAndStore struct { + Certificate + Store string +} + // Certificate is a struct which contains all data needed from an ACME certificate type Certificate struct { Domain types.Domain `json:"domain,omitempty" toml:"domain,omitempty" yaml:"domain,omitempty"` @@ -84,11 +82,13 @@ type TLSChallenge struct{} // Provider holds configurations of the provider. type Provider struct { *Configuration + ResolverName string Store Store `json:"store,omitempty" toml:"store,omitempty" yaml:"store,omitempty"` - certificates []*Certificate + ChallengeStore ChallengeStore + certificates []*CertAndStore account *Account client *lego.Client - certsChan chan *Certificate + certsChan chan *CertAndStore configurationChan chan<- dynamic.Message tlsManager *traefiktls.Manager clientMutex sync.Mutex @@ -113,41 +113,20 @@ func (p *Provider) ListenConfiguration(config dynamic.Configuration) { p.configFromListenerChan <- config } -// ListenRequest resolves new certificates for a domain from an incoming request and return a valid Certificate to serve (onDemand option) -func (p *Provider) ListenRequest(domain string) (*tls.Certificate, error) { - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) - - acmeCert, err := p.resolveCertificate(ctx, types.Domain{Main: domain}, false) - if acmeCert == nil || err != nil { - return nil, err - } - - cert, err := tls.X509KeyPair(acmeCert.Certificate, acmeCert.PrivateKey) - - return &cert, err -} - // Init for compatibility reason the BaseProvider implements an empty Init func (p *Provider) Init() error { ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) logger := log.FromContext(ctx) - if p.ACMELogging { - legolog.Logger = fmtlog.New(logger.WriterLevel(logrus.InfoLevel), "legolog: ", 0) - } else { - legolog.Logger = fmtlog.New(ioutil.Discard, "", 0) - } - if len(p.Configuration.Storage) == 0 { return errors.New("unable to initialize ACME provider with no storage location for the certificates") } - p.Store = NewLocalStore(p.Configuration.Storage) var err error - p.account, err = p.Store.GetAccount() + p.account, err = p.Store.GetAccount(p.ResolverName) if err != nil { - return fmt.Errorf("unable to get ACME account : %v", err) + return fmt.Errorf("unable to get ACME account: %v", err) } // Reset Account if caServer changed, thus registration URI can be updated @@ -156,7 +135,7 @@ func (p *Provider) Init() error { p.account = nil } - p.certificates, err = p.Store.GetCertificates() + p.certificates, err = p.Store.GetCertificates(p.ResolverName) if err != nil { return fmt.Errorf("unable to get ACME certificates : %v", err) } @@ -188,7 +167,7 @@ func isAccountMatchingCaServer(ctx context.Context, accountURI string, serverURI // Provide allows the file provider to provide configurations to traefik // using the given Configuration channel. func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) + ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme."+p.ResolverName)) p.pool = pool @@ -198,17 +177,6 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe. p.configurationChan = configurationChan p.refreshCertificates() - p.deleteUnnecessaryDomains(ctx) - for i := 0; i < len(p.Domains); i++ { - domain := p.Domains[i] - safe.Go(func() { - if _, err := p.resolveCertificate(ctx, domain, true); err != nil { - log.WithoutContext().WithField(log.ProviderName, "acme"). - Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err) - } - }) - } - p.renewCertificates(ctx) ticker := time.NewTicker(24 * time.Hour) @@ -275,13 +243,18 @@ func (p *Provider) getClient() (*lego.Client, error) { // Save the account once before all the certificates generation/storing // No certificate can be generated if account is not initialized - err = p.Store.SaveAccount(account) + err = p.Store.SaveAccount(p.ResolverName, account) if err != nil { return nil, err } - switch { - case p.DNSChallenge != nil && len(p.DNSChallenge.Provider) > 0: + if (p.DNSChallenge == nil || len(p.DNSChallenge.Provider) == 0) && + (p.HTTPChallenge == nil || len(p.HTTPChallenge.EntryPoint) == 0) && + p.TLSChallenge == nil { + return nil, errors.New("ACME challenge not specified, please select TLS or HTTP or DNS Challenge") + } + + if p.DNSChallenge != nil && len(p.DNSChallenge.Provider) > 0 { logger.Debugf("Using DNS Challenge provider: %s", p.DNSChallenge.Provider) var provider challenge.Provider @@ -304,25 +277,24 @@ func (p *Provider) getClient() (*lego.Client, error) { if err != nil { return nil, err } + } - case p.HTTPChallenge != nil && len(p.HTTPChallenge.EntryPoint) > 0: + if p.HTTPChallenge != nil && len(p.HTTPChallenge.EntryPoint) > 0 { logger.Debug("Using HTTP Challenge provider.") - err = client.Challenge.SetHTTP01Provider(&challengeHTTP{Store: p.Store}) + err = client.Challenge.SetHTTP01Provider(&challengeHTTP{Store: p.ChallengeStore}) if err != nil { return nil, err } + } - case p.TLSChallenge != nil: + if p.TLSChallenge != nil { logger.Debug("Using TLS Challenge provider.") - err = client.Challenge.SetTLSALPN01Provider(&challengeTLSALPN{Store: p.Store}) + err = client.Challenge.SetTLSALPN01Provider(&challengeTLSALPN{Store: p.ChallengeStore}) if err != nil { return nil, err } - - default: - return nil, errors.New("ACME challenge not specified, please select TLS or HTTP or DNS Challenge") } p.client = client @@ -346,7 +318,7 @@ func (p *Provider) initAccount(ctx context.Context) (*Account, error) { return p.account, nil } -func (p *Provider) resolveDomains(ctx context.Context, domains []string) { +func (p *Provider) resolveDomains(ctx context.Context, domains []string, tlsStore string) { if len(domains) == 0 { log.FromContext(ctx).Debug("No domain parsed in provider ACME") return @@ -362,7 +334,7 @@ func (p *Provider) resolveDomains(ctx context.Context, domains []string) { } safe.Go(func() { - if _, err := p.resolveCertificate(ctx, domain, false); err != nil { + if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil { log.FromContext(ctx).Errorf("Unable to obtain ACME certificate for domains %q: %v", strings.Join(domains, ","), err) } }) @@ -376,32 +348,72 @@ func (p *Provider) watchNewDomains(ctx context.Context) { case config := <-p.configFromListenerChan: if config.TCP != nil { for routerName, route := range config.TCP.Routers { - if route.TLS == nil { + if route.TLS == nil || route.TLS.CertResolver != p.ResolverName { continue } ctxRouter := log.With(ctx, log.Str(log.RouterName, routerName), log.Str(log.Rule, route.Rule)) - domains, err := rules.ParseHostSNI(route.Rule) - if err != nil { - log.FromContext(ctxRouter).Errorf("Error parsing domains in provider ACME: %v", err) - continue + tlsStore := "default" + if len(route.TLS.Domains) > 0 { + for _, domain := range route.TLS.Domains { + if domain.Main != dns01.UnFqdn(domain.Main) { + log.Warnf("FQDN detected, please remove the trailing dot: %s", domain.Main) + } + for _, san := range domain.SANs { + if san != dns01.UnFqdn(san) { + log.Warnf("FQDN detected, please remove the trailing dot: %s", san) + } + } + } + + domains := deleteUnnecessaryDomains(ctxRouter, route.TLS.Domains) + for i := 0; i < len(domains); i++ { + domain := domains[i] + safe.Go(func() { + if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil { + log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName). + Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err) + } + }) + } + } else { + domains, err := rules.ParseHostSNI(route.Rule) + if err != nil { + log.FromContext(ctxRouter).Errorf("Error parsing domains in provider ACME: %v", err) + continue + } + p.resolveDomains(ctxRouter, domains, tlsStore) } - p.resolveDomains(ctxRouter, domains) } } for routerName, route := range config.HTTP.Routers { - if route.TLS == nil { + if route.TLS == nil || route.TLS.CertResolver != p.ResolverName { continue } ctxRouter := log.With(ctx, log.Str(log.RouterName, routerName), log.Str(log.Rule, route.Rule)) - domains, err := rules.ParseDomains(route.Rule) - if err != nil { - log.FromContext(ctxRouter).Errorf("Error parsing domains in provider ACME: %v", err) - continue + tlsStore := "default" + if len(route.TLS.Domains) > 0 { + domains := deleteUnnecessaryDomains(ctxRouter, route.TLS.Domains) + for i := 0; i < len(domains); i++ { + domain := domains[i] + safe.Go(func() { + if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil { + log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName). + Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err) + } + }) + } + } else { + domains, err := rules.ParseDomains(route.Rule) + if err != nil { + log.FromContext(ctxRouter).Errorf("Error parsing domains in provider ACME: %v", err) + continue + } + p.resolveDomains(ctxRouter, domains, tlsStore) } - p.resolveDomains(ctxRouter, domains) + } case <-stop: return @@ -410,14 +422,14 @@ func (p *Provider) watchNewDomains(ctx context.Context) { }) } -func (p *Provider) resolveCertificate(ctx context.Context, domain types.Domain, domainFromConfigurationFile bool) (*certificate.Resource, error) { - domains, err := p.getValidDomains(ctx, domain, domainFromConfigurationFile) +func (p *Provider) resolveCertificate(ctx context.Context, domain types.Domain, tlsStore string) (*certificate.Resource, error) { + domains, err := p.getValidDomains(ctx, domain) if err != nil { return nil, err } // Check provided certificates - uncheckedDomains := p.getUncheckedDomains(ctx, domains, !domainFromConfigurationFile) + uncheckedDomains := p.getUncheckedDomains(ctx, domains, tlsStore) if len(uncheckedDomains) == 0 { return nil, nil } @@ -457,7 +469,7 @@ func (p *Provider) resolveCertificate(ctx context.Context, domain types.Domain, } else { domain = types.Domain{Main: uncheckedDomains[0]} } - p.addCertificateForDomain(domain, cert.Certificate, cert.PrivateKey) + p.addCertificateForDomain(domain, cert.Certificate, cert.PrivateKey, tlsStore) return cert, nil } @@ -480,22 +492,22 @@ func (p *Provider) addResolvingDomains(resolvingDomains []string) { } } -func (p *Provider) addCertificateForDomain(domain types.Domain, certificate []byte, key []byte) { - p.certsChan <- &Certificate{Certificate: certificate, Key: key, Domain: domain} +func (p *Provider) addCertificateForDomain(domain types.Domain, certificate []byte, key []byte, tlsStore string) { + p.certsChan <- &CertAndStore{Certificate: Certificate{Certificate: certificate, Key: key, Domain: domain}, Store: tlsStore} } // deleteUnnecessaryDomains deletes from the configuration : // - Duplicated domains // - Domains which are checked by wildcard domain -func (p *Provider) deleteUnnecessaryDomains(ctx context.Context) { +func deleteUnnecessaryDomains(ctx context.Context, domains []types.Domain) []types.Domain { var newDomains []types.Domain logger := log.FromContext(ctx) - for idxDomainToCheck, domainToCheck := range p.Domains { + for idxDomainToCheck, domainToCheck := range domains { keepDomain := true - for idxDomain, domain := range p.Domains { + for idxDomain, domain := range domains { if idxDomainToCheck == idxDomain { continue } @@ -538,11 +550,11 @@ func (p *Provider) deleteUnnecessaryDomains(ctx context.Context) { } } - p.Domains = newDomains + return newDomains } func (p *Provider) watchCertificate(ctx context.Context) { - p.certsChan = make(chan *Certificate) + p.certsChan = make(chan *CertAndStore) p.pool.Go(func(stop chan bool) { for { @@ -550,9 +562,8 @@ func (p *Provider) watchCertificate(ctx context.Context) { case cert := <-p.certsChan: certUpdated := false for _, domainsCertificate := range p.certificates { - if reflect.DeepEqual(cert.Domain, domainsCertificate.Domain) { + if reflect.DeepEqual(cert.Domain, domainsCertificate.Certificate.Domain) { domainsCertificate.Certificate = cert.Certificate - domainsCertificate.Key = cert.Key certUpdated = true break } @@ -573,7 +584,7 @@ func (p *Provider) watchCertificate(ctx context.Context) { } func (p *Provider) saveCertificates() error { - err := p.Store.SaveCertificates(p.certificates) + err := p.Store.SaveCertificates(p.ResolverName, p.certificates) p.refreshCertificates() @@ -582,7 +593,7 @@ func (p *Provider) saveCertificates() error { func (p *Provider) refreshCertificates() { conf := dynamic.Message{ - ProviderName: "ACME", + ProviderName: "acme." + p.ResolverName, Configuration: &dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Routers: map[string]*dynamic.Router{}, @@ -596,9 +607,10 @@ func (p *Provider) refreshCertificates() { for _, cert := range p.certificates { certConf := &traefiktls.CertAndStores{ Certificate: traefiktls.Certificate{ - CertFile: traefiktls.FileOrContent(cert.Certificate), + CertFile: traefiktls.FileOrContent(cert.Certificate.Certificate), KeyFile: traefiktls.FileOrContent(cert.Key), }, + Stores: []string{cert.Store}, } conf.Configuration.TLS.Certificates = append(conf.Configuration.TLS.Certificates, certConf) } @@ -611,7 +623,7 @@ func (p *Provider) renewCertificates(ctx context.Context) { logger.Info("Testing certificate renew...") for _, cert := range p.certificates { - crt, err := getX509Certificate(ctx, cert) + crt, err := getX509Certificate(ctx, &cert.Certificate) // If there's an error, we assume the cert is broken, and needs update // <= 30 days left, renew certificate if err != nil || crt == nil || crt.NotAfter.Before(time.Now().Add(24*30*time.Hour)) { @@ -626,7 +638,7 @@ func (p *Provider) renewCertificates(ctx context.Context) { renewedCert, err := client.Certificate.Renew(certificate.Resource{ Domain: cert.Domain.Main, PrivateKey: cert.Key, - Certificate: cert.Certificate, + Certificate: cert.Certificate.Certificate, }, true, oscpMustStaple) if err != nil { @@ -639,20 +651,20 @@ func (p *Provider) renewCertificates(ctx context.Context) { continue } - p.addCertificateForDomain(cert.Domain, renewedCert.Certificate, renewedCert.PrivateKey) + p.addCertificateForDomain(cert.Domain, renewedCert.Certificate, renewedCert.PrivateKey, cert.Store) } } } // Get provided certificate which check a domains list (Main and SANs) // from static and dynamic provided certificates -func (p *Provider) getUncheckedDomains(ctx context.Context, domainsToCheck []string, checkConfigurationDomains bool) []string { +func (p *Provider) getUncheckedDomains(ctx context.Context, domainsToCheck []string, tlsStore string) []string { p.resolvingDomainsMutex.RLock() defer p.resolvingDomainsMutex.RUnlock() log.FromContext(ctx).Debugf("Looking for provided certificate(s) to validate %q...", domainsToCheck) - allDomains := p.tlsManager.GetStore("default").GetAllDomains() + allDomains := p.tlsManager.GetStore(tlsStore).GetAllDomains() // Get ACME certificates for _, cert := range p.certificates { @@ -664,13 +676,6 @@ func (p *Provider) getUncheckedDomains(ctx context.Context, domainsToCheck []str allDomains = append(allDomains, domain) } - // Get Configuration Domains - if checkConfigurationDomains { - for i := 0; i < len(p.Domains); i++ { - allDomains = append(allDomains, strings.Join(p.Domains[i].ToStrArray(), ",")) - } - } - return searchUncheckedDomains(ctx, domainsToCheck, allDomains) } @@ -712,17 +717,13 @@ func getX509Certificate(ctx context.Context, cert *Certificate) (*x509.Certifica } // getValidDomains checks if given domain is allowed to generate a ACME certificate and return it -func (p *Provider) getValidDomains(ctx context.Context, domain types.Domain, wildcardAllowed bool) ([]string, error) { +func (p *Provider) getValidDomains(ctx context.Context, domain types.Domain) ([]string, error) { domains := domain.ToStrArray() if len(domains) == 0 { return nil, errors.New("unable to generate a certificate in ACME provider when no domain is given") } if strings.HasPrefix(domain.Main, "*") { - if !wildcardAllowed { - return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q from a 'Host' rule", strings.Join(domains, ",")) - } - if p.DNSChallenge == nil { return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : ACME needs a DNSChallenge", strings.Join(domains, ",")) } diff --git a/pkg/provider/acme/provider_test.go b/pkg/provider/acme/provider_test.go index 2f2581fa6..2629dda10 100644 --- a/pkg/provider/acme/provider_test.go +++ b/pkg/provider/acme/provider_test.go @@ -30,7 +30,7 @@ func TestGetUncheckedCertificates(t *testing.T) { desc string dynamicCerts *safe.Safe resolvingDomains map[string]struct{} - acmeCertificates []*Certificate + acmeCertificates []*CertAndStore domains []string expectedDomains []string }{ @@ -48,9 +48,11 @@ func TestGetUncheckedCertificates(t *testing.T) { { desc: "wildcard already exists in ACME certificates", domains: []string{"*.traefik.wtf"}, - acmeCertificates: []*Certificate{ + acmeCertificates: []*CertAndStore{ { - Domain: types.Domain{Main: "*.traefik.wtf"}, + Certificate: Certificate{ + Domain: types.Domain{Main: "*.traefik.wtf"}, + }, }, }, expectedDomains: nil, @@ -69,9 +71,11 @@ func TestGetUncheckedCertificates(t *testing.T) { { desc: "domain CN already exists in ACME certificates and SANs to generate", domains: []string{"traefik.wtf", "foo.traefik.wtf"}, - acmeCertificates: []*Certificate{ + acmeCertificates: []*CertAndStore{ { - Domain: types.Domain{Main: "traefik.wtf"}, + Certificate: Certificate{ + Domain: types.Domain{Main: "traefik.wtf"}, + }, }, }, expectedDomains: []string{"foo.traefik.wtf"}, @@ -85,9 +89,11 @@ func TestGetUncheckedCertificates(t *testing.T) { { desc: "domain already exists in ACME certificates", domains: []string{"traefik.wtf"}, - acmeCertificates: []*Certificate{ + acmeCertificates: []*CertAndStore{ { - Domain: types.Domain{Main: "traefik.wtf"}, + Certificate: Certificate{ + Domain: types.Domain{Main: "traefik.wtf"}, + }, }, }, expectedDomains: nil, @@ -101,9 +107,11 @@ func TestGetUncheckedCertificates(t *testing.T) { { desc: "domain matched by wildcard in ACME certificates", domains: []string{"who.traefik.wtf", "foo.traefik.wtf"}, - acmeCertificates: []*Certificate{ + acmeCertificates: []*CertAndStore{ { - Domain: types.Domain{Main: "*.traefik.wtf"}, + Certificate: Certificate{ + Domain: types.Domain{Main: "*.traefik.wtf"}, + }, }, }, expectedDomains: nil, @@ -111,9 +119,11 @@ func TestGetUncheckedCertificates(t *testing.T) { { desc: "root domain with wildcard in ACME certificates", domains: []string{"traefik.wtf", "foo.traefik.wtf"}, - acmeCertificates: []*Certificate{ + acmeCertificates: []*CertAndStore{ { - Domain: types.Domain{Main: "*.traefik.wtf"}, + Certificate: Certificate{ + Domain: types.Domain{Main: "*.traefik.wtf"}, + }, }, }, expectedDomains: []string{"traefik.wtf"}, @@ -171,7 +181,7 @@ func TestGetUncheckedCertificates(t *testing.T) { resolvingDomains: test.resolvingDomains, } - domains := acmeProvider.getUncheckedDomains(context.Background(), test.domains, false) + domains := acmeProvider.getUncheckedDomains(context.Background(), test.domains, "default") assert.Equal(t, len(test.expectedDomains), len(domains), "Unexpected domains.") }) } @@ -181,7 +191,6 @@ func TestGetValidDomain(t *testing.T) { testCases := []struct { desc string domains types.Domain - wildcardAllowed bool dnsChallenge *DNSChallenge expectedErr string expectedDomains []string @@ -190,7 +199,6 @@ func TestGetValidDomain(t *testing.T) { desc: "valid wildcard", domains: types.Domain{Main: "*.traefik.wtf"}, dnsChallenge: &DNSChallenge{}, - wildcardAllowed: true, expectedErr: "", expectedDomains: []string{"*.traefik.wtf"}, }, @@ -199,22 +207,12 @@ func TestGetValidDomain(t *testing.T) { domains: types.Domain{Main: "traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, expectedErr: "", - wildcardAllowed: true, expectedDomains: []string{"traefik.wtf", "foo.traefik.wtf"}, }, - { - desc: "unauthorized wildcard", - domains: types.Domain{Main: "*.traefik.wtf"}, - dnsChallenge: &DNSChallenge{}, - wildcardAllowed: false, - expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.traefik.wtf\" from a 'Host' rule", - expectedDomains: nil, - }, { desc: "no domain", domains: types.Domain{}, dnsChallenge: nil, - wildcardAllowed: true, expectedErr: "unable to generate a certificate in ACME provider when no domain is given", expectedDomains: nil, }, @@ -222,7 +220,6 @@ func TestGetValidDomain(t *testing.T) { desc: "no DNSChallenge", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: nil, - wildcardAllowed: true, expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.traefik.wtf,foo.traefik.wtf\" : ACME needs a DNSChallenge", expectedDomains: nil, }, @@ -230,7 +227,6 @@ func TestGetValidDomain(t *testing.T) { desc: "unauthorized wildcard with SAN", domains: types.Domain{Main: "*.*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, - wildcardAllowed: true, expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.*.traefik.wtf,foo.traefik.wtf\" : ACME does not allow '*.*' wildcard domain", expectedDomains: nil, }, @@ -238,7 +234,6 @@ func TestGetValidDomain(t *testing.T) { desc: "wildcard and SANs", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"traefik.wtf"}}, dnsChallenge: &DNSChallenge{}, - wildcardAllowed: true, expectedErr: "", expectedDomains: []string{"*.traefik.wtf", "traefik.wtf"}, }, @@ -246,7 +241,6 @@ func TestGetValidDomain(t *testing.T) { desc: "wildcard SANs", domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"*.acme.wtf"}}, dnsChallenge: &DNSChallenge{}, - wildcardAllowed: true, expectedErr: "", expectedDomains: []string{"*.traefik.wtf", "*.acme.wtf"}, }, @@ -259,7 +253,7 @@ func TestGetValidDomain(t *testing.T) { acmeProvider := Provider{Configuration: &Configuration{DNSChallenge: test.dnsChallenge}} - domains, err := acmeProvider.getValidDomains(context.Background(), test.domains, test.wildcardAllowed) + domains, err := acmeProvider.getValidDomains(context.Background(), test.domains) if len(test.expectedErr) > 0 { assert.EqualError(t, err, test.expectedErr, "Unexpected error.") @@ -439,10 +433,8 @@ func TestDeleteUnnecessaryDomains(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - acmeProvider := Provider{Configuration: &Configuration{Domains: test.domains}} - - acmeProvider.deleteUnnecessaryDomains(context.Background()) - assert.Equal(t, test.expectedDomains, acmeProvider.Domains, "unexpected domain") + domains := deleteUnnecessaryDomains(context.Background(), test.domains) + assert.Equal(t, test.expectedDomains, domains, "unexpected domain") }) } } diff --git a/pkg/provider/acme/store.go b/pkg/provider/acme/store.go index f8ea1baef..4d8c7965b 100644 --- a/pkg/provider/acme/store.go +++ b/pkg/provider/acme/store.go @@ -1,20 +1,27 @@ package acme -// StoredData represents the data managed by Store +// StoredData represents the data managed by Store. type StoredData struct { - Account *Account - Certificates []*Certificate + Account *Account + Certificates []*CertAndStore +} + +// StoredChallengeData represents the data managed by ChallengeStore. +type StoredChallengeData struct { HTTPChallenges map[string]map[string][]byte TLSChallenges map[string]*Certificate } -// Store is a generic interface that represents a storage +// Store is a generic interface that represents a storage. type Store interface { - GetAccount() (*Account, error) - SaveAccount(*Account) error - GetCertificates() ([]*Certificate, error) - SaveCertificates([]*Certificate) error + GetAccount(string) (*Account, error) + SaveAccount(string, *Account) error + GetCertificates(string) ([]*CertAndStore, error) + SaveCertificates(string, []*CertAndStore) error +} +// ChallengeStore is a generic interface that represents a store for challenge data. +type ChallengeStore interface { GetHTTPChallengeToken(token, domain string) ([]byte, error) SetHTTPChallengeToken(token, domain string, keyAuth []byte) error RemoveHTTPChallengeToken(token, domain string) error diff --git a/pkg/provider/kubernetes/crd/kubernetes.go b/pkg/provider/kubernetes/crd/kubernetes.go index 8f4a463d8..2450b6166 100644 --- a/pkg/provider/kubernetes/crd/kubernetes.go +++ b/pkg/provider/kubernetes/crd/kubernetes.go @@ -438,7 +438,10 @@ func (p *Provider) loadIngressRouteConfiguration(ctx context.Context, client Cli } if ingressRoute.Spec.TLS != nil { - tlsConf := &dynamic.RouterTLSConfig{} + tlsConf := &dynamic.RouterTLSConfig{ + CertResolver: ingressRoute.Spec.TLS.CertResolver, + } + if ingressRoute.Spec.TLS.Options != nil && len(ingressRoute.Spec.TLS.Options.Name) > 0 { tlsOptionsName := ingressRoute.Spec.TLS.Options.Name // Is a Kubernetes CRD reference, (i.e. not a cross-provider reference) @@ -537,7 +540,8 @@ func (p *Provider) loadIngressRouteTCPConfiguration(ctx context.Context, client if ingressRouteTCP.Spec.TLS != nil { conf.Routers[serviceName].TLS = &dynamic.RouterTCPTLSConfig{ - Passthrough: ingressRouteTCP.Spec.TLS.Passthrough, + Passthrough: ingressRouteTCP.Spec.TLS.Passthrough, + CertResolver: ingressRouteTCP.Spec.TLS.CertResolver, } if ingressRouteTCP.Spec.TLS.Options != nil && len(ingressRouteTCP.Spec.TLS.Options.Name) > 0 { diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go index 2fb9be90a..ac7eb32e3 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroute.go @@ -32,7 +32,8 @@ type TLS struct { // certificate details. SecretName string `json:"secretName"` // Options is a reference to a TLSOption, that specifies the parameters of the TLS connection. - Options *TLSOptionRef `json:"options"` + Options *TLSOptionRef `json:"options"` + CertResolver string `json:"certResolver"` } // TLSOptionRef is a ref to the TLSOption resources. diff --git a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroutetcp.go b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroutetcp.go index 4b844722c..c97bb109e 100644 --- a/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroutetcp.go +++ b/pkg/provider/kubernetes/crd/traefik/v1alpha1/ingressroutetcp.go @@ -30,7 +30,8 @@ type TLSTCP struct { SecretName string `json:"secretName"` Passthrough bool `json:"passthrough"` // Options is a reference to a TLSOption, that specifies the parameters of the TLS connection. - Options *TLSOptionTCPRef `json:"options"` + Options *TLSOptionTCPRef `json:"options"` + CertResolver string `json:"certResolver"` } // TLSOptionTCPRef is a ref to the TLSOption resources. diff --git a/pkg/server/router/route_appender_factory.go b/pkg/server/router/route_appender_factory.go index 5565aa616..2391fea79 100644 --- a/pkg/server/router/route_appender_factory.go +++ b/pkg/server/router/route_appender_factory.go @@ -11,7 +11,7 @@ import ( ) // NewRouteAppenderFactory Creates a new RouteAppenderFactory -func NewRouteAppenderFactory(staticConfiguration static.Configuration, entryPointName string, acmeProvider *acme.Provider) *RouteAppenderFactory { +func NewRouteAppenderFactory(staticConfiguration static.Configuration, entryPointName string, acmeProvider []*acme.Provider) *RouteAppenderFactory { return &RouteAppenderFactory{ staticConfiguration: staticConfiguration, entryPointName: entryPointName, @@ -23,15 +23,18 @@ func NewRouteAppenderFactory(staticConfiguration static.Configuration, entryPoin type RouteAppenderFactory struct { staticConfiguration static.Configuration entryPointName string - acmeProvider *acme.Provider + acmeProvider []*acme.Provider } // NewAppender Creates a new RouteAppender func (r *RouteAppenderFactory) NewAppender(ctx context.Context, middlewaresBuilder *middleware.Builder, runtimeConfiguration *runtime.Configuration) types.RouteAppender { aggregator := NewRouteAppenderAggregator(ctx, middlewaresBuilder, r.staticConfiguration, r.entryPointName, runtimeConfiguration) - if r.acmeProvider != nil && r.acmeProvider.HTTPChallenge != nil && r.acmeProvider.HTTPChallenge.EntryPoint == r.entryPointName { - aggregator.AddAppender(r.acmeProvider) + for _, p := range r.acmeProvider { + if p != nil && p.HTTPChallenge != nil && p.HTTPChallenge.EntryPoint == r.entryPointName { + aggregator.AddAppender(p) + break + } } return aggregator diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index 3111f3838..5552b2e22 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -79,6 +79,11 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string) m return entryPointHandlers } +type nameAndConfig struct { + routerName string // just so we have it as additional information when logging + TLSConfig *tls.Config +} + func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string]*runtime.TCPRouterInfo, configsHTTP map[string]*runtime.RouterInfo, handlerHTTP http.Handler, handlerHTTPS http.Handler) (*tcp.Router, error) { router := &tcp.Router{} router.HTTPHandler(handlerHTTP) @@ -86,15 +91,11 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string defaultTLSConf, err := m.tlsManager.Get("default", defaultTLSConfigName) if err != nil { - return nil, err + log.FromContext(ctx).Errorf("Error during the build of the default TLS configuration: %v", err) } router.HTTPSHandler(handlerHTTPS, defaultTLSConf) - type nameAndConfig struct { - routerName string // just so we have it as additional information when logging - TLSConfig *tls.Config - } // Keyed by domain, then by options reference. tlsOptionsForHostSNI := map[string]map[string]nameAndConfig{} for routerHTTPName, routerHTTPConfig := range configsHTTP { @@ -156,7 +157,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string } else { routers := make([]string, 0, len(tlsConfigs)) for _, v := range tlsConfigs { - configsHTTP[v.routerName].AddError(fmt.Errorf("found different TLS options for routers on the same host %v, so using the default TLS option instead", hostSNI), false) + configsHTTP[v.routerName].AddError(fmt.Errorf("found different TLS options for routers on the same host %v, so using the default TLS options instead", hostSNI), false) routers = append(routers, v.routerName) } logger.Warnf("Found different TLS options for routers on the same host %v, so using the default TLS options instead for these routers: %#v", hostSNI, routers) diff --git a/pkg/tls/tlsmanager.go b/pkg/tls/tlsmanager.go index 1873cfe58..90914998b 100644 --- a/pkg/tls/tlsmanager.go +++ b/pkg/tls/tlsmanager.go @@ -74,17 +74,22 @@ func (m *Manager) Get(storeName string, configName string) (*tls.Config, error) m.lock.RLock() defer m.lock.RUnlock() + var tlsConfig *tls.Config + var err error + config, ok := m.configs[configName] if !ok { - return nil, fmt.Errorf("unknown TLS options: %s", configName) + err = fmt.Errorf("unknown TLS options: %s", configName) + tlsConfig = &tls.Config{} } store := m.getStore(storeName) - tlsConfig, err := buildTLSConfig(config) - if err != nil { - log.Error(err) - tlsConfig = &tls.Config{} + if err == nil { + tlsConfig, err = buildTLSConfig(config) + if err != nil { + tlsConfig = &tls.Config{} + } } tlsConfig.GetCertificate = func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error) { @@ -113,7 +118,8 @@ func (m *Manager) Get(storeName string, configName string) (*tls.Config, error) log.WithoutContext().Debugf("Serving default certificate for request: %q", domainToCheck) return store.DefaultCertificate, nil } - return tlsConfig, nil + + return tlsConfig, err } func (m *Manager) getStore(storeName string) *CertificateStore { @@ -143,7 +149,7 @@ func buildCertificateStore(tlsStore Store) (*CertificateStore, error) { } certificateStore.DefaultCertificate = cert } else { - log.Debug("No default certificate, generate one") + log.Debug("No default certificate, generating one") cert, err := generate.DefaultCertificate() if err != nil { return certificateStore, err diff --git a/pkg/tls/tlsmanager_test.go b/pkg/tls/tlsmanager_test.go index a176bfe11..9fcc4935b 100644 --- a/pkg/tls/tlsmanager_test.go +++ b/pkg/tls/tlsmanager_test.go @@ -152,11 +152,21 @@ func TestManager_Get(t *testing.T) { func TestClientAuth(t *testing.T) { tlsConfigs := map[string]Options{ - "eca": {ClientAuth: ClientAuth{}}, - "ecat": {ClientAuth: ClientAuth{ClientAuthType: ""}}, - "ncc": {ClientAuth: ClientAuth{ClientAuthType: "NoClientCert"}}, - "rcc": {ClientAuth: ClientAuth{ClientAuthType: "RequestClientCert"}}, - "racc": {ClientAuth: ClientAuth{ClientAuthType: "RequireAnyClientCert"}}, + "eca": { + ClientAuth: ClientAuth{}, + }, + "ecat": { + ClientAuth: ClientAuth{ClientAuthType: ""}, + }, + "ncc": { + ClientAuth: ClientAuth{ClientAuthType: "NoClientCert"}, + }, + "rcc": { + ClientAuth: ClientAuth{ClientAuthType: "RequestClientCert"}, + }, + "racc": { + ClientAuth: ClientAuth{ClientAuthType: "RequireAnyClientCert"}, + }, "vccig": { ClientAuth: ClientAuth{ CAFiles: []FileOrContent{localhostCert}, @@ -166,7 +176,9 @@ func TestClientAuth(t *testing.T) { "vccigwca": { ClientAuth: ClientAuth{ClientAuthType: "VerifyClientCertIfGiven"}, }, - "ravcc": {ClientAuth: ClientAuth{ClientAuthType: "RequireAndVerifyClientCert"}}, + "ravcc": { + ClientAuth: ClientAuth{ClientAuthType: "RequireAndVerifyClientCert"}, + }, "ravccwca": { ClientAuth: ClientAuth{ CAFiles: []FileOrContent{localhostCert}, @@ -179,7 +191,9 @@ func TestClientAuth(t *testing.T) { ClientAuthType: "RequireAndVerifyClientCert", }, }, - "ucat": {ClientAuth: ClientAuth{ClientAuthType: "Unknown"}}, + "ucat": { + ClientAuth: ClientAuth{ClientAuthType: "Unknown"}, + }, } block, _ := pem.Decode([]byte(localhostCert)) @@ -191,6 +205,7 @@ func TestClientAuth(t *testing.T) { tlsOptionsName string expectedClientAuth tls.ClientAuthType expectedRawSubject []byte + expectedError bool }{ { desc: "Empty ClientAuth option should get a tls.NoClientCert (default value)", @@ -223,14 +238,16 @@ func TestClientAuth(t *testing.T) { expectedClientAuth: tls.VerifyClientCertIfGiven, }, { - desc: "VerifyClientCertIfGiven option without CAFiles yields a default ClientAuthType (NoClientCert)", + desc: "VerifyClientCertIfGiven option without CAFiles yields a default ClientAuthType (NoClientCert)", tlsOptionsName: "vccigwca", expectedClientAuth: tls.NoClientCert, + expectedError: true, }, { - desc: "RequireAndVerifyClientCert option without CAFiles yields a default ClientAuthType (NoClientCert)", + desc: "RequireAndVerifyClientCert option without CAFiles yields a default ClientAuthType (NoClientCert)", tlsOptionsName: "ravcc", expectedClientAuth: tls.NoClientCert, + expectedError: true, }, { desc: "RequireAndVerifyClientCert option should get a tls.RequireAndVerifyClientCert as ClientAuthType with CA files", @@ -242,11 +259,13 @@ func TestClientAuth(t *testing.T) { desc: "Unknown option yields a default ClientAuthType (NoClientCert)", tlsOptionsName: "ucat", expectedClientAuth: tls.NoClientCert, + expectedError: true, }, { desc: "Bad CA certificate content yields a default ClientAuthType (NoClientCert)", tlsOptionsName: "ravccwbca", expectedClientAuth: tls.NoClientCert, + expectedError: true, }, } @@ -259,6 +278,12 @@ func TestClientAuth(t *testing.T) { t.Parallel() config, err := tlsManager.Get("default", test.tlsOptionsName) + + if test.expectedError { + assert.Error(t, err) + return + } + assert.NoError(t, err) if test.expectedRawSubject != nil { diff --git a/pkg/types/domains.go b/pkg/types/domains.go index 0ebda7f59..101fb584a 100644 --- a/pkg/types/domains.go +++ b/pkg/types/domains.go @@ -1,10 +1,11 @@ package types import ( - "fmt" "strings" ) +// +k8s:deepcopy-gen=true + // Domain holds a domain name with SANs. type Domain struct { Main string `description:"Default subject name." json:"main,omitempty" toml:"main,omitempty" yaml:"main,omitempty"` @@ -28,44 +29,6 @@ func (d *Domain) Set(domains []string) { } } -// Domains parse []Domain. -type Domains []Domain - -// Set []Domain -func (ds *Domains) Set(str string) error { - fargs := func(c rune) bool { - return c == ',' || c == ';' - } - - // get function - slice := strings.FieldsFunc(str, fargs) - if len(slice) < 1 { - return fmt.Errorf("parse error ACME.Domain. Unable to parse %s", str) - } - - d := Domain{ - Main: slice[0], - } - - if len(slice) > 1 { - d.SANs = slice[1:] - } - - *ds = append(*ds, d) - return nil -} - -// Get []Domain. -func (ds *Domains) Get() interface{} { return []Domain(*ds) } - -// String returns []Domain in string. -func (ds *Domains) String() string { return fmt.Sprintf("%+v", *ds) } - -// SetValue sets []Domain into the parser -func (ds *Domains) SetValue(val interface{}) { - *ds = val.([]Domain) -} - // MatchDomain returns true if a domain match the cert domain. func MatchDomain(domain string, certDomain string) bool { if domain == certDomain { diff --git a/pkg/types/zz_generated.deepcopy.go b/pkg/types/zz_generated.deepcopy.go new file mode 100644 index 000000000..78befb756 --- /dev/null +++ b/pkg/types/zz_generated.deepcopy.go @@ -0,0 +1,50 @@ +// +build !ignore_autogenerated + +/* +The MIT License (MIT) + +Copyright (c) 2016-2019 Containous SAS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package types + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Domain) DeepCopyInto(out *Domain) { + *out = *in + if in.SANs != nil { + in, out := &in.SANs, &out.SANs + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Domain. +func (in *Domain) DeepCopy() *Domain { + if in == nil { + return nil + } + out := new(Domain) + in.DeepCopyInto(out) + return out +} diff --git a/script/update-generated-crd-code.sh b/script/update-generated-crd-code.sh index b7f7a5e4b..b19eceb63 100755 --- a/script/update-generated-crd-code.sh +++ b/script/update-generated-crd-code.sh @@ -11,4 +11,8 @@ REPO_ROOT=${HACK_DIR}/.. --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \ "$@" -deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config/dynamic --input-dirs github.com/containous/traefik/pkg/tls -O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl +deepcopy-gen \ +--input-dirs github.com/containous/traefik/pkg/config/dynamic \ +--input-dirs github.com/containous/traefik/pkg/tls \ +--input-dirs github.com/containous/traefik/pkg/types \ +-O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl From 092aa8fa6ddefb2bc6308a6fd4d692206daf3818 Mon Sep 17 00:00:00 2001 From: mpl Date: Fri, 19 Jul 2019 12:28:07 +0200 Subject: [PATCH 34/49] API: remove configuration of Entrypoint and Middlewares Co-authored-by: Julien Salleyron --- cmd/healthcheck/healthcheck.go | 2 +- .../observability/metrics/prometheus.md | 48 ---------- docs/content/operations/api.md | 88 ++----------------- docs/content/operations/ping.md | 18 +--- .../reference/static-configuration/cli-ref.md | 31 +------ .../reference/static-configuration/env-ref.md | 31 +------ integration/fixtures/marathon/simple.toml | 3 +- integration/fixtures/ratelimit/simple.toml | 4 - integration/simple_test.go | 3 + pkg/anonymize/anonymize_config_test.go | 13 +-- pkg/api/handler.go | 7 +- pkg/config/static/static_config.go | 20 ++--- pkg/ping/ping.go | 3 - pkg/provider/rest/rest.go | 2 - .../router/route_appender_aggregator.go | 28 +++--- .../router/route_appender_aggregator_test.go | 13 +-- pkg/types/metrics.go | 3 - 17 files changed, 48 insertions(+), 269 deletions(-) diff --git a/cmd/healthcheck/healthcheck.go b/cmd/healthcheck/healthcheck.go index 5bbc09eb0..36dcc9c5e 100644 --- a/cmd/healthcheck/healthcheck.go +++ b/cmd/healthcheck/healthcheck.go @@ -51,7 +51,7 @@ func Do(staticConfiguration static.Configuration) (*http.Response, error) { return nil, errors.New("please enable `ping` to use health check") } - pingEntryPoint, ok := staticConfiguration.EntryPoints[staticConfiguration.Ping.EntryPoint] + pingEntryPoint, ok := staticConfiguration.EntryPoints["traefik"] if !ok { return nil, errors.New("missing `ping` entrypoint") } diff --git a/docs/content/observability/metrics/prometheus.md b/docs/content/observability/metrics/prometheus.md index d409f05de..8ffd46cf1 100644 --- a/docs/content/observability/metrics/prometheus.md +++ b/docs/content/observability/metrics/prometheus.md @@ -44,54 +44,6 @@ metrics: --metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000 ``` -#### `entryPoint` - -_Optional, Default=traefik_ - -Entry-point used by prometheus to expose metrics. - -```toml tab="File (TOML)" -[metrics] - [metrics.prometheus] - entryPoint = traefik -``` - -```yaml tab="File (TOML)" -metrics: - prometheus: - entryPoint: traefik -``` - -```bash tab="CLI" ---metrics ---metrics.prometheus.entryPoint=traefik -``` - -#### `middlewares` - -_Optional, Default=""_ - -Middlewares. - -```toml tab="File (TOML)" -[metrics] - [metrics.prometheus] - middlewares = ["xxx", "yyy"] -``` - -```yaml tab="File (TOML)" -metrics: - prometheus: - middlewares: - - xxx - - yyy -``` - -```bash tab="CLI" ---metrics ---metrics.prometheus.middlewares="xxx,yyy" -``` - #### `addEntryPointsLabels` _Optional, Default=true_ diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index 70117dc7a..2cbba5862 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -1,5 +1,8 @@ # API +!!! important + In the beta version, you can't configure middlewares (basic authentication or white listing) anymore, but as security is important, this will change before the RC version. + Traefik exposes a number of information through an API handler, such as the configuration of all routers, services, middlewares, etc. As with all features of Traefik, this handler can be enabled with the [static configuration](../getting-started/configuration-overview.md#the-static-configuration). @@ -14,14 +17,14 @@ In production, it should be at least secured by authentication and authorization A good sane default (non exhaustive) set of recommendations would be to apply the following protection mechanisms: -* At the application level: - securing with middlewares such as [basic authentication](../middlewares/basicauth.md) or [white listing](../middlewares/ipwhitelist.md). - * At the transport level: NOT publicly exposing the API's port, keeping it restricted to internal networks (as in the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege), applied to networks). +!!! important + In the beta version, you can't configure middlewares (basic authentication or white listing) anymore, but as security is important, this will change before the RC version. + ## Configuration To enable the API handler: @@ -49,37 +52,6 @@ Enable the dashboard. More about the dashboard features [here](./dashboard.md). --api.dashboard ``` -### `entrypoint` - -_Optional, Default="traefik"_ - -The entry point that the API handler will be bound to. -The default ("traefik") is an internal entry point (which is always defined). - -```toml tab="File" -[api] - entrypoint = "web" -``` - -```bash tab="CLI" ---api.entrypoint="web" -``` - -### `middlewares` - -_Optional, Default=empty_ - -The list of [middlewares](../middlewares/overview.md) applied to the API handler. - -```toml tab="File" -[api] - middlewares = ["api-auth", "api-prefix"] -``` - -```bash tab="CLI" ---api.middlewares="api-auth,api-prefix" -``` - ### `debug` _Optional, Default=false_ @@ -120,51 +92,3 @@ All the following endpoints must be accessed with a `GET` HTTP request. | `/debug/pprof/profile` | See the [pprof Profile](https://golang.org/pkg/net/http/pprof/#Profile) Go documentation. | | `/debug/pprof/symbol` | See the [pprof Symbol](https://golang.org/pkg/net/http/pprof/#Symbol) Go documentation. | | `/debug/pprof/trace` | See the [pprof Trace](https://golang.org/pkg/net/http/pprof/#Trace) Go documentation. | - -## Common Configuration Use Cases - -### Address / Port - -You can define a custom address/port like this: - -```toml -[entryPoints] - [entryPoints.web] - address = ":80" - - [entryPoints.foo] - address = ":8082" - - [entryPoints.bar] - address = ":8083" - -[ping] - entryPoint = "foo" - -[api] - entryPoint = "bar" -``` - -In the above example, you would access a service at /foo, an api endpoint, or the health-check as follows: - -* Service: `http://hostname:80/foo` -* API: `http://hostname:8083/api/http/routers` -* Ping URL: `http://hostname:8082/ping` - -### Authentication - -To restrict access to the API handler, one can add authentication with the [basic auth middleware](../middlewares/basicauth.md). - -```toml -[api] - middlewares=["api-auth"] -``` - -```toml -[http.middlewares] - [http.middlewares.api-auth.basicAuth] - users = [ - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", - "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", - ] -``` diff --git a/docs/content/operations/ping.md b/docs/content/operations/ping.md index 694e220dd..6200f2739 100644 --- a/docs/content/operations/ping.md +++ b/docs/content/operations/ping.md @@ -11,26 +11,10 @@ Checking the Health of Your Traefik Instances [ping] ``` -??? example "Enabling /ping on a dedicated EntryPoint" - - ```toml - [entryPoints] - [entryPoints.web] - address = ":80" - - [entryPoints.ping] - address = ":8082" - - [ping] - entryPoint = "ping" - ``` - | Path | Method | Description | |---------|---------------|-----------------------------------------------------------------------------------------------------| | `/ping` | `GET`, `HEAD` | A simple endpoint to check for Traefik process liveness. Return a code `200` with the content: `OK` | ## Configuration Options -The `/ping` health-check URL is enabled with the command-line `--ping` or config file option `[ping]`. - -You can customize the `entryPoint` where the `/ping` is active with the `entryPoint` option (default value: `traefik`) \ No newline at end of file +The `/ping` health-check URL is enabled with the command-line `--ping` or config file option `[ping]`. \ No newline at end of file diff --git a/docs/content/reference/static-configuration/cli-ref.md b/docs/content/reference/static-configuration/cli-ref.md index 2e9069e2f..55ebff757 100644 --- a/docs/content/reference/static-configuration/cli-ref.md +++ b/docs/content/reference/static-configuration/cli-ref.md @@ -45,18 +45,6 @@ Activate dashboard. (Default: ```true```) `--api.debug`: Enable additional endpoints for debugging and profiling. (Default: ```false```) -`--api.entrypoint`: -The entry point that the API handler will be bound to. (Default: ```traefik```) - -`--api.middlewares`: -Middleware list. - -`--api.statistics`: -Enable more detailed statistics. (Default: ```false```) - -`--api.statistics.recenterrors`: -Number of recent errors logged. (Default: ```10```) - `--certificatesresolvers.`: Certificates resolvers configuration. (Default: ```false```) @@ -219,12 +207,6 @@ Enable metrics on services. (Default: ```true```) `--metrics.prometheus.buckets`: Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) -`--metrics.prometheus.entrypoint`: -EntryPoint. (Default: ```traefik```) - -`--metrics.prometheus.middlewares`: -Middlewares. - `--metrics.statsd`: StatsD metrics exporter type. (Default: ```false```) @@ -241,13 +223,7 @@ Enable metrics on services. (Default: ```true```) StatsD push interval. (Default: ```10```) `--ping`: -Enable ping. (Default: ```false```) - -`--ping.entrypoint`: -Ping entryPoint. (Default: ```traefik```) - -`--ping.middlewares`: -Middleware list. +Enable ping. (Default: ```true```) `--providers.docker`: Enable Docker backend with default settings. (Default: ```false```) @@ -457,10 +433,7 @@ Defines the polling interval in seconds. (Default: ```15```) Watch provider. (Default: ```true```) `--providers.rest`: -Enable Rest backend with default settings. (Default: ```false```) - -`--providers.rest.entrypoint`: -EntryPoint. (Default: ```traefik```) +Enable Rest backend with default settings. (Default: ```true```) `--serverstransport.forwardingtimeouts.dialtimeout`: The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```) diff --git a/docs/content/reference/static-configuration/env-ref.md b/docs/content/reference/static-configuration/env-ref.md index c1d8a8397..e578642e9 100644 --- a/docs/content/reference/static-configuration/env-ref.md +++ b/docs/content/reference/static-configuration/env-ref.md @@ -45,18 +45,6 @@ Activate dashboard. (Default: ```true```) `TRAEFIK_API_DEBUG`: Enable additional endpoints for debugging and profiling. (Default: ```false```) -`TRAEFIK_API_ENTRYPOINT`: -The entry point that the API handler will be bound to. (Default: ```traefik```) - -`TRAEFIK_API_MIDDLEWARES`: -Middleware list. - -`TRAEFIK_API_STATISTICS`: -Enable more detailed statistics. (Default: ```false```) - -`TRAEFIK_API_STATISTICS_RECENTERRORS`: -Number of recent errors logged. (Default: ```10```) - `TRAEFIK_CERTIFICATESRESOLVERS_`: Certificates resolvers configuration. (Default: ```false```) @@ -219,12 +207,6 @@ Enable metrics on services. (Default: ```true```) `TRAEFIK_METRICS_PROMETHEUS_BUCKETS`: Buckets for latency metrics. (Default: ```0.100000, 0.300000, 1.200000, 5.000000```) -`TRAEFIK_METRICS_PROMETHEUS_ENTRYPOINT`: -EntryPoint. (Default: ```traefik```) - -`TRAEFIK_METRICS_PROMETHEUS_MIDDLEWARES`: -Middlewares. - `TRAEFIK_METRICS_STATSD`: StatsD metrics exporter type. (Default: ```false```) @@ -241,13 +223,7 @@ Enable metrics on services. (Default: ```true```) StatsD push interval. (Default: ```10```) `TRAEFIK_PING`: -Enable ping. (Default: ```false```) - -`TRAEFIK_PING_ENTRYPOINT`: -Ping entryPoint. (Default: ```traefik```) - -`TRAEFIK_PING_MIDDLEWARES`: -Middleware list. +Enable ping. (Default: ```true```) `TRAEFIK_PROVIDERS_DOCKER`: Enable Docker backend with default settings. (Default: ```false```) @@ -457,10 +433,7 @@ Defines the polling interval in seconds. (Default: ```15```) Watch provider. (Default: ```true```) `TRAEFIK_PROVIDERS_REST`: -Enable Rest backend with default settings. (Default: ```false```) - -`TRAEFIK_PROVIDERS_REST_ENTRYPOINT`: -EntryPoint. (Default: ```traefik```) +Enable Rest backend with default settings. (Default: ```true```) `TRAEFIK_SERVERSTRANSPORT_FORWARDINGTIMEOUTS_DIALTIMEOUT`: The amount of time to wait until a connection to a backend server can be established. If zero, no timeout exists. (Default: ```30```) diff --git a/integration/fixtures/marathon/simple.toml b/integration/fixtures/marathon/simple.toml index 6ae3c66c0..81082bfe4 100644 --- a/integration/fixtures/marathon/simple.toml +++ b/integration/fixtures/marathon/simple.toml @@ -8,11 +8,10 @@ [entryPoints] [entryPoints.web] address = ":8000" - [entryPoints.api] + [entryPoints.traefik] address = ":9090" [api] - entryPoint = "api" [providers] [providers.marathon] diff --git a/integration/fixtures/ratelimit/simple.toml b/integration/fixtures/ratelimit/simple.toml index 9a1a18c24..49373088a 100644 --- a/integration/fixtures/ratelimit/simple.toml +++ b/integration/fixtures/ratelimit/simple.toml @@ -3,7 +3,6 @@ sendAnonymousUsage = false [api] - entrypoint="api" [log] level = "DEBUG" @@ -12,9 +11,6 @@ [entryPoints.web] address = ":8081" - [entryPoints.api] - address = ":8080" - [providers.file] filename = "{{ .SelfFilename }}" diff --git a/integration/simple_test.go b/integration/simple_test.go index 985e76eb5..9ab260eb1 100644 --- a/integration/simple_test.go +++ b/integration/simple_test.go @@ -159,6 +159,7 @@ func (s *SimpleSuite) TestRequestAcceptGraceTimeout(c *check.C) { } func (s *SimpleSuite) TestApiOnSameEntryPoint(c *check.C) { + c.Skip("Waiting for new api handler implementation") s.createComposeProject(c, "base") s.composeProject.Start(c) @@ -221,6 +222,8 @@ func (s *SimpleSuite) TestStatsWithMultipleEntryPoint(c *check.C) { } func (s *SimpleSuite) TestNoAuthOnPing(c *check.C) { + c.Skip("Waiting for new api handler implementation") + s.createComposeProject(c, "base") s.composeProject.Start(c) diff --git a/pkg/anonymize/anonymize_config_test.go b/pkg/anonymize/anonymize_config_test.go index 823217c70..2e0e3d338 100644 --- a/pkg/anonymize/anonymize_config_test.go +++ b/pkg/anonymize/anonymize_config_test.go @@ -119,8 +119,7 @@ func TestDo_globalConfiguration(t *testing.T) { } config.API = &static.API{ - EntryPoint: "traefik", - Dashboard: true, + Dashboard: true, DashboardAssets: &assetfs.AssetFS{ Asset: func(path string) ([]byte, error) { return nil, nil @@ -133,7 +132,6 @@ func TestDo_globalConfiguration(t *testing.T) { }, Prefix: "fii", }, - Middlewares: []string{"first", "second"}, } config.Providers.File = &file.Provider{ @@ -186,9 +184,7 @@ func TestDo_globalConfiguration(t *testing.T) { config.Metrics = &types.Metrics{ Prometheus: &types.Prometheus{ - Buckets: []float64{0.1, 0.3, 1.2, 5}, - EntryPoint: "MyEntryPoint", - Middlewares: []string{"m1", "m2"}, + Buckets: []float64{0.1, 0.3, 1.2, 5}, }, DataDog: &types.DataDog{ Address: "localhost:8181", @@ -209,10 +205,7 @@ func TestDo_globalConfiguration(t *testing.T) { }, } - config.Ping = &ping.Handler{ - EntryPoint: "MyEntryPoint", - Middlewares: []string{"m1", "m2", "m3"}, - } + config.Ping = &ping.Handler{} config.Tracing = &static.Tracing{ ServiceName: "myServiceName", diff --git a/pkg/api/handler.go b/pkg/api/handler.go index 75fa1f7ff..594e9b46c 100644 --- a/pkg/api/handler.go +++ b/pkg/api/handler.go @@ -11,7 +11,6 @@ import ( "github.com/containous/traefik/pkg/config/runtime" "github.com/containous/traefik/pkg/config/static" "github.com/containous/traefik/pkg/log" - "github.com/containous/traefik/pkg/types" "github.com/containous/traefik/pkg/version" assetfs "github.com/elazarl/go-bindata-assetfs" ) @@ -50,7 +49,7 @@ type Handler struct { // runtimeConfiguration is the data set used to create all the data representations exposed by the API. runtimeConfiguration *runtime.Configuration staticConfig static.Configuration - statistics *types.Statistics + // statistics *types.Statistics // stats *thoasstats.Stats // FIXME stats // StatsRecorder *middlewares.StatsRecorder // FIXME stats dashboardAssets *assetfs.AssetFS @@ -65,8 +64,8 @@ func New(staticConfig static.Configuration, runtimeConfig *runtime.Configuration } return &Handler{ - dashboard: staticConfig.API.Dashboard, - statistics: staticConfig.API.Statistics, + dashboard: staticConfig.API.Dashboard, + // statistics: staticConfig.API.Statistics, dashboardAssets: staticConfig.API.DashboardAssets, runtimeConfiguration: rConfig, staticConfig: staticConfig, diff --git a/pkg/config/static/static_config.go b/pkg/config/static/static_config.go index e297e422e..3b568c458 100644 --- a/pkg/config/static/static_config.go +++ b/pkg/config/static/static_config.go @@ -85,17 +85,15 @@ type ServersTransport struct { // API holds the API configuration type API struct { - 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:"-"` + 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"` + // TODO: Re-enable statistics + // Statistics *types.Statistics `description:"Enable more detailed statistics." json:"statistics,omitempty" toml:"statistics,omitempty" yaml:"statistics,omitempty" export:"true" label:"allowEmpty"` + DashboardAssets *assetfs.AssetFS `json:"-" toml:"-" yaml:"-" label:"-"` } // SetDefaults sets the default values. func (a *API) SetDefaults() { - a.EntryPoint = "traefik" a.Dashboard = true } @@ -175,10 +173,10 @@ func (c *Configuration) SetEffectiveConfiguration() { } } - if (c.API != nil && c.API.EntryPoint == DefaultInternalEntryPointName) || - (c.Ping != nil && c.Ping.EntryPoint == DefaultInternalEntryPointName) || - (c.Metrics != nil && c.Metrics.Prometheus != nil && c.Metrics.Prometheus.EntryPoint == DefaultInternalEntryPointName) || - (c.Providers.Rest != nil && c.Providers.Rest.EntryPoint == DefaultInternalEntryPointName) { + if (c.API != nil) || + (c.Ping != nil) || + (c.Metrics != nil && c.Metrics.Prometheus != nil) || + (c.Providers.Rest != nil) { if _, ok := c.EntryPoints[DefaultInternalEntryPointName]; !ok { ep := &EntryPoint{Address: ":8080"} ep.SetDefaults() diff --git a/pkg/ping/ping.go b/pkg/ping/ping.go index 50e7b4708..4477c71c7 100644 --- a/pkg/ping/ping.go +++ b/pkg/ping/ping.go @@ -10,14 +10,11 @@ import ( // Handler expose ping routes. type Handler struct { - 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 } // SetDefaults sets the default values. func (h *Handler) SetDefaults() { - h.EntryPoint = "traefik" } // WithContext causes the ping endpoint to serve non 200 responses. diff --git a/pkg/provider/rest/rest.go b/pkg/provider/rest/rest.go index 8e3028286..175e89dbd 100644 --- a/pkg/provider/rest/rest.go +++ b/pkg/provider/rest/rest.go @@ -19,12 +19,10 @@ var _ provider.Provider = (*Provider)(nil) // Provider is a provider.Provider implementation that provides a Rest API. type Provider struct { configurationChan chan<- dynamic.Message - EntryPoint string `description:"EntryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"` } // SetDefaults sets the default values. func (p *Provider) SetDefaults() { - p.EntryPoint = "traefik" } var templatesRenderer = render.New(render.Options{Directory: "nowhere"}) diff --git a/pkg/server/router/route_appender_aggregator.go b/pkg/server/router/route_appender_aggregator.go index 271498a23..80bb02583 100644 --- a/pkg/server/router/route_appender_aggregator.go +++ b/pkg/server/router/route_appender_aggregator.go @@ -23,32 +23,24 @@ func NewRouteAppenderAggregator(ctx context.Context, chainBuilder chainBuilder, entryPointName string, runtimeConfiguration *runtime.Configuration) *RouteAppenderAggregator { aggregator := &RouteAppenderAggregator{} + if entryPointName != "traefik" { + return aggregator + } + if conf.Providers != nil && conf.Providers.Rest != nil { aggregator.AddAppender(conf.Providers.Rest) } - if conf.API != nil && conf.API.EntryPoint == entryPointName { - chain := chainBuilder.BuildChain(ctx, conf.API.Middlewares) - aggregator.AddAppender(&WithMiddleware{ - appender: api.New(conf, runtimeConfiguration), - routerMiddlewares: chain, - }) + if conf.API != nil { + aggregator.AddAppender(api.New(conf, runtimeConfiguration)) } - if conf.Ping != nil && conf.Ping.EntryPoint == entryPointName { - chain := chainBuilder.BuildChain(ctx, conf.Ping.Middlewares) - aggregator.AddAppender(&WithMiddleware{ - appender: conf.Ping, - routerMiddlewares: chain, - }) + if conf.Ping != nil { + aggregator.AddAppender(conf.Ping) } - if conf.Metrics != nil && conf.Metrics.Prometheus != nil && conf.Metrics.Prometheus.EntryPoint == entryPointName { - chain := chainBuilder.BuildChain(ctx, conf.Metrics.Prometheus.Middlewares) - aggregator.AddAppender(&WithMiddleware{ - appender: metrics.PrometheusHandler{}, - routerMiddlewares: chain, - }) + if conf.Metrics != nil && conf.Metrics.Prometheus != nil { + aggregator.AddAppender(metrics.PrometheusHandler{}) } return aggregator diff --git a/pkg/server/router/route_appender_aggregator_test.go b/pkg/server/router/route_appender_aggregator_test.go index a9406ad39..7e948262c 100644 --- a/pkg/server/router/route_appender_aggregator_test.go +++ b/pkg/server/router/route_appender_aggregator_test.go @@ -30,6 +30,7 @@ func (c *ChainBuilderMock) BuildChain(ctx context.Context, middles []string) *al } func TestNewRouteAppenderAggregator(t *testing.T) { + t.Skip("Waiting for new api handler implementation") testCases := []struct { desc string staticConf static.Configuration @@ -40,12 +41,12 @@ func TestNewRouteAppenderAggregator(t *testing.T) { desc: "API with auth, ping without auth", staticConf: static.Configuration{ Global: &static.Global{}, - API: &static.API{ - EntryPoint: "traefik", - Middlewares: []string{"dumb"}, + API: &static.API{ + // EntryPoint: "traefik", + // Middlewares: []string{"dumb"}, }, Ping: &ping.Handler{ - EntryPoint: "traefik", + // EntryPoint: "traefik", }, EntryPoints: static.EntryPoints{ "traefik": {}, @@ -69,8 +70,8 @@ func TestNewRouteAppenderAggregator(t *testing.T) { desc: "Wrong entrypoint name", staticConf: static.Configuration{ Global: &static.Global{}, - API: &static.API{ - EntryPoint: "no", + API: &static.API{ + // EntryPoint: "no", }, EntryPoints: static.EntryPoints{ "traefik": {}, diff --git a/pkg/types/metrics.go b/pkg/types/metrics.go index 3fc813955..f05d1a77c 100644 --- a/pkg/types/metrics.go +++ b/pkg/types/metrics.go @@ -15,8 +15,6 @@ type Metrics struct { // Prometheus can contain specific configuration used by the Prometheus Metrics exporter. type Prometheus struct { 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"` AddEntryPointsLabels bool `description:"Enable metrics on entry points." json:"addEntryPointsLabels,omitempty" toml:"addEntryPointsLabels,omitempty" yaml:"addEntryPointsLabels,omitempty" export:"true"` AddServicesLabels bool `description:"Enable metrics on services." json:"addServicesLabels,omitempty" toml:"addServicesLabels,omitempty" yaml:"addServicesLabels,omitempty" export:"true"` } @@ -24,7 +22,6 @@ type Prometheus struct { // SetDefaults sets the default values. func (p *Prometheus) SetDefaults() { p.Buckets = []float64{0.1, 0.3, 1.2, 5} - p.EntryPoint = "traefik" p.AddEntryPointsLabels = true p.AddServicesLabels = true } From c39a550b00b26dffad8f7950b49900a91331bbbf Mon Sep 17 00:00:00 2001 From: Julien Salleyron Date: Fri, 19 Jul 2019 15:52:03 +0200 Subject: [PATCH 35/49] Lets encrypt documentation typo --- docs/content/https/acme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index e60b6d759..bfb683872 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -117,7 +117,7 @@ when using the `TLS-ALPN-01` challenge, Traefik must be reachable by Let's Encry Use the `HTTP-01` challenge to generate and renew ACME certificates by provisioning an HTTP resource under a well-known URI. As described on the Let's Encrypt [community forum](https://community.letsencrypt.org/t/support-for-ports-other-than-80-and-443/3419/72), -when using the `HTTP-01` challenge, `acme.httpChallenge.entryPoint` must be reachable by Let's Encrypt through port 80. +when using the `HTTP-01` challenge, `certificatesResolvers.sample.acme.httpChallenge.entryPoint` must be reachable by Let's Encrypt through port 80. ??? example "Using an EntryPoint Called http for the `httpChallenge`" From 1800b0b69c5765850990f79a909976e2761ea6a7 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 19 Jul 2019 16:42:04 +0200 Subject: [PATCH 36/49] Improve error on router without service. Co-authored-by: Mathieu Lonjaret --- integration/testdata/rawdata-crd.json | 1 + pkg/api/handler_overview.go | 10 ++- pkg/api/handler_overview_test.go | 4 +- pkg/api/testdata/getrawdata.json | 3 + pkg/api/testdata/middleware-auth.json | 1 + pkg/api/testdata/middlewares-page2.json | 1 + pkg/api/testdata/middlewares.json | 3 + pkg/config/runtime/runtime.go | 109 ++++++++++++++++++------ pkg/server/middleware/middlewares.go | 6 +- pkg/server/router/router.go | 5 ++ pkg/server/router/tcp/router.go | 14 ++- pkg/server/router/tcp/router_test.go | 3 +- pkg/server/service/tcp/service.go | 5 +- 13 files changed, 125 insertions(+), 40 deletions(-) diff --git a/integration/testdata/rawdata-crd.json b/integration/testdata/rawdata-crd.json index 8b2dadbbb..8600da5de 100644 --- a/integration/testdata/rawdata-crd.json +++ b/integration/testdata/rawdata-crd.json @@ -31,6 +31,7 @@ "/tobestripped" ] }, + "status": "enabled", "usedBy": [ "default/test2.route-23c7f4c450289ee29016@kubernetescrd" ] diff --git a/pkg/api/handler_overview.go b/pkg/api/handler_overview.go index 1d90446b9..9818de22f 100644 --- a/pkg/api/handler_overview.go +++ b/pkg/api/handler_overview.go @@ -100,15 +100,19 @@ func getHTTPServiceSection(services map[string]*runtime.ServiceInfo) *section { func getHTTPMiddlewareSection(middlewares map[string]*runtime.MiddlewareInfo) *section { var countErrors int - for _, md := range middlewares { - if md.Err != nil { + var countWarnings int + for _, mid := range middlewares { + switch mid.Status { + case runtime.StatusDisabled: countErrors++ + case runtime.StatusWarning: + countWarnings++ } } return §ion{ Total: len(middlewares), - Warnings: 0, + Warnings: countWarnings, Errors: countErrors, } } diff --git a/pkg/api/handler_overview_test.go b/pkg/api/handler_overview_test.go index 5b08954f7..07c9fc05c 100644 --- a/pkg/api/handler_overview_test.go +++ b/pkg/api/handler_overview_test.go @@ -85,6 +85,7 @@ func TestHandler_Overview(t *testing.T) { Users: []string{"admin:admin"}, }, }, + Status: runtime.StatusEnabled, }, "addPrefixTest@myprovider": { Middleware: &dynamic.Middleware{ @@ -99,7 +100,8 @@ func TestHandler_Overview(t *testing.T) { Prefix: "/toto", }, }, - Err: []string{"error"}, + Err: []string{"error"}, + Status: runtime.StatusDisabled, }, }, Routers: map[string]*runtime.RouterInfo{ diff --git a/pkg/api/testdata/getrawdata.json b/pkg/api/testdata/getrawdata.json index 9ef1b9111..7e1de0bbb 100644 --- a/pkg/api/testdata/getrawdata.json +++ b/pkg/api/testdata/getrawdata.json @@ -30,6 +30,7 @@ "addPrefix": { "prefix": "/toto" }, + "status": "enabled", "usedBy": [ "bar@myprovider" ] @@ -38,6 +39,7 @@ "addPrefix": { "prefix": "/titi" }, + "status": "enabled", "usedBy": [ "test@myprovider" ] @@ -48,6 +50,7 @@ "admin:admin" ] }, + "status": "enabled", "usedBy": [ "bar@myprovider", "test@myprovider" diff --git a/pkg/api/testdata/middleware-auth.json b/pkg/api/testdata/middleware-auth.json index 074a90163..0ed588873 100644 --- a/pkg/api/testdata/middleware-auth.json +++ b/pkg/api/testdata/middleware-auth.json @@ -6,6 +6,7 @@ }, "name": "auth@myprovider", "provider": "myprovider", + "status": "enabled", "usedBy": [ "bar@myprovider", "test@myprovider" diff --git a/pkg/api/testdata/middlewares-page2.json b/pkg/api/testdata/middlewares-page2.json index d19b50439..25ebc13f5 100644 --- a/pkg/api/testdata/middlewares-page2.json +++ b/pkg/api/testdata/middlewares-page2.json @@ -5,6 +5,7 @@ }, "name": "addPrefixTest@myprovider", "provider": "myprovider", + "status": "enabled", "usedBy": [ "test@myprovider" ] diff --git a/pkg/api/testdata/middlewares.json b/pkg/api/testdata/middlewares.json index 61717ebec..c27533ee1 100644 --- a/pkg/api/testdata/middlewares.json +++ b/pkg/api/testdata/middlewares.json @@ -5,6 +5,7 @@ }, "name": "addPrefixTest@anotherprovider", "provider": "anotherprovider", + "status": "enabled", "usedBy": [ "bar@myprovider" ] @@ -15,6 +16,7 @@ }, "name": "addPrefixTest@myprovider", "provider": "myprovider", + "status": "enabled", "usedBy": [ "test@myprovider" ] @@ -27,6 +29,7 @@ }, "name": "auth@myprovider", "provider": "myprovider", + "status": "enabled", "usedBy": [ "bar@myprovider", "test@myprovider" diff --git a/pkg/config/runtime/runtime.go b/pkg/config/runtime/runtime.go index 4c6221af3..aac70cc56 100644 --- a/pkg/config/runtime/runtime.go +++ b/pkg/config/runtime/runtime.go @@ -55,7 +55,7 @@ func NewConfig(conf dynamic.Configuration) *Configuration { if len(middlewares) > 0 { runtimeConfig.Middlewares = make(map[string]*MiddlewareInfo, len(middlewares)) for k, v := range middlewares { - runtimeConfig.Middlewares[k] = &MiddlewareInfo{Middleware: v} + runtimeConfig.Middlewares[k] = &MiddlewareInfo{Middleware: v, Status: StatusEnabled} } } } @@ -81,14 +81,14 @@ func NewConfig(conf dynamic.Configuration) *Configuration { // PopulateUsedBy populates all the UsedBy lists of the underlying fields of r, // based on the relations between the included services, routers, and middlewares. -func (r *Configuration) PopulateUsedBy() { - if r == nil { +func (c *Configuration) PopulateUsedBy() { + if c == nil { return } logger := log.WithoutContext() - for routerName, routerInfo := range r.Routers { + for routerName, routerInfo := range c.Routers { // lazily initialize Status in case caller forgot to do it if routerInfo.Status == "" { routerInfo.Status = StatusEnabled @@ -102,33 +102,38 @@ func (r *Configuration) PopulateUsedBy() { for _, midName := range routerInfo.Router.Middlewares { fullMidName := getQualifiedName(providerName, midName) - if _, ok := r.Middlewares[fullMidName]; !ok { + if _, ok := c.Middlewares[fullMidName]; !ok { continue } - r.Middlewares[fullMidName].UsedBy = append(r.Middlewares[fullMidName].UsedBy, routerName) + c.Middlewares[fullMidName].UsedBy = append(c.Middlewares[fullMidName].UsedBy, routerName) } serviceName := getQualifiedName(providerName, routerInfo.Router.Service) - if _, ok := r.Services[serviceName]; !ok { + if _, ok := c.Services[serviceName]; !ok { continue } - r.Services[serviceName].UsedBy = append(r.Services[serviceName].UsedBy, routerName) + c.Services[serviceName].UsedBy = append(c.Services[serviceName].UsedBy, routerName) } - for k, serviceInfo := range r.Services { + for k, serviceInfo := range c.Services { // lazily initialize Status in case caller forgot to do it if serviceInfo.Status == "" { serviceInfo.Status = StatusEnabled } - sort.Strings(r.Services[k].UsedBy) + sort.Strings(c.Services[k].UsedBy) } - for k := range r.Middlewares { - sort.Strings(r.Middlewares[k].UsedBy) + for midName, mid := range c.Middlewares { + // lazily initialize Status in case caller forgot to do it + if mid.Status == "" { + mid.Status = StatusEnabled + } + + sort.Strings(c.Middlewares[midName].UsedBy) } - for routerName, routerInfo := range r.TCPRouters { + for routerName, routerInfo := range c.TCPRouters { // lazily initialize Status in case caller forgot to do it if routerInfo.Status == "" { routerInfo.Status = StatusEnabled @@ -141,19 +146,19 @@ func (r *Configuration) PopulateUsedBy() { } serviceName := getQualifiedName(providerName, routerInfo.TCPRouter.Service) - if _, ok := r.TCPServices[serviceName]; !ok { + if _, ok := c.TCPServices[serviceName]; !ok { continue } - r.TCPServices[serviceName].UsedBy = append(r.TCPServices[serviceName].UsedBy, routerName) + c.TCPServices[serviceName].UsedBy = append(c.TCPServices[serviceName].UsedBy, routerName) } - for k, serviceInfo := range r.TCPServices { + for k, serviceInfo := range c.TCPServices { // lazily initialize Status in case caller forgot to do it if serviceInfo.Status == "" { serviceInfo.Status = StatusEnabled } - sort.Strings(r.TCPServices[k].UsedBy) + sort.Strings(c.TCPServices[k].UsedBy) } } @@ -167,10 +172,10 @@ func contains(entryPoints []string, entryPointName string) bool { } // GetRoutersByEntryPoints returns all the http routers by entry points name and routers name -func (r *Configuration) GetRoutersByEntryPoints(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*RouterInfo { +func (c *Configuration) GetRoutersByEntryPoints(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*RouterInfo { entryPointsRouters := make(map[string]map[string]*RouterInfo) - for rtName, rt := range r.Routers { + for rtName, rt := range c.Routers { if (tls && rt.TLS == nil) || (!tls && rt.TLS != nil) { continue } @@ -198,10 +203,10 @@ func (r *Configuration) GetRoutersByEntryPoints(ctx context.Context, entryPoints } // GetTCPRoutersByEntryPoints returns all the tcp routers by entry points name and routers name -func (r *Configuration) GetTCPRoutersByEntryPoints(ctx context.Context, entryPoints []string) map[string]map[string]*TCPRouterInfo { +func (c *Configuration) GetTCPRoutersByEntryPoints(ctx context.Context, entryPoints []string) map[string]map[string]*TCPRouterInfo { entryPointsRouters := make(map[string]map[string]*TCPRouterInfo) - for rtName, rt := range r.TCPRouters { + for rtName, rt := range c.TCPRouters { eps := rt.EntryPoints if len(eps) == 0 { eps = entryPoints @@ -259,25 +264,47 @@ func (r *RouterInfo) AddError(err error, critical bool) { // TCPRouterInfo holds information about a currently running TCP router type TCPRouterInfo struct { - *dynamic.TCPRouter // dynamic configuration - Err string `json:"error,omitempty"` // initialization error + *dynamic.TCPRouter // dynamic configuration + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the router is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. Status string `json:"status,omitempty"` } +// AddError adds err to r.Err, if it does not already exist. +// If critical is set, r is marked as disabled. +func (r *TCPRouterInfo) AddError(err error, critical bool) { + for _, value := range r.Err { + if value == err.Error() { + return + } + } + + r.Err = append(r.Err, err.Error()) + if critical { + r.Status = StatusDisabled + return + } + + // only set it to "warning" if not already in a worse state + if r.Status != StatusDisabled { + r.Status = StatusWarning + } +} + // MiddlewareInfo holds information about a currently running middleware type MiddlewareInfo struct { *dynamic.Middleware // dynamic configuration // Err contains all the errors that occurred during service creation. Err []string `json:"error,omitempty"` + Status string `json:"status,omitempty"` UsedBy []string `json:"usedBy,omitempty"` // list of routers and services using that middleware } // AddError adds err to s.Err, if it does not already exist. // If critical is set, m is marked as disabled. -func (m *MiddlewareInfo) AddError(err error) { +func (m *MiddlewareInfo) AddError(err error, critical bool) { for _, value := range m.Err { if value == err.Error() { return @@ -285,6 +312,15 @@ func (m *MiddlewareInfo) AddError(err error) { } m.Err = append(m.Err, err.Error()) + if critical { + m.Status = StatusDisabled + return + } + + // only set it to "warning" if not already in a worse state + if m.Status != StatusDisabled { + m.Status = StatusWarning + } } // ServiceInfo holds information about a currently running service @@ -354,8 +390,8 @@ func (s *ServiceInfo) GetAllStatus() map[string]string { // TCPServiceInfo holds information about a currently running TCP service type TCPServiceInfo struct { - *dynamic.TCPService // dynamic configuration - Err error `json:"error,omitempty"` // initialization error + *dynamic.TCPService // dynamic configuration + Err []string `json:"error,omitempty"` // initialization error // Status reports whether the service is disabled, in a warning state, or all good (enabled). // If not in "enabled" state, the reason for it should be in the list of Err. // It is the caller's responsibility to set the initial status. @@ -363,6 +399,27 @@ type TCPServiceInfo struct { UsedBy []string `json:"usedBy,omitempty"` // list of routers using that service } +// AddError adds err to s.Err, if it does not already exist. +// If critical is set, s is marked as disabled. +func (s *TCPServiceInfo) AddError(err error, critical bool) { + for _, value := range s.Err { + if value == err.Error() { + return + } + } + + s.Err = append(s.Err, err.Error()) + if critical { + s.Status = StatusDisabled + return + } + + // only set it to "warning" if not already in a worse state + if s.Status != StatusDisabled { + s.Status = StatusWarning + } +} + func getProviderName(elementName string) string { parts := strings.Split(elementName, "@") if len(parts) > 1 { diff --git a/pkg/server/middleware/middlewares.go b/pkg/server/middleware/middlewares.go index 3d161e4f2..a887d2854 100644 --- a/pkg/server/middleware/middlewares.go +++ b/pkg/server/middleware/middlewares.go @@ -65,19 +65,19 @@ func (b *Builder) BuildChain(ctx context.Context, middlewares []string) *alice.C var err error if constructorContext, err = checkRecursion(constructorContext, middlewareName); err != nil { - b.configs[middlewareName].AddError(err) + b.configs[middlewareName].AddError(err, true) return nil, err } constructor, err := b.buildConstructor(constructorContext, middlewareName) if err != nil { - b.configs[middlewareName].AddError(err) + b.configs[middlewareName].AddError(err, true) return nil, err } handler, err := constructor(next) if err != nil { - b.configs[middlewareName].AddError(err) + b.configs[middlewareName].AddError(err, true) return nil, err } diff --git a/pkg/server/router/router.go b/pkg/server/router/router.go index 79a7aec15..6f69e0e6e 100644 --- a/pkg/server/router/router.go +++ b/pkg/server/router/router.go @@ -2,6 +2,7 @@ package router import ( "context" + "errors" "net/http" "github.com/containous/alice" @@ -148,6 +149,10 @@ func (m *Manager) buildHTTPHandler(ctx context.Context, router *runtime.RouterIn } rm := m.modifierBuilder.Build(ctx, qualifiedNames) + if router.Service == "" { + return nil, errors.New("the service is missing on the router") + } + sHandler, err := m.serviceManager.BuildHTTP(ctx, router.Service, rm) if err != nil { return nil, err diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go index 5552b2e22..e60d8995e 100644 --- a/pkg/server/router/tcp/router.go +++ b/pkg/server/router/tcp/router.go @@ -3,6 +3,7 @@ package tcp import ( "context" "crypto/tls" + "errors" "fmt" "net/http" @@ -169,9 +170,16 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string ctxRouter := log.With(internal.AddProviderInContext(ctx, routerName), log.Str(log.RouterName, routerName)) logger := log.FromContext(ctxRouter) + if routerConfig.Service == "" { + err := errors.New("the service is missing on the router") + routerConfig.AddError(err, true) + logger.Error(err) + continue + } + handler, err := m.serviceManager.BuildTCP(ctxRouter, routerConfig.Service) if err != nil { - routerConfig.Err = err.Error() + routerConfig.AddError(err, true) logger.Error(err) continue } @@ -179,7 +187,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string domains, err := rules.ParseHostSNI(routerConfig.Rule) if err != nil { routerErr := fmt.Errorf("unknown rule %s", routerConfig.Rule) - routerConfig.Err = routerErr.Error() + routerConfig.AddError(routerErr, true) logger.Debug(routerErr) continue } @@ -203,7 +211,7 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string tlsConf, err := m.tlsManager.Get("default", tlsOptionsName) if err != nil { - routerConfig.Err = err.Error() + routerConfig.AddError(err, true) logger.Debug(err) continue } diff --git a/pkg/server/router/tcp/router_test.go b/pkg/server/router/tcp/router_test.go index a3fda9d7a..cb4c66640 100644 --- a/pkg/server/router/tcp/router_test.go +++ b/pkg/server/router/tcp/router_test.go @@ -232,12 +232,11 @@ func TestRuntimeConfiguration(t *testing.T) { } } for _, v := range conf.TCPRouters { - if v.Err != "" { + if len(v.Err) > 0 { allErrors++ } } assert.Equal(t, test.expectedError, allErrors) }) } - } diff --git a/pkg/server/service/tcp/service.go b/pkg/server/service/tcp/service.go index 6abc92d04..59d159a11 100644 --- a/pkg/server/service/tcp/service.go +++ b/pkg/server/service/tcp/service.go @@ -35,8 +35,9 @@ func (m *Manager) BuildTCP(rootCtx context.Context, serviceName string) (tcp.Han return nil, fmt.Errorf("the service %q does not exist", serviceQualifiedName) } if conf.LoadBalancer == nil { - conf.Err = fmt.Errorf("the service %q doesn't have any TCP load balancer", serviceQualifiedName) - return nil, conf.Err + err := fmt.Errorf("the service %q doesn't have any TCP load balancer", serviceQualifiedName) + conf.AddError(err, true) + return nil, err } logger := log.FromContext(ctx) From 022d14abe1803c28bc7592bb59195ca9420f7ed1 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 19 Jul 2019 17:00:05 +0200 Subject: [PATCH 37/49] Fixed a typo in label. --- docs/content/middlewares/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index 9b21ecd3e..e520e2b29 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.routers.router1.middlewares=foo-add-prefix@docker" ``` ```yaml tab="Kubernetes" From a5aa8c6006fc39d81427c57bf620cc878af1da03 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 19 Jul 2019 17:18:03 +0200 Subject: [PATCH 38/49] Prepare release v2.0.0-beta1 --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d38e0d33..d88dc0328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ # Change Log +## [v2.0.0-beta1](https://github.com/containous/traefik/tree/v2.0.0-beta1) (2019-07-19) +[All Commits](https://github.com/containous/traefik/compare/v2.0.0-alpha8...v2.0.0-beta1) + +**Enhancements:** +- **[acme]** Certificate resolvers. ([#5116](https://github.com/containous/traefik/pull/5116) by [ldez](https://github.com/ldez)) +- **[api,provider]** Enhance REST provider ([#5072](https://github.com/containous/traefik/pull/5072) by [dtomcej](https://github.com/dtomcej)) +- **[api]** Deal with multiple errors and their criticality ([#5070](https://github.com/containous/traefik/pull/5070) by [mpl](https://github.com/mpl)) +- **[api]** API: remove configuration of Entrypoint and Middlewares ([#5119](https://github.com/containous/traefik/pull/5119) by [mpl](https://github.com/mpl)) +- **[api]** Improve API endpoints ([#5080](https://github.com/containous/traefik/pull/5080) by [ldez](https://github.com/ldez)) +- **[api]** Manage status for TCP element in the endpoint overview. ([#5108](https://github.com/containous/traefik/pull/5108) by [ldez](https://github.com/ldez)) +- **[file]** Restrict traefik.toml to static configuration. ([#5090](https://github.com/containous/traefik/pull/5090) by [ldez](https://github.com/ldez)) +- **[k8s,k8s/crd]** Add scheme to IngressRoute. ([#5062](https://github.com/containous/traefik/pull/5062) by [ldez](https://github.com/ldez)) +- **[k8s,k8s/ingress]** Renamed `kubernetes` provider in `kubernetesIngress` provider ([#5068](https://github.com/containous/traefik/pull/5068) by [jbdoumenjou](https://github.com/jbdoumenjou)) +- **[logs]** Improve error on router without service. ([#5126](https://github.com/containous/traefik/pull/5126) by [ldez](https://github.com/ldez)) +- **[metrics]** Add Metrics ([#5111](https://github.com/containous/traefik/pull/5111) by [mmatur](https://github.com/mmatur)) +- **[middleware]** Disable RateLimit temporarily ([#5123](https://github.com/containous/traefik/pull/5123) by [juliens](https://github.com/juliens)) +- **[tls]** TLSOptions: handle conflict: same host name, different TLS options ([#5056](https://github.com/containous/traefik/pull/5056) by [mpl](https://github.com/mpl)) +- **[tls]** Expand Client Auth Type configuration ([#5078](https://github.com/containous/traefik/pull/5078) by [jbdoumenjou](https://github.com/jbdoumenjou)) +- **[tracing]** Add Jaeger collector endpoint ([#5082](https://github.com/containous/traefik/pull/5082) by [rmfitzpatrick](https://github.com/rmfitzpatrick)) +- **[webui]** refactor(webui): use @vue/cli to bootstrap new ui ([#5091](https://github.com/containous/traefik/pull/5091) by [Slashgear](https://github.com/Slashgear)) +- **[webui]** feat(webui/dashboard): init new dashboard ([#5105](https://github.com/containous/traefik/pull/5105) by [Slashgear](https://github.com/Slashgear)) +- Move dynamic config into a dedicated package. ([#5075](https://github.com/containous/traefik/pull/5075) by [ldez](https://github.com/ldez)) + +**Bug fixes:** +- **[file]** fix: TLS configuration from directory. ([#5118](https://github.com/containous/traefik/pull/5118) by [ldez](https://github.com/ldez)) +- **[middleware]** Remove X-Forwarded-(Uri, Method, Tls-Client-Cert and Tls-Client-Cert-Info) from untrusted IP ([#5012](https://github.com/containous/traefik/pull/5012) by [stffabi](https://github.com/stffabi)) +- **[middleware]** Properly add response headers for CORS ([#4857](https://github.com/containous/traefik/pull/4857) by [dtomcej](https://github.com/dtomcej)) + +**Documentation:** +- **[acme]** Lets encrypt documentation typo ([#5127](https://github.com/containous/traefik/pull/5127) by [juliens](https://github.com/juliens)) +- **[docker,marathon]** Update Dynamic Configuration Reference for both Docker and Marathon ([#5100](https://github.com/containous/traefik/pull/5100) by [jbdoumenjou](https://github.com/jbdoumenjou)) +- **[k8s,k8s/ingress]** Add documentation about Kubernetes Ingress provider ([#5112](https://github.com/containous/traefik/pull/5112) by [mpl](https://github.com/mpl)) +- **[k8s/crd]** user guide: fix a mistake in the deployment definition ([#5096](https://github.com/containous/traefik/pull/5096) by [ldez](https://github.com/ldez)) +- **[middleware]** Fixed a typo in label. ([#5128](https://github.com/containous/traefik/pull/5128) by [jamct](https://github.com/jamct)) +- **[provider]** Improve providers documentation. ([#5050](https://github.com/containous/traefik/pull/5050) by [ldez](https://github.com/ldez)) +- **[tracing]** Improve tracing documentation ([#5102](https://github.com/containous/traefik/pull/5102) by [mmatur](https://github.com/mmatur)) +- Add a basic Traefik install guide ([#5117](https://github.com/containous/traefik/pull/5117) by [jbdoumenjou](https://github.com/jbdoumenjou)) + +**Misc:** +- Cherry pick v1.7 into v2.0 ([#5115](https://github.com/containous/traefik/pull/5115) by [jbdoumenjou](https://github.com/jbdoumenjou)) + ## [v2.0.0-alpha8](https://github.com/containous/traefik/tree/v2.0.0-alpha8) (2019-07-01) [All Commits](https://github.com/containous/traefik/compare/v2.0.0-alpha7...v2.0.0-alpha8) From 3ef2971c3fd3c063412cffa400f82c0e0fbb09a3 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 19 Jul 2019 18:06:03 +0200 Subject: [PATCH 39/49] Fix acme example --- docs/content/https/acme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index bfb683872..de8728372 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -345,7 +345,7 @@ The `storage` option sets the location where your ACME certificates are saved to # ... ``` -```toml tab="File (TOML)" +```yaml tab="File (YAML)" certificatesResolvers: sample: acme: From 8b4ba3cb6714a35086c503e2f863fc8cff91337f Mon Sep 17 00:00:00 2001 From: Daniel Tomcej Date: Mon, 22 Jul 2019 01:24:04 -0600 Subject: [PATCH 40/49] Fix malformed rule --- docs/content/routing/routers/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 2f23af18b..8ba971c97 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -215,7 +215,7 @@ The table below lists all the available matchers: | ```HeadersRegexp(`key`, `regexp`)``` | Check if there is a key `key`defined in the headers, with a value that matches the regular expression `regexp` | | ```Host(`domain-1`, ...)``` | Check if the request domain targets one of the given `domains`. | | ```HostRegexp(`traefik.io`, `{subdomain:[a-z]+}.traefik.io`, ...)``` | Check if the request domain matches the given `regexp`. | -| `Method(methods, ...)` | Check if the request method is one of the given `methods` (`GET`, `POST`, `PUT`, `DELETE`, `PATCH`) | +| ```Method(`GET`, ...)``` | Check if the request method is one of the given `methods` (`GET`, `POST`, `PUT`, `DELETE`, `PATCH`) | | ```Path(`path`, `/articles/{category}/{id:[0-9]+}`, ...)``` | Match exact request path. It accepts a sequence of literal and regular expression paths. | | ```PathPrefix(`/products/`, `/articles/{category}/{id:[0-9]+}`)``` | Match request prefix path. It accepts a sequence of literal and regular expression prefix paths. | | ```Query(`foo=bar`, `bar=baz`)``` | Match` Query String parameters. It accepts a sequence of key=value pairs. | From 75c99a04910773dc7db6e93a4f496854f5282b20 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 22 Jul 2019 09:58:04 +0200 Subject: [PATCH 41/49] doc: improve examples. --- docs/content/contributing/data-collection.md | 23 ++- .../getting-started/install-traefik.md | 2 +- docs/content/https/acme.md | 2 +- docs/content/https/ref-acme.txt | 7 +- docs/content/https/tls.md | 10 +- docs/content/includes/more-on-entrypoints.md | 4 +- docs/content/middlewares/addprefix.md | 11 +- docs/content/middlewares/basicauth.md | 24 ++- docs/content/middlewares/buffering.md | 13 +- docs/content/middlewares/chain.md | 42 ++++- docs/content/middlewares/circuitbreaker.md | 11 +- docs/content/middlewares/compress.md | 10 +- docs/content/middlewares/digestauth.md | 23 ++- docs/content/middlewares/errorpages.md | 17 +- docs/content/middlewares/forwardauth.md | 20 +- docs/content/middlewares/headers.md | 64 ++++++- docs/content/middlewares/ipwhitelist.md | 42 ++++- docs/content/middlewares/maxconnection.md | 17 +- docs/content/middlewares/overview.md | 36 +++- docs/content/middlewares/passtlsclientcert.md | 41 +++- docs/content/middlewares/ratelimit.md | 27 ++- docs/content/middlewares/redirectregex.md | 12 +- docs/content/middlewares/redirectscheme.md | 11 +- docs/content/middlewares/replacepath.md | 11 +- docs/content/middlewares/replacepathregex.md | 12 +- docs/content/middlewares/retry.md | 11 +- docs/content/middlewares/stripprefix.md | 13 +- docs/content/middlewares/stripprefixregex.md | 13 +- docs/content/observability/access-logs.md | 62 +++++- docs/content/observability/logs.md | 26 ++- docs/content/observability/metrics/datadog.md | 20 +- .../content/observability/metrics/influxdb.md | 32 ++-- .../content/observability/metrics/overview.md | 4 +- .../observability/metrics/prometheus.md | 14 +- docs/content/observability/metrics/statsd.md | 17 +- docs/content/observability/tracing/datadog.md | 7 +- .../content/observability/tracing/haystack.md | 10 +- docs/content/observability/tracing/instana.md | 6 +- docs/content/observability/tracing/jaeger.md | 13 +- .../content/observability/tracing/overview.md | 4 +- docs/content/observability/tracing/zipkin.md | 8 +- docs/content/operations/api.md | 24 ++- docs/content/operations/dashboard.md | 55 +++--- docs/content/operations/ping.md | 14 +- docs/content/providers/docker.md | 6 +- docs/content/providers/kubernetes-ingress.md | 2 +- docs/content/providers/marathon.md | 2 +- docs/content/providers/rancher.md | 4 +- docs/content/providers/rancher.toml | 2 +- docs/content/providers/rancher.txt | 4 +- docs/content/providers/rancher.yml | 2 +- .../dynamic-configuration/docker-labels.yml | 177 ++++++++++++++++++ .../reference/dynamic-configuration/docker.md | 4 +- .../dynamic-configuration/docker.yml | 6 +- .../reference/dynamic-configuration/file.toml | 68 +++++-- .../reference/dynamic-configuration/file.yaml | 58 +++++- .../dynamic-configuration/labels.yml | 157 ---------------- .../marathon-labels.json | 177 ++++++++++++++++++ .../dynamic-configuration/marathon.json | 2 + .../dynamic-configuration/marathon.md | 9 +- .../dynamic-configuration/marathon.yml | 2 - .../dynamic-configuration/rancher.md | 12 ++ .../dynamic-configuration/rancher.yml | 1 + .../reference/static-configuration/file.toml | 60 +++--- .../reference/static-configuration/file.yaml | 77 ++++---- docs/content/routing/routers/index.md | 10 +- docs/content/user-guides/grpc.md | 4 +- docs/mkdocs.yml | 9 +- traefik.sample.toml | 108 ++++++----- 69 files changed, 1256 insertions(+), 552 deletions(-) create mode 100644 docs/content/reference/dynamic-configuration/docker-labels.yml delete mode 100644 docs/content/reference/dynamic-configuration/labels.yml create mode 100644 docs/content/reference/dynamic-configuration/marathon-labels.json create mode 100644 docs/content/reference/dynamic-configuration/marathon.json delete mode 100644 docs/content/reference/dynamic-configuration/marathon.yml create mode 100644 docs/content/reference/dynamic-configuration/rancher.md create mode 100644 docs/content/reference/dynamic-configuration/rancher.yml diff --git a/docs/content/contributing/data-collection.md b/docs/content/contributing/data-collection.md index 467584d7c..03a6d90bc 100644 --- a/docs/content/contributing/data-collection.md +++ b/docs/content/contributing/data-collection.md @@ -9,22 +9,27 @@ Understanding how you use Traefik is very important to us: it helps us improve t For this very reason, the sendAnonymousUsage option is mandatory: we want you to take time to consider whether or not you wish to share anonymous data with us so we can benefit from your experience and use cases. !!! warning - During the alpha stage only, leaving this option unset will not prevent Traefik from running but will generate an error log indicating that it enables data collection by default. + During the beta stage only, leaving this option unset will not prevent Traefik from running but will generate an error log indicating that it enables data collection by default. -??? example "Enabling Data Collection with TOML" - - ```toml +!!! example "Enabling Data Collection" + + ```toml tab="File (TOML)" [global] # Send anonymous usage data sendAnonymousUsage = true ``` - -??? example "Enabling Data Collection with the CLI" - - ```bash - ./traefik --sendAnonymousUsage=true + + ```yaml tab="File (YAML)" + global: + # Send anonymous usage data + sendAnonymousUsage: true ``` + ```bash tab="CLI" + # Send anonymous usage data + --global.sendAnonymousUsage + ``` + ## Collected Data This feature comes from the public proposal [here](https://github.com/containous/traefik/issues/2369). diff --git a/docs/content/getting-started/install-traefik.md b/docs/content/getting-started/install-traefik.md index b468bc6d0..a3d0b3db5 100644 --- a/docs/content/getting-started/install-traefik.md +++ b/docs/content/getting-started/install-traefik.md @@ -8,7 +8,7 @@ You can install Traefik with the following flavors: ## Use the Official Docker Image -Choose one of the [official Docker images](https://hub.docker.com/_/traefik) and run it with the [sample configuration file](https://raw.githubusercontent.com/containous/traefik/master/traefik.sample.toml): +Choose one of the [official Docker images](https://hub.docker.com/_/traefik) and run it with the [sample configuration file](https://raw.githubusercontent.com/containous/traefik/v2.0/traefik.sample.toml): ```shell docker run -d -p 8080:8080 -p 80:80 \ diff --git a/docs/content/https/acme.md b/docs/content/https/acme.md index de8728372..eed817ece 100644 --- a/docs/content/https/acme.md +++ b/docs/content/https/acme.md @@ -109,7 +109,7 @@ when using the `TLS-ALPN-01` challenge, Traefik must be reachable by Let's Encry ```bash tab="CLI" # ... - --certificatesResolvers.sample.acme.tlsChallenge + --certificatesResolvers.sample.acme.tlsChallenge=true ``` ### `httpChallenge` diff --git a/docs/content/https/ref-acme.txt b/docs/content/https/ref-acme.txt index 4e9fefc3a..d71023048 100644 --- a/docs/content/https/ref-acme.txt +++ b/docs/content/https/ref-acme.txt @@ -1,5 +1,4 @@ # Enable ACME (Let's Encrypt): automatic SSL. ---certificatesResolvers.sample.acme # Email address used for registration. # @@ -35,13 +34,13 @@ # # Optional (but recommended) # ---certificatesResolvers.sample.acme.tlsChallenge +--certificatesResolvers.sample.acme.tlsChallenge=true # Use a HTTP-01 ACME challenge. # # Optional # ---certificatesResolvers.sample.acme.httpChallenge +--certificatesResolvers.sample.acme.httpChallenge=true # EntryPoint to use for the HTTP-01 challenges. # @@ -54,7 +53,7 @@ # # Optional # ---certificatesResolvers.sample.acme.dnsChallenge +--certificatesResolvers.sample.acme.dnsChallenge=true # DNS provider used. # diff --git a/docs/content/https/tls.md b/docs/content/https/tls.md index 4f3540de3..d9dd7b850 100644 --- a/docs/content/https/tls.md +++ b/docs/content/https/tls.md @@ -35,7 +35,7 @@ tls: !!! important "File Provider Only" In the above example, we've used the [file provider](../providers/file.md) to handle these definitions. - In its current alpha version, it is the only available method to configure the certificates (as well as the options and the stores). + In its current beta version, it is the only available method to configure the certificates (as well as the options and the stores). ## Certificates Stores @@ -52,9 +52,9 @@ tls: default: {} ``` -!!! important "Alpha restriction" +!!! important "Beta restriction" - During the alpha version, any store definition other than the default one (named `default`) will be ignored, + During the beta 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: @@ -85,9 +85,9 @@ tls: keyFile: /path/to/other-domain.key ``` -!!! important "Alpha restriction" +!!! important "Beta restriction" - During the alpha version, the `stores` list will actually be ignored and automatically set to `["default"]`. + During the beta version, the `stores` list will actually be ignored and automatically set to `["default"]`. ### Default Certificate diff --git a/docs/content/includes/more-on-entrypoints.md b/docs/content/includes/more-on-entrypoints.md index 65e801bd4..593b78ce8 100644 --- a/docs/content/includes/more-on-entrypoints.md +++ b/docs/content/includes/more-on-entrypoints.md @@ -1,2 +1,2 @@ -!!! info "More On Entrypoints" - Learn more about entrypoints and their configuration options in the dedicated section. \ No newline at end of file +!!! info "More On Entry Points" + Learn more about entry points and their configuration options in the dedicated section. \ No newline at end of file diff --git a/docs/content/middlewares/addprefix.md b/docs/content/middlewares/addprefix.md index 0c3ffe998..220b7dccc 100644 --- a/docs/content/middlewares/addprefix.md +++ b/docs/content/middlewares/addprefix.md @@ -38,13 +38,22 @@ labels: - "traefik.http.middlewares.add-foo.addprefix.prefix=/foo" ``` -```toml tab="File" +```toml tab="File (TOML)" # Prefixing with /foo [http.middlewares] [http.middlewares.add-foo.addPrefix] prefix = "/foo" ``` +```yaml tab="File (YAML)" +# Prefixing with /foo +http: + middlewares: + add-foo: + addPrefix: + prefix: "/foo" +``` + ## Configuration Options ### `prefix` diff --git a/docs/content/middlewares/basicauth.md b/docs/content/middlewares/basicauth.md index b132eec2c..83f97d0cb 100644 --- a/docs/content/middlewares/basicauth.md +++ b/docs/content/middlewares/basicauth.md @@ -44,7 +44,7 @@ labels: - "traefik.http.middlewares.test-auth.basicauth.users=test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/,test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0" ``` -```toml tab="File" +```toml tab="File (TOML)" # Declaring the user list [http.middlewares] [http.middlewares.test-auth.basicAuth] @@ -54,6 +54,17 @@ labels: ] ``` +```yaml tab="File (YAML)" +# Declaring the user list +http: + middlewares: + test-auth: + basicAuth: + users: + - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" + - "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0" +``` + ## Configuration Options ### General @@ -119,12 +130,21 @@ spec: } ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares.my-auth.basicAuth] # ... headerField = "X-WebAuth-User" ``` +```yaml tab="File (YAML)" +http: + middlewares: + my-auth: + basicAuth: + # ... + headerField: "X-WebAuth-User" +``` + ### `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/buffering.md b/docs/content/middlewares/buffering.md index c29ec3991..28e25489f 100644 --- a/docs/content/middlewares/buffering.md +++ b/docs/content/middlewares/buffering.md @@ -42,13 +42,22 @@ labels: - "traefik.http.middlewares.limit.buffering.maxRequestBodyBytes=250000" ``` -```toml tab="File" +```toml tab="File (TOML)" # Sets the maximum request body to 2Mb [http.middlewares] [http.middlewares.limit.buffering] maxRequestBodyBytes = 250000 ``` +```yaml tab="File (YAML)" +# Sets the maximum request body to 2Mb +http: + middlewares: + limit: + buffering: + maxRequestBodyBytes: 250000 +``` + ## Configuration Options ### `maxRequestBodyBytes` @@ -77,7 +86,7 @@ You can have the Buffering middleware replay the request with the help of the `r !!! example "Retries once in case of a network error" - ``` + ```toml retryExpression = "IsNetworkError() && Attempts() < 2" ``` diff --git a/docs/content/middlewares/chain.md b/docs/content/middlewares/chain.md index 09b16ad95..8ad38f7dd 100644 --- a/docs/content/middlewares/chain.md +++ b/docs/content/middlewares/chain.md @@ -108,7 +108,7 @@ labels: - "http.services.service1.loadbalancer.server.port=80" ``` -```toml tab="File" +```toml tab="File (TOML)" # ... [http.routers] [http.routers.router1] @@ -135,3 +135,43 @@ labels: [[http.services.service1.loadBalancer.servers]] url = "http://127.0.0.1:80" ``` + +```yaml tab="File (YAML)" +# ... +http: + routers: + router1: + service: service1 + middlewares: + - secured + rule: "Host(`mydomain`)" + + middlewares: + secured: + chain: + middlewares: + - https-only + - known-ips + - auth-users + + auth-users: + basicAuth: + users: + - "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/" + + https-only: + redirectScheme: + scheme: https + + known-ips: + ipWhiteList: + sourceRange: + - "192.168.1.7" + - "127.0.0.1/32" + + 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 1d837a5ed..03f2c0c19 100644 --- a/docs/content/middlewares/circuitbreaker.md +++ b/docs/content/middlewares/circuitbreaker.md @@ -52,13 +52,22 @@ labels: - "traefik.http.middlewares.latency-check.circuitbreaker.expression=LatencyAtQuantileMS(50.0) > 100" ``` -```toml tab="File" +```toml tab="File (TOML)" # Latency Check [http.middlewares] [http.middlewares.latency-check.circuitBreaker] expression = "LatencyAtQuantileMS(50.0) > 100" ``` +```yaml tab="File (YAML)" +# Latency Check +http: + middlewares: + latency-check: + circuitBreaker: + expression: "LatencyAtQuantileMS(50.0) > 100" +``` + ## Possible States There are three possible states for your circuit breaker: diff --git a/docs/content/middlewares/compress.md b/docs/content/middlewares/compress.md index 67d0b7b08..a1b07b84e 100644 --- a/docs/content/middlewares/compress.md +++ b/docs/content/middlewares/compress.md @@ -37,12 +37,20 @@ labels: - "traefik.http.middlewares.test-compress.compress=true" ``` -```toml tab="File" +```toml tab="File (TOML)" # Enable gzip compression [http.middlewares] [http.middlewares.test-compress.compress] ``` +```yaml tab="File (YAML)" +# Enable gzip compression +http: + middlewares: + test-compress: + compress: {} +``` + ## Notes Responses are compressed when: diff --git a/docs/content/middlewares/digestauth.md b/docs/content/middlewares/digestauth.md index d0d00d22b..7af3a5390 100644 --- a/docs/content/middlewares/digestauth.md +++ b/docs/content/middlewares/digestauth.md @@ -38,7 +38,7 @@ labels: - "traefik.http.middlewares.test-auth.digestauth.users=test:traefik:a2688e031edb4be6a3797f3882655c05,test2:traefik:518845800f9e2bfb1f1f740ec24f074e" ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares] [http.middlewares.test-auth.digestAuth] users = [ @@ -47,6 +47,16 @@ labels: ] ``` +```yaml tab="File (YAML)" +http: + middlewares: + test-auth: + digestAuth: + users: + - "test:traefik:a2688e031edb4be6a3797f3882655c05" + - "test2:traefik:518845800f9e2bfb1f1f740ec24f074e" +``` + !!! tip Use `htdigest` to generate passwords. @@ -115,12 +125,21 @@ labels: } ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares.my-auth.digestAuth] # ... headerField = "X-WebAuth-User" ``` +```yaml tab="File (YAML)" +http: + middlewares: + my-auth: + digestAuth: + # ... + headerField: "X-WebAuth-User" +``` + ### `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 601d73b5c..29ee280ba 100644 --- a/docs/content/middlewares/errorpages.md +++ b/docs/content/middlewares/errorpages.md @@ -49,7 +49,7 @@ labels: - "traefik.http.middlewares.test-errorpage.errors.query=/{status}.html" ``` -```toml tab="File" +```toml tab="File (TOML)" # Custom Error Page for 5XX [http.middlewares] [http.middlewares.test-errorpage.errors] @@ -61,6 +61,21 @@ labels: # ... definition of error-handler-service and my-service ``` +```yaml tab="File (YAML)" +# Custom Error Page for 5XX +http: + middlewares: + test-errorpage: + errors: + status: + - "500-599" + service: serviceError + query: "/{status}.html" + +[http.services] + # ... definition of error-handler-service and my-service +``` + !!! note In this example, the error page URL is based on the status code (`query=/{status}.html)`. diff --git a/docs/content/middlewares/forwardauth.md b/docs/content/middlewares/forwardauth.md index 7c96bbd9b..29c02b7a8 100644 --- a/docs/content/middlewares/forwardauth.md +++ b/docs/content/middlewares/forwardauth.md @@ -69,7 +69,7 @@ labels: - "traefik.http.middlewares.test-auth.forwardauth.trustForwardHeader=true" ``` -```toml tab="File" +```toml tab="File (TOML)" # Forward authentication to authserver.com [http.middlewares] [http.middlewares.test-auth.forwardAuth] @@ -84,6 +84,24 @@ labels: key = "path/to/foo.key" ``` +```yaml tab="File (YAML)" +# Forward authentication to authserver.com +http: + middlewares: + test-auth: + forwardAuth: + address: "https://authserver.com/auth" + trustForwardHeader: true + authResponseHeaders: + - "X-Auth-User" + - "X-Secret" + tls: + ca: "path/to/local.crt" + caOptional: true + cert: "path/to/foo.cert" + key: "path/to/foo.key" +``` + ## Configuration Options ### `address` diff --git a/docs/content/middlewares/headers.md b/docs/content/middlewares/headers.md index 716d49525..47b1e0305 100644 --- a/docs/content/middlewares/headers.md +++ b/docs/content/middlewares/headers.md @@ -16,7 +16,7 @@ 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.customresponseheaders.X-Custom-Response-Header=value" ``` ```yaml tab="Kubernetes" @@ -29,29 +29,40 @@ spec: customRequestHeaders: X-Script-Name: "test" customResponseHeaders: - X-Custom-Response-Header: "True" + X-Custom-Response-Header: "value" ``` ```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.customresponseheaders.X-Custom-Response-Header": "value" } ``` ```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.customresponseheaders.X-Custom-Response-Header=value" ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares] [http.middlewares.testHeader.headers] [http.middlewares.testHeader.headers.customRequestHeaders] X-Script-Name = "test" [http.middlewares.testHeader.headers.customResponseHeaders] - X-Custom-Response-Header = "True" + X-Custom-Response-Header = "value" +``` + +```yaml tab="File (YAML)" +http: + middlewares: + testHeader: + headers: + customRequestHeaders: + X-Script-Name: "test" + customResponseHeaders: + X-Custom-Response-Header: "value" ``` ### Adding and Removing Headers @@ -86,7 +97,7 @@ labels: } ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares] [http.middlewares.testHeader.headers] [http.middlewares.testHeader.headers.customRequestHeaders] @@ -96,6 +107,18 @@ labels: X-Custom-Response-Header = "" # Removes ``` +```yaml tab="File (YAML)" +http: + middlewares: + testHeader: + headers: + customRequestHeaders: + X-Script-Name: "test" # Adds + X-Custom-Request-Header: "" # Removes + customResponseHeaders: + X-Custom-Response-Header: "" # Removes +``` + ### Using Security Headers Security related headers (HSTS headers, SSL redirection, Browser XSS filter, etc) can be added and configured per frontend in a similar manner to the custom headers above. @@ -131,13 +154,22 @@ labels: } ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares] [http.middlewares.testHeader.headers] FrameDeny = true SSLRedirect = true ``` +```yaml tab="File (YAML)" +http: + middlewares: + testHeader: + headers: + FrameDeny: true + SSLRedirect: true +``` + ### CORS Headers CORS (Cross-Origin Resource Sharing) headers can be added and configured per frontend in a similar manner to the custom headers above. @@ -184,7 +216,7 @@ labels: } ``` -```toml tab="File" +```toml tab="File (TOML)" [http.middlewares] [http.middlewares.testHeader.headers] accessControlAllowMethods= ["GET", "OPTIONS", "PUT"] @@ -193,6 +225,20 @@ labels: addVaryHeader = true ``` +```yaml tab="File (YAML)" +http: + middlewares: + testHeader: + headers: + accessControlAllowMethod: + - GET + - OPTIONS + - PUT + accessControlAllowOrigin: "origin-list-or-null" + accessControlMaxAge: 100 + addVaryHeader: true +``` + ## Configuration Options ### General diff --git a/docs/content/middlewares/ipwhitelist.md b/docs/content/middlewares/ipwhitelist.md index c39e42b54..869ba0af8 100644 --- a/docs/content/middlewares/ipwhitelist.md +++ b/docs/content/middlewares/ipwhitelist.md @@ -39,13 +39,24 @@ labels: - "traefik.http.middlewares.test-ipwhitelist.ipwhitelist.sourcerange=127.0.0.1/32, 192.168.1.7" ``` -```toml tab="File" +```toml tab="File (TOML)" # Accepts request from defined IP [http.middlewares] [http.middlewares.test-ipwhitelist.ipWhiteList] sourceRange = ["127.0.0.1/32", "192.168.1.7"] ``` +```yaml tab="File (YAML)" +# Accepts request from defined IP +http: + middlewares: + test-ipwhitelist: + ipWhiteList: + sourceRange: + - "127.0.0.1/32" + - "192.168.1.7" +``` + ## Configuration Options ### `sourceRange` @@ -108,7 +119,7 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th } ``` - ```toml tab="File" + ```toml tab="File (TOML)" # Whitelisting Based on `X-Forwarded-For` with `depth=2` [http.middlewares] [http.middlewares.test-ipwhitelist.ipWhiteList] @@ -116,6 +127,19 @@ The `depth` option tells Traefik to use the `X-Forwarded-For` header and take th [http.middlewares.test-ipwhitelist.ipWhiteList.ipStrategy] depth = 2 ``` + + ```yaml tab="File (YAML)" + # Whitelisting Based on `X-Forwarded-For` with `depth=2` + http: + middlewares: + test-ipwhitelist: + ipWhiteList: + sourceRange: + - "127.0.0.1/32" + - "192.168.1.7" + ipStrategy: + depth: 2 + ``` !!! note @@ -171,10 +195,22 @@ labels: } ``` -```toml tab="File" +```toml tab="File (TOML)" # Exclude from `X-Forwarded-For` [http.middlewares] [http.middlewares.test-ipwhitelist.ipWhiteList] [http.middlewares.test-ipwhitelist.ipWhiteList.ipStrategy] excludedIPs = ["127.0.0.1/32", "192.168.1.7"] ``` + +```yaml tab="File (YAML)" +# Exclude from `X-Forwarded-For` +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 b0523d790..bfddf30d9 100644 --- a/docs/content/middlewares/maxconnection.md +++ b/docs/content/middlewares/maxconnection.md @@ -37,23 +37,32 @@ labels: - "traefik.http.middlewares.test-maxconn.maxconn.amount=10" ``` -```toml tab="File" +```toml tab="File (TOML)" # Limiting to 10 simultaneous connections [http.middlewares] [http.middlewares.test-maxconn.maxConn] amount = 10 ``` +```yaml tab="File (YAML)" +# Limiting to 10 simultaneous connections +http: + middlewares: + test-maxconn: + maxConn: + amount: 10 +``` + ## Configuration Options ### `amount` The `amount` option defines the maximum amount of allowed simultaneous connections. -The middleware will return an `HTTP 429 Too Many Requests` if there are already `amount` requests in progress (based on the same `extractorfunc` strategy). +The middleware will return an `HTTP 429 Too Many Requests` if there are already `amount` requests in progress (based on the same `extractorFunc` strategy). -### extractorfunc +### `extractorFunc` -The `extractorfunc` defines the strategy used to categorize requests. +The `extractorFunc` defines the strategy used to categorize requests. The possible values are: diff --git a/docs/content/middlewares/overview.md b/docs/content/middlewares/overview.md index e520e2b29..91740e41f 100644 --- a/docs/content/middlewares/overview.md +++ b/docs/content/middlewares/overview.md @@ -79,8 +79,8 @@ labels: - "traefik.http.router.router1.middlewares=foo-add-prefix@rancher" ``` -```toml tab="File" -# As Toml Configuration File +```toml tab="File (TOML)" +# As TOML Configuration File [http.routers] [http.routers.router1] service = "myService" @@ -99,6 +99,28 @@ labels: url = "http://127.0.0.1:80" ``` +```yaml tab="File (YAML)" +# As YAML Configuration File +http: + routers: + router1: + service: myService + middlewares: + - "foo-add-prefix" + rule: "Host(`example.com`)" + + middlewares: + foo-add-prefix: + addPrefix: + prefix: "/foo" + + services: + service1: + loadBalancer: + servers: + - url: "http://127.0.0.1:80" +``` + ## Provider Namespace When you declare a middleware, it lives in its provider namespace. @@ -124,11 +146,19 @@ and therefore this specification would be ignored even if present. Declaring the add-foo-prefix in the file provider. - ```toml + ```toml tab="File (TOML)" [http.middlewares] [http.middlewares.add-foo-prefix.addPrefix] prefix = "/foo" ``` + + ```yaml tab="File (YAML)" + http: + middlewares: + add-foo-prefix: + addPrefix: + prefix: "/foo" + ``` Using the add-foo-prefix middleware from other providers: diff --git a/docs/content/middlewares/passtlsclientcert.md b/docs/content/middlewares/passtlsclientcert.md index 4824845b5..46b6aec36 100644 --- a/docs/content/middlewares/passtlsclientcert.md +++ b/docs/content/middlewares/passtlsclientcert.md @@ -39,13 +39,22 @@ labels: - "traefik.http.middlewares.test-passtlsclientcert.passtlsclientcert.pem=true" ``` -```toml tab="File" +```toml tab="File (TOML)" # Pass the escaped pem in the `X-Forwarded-Tls-Client-Cert` header. [http.middlewares] [http.middlewares.test-passtlsclientcert.passTLSClientCert] pem = true ``` +```yaml tab="File (YAML)" +# Pass the escaped pem in the `X-Forwarded-Tls-Client-Cert` header. +http: + middlewares: + test-passtlsclientcert: + passTLSClientCert: + pem: true +``` + ??? example "Pass the escaped pem in the `X-Forwarded-Tls-Client-Cert` header" ```yaml tab="Docker" @@ -144,7 +153,7 @@ labels: } ``` - ```toml tab="File" + ```toml tab="File (TOML)" # Pass all the available info in the `X-Forwarded-Tls-Client-Cert-Info` header [http.middlewares] [http.middlewares.test-passtlsclientcert.passTLSClientCert] @@ -170,6 +179,34 @@ labels: domainComponent = true ``` + ```yaml tab="File (YAML)" + # Pass all the available info in the `X-Forwarded-Tls-Client-Cert-Info` header + http: + middlewares: + test-passtlsclientcert: + passTLSClientCert: + info: + notAfter: true + notBefore: true + sans: true + subject: + country: true + province: true + locality: true + organization: true + commonName: true + serialNumber: true + domainComponent: true + issuer: + country: true + province: true + locality: true + organization: true + commonName: true + serialNumber: true + domainComponent: true + ``` + ## Configuration Options ### General diff --git a/docs/content/middlewares/ratelimit.md b/docs/content/middlewares/ratelimit.md index 2194a6f71..fa3856df5 100644 --- a/docs/content/middlewares/ratelimit.md +++ b/docs/content/middlewares/ratelimit.md @@ -73,12 +73,12 @@ labels: ``` -```toml tab="File" +```toml tab="File (TOML)" # 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] - extractorfunc = "client.ip" + extractorFunc = "client.ip" [http.middlewares.test-ratelimit.rateLimit.rateSet.rate0] period = "10s" @@ -91,11 +91,30 @@ labels: burst = 10 ``` +```yaml tab="File (YAML)" +# 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: + test-ratelimit: + rateLimit: + extractorFunc: "client.ip" + rateSet: + rate0: + period: "10s" + average: 100 + burst: 200 + rate1: + period: "3s" + average: 5 + burst: 10 +``` + ## Configuration Options -### `extractorfunc` +### `extractorFunc` -The `extractorfunc` option defines the strategy used to categorize requests. +The `extractorFunc` option defines the strategy used to categorize requests. The possible values are: diff --git a/docs/content/middlewares/redirectregex.md b/docs/content/middlewares/redirectregex.md index 6a1d89255..68b9343db 100644 --- a/docs/content/middlewares/redirectregex.md +++ b/docs/content/middlewares/redirectregex.md @@ -42,7 +42,7 @@ labels: - "traefik.http.middlewares.test-redirectregex.redirectregex.replacement=http://mydomain/$1" ``` -```toml tab="File" +```toml tab="File (TOML)" # Redirect with domain replacement [http.middlewares] [http.middlewares.test-redirectregex.redirectRegex] @@ -50,6 +50,16 @@ labels: replacement = "http://mydomain/$1" ``` +```yaml tab="File (YAML)" +# Redirect with domain replacement +http: + middlewares: + test-redirectregex: + redirectRegex: + regex: "^http://localhost/(.*)" + replacement: "http://mydomain/$1" +``` + ## Configuration Options ### `permanent` diff --git a/docs/content/middlewares/redirectscheme.md b/docs/content/middlewares/redirectscheme.md index d658e3c7b..65a01c823 100644 --- a/docs/content/middlewares/redirectscheme.md +++ b/docs/content/middlewares/redirectscheme.md @@ -38,13 +38,22 @@ labels: - "traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme=https" ``` -```toml tab="File" +```toml tab="File (TOML)" # Redirect to https [http.middlewares] [http.middlewares.test-redirectscheme.redirectScheme] scheme = "https" ``` +```yaml tab="File (YAML)" +# Redirect to https +http: + middlewares: + test-redirectscheme: + redirectScheme: + scheme: https +``` + ## Configuration Options ### `permanent` diff --git a/docs/content/middlewares/replacepath.md b/docs/content/middlewares/replacepath.md index d8c1a771f..b491c8033 100644 --- a/docs/content/middlewares/replacepath.md +++ b/docs/content/middlewares/replacepath.md @@ -38,13 +38,22 @@ labels: - "traefik.http.middlewares.test-replacepath.replacepath.path=/foo" ``` -```toml tab="File" +```toml tab="File (TOML)" # Replace the path by /foo [http.middlewares] [http.middlewares.test-replacepath.replacePath] path = "/foo" ``` +```yaml tab="File (YAML)" +# Replace the path by /foo +http: + middlewares: + test-replacepath: + replacePath: + path: "/foo" +``` + ## Configuration Options ### General diff --git a/docs/content/middlewares/replacepathregex.md b/docs/content/middlewares/replacepathregex.md index 3c8e242d9..fbdb47f0d 100644 --- a/docs/content/middlewares/replacepathregex.md +++ b/docs/content/middlewares/replacepathregex.md @@ -42,7 +42,7 @@ labels: - "traefik.http.middlewares.test-replacepathregex.replacepathregex.replacement=/bar/$1" ``` -```toml tab="File" +```toml tab="File (TOML)" # Redirect with domain replacement [http.middlewares] [http.middlewares.test-replacepathregex.replacePathRegex] @@ -50,6 +50,16 @@ labels: replacement = "/bar/$1" ``` +```yaml tab="File (YAML)" +# Redirect with domain replacement +http: + middlewares: + test-replacepathregex: + replacePathRegex: + regex: "^/foo/(.*)" + replacement: "/bar/$1" +``` + ## Configuration Options ### General diff --git a/docs/content/middlewares/retry.md b/docs/content/middlewares/retry.md index d07c0aebf..439cb9cbf 100644 --- a/docs/content/middlewares/retry.md +++ b/docs/content/middlewares/retry.md @@ -38,13 +38,22 @@ labels: - "traefik.http.middlewares.test-retry.retry.attempts=4" ``` -```toml tab="File" +```toml tab="File (TOML)" # Retry to send request 4 times [http.middlewares] [http.middlewares.test-retry.retry] attempts = 4 ``` +```yaml tab="File (YAML)" +# Retry to send request 4 times +http: + middlewares: + test-retry: + retry: + attempts: 4 +``` + ## Configuration Options ### `attempts` diff --git a/docs/content/middlewares/stripprefix.md b/docs/content/middlewares/stripprefix.md index 0b7ff50f7..8b2fe0ab2 100644 --- a/docs/content/middlewares/stripprefix.md +++ b/docs/content/middlewares/stripprefix.md @@ -40,13 +40,24 @@ labels: - "traefik.http.middlewares.test-stripprefix.stripprefix.prefixes=/foobar, /fiibar" ``` -```toml tab="File" +```toml tab="File (TOML)" # Strip prefix /foobar and /fiibar [http.middlewares] [http.middlewares.test-stripprefix.stripPrefix] prefixes = ["/foobar", "/fiibar"] ``` +```yaml tab="File (YAML)" +# Strip prefix /foobar and /fiibar +http: + middlewares: + test-stripprefix: + stripPrefix: + prefixes: + - "/foobar" + - "/fiibar" +``` + ## Configuration Options ### General diff --git a/docs/content/middlewares/stripprefixregex.md b/docs/content/middlewares/stripprefixregex.md index e51e4ccdc..f6a6451aa 100644 --- a/docs/content/middlewares/stripprefixregex.md +++ b/docs/content/middlewares/stripprefixregex.md @@ -38,11 +38,20 @@ labels: - "traefik.http.middlewares.test-stripprefixregex.stripprefixregex.regex=^/foo/(.*)", ``` -```toml tab="File" +```toml tab="File (TOML)" # Replace the path by /foo [http.middlewares] [http.middlewares.test-stripprefixregex.stripPrefixRegex] - regex: "^/foo/(.*)" + regex = "^/foo/(.*)" +``` + +```yaml tab="File (YAML)" +# Replace the path by /foo +http: + middlewares: + test-stripprefixregex: + stripPrefixRegex: + regex: "^/foo/(.*)" ``` ## Configuration Options diff --git a/docs/content/observability/access-logs.md b/docs/content/observability/access-logs.md index d3e8dfe4a..00a29cf79 100644 --- a/docs/content/observability/access-logs.md +++ b/docs/content/observability/access-logs.md @@ -9,12 +9,16 @@ By default, logs are written to stdout, in text format. To enable the access logs: -```toml tab="File" +```toml tab="File (TOML)" [accessLog] ``` +```yaml tab="File (YAML)" +accessLog: {} +``` + ```bash tab="CLI" ---accesslog +--accesslog=true ``` ### `filePath` @@ -41,16 +45,23 @@ To write the logs in an asynchronous fashion, specify a `bufferingSize` option. This option represents the number of log lines Traefik will keep in memory before writing them to the selected output. In some cases, this option can greatly help performances. -```toml tab="File" +```toml tab="File (TOML)" # Configuring a buffer of 100 lines [accessLog] filePath = "/path/to/access.log" bufferingSize = 100 ``` +```yaml tab="File (YAML)" +# Configuring a buffer of 100 lines +accessLog: + filePath: "/path/to/access.log" + bufferingSize: 100 +``` + ```bash tab="CLI" # Configuring a buffer of 100 lines ---accesslog +--accesslog=true --accesslog.filepath="/path/to/access.log" --accesslog.bufferingsize=100 ``` @@ -66,11 +77,11 @@ The available filters are: - `retryAttempts`, to keep the access logs when at least one retry has happened - `minDuration`, to keep access logs when requests take longer than the specified duration -```toml tab="File" +```toml tab="File (TOML)" # Configuring Multiple Filters [accessLog] -filePath = "/path/to/access.log" -format = "json" + filePath = "/path/to/access.log" + format = "json" [accessLog.filters] statusCodes = ["200", "300-302"] @@ -78,9 +89,22 @@ format = "json" minDuration = "10ms" ``` +```yaml tab="File (YAML)" +# Configuring Multiple Filters +accessLog: + filePath: "/path/to/access.log" + format: json + filters: + statusCodes: + - "200" + - "300-302" + retryAttempts: true + minDuration: "10ms" +``` + ```bash tab="CLI" # Configuring Multiple Filters ---accesslog +--accesslog=true --accesslog.filepath="/path/to/access.log" --accesslog.format="json" --accesslog.filters.statuscodes="200, 300-302" @@ -100,7 +124,7 @@ Each field can be set to: The `defaultMode` for `fields.header` is `drop`. -```toml tab="File" +```toml tab="File (TOML)" # Limiting the Logs to Specific Fields [accessLog] filePath = "/path/to/access.log" @@ -121,9 +145,27 @@ The `defaultMode` for `fields.header` is `drop`. "Content-Type" = "keep" ``` +```yaml tab="File (YAML)" +# Limiting the Logs to Specific Fields +accessLog: + filePath: "/path/to/access.log" + format: json + fields: + defaultMode: keep + fields: + names: + ClientUsername: drop + headers: + defaultMode: keep + names: + - User-Agent: redact + - Authorization: drop + - Content-Type: keep +``` + ```bash tab="CLI" # Limiting the Logs to Specific Fields ---accesslog +--accesslog=true --accesslog.filepath="/path/to/access.log" --accesslog.format="json" --accesslog.fields.defaultmode="keep" diff --git a/docs/content/observability/logs.md b/docs/content/observability/logs.md index 6d8027676..712052de9 100644 --- a/docs/content/observability/logs.md +++ b/docs/content/observability/logs.md @@ -16,12 +16,18 @@ Traefik logs concern everything that happens to Traefik itself (startup, configu By default, the logs are written to the standard output. You can configure a file path instead using the `filePath` option. -```toml tab="File" +```toml tab="File (TOML)" # Writing Logs to a File [log] filePath = "/path/to/traefik.log" ``` +```yaml tab="File (YAML)" +# Writing Logs to a File +log: + filePath: "/path/to/traefik.log" +``` + ```bash tab="CLI" # Writing Logs to a File --log.filePath="/path/to/traefik.log" @@ -31,11 +37,18 @@ You can configure a file path instead using the `filePath` option. By default, the logs use a text format (`common`), but you can also ask for the `json` format in the `format` option. -```toml tab="File" +```toml tab="File (TOML)" # Writing Logs to a File, in JSON [log] filePath = "/path/to/log-file.log" - format = "json" + format = "json" +``` + +```yaml tab="File (YAML)" +# Writing Logs to a File, in JSON +log: + filePath: "/path/to/log-file.log" + format: json ``` ```bash tab="CLI" @@ -48,11 +61,16 @@ By default, the logs use a text format (`common`), but you can also ask for the By default, the `level` is set to `ERROR`. Alternative logging levels are `DEBUG`, `PANIC`, `FATAL`, `ERROR`, `WARN`, and `INFO`. -```toml tab="File" +```toml tab="File (TOML)" [log] level = "DEBUG" ``` +```yaml tab="File (YAML)" +log: + level: DEBUG +``` + ```bash tab="CLI" --log.level="DEBUG" ``` diff --git a/docs/content/observability/metrics/datadog.md b/docs/content/observability/metrics/datadog.md index 242103d3b..00af98c58 100644 --- a/docs/content/observability/metrics/datadog.md +++ b/docs/content/observability/metrics/datadog.md @@ -7,9 +7,13 @@ To enable the DataDog: [metrics.dataDog] ``` +```yaml tab="File (YAML)" +metrics: + dataDog: {} +``` + ```bash tab="CLI" ---metrics ---metrics.datadog +--metrics.datadog=true ``` #### `address` @@ -24,14 +28,13 @@ Address instructs exporter to send metrics to datadog-agent at this address. address = "127.0.0.1:8125" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: dataDog: address: 127.0.0.1:8125 ``` ```bash tab="CLI" ---metrics --metrics.datadog.address="127.0.0.1:8125" ``` @@ -47,14 +50,13 @@ Enable metrics on entry points. addEntryPointsLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: dataDog: addEntryPointsLabels: true ``` ```bash tab="CLI" ---metrics --metrics.datadog.addEntryPointsLabels=true ``` @@ -70,14 +72,13 @@ Enable metrics on services. addServicesLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: dataDog: addServicesLabels: true ``` ```bash tab="CLI" ---metrics --metrics.datadog.addServicesLabels=true ``` @@ -93,14 +94,13 @@ The interval used by the exporter to push metrics to datadog-agent. pushInterval = 10s ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: dataDog: pushInterval: 10s ``` ```bash tab="CLI" ---metrics --metrics.datadog.pushInterval=10s ``` diff --git a/docs/content/observability/metrics/influxdb.md b/docs/content/observability/metrics/influxdb.md index 7fa367630..c7e0a93c0 100644 --- a/docs/content/observability/metrics/influxdb.md +++ b/docs/content/observability/metrics/influxdb.md @@ -7,14 +7,13 @@ To enable the InfluxDB: [metrics.influxdb] ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: {} ``` ```bash tab="CLI" ---metrics ---metrics.influxdb +--metrics.influxdb=true ``` #### `address` @@ -29,14 +28,13 @@ Address instructs exporter to send metrics to influxdb at this address. address = "localhost:8089" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: address: localhost:8089 ``` ```bash tab="CLI" ---metrics --metrics.influxdb.address="localhost:8089" ``` @@ -52,14 +50,13 @@ InfluxDB's address protocol (udp or http). protocol = "upd" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: protocol: udp ``` ```bash tab="CLI" ---metrics --metrics.influxdb.protocol="udp" ``` @@ -75,14 +72,13 @@ InfluxDB database used when protocol is http. database = "" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: database: "" ``` ```bash tab="CLI" ---metrics --metrics.influxdb.database="" ``` @@ -98,14 +94,13 @@ InfluxDB retention policy used when protocol is http. retentionPolicy = "" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: retentionPolicy: "" ``` ```bash tab="CLI" ---metrics --metrics.influxdb.retentionPolicy="" ``` @@ -121,14 +116,13 @@ InfluxDB username (only with http). username = "" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: username: "" ``` ```bash tab="CLI" ---metrics --metrics.influxdb.username="" ``` @@ -144,14 +138,13 @@ InfluxDB password (only with http). password = "" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: password: "" ``` ```bash tab="CLI" ---metrics --metrics.influxdb.password="" ``` @@ -167,14 +160,13 @@ Enable metrics on entry points. addEntryPointsLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: addEntryPointsLabels: true ``` ```bash tab="CLI" ---metrics --metrics.influxdb.addEntryPointsLabels=true ``` @@ -190,14 +182,13 @@ Enable metrics on services. addServicesLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: addServicesLabels: true ``` ```bash tab="CLI" ---metrics --metrics.influxdb.addServicesLabels=true ``` @@ -213,13 +204,12 @@ The interval used by the exporter to push metrics to influxdb. pushInterval = 10s ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: influxdb: pushInterval: 10s ``` ```bash tab="CLI" ---metrics --metrics.influxdb.pushInterval=10s ``` diff --git a/docs/content/observability/metrics/overview.md b/docs/content/observability/metrics/overview.md index f266c6b8c..f7d148fbf 100644 --- a/docs/content/observability/metrics/overview.md +++ b/docs/content/observability/metrics/overview.md @@ -17,10 +17,10 @@ To enable metrics: [metrics] ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: {} ``` ```bash tab="CLI" ---metrics +--metrics=true ``` diff --git a/docs/content/observability/metrics/prometheus.md b/docs/content/observability/metrics/prometheus.md index 8ffd46cf1..ac8a43dc3 100644 --- a/docs/content/observability/metrics/prometheus.md +++ b/docs/content/observability/metrics/prometheus.md @@ -7,14 +7,13 @@ To enable the Prometheus: [metrics.prometheus] ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: prometheus: {} ``` ```bash tab="CLI" ---metrics ---metrics.prometheus +--metrics.prometheus=true ``` #### `buckets` @@ -29,7 +28,7 @@ Buckets for latency metrics. buckets = [0.1,0.3,1.2,5.0] ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: prometheus: buckets: @@ -40,7 +39,6 @@ metrics: ``` ```bash tab="CLI" ---metrics --metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000 ``` @@ -56,14 +54,13 @@ Enable metrics on entry points. addEntryPointsLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: prometheus: addEntryPointsLabels: true ``` ```bash tab="CLI" ---metrics --metrics.prometheus.addEntryPointsLabels=true ``` @@ -79,13 +76,12 @@ Enable metrics on services. addServicesLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: prometheus: addServicesLabels: true ``` ```bash tab="CLI" ---metrics --metrics.prometheus.addServicesLabels=true ``` diff --git a/docs/content/observability/metrics/statsd.md b/docs/content/observability/metrics/statsd.md index f4160878d..b7624101b 100644 --- a/docs/content/observability/metrics/statsd.md +++ b/docs/content/observability/metrics/statsd.md @@ -7,14 +7,13 @@ To enable the Statsd: [metrics.statsd] ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: statsd: {} ``` ```bash tab="CLI" ---metrics ---metrics.statsd +--metrics.statsd=true ``` #### `address` @@ -29,14 +28,13 @@ Address instructs exporter to send metrics to statsd at this address. address = "localhost:8125" ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: statsd: address: localhost:8125 ``` ```bash tab="CLI" ---metrics --metrics.statsd.address="localhost:8125" ``` @@ -52,14 +50,13 @@ Enable metrics on entry points. addEntryPointsLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: statsd: addEntryPointsLabels: true ``` ```bash tab="CLI" ---metrics --metrics.statsd.addEntryPointsLabels=true ``` @@ -75,14 +72,13 @@ Enable metrics on services. addServicesLabels = true ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: statsd: addServicesLabels: true ``` ```bash tab="CLI" ---metrics --metrics.statsd.addServicesLabels=true ``` @@ -98,13 +94,12 @@ The interval used by the exporter to push metrics to statsD. pushInterval = 10s ``` -```yaml tab="File (TOML)" +```yaml tab="File (YAML)" metrics: statsd: pushInterval: 10s ``` ```bash tab="CLI" ---metrics --metrics.statsd.pushInterval=10s ``` diff --git a/docs/content/observability/tracing/datadog.md b/docs/content/observability/tracing/datadog.md index 92da66d7b..5f3ed46b5 100644 --- a/docs/content/observability/tracing/datadog.md +++ b/docs/content/observability/tracing/datadog.md @@ -13,8 +13,7 @@ tracing: ``` ```bash tab="CLI" ---tracing ---tracing.datadog +--tracing.datadog=true ``` #### `localAgentHostPort` @@ -36,7 +35,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.datadog.localAgentHostPort="127.0.0.1:8126" ``` @@ -59,7 +57,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.datadog.debug=true ``` @@ -82,7 +79,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.datadog.globalTag="sample" ``` @@ -106,6 +102,5 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.datadog.prioritySampling=true ``` diff --git a/docs/content/observability/tracing/haystack.md b/docs/content/observability/tracing/haystack.md index 86557c220..eb32bea21 100644 --- a/docs/content/observability/tracing/haystack.md +++ b/docs/content/observability/tracing/haystack.md @@ -13,8 +13,7 @@ tracing: ``` ```bash tab="CLI" ---tracing ---tracing.haystack +--tracing.haystack=true ``` #### `localAgentHost` @@ -36,7 +35,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.localAgentHost="127.0.0.1" ``` @@ -59,7 +57,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.localAgentPort=42699 ``` @@ -82,7 +79,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.globalTag="sample:test" ``` @@ -105,7 +101,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.traceIDHeaderName="sample" ``` @@ -128,7 +123,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.parentIDHeaderName="sample" ``` @@ -151,7 +145,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.haystack.spanIDHeaderName=sample:test ``` @@ -175,6 +168,5 @@ tracing: ```bash tab="CLI" ---tracing --tracing.haystack.baggagePrefixHeaderName="sample" ``` diff --git a/docs/content/observability/tracing/instana.md b/docs/content/observability/tracing/instana.md index 27daa3304..b4e5d78e1 100644 --- a/docs/content/observability/tracing/instana.md +++ b/docs/content/observability/tracing/instana.md @@ -13,8 +13,7 @@ tracing: ``` ```bash tab="CLI" ---tracing ---tracing.instana +--tracing.instana=true ``` #### `localAgentHost` @@ -36,7 +35,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.instana.localAgentHost="127.0.0.1" ``` @@ -59,7 +57,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.instana.localAgentPort=42699 ``` @@ -89,6 +86,5 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.instana.logLevel="info" ``` diff --git a/docs/content/observability/tracing/jaeger.md b/docs/content/observability/tracing/jaeger.md index 0979ff6e1..a95975db1 100644 --- a/docs/content/observability/tracing/jaeger.md +++ b/docs/content/observability/tracing/jaeger.md @@ -13,8 +13,7 @@ tracing: ``` ```bash tab="CLI" ---tracing ---tracing.jaeger +--tracing.jaeger=true ``` !!! warning @@ -40,7 +39,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.samplingServerURL="http://localhost:5778/sampling" ``` @@ -63,7 +61,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.samplingType="const" ``` @@ -92,7 +89,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.samplingParam="1.0" ``` @@ -115,7 +111,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.localAgentHostPort="127.0.0.1:6831" ``` @@ -138,7 +133,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.gen128Bit ``` @@ -165,7 +159,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.propagation="jaeger" ``` @@ -189,7 +182,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.traceContextHeaderName="uber-trace-id" ``` @@ -214,7 +206,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.collector.endpoint="http://127.0.0.1:14268/api/traces?format=jaeger.thrift" ``` @@ -238,7 +229,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.collector.user="my-user" ``` @@ -262,6 +252,5 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.jaeger.collector.password="my-password" ``` diff --git a/docs/content/observability/tracing/overview.md b/docs/content/observability/tracing/overview.md index 4b0ad2cba..543f0a354 100644 --- a/docs/content/observability/tracing/overview.md +++ b/docs/content/observability/tracing/overview.md @@ -30,7 +30,7 @@ tracing: {} ``` ```bash tab="CLI" ---tracing +--tracing=true ``` ### Common Options @@ -52,7 +52,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.serviceName="traefik" ``` @@ -76,6 +75,5 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.spanNameLimit=150 ``` diff --git a/docs/content/observability/tracing/zipkin.md b/docs/content/observability/tracing/zipkin.md index dc2665e85..101040566 100644 --- a/docs/content/observability/tracing/zipkin.md +++ b/docs/content/observability/tracing/zipkin.md @@ -13,8 +13,7 @@ tracing: ``` ```bash tab="CLI" ---tracing ---tracing.zipkin +--tracing.zipkin=true ``` #### `httpEndpoint` @@ -36,7 +35,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.zipkin.httpEndpoint="http://localhost:9411/api/v1/spans" ``` @@ -59,7 +57,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.zipkin.debug=true ``` @@ -82,7 +79,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.zipkin.sameSpan=true ``` @@ -105,7 +101,6 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.zipkin.id128Bit=false ``` @@ -128,6 +123,5 @@ tracing: ``` ```bash tab="CLI" ---tracing --tracing.zipkin.sampleRate="0.2" ``` \ No newline at end of file diff --git a/docs/content/operations/api.md b/docs/content/operations/api.md index 2cbba5862..1cae400b5 100644 --- a/docs/content/operations/api.md +++ b/docs/content/operations/api.md @@ -29,12 +29,16 @@ would be to apply the following protection mechanisms: To enable the API handler: -```toml tab="File" +```toml tab="File (TOML)" [api] ``` +```yaml tab="File (YAML)" +api: {} +``` + ```bash tab="CLI" ---api +--api=true ``` ### `dashboard` @@ -43,13 +47,18 @@ _Optional, Default=true_ Enable the dashboard. More about the dashboard features [here](./dashboard.md). -```toml tab="File" +```toml tab="File (TOML)" [api] dashboard = true ``` +```yaml tab="File (YAML)" +api: + dashboard: true +``` + ```bash tab="CLI" ---api.dashboard +--api.dashboard=true ``` ### `debug` @@ -58,11 +67,16 @@ _Optional, Default=false_ Enable additional endpoints for debugging and profiling, served under `/debug/`. -```toml tab="File" +```toml tab="File (TOML)" [api] debug = true ``` +```yaml tab="File (YAML)" +api: + debug: true +``` + ```bash tab="CLI" --api.debug=true ``` diff --git a/docs/content/operations/dashboard.md b/docs/content/operations/dashboard.md index a867c1976..c0443c199 100644 --- a/docs/content/operations/dashboard.md +++ b/docs/content/operations/dashboard.md @@ -29,38 +29,39 @@ By default, the dashboard is available on `/` on port `:8080`. To enable the dashboard, you need to enable Traefik's API. -??? example "Using the Command Line" +```toml tab="File (TOML)" +[api] + # Dashboard + # + # Optional + # Default: true + # + dashboard = true +``` - | Option | Values | Default Value | - | --------------- | --------------- | --------------------: | - | --api | \[true\|false\] | false | - | --api.dashboard | \[true\|false\] | true when api is true | - - {!more-on-command-line.md!} +```yaml tab="File (YAML)" +api: + # Dashboard + # + # Optional + # Default: true + # + dashboard: true +``` -??? example "Using the Configuration File" +```bash tab="CLI" +# Dashboard +# +# Optional +# Default: true +# +--api.dashboard=true +``` - ```toml - [api] - # Dashboard - # - # Optional - # Default: true - # - dashboard = true - ``` - - {!more-on-configuration-file.md!} +{!more-on-command-line.md!} -??? example "Using a Key/Value Store" +{!more-on-configuration-file.md!} - | Key | Values | Default Value | - | ------------- | --------------- | --------------------: | - | api | \[true\|false\] | false | - | api.dashboard | \[true\|false\] | true when api is true | - - {!more-on-key-value-store.md!} - !!! tip "Did You Know?" The API provides more features than the Dashboard. To learn more about it, refer to the `Traefik's API documentation`(TODO: add doc and link). diff --git a/docs/content/operations/ping.md b/docs/content/operations/ping.md index 6200f2739..deee3d641 100644 --- a/docs/content/operations/ping.md +++ b/docs/content/operations/ping.md @@ -7,9 +7,17 @@ Checking the Health of Your Traefik Instances ??? example "Enabling /ping" - ```toml - [ping] - ``` +```toml tab="File (TOML)" +[ping] +``` + +```yaml tab="File (YAML)" +ping: {} +``` + +```bash tab="CLI" +--ping=true +``` | Path | Method | Description | |---------|---------------|-----------------------------------------------------------------------------------------------------| diff --git a/docs/content/providers/docker.md b/docs/content/providers/docker.md index e532496ff..6e20e5e4b 100644 --- a/docs/content/providers/docker.md +++ b/docs/content/providers/docker.md @@ -26,7 +26,7 @@ Attach labels to your containers and let Traefik do the rest! ``` ```bash tab="CLI" - --providers.docker + --providers.docker=true ``` Attaching labels to containers (in your docker compose file) @@ -65,7 +65,7 @@ Attach labels to your containers and let Traefik do the rest! ```bash tab="CLI" --providers.docker.endpoint="tcp://127.0.0.1:2375" - --providers.docker.swarmMode + --providers.docker.swarmMode=true ``` Attach labels to services (not to containers) while in Swarm mode (in your docker compose file) @@ -331,7 +331,7 @@ providers: ``` ```bash tab="CLI" ---providers.docker.swarmMode +--providers.docker.swarmMode=true # ... ``` diff --git a/docs/content/providers/kubernetes-ingress.md b/docs/content/providers/kubernetes-ingress.md index a6de09424..ca0978d44 100644 --- a/docs/content/providers/kubernetes-ingress.md +++ b/docs/content/providers/kubernetes-ingress.md @@ -20,7 +20,7 @@ providers: ``` ```bash tab="CLI" ---providers.kubernetesingress +--providers.kubernetesingress=true ``` The provider then watches for incoming ingresses events, such as the example below, and derives the corresponding dynamic configuration from it, which in turn will create the resulting routers, services, handlers, etc. diff --git a/docs/content/providers/marathon.md b/docs/content/providers/marathon.md index b2c851541..e19e9877c 100644 --- a/docs/content/providers/marathon.md +++ b/docs/content/providers/marathon.md @@ -21,7 +21,7 @@ See also [Marathon user guide](../user-guides/marathon.md). ``` ```bash tab="CLI" - --providers.marathon + --providers.marathon=true ``` Attaching labels to marathon applications diff --git a/docs/content/providers/rancher.md b/docs/content/providers/rancher.md index ea74e39bd..f3aa97121 100644 --- a/docs/content/providers/rancher.md +++ b/docs/content/providers/rancher.md @@ -28,7 +28,7 @@ Attach labels to your services and let Traefik do the rest! ``` ```bash tab="CLI" - --providers.rancher + --providers.rancher=true ``` Attaching labels to services @@ -55,6 +55,8 @@ Attach labels to your services and let Traefik do the rest! --8<-- "content/providers/rancher.txt" ``` +List of all available labels for the [dynamic](../reference/dynamic-configuration/rancher.md) configuration references. + ### `exposedByDefault` _Optional, Default=true_ diff --git a/docs/content/providers/rancher.toml b/docs/content/providers/rancher.toml index b209fb8cb..e809d737d 100644 --- a/docs/content/providers/rancher.toml +++ b/docs/content/providers/rancher.toml @@ -11,7 +11,7 @@ enableServiceHealthFilter = true # Defines the polling interval (in seconds). - refreshSeconds = true + refreshSeconds = 15 # Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate intervalPoll = false diff --git a/docs/content/providers/rancher.txt b/docs/content/providers/rancher.txt index daf9db4ce..be28f4d99 100644 --- a/docs/content/providers/rancher.txt +++ b/docs/content/providers/rancher.txt @@ -1,5 +1,5 @@ # Enable Rancher Provider. ---providers.rancher +--providers.rancher=true # Expose Rancher services by default in Traefik. --providers.rancher.exposedByDefault=true @@ -11,7 +11,7 @@ --providers.rancher.enableServiceHealthFilter=true # Defines the polling interval (in seconds). ---providers.rancher.refreshSeconds=true +--providers.rancher.refreshSeconds=15 # Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate --providers.rancher.intervalPoll=false diff --git a/docs/content/providers/rancher.yml b/docs/content/providers/rancher.yml index 9db978da2..bc9d57fff 100644 --- a/docs/content/providers/rancher.yml +++ b/docs/content/providers/rancher.yml @@ -12,7 +12,7 @@ providers: enableServiceHealthFilter: true # Defines the polling interval (in seconds). - refreshSeconds: true + refreshSeconds: 15 # Poll the Rancher metadata service for changes every `rancher.refreshSeconds`, which is less accurate intervalPoll: false diff --git a/docs/content/reference/dynamic-configuration/docker-labels.yml b/docs/content/reference/dynamic-configuration/docker-labels.yml new file mode 100644 index 000000000..29541203f --- /dev/null +++ b/docs/content/reference/dynamic-configuration/docker-labels.yml @@ -0,0 +1,177 @@ +- "traefik.http.middlewares.middleware00.addprefix.prefix=foobar" +- "traefik.http.middlewares.middleware01.basicauth.headerfield=foobar" +- "traefik.http.middlewares.middleware01.basicauth.realm=foobar" +- "traefik.http.middlewares.middleware01.basicauth.removeheader=true" +- "traefik.http.middlewares.middleware01.basicauth.users=foobar, foobar" +- "traefik.http.middlewares.middleware01.basicauth.usersfile=foobar" +- "traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.memrequestbodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.memresponsebodybytes=42" +- "traefik.http.middlewares.middleware02.buffering.retryexpression=foobar" +- "traefik.http.middlewares.middleware03.chain.middlewares=foobar, foobar" +- "traefik.http.middlewares.middleware04.circuitbreaker.expression=foobar" +- "traefik.http.middlewares.middleware05.compress=true" +- "traefik.http.middlewares.middleware06.digestauth.headerfield=foobar" +- "traefik.http.middlewares.middleware06.digestauth.realm=foobar" +- "traefik.http.middlewares.middleware06.digestauth.removeheader=true" +- "traefik.http.middlewares.middleware06.digestauth.users=foobar, foobar" +- "traefik.http.middlewares.middleware06.digestauth.usersfile=foobar" +- "traefik.http.middlewares.middleware07.errors.query=foobar" +- "traefik.http.middlewares.middleware07.errors.service=foobar" +- "traefik.http.middlewares.middleware07.errors.status=foobar, foobar" +- "traefik.http.middlewares.middleware08.forwardauth.address=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.authresponseheaders=foobar, foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.ca=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.caoptional=true" +- "traefik.http.middlewares.middleware08.forwardauth.tls.cert=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify=true" +- "traefik.http.middlewares.middleware08.forwardauth.tls.key=foobar" +- "traefik.http.middlewares.middleware08.forwardauth.trustforwardheader=true" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials=true" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin=foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.accesscontrolmaxage=42" +- "traefik.http.middlewares.middleware09.headers.addvaryheader=true" +- "traefik.http.middlewares.middleware09.headers.allowedhosts=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.browserxssfilter=true" +- "traefik.http.middlewares.middleware09.headers.contentsecuritypolicy=foobar" +- "traefik.http.middlewares.middleware09.headers.contenttypenosniff=true" +- "traefik.http.middlewares.middleware09.headers.custombrowserxssvalue=foobar" +- "traefik.http.middlewares.middleware09.headers.customframeoptionsvalue=foobar" +- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.customrequestheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.customresponseheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.forcestsheader=true" +- "traefik.http.middlewares.middleware09.headers.framedeny=true" +- "traefik.http.middlewares.middleware09.headers.hostsproxyheaders=foobar, foobar" +- "traefik.http.middlewares.middleware09.headers.isdevelopment=true" +- "traefik.http.middlewares.middleware09.headers.publickey=foobar" +- "traefik.http.middlewares.middleware09.headers.referrerpolicy=foobar" +- "traefik.http.middlewares.middleware09.headers.sslforcehost=true" +- "traefik.http.middlewares.middleware09.headers.sslhost=foobar" +- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0=foobar" +- "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1=foobar" +- "traefik.http.middlewares.middleware09.headers.sslredirect=true" +- "traefik.http.middlewares.middleware09.headers.ssltemporaryredirect=true" +- "traefik.http.middlewares.middleware09.headers.stsincludesubdomains=true" +- "traefik.http.middlewares.middleware09.headers.stspreload=true" +- "traefik.http.middlewares.middleware09.headers.stsseconds=42" +- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth=42" +- "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips=foobar, foobar" +- "traefik.http.middlewares.middleware10.ipwhitelist.sourcerange=foobar, foobar" +- "traefik.http.middlewares.middleware11.maxconn.amount=42" +- "traefik.http.middlewares.middleware11.maxconn.extractorfunc=foobar" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.sans=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" +- "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" +- "traefik.http.middlewares.middleware13.redirectregex.permanent=true" +- "traefik.http.middlewares.middleware13.redirectregex.regex=foobar" +- "traefik.http.middlewares.middleware13.redirectregex.replacement=foobar" +- "traefik.http.middlewares.middleware14.redirectscheme.permanent=true" +- "traefik.http.middlewares.middleware14.redirectscheme.port=foobar" +- "traefik.http.middlewares.middleware14.redirectscheme.scheme=foobar" +- "traefik.http.middlewares.middleware15.replacepath.path=foobar" +- "traefik.http.middlewares.middleware16.replacepathregex.regex=foobar" +- "traefik.http.middlewares.middleware16.replacepathregex.replacement=foobar" +- "traefik.http.middlewares.middleware17.retry.attempts=42" +- "traefik.http.middlewares.middleware18.stripprefix.prefixes=foobar, foobar" +- "traefik.http.middlewares.middleware19.stripprefixregex.regex=foobar, foobar" +- "traefik.http.routers.router0.entrypoints=foobar, foobar" +- "traefik.http.routers.router0.middlewares=foobar, foobar" +- "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.certresolver=foobar" +- "traefik.http.routers.router0.tls.domains[0].main=foobar" +- "traefik.http.routers.router0.tls.domains[0].sans=foobar, foobar" +- "traefik.http.routers.router0.tls.domains[1].main=foobar" +- "traefik.http.routers.router0.tls.domains[1].sans=foobar, foobar" +- "traefik.http.routers.router0.tls.options=foobar" +- "traefik.http.routers.router1.entrypoints=foobar, foobar" +- "traefik.http.routers.router1.middlewares=foobar, foobar" +- "traefik.http.routers.router1.priority=42" +- "traefik.http.routers.router1.rule=foobar" +- "traefik.http.routers.router1.service=foobar" +- "traefik.http.routers.router1.tls=true" +- "traefik.http.routers.router1.tls.certresolver=foobar" +- "traefik.http.routers.router1.tls.domains[0].main=foobar" +- "traefik.http.routers.router1.tls.domains[0].sans=foobar, foobar" +- "traefik.http.routers.router1.tls.domains[1].main=foobar" +- "traefik.http.routers.router1.tls.domains[1].sans=foobar, foobar" +- "traefik.http.routers.router1.tls.options=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.stickiness=true" +- "traefik.http.services.service0.loadbalancer.stickiness.cookiename=foobar" +- "traefik.http.services.service0.loadbalancer.stickiness.httponlycookie=true" +- "traefik.http.services.service0.loadbalancer.stickiness.securecookie=true" +- "traefik.http.services.service0.loadbalancer.server.port=foobar" +- "traefik.http.services.service0.loadbalancer.server.scheme=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.stickiness=true" +- "traefik.http.services.service1.loadbalancer.stickiness.cookiename=foobar" +- "traefik.http.services.service1.loadbalancer.stickiness.httponlycookie=true" +- "traefik.http.services.service1.loadbalancer.stickiness.securecookie=true" +- "traefik.http.services.service1.loadbalancer.server.port=foobar" +- "traefik.http.services.service1.loadbalancer.server.scheme=foobar" +- "traefik.tcp.routers.tcprouter0.entrypoints=foobar, foobar" +- "traefik.tcp.routers.tcprouter0.rule=foobar" +- "traefik.tcp.routers.tcprouter0.service=foobar" +- "traefik.tcp.routers.tcprouter0.tls=true" +- "traefik.tcp.routers.tcprouter0.tls.certresolver=foobar" +- "traefik.tcp.routers.tcprouter0.tls.domains[0].main=foobar" +- "traefik.tcp.routers.tcprouter0.tls.domains[0].sans=foobar, foobar" +- "traefik.tcp.routers.tcprouter0.tls.domains[1].main=foobar" +- "traefik.tcp.routers.tcprouter0.tls.domains[1].sans=foobar, foobar" +- "traefik.tcp.routers.tcprouter0.tls.options=foobar" +- "traefik.tcp.routers.tcprouter0.tls.passthrough=true" +- "traefik.tcp.routers.tcprouter1.entrypoints=foobar, foobar" +- "traefik.tcp.routers.tcprouter1.rule=foobar" +- "traefik.tcp.routers.tcprouter1.service=foobar" +- "traefik.tcp.routers.tcprouter1.tls=true" +- "traefik.tcp.routers.tcprouter1.tls.certresolver=foobar" +- "traefik.tcp.routers.tcprouter1.tls.domains[0].main=foobar" +- "traefik.tcp.routers.tcprouter1.tls.domains[0].sans=foobar, foobar" +- "traefik.tcp.routers.tcprouter1.tls.domains[1].main=foobar" +- "traefik.tcp.routers.tcprouter1.tls.domains[1].sans=foobar, foobar" +- "traefik.tcp.routers.tcprouter1.tls.options=foobar" +- "traefik.tcp.routers.tcprouter1.tls.passthrough=true" +- "traefik.tcp.services.tcpservice0.loadbalancer.server.port=foobar" +- "traefik.tcp.services.tcpservice1.loadbalancer.server.port=foobar" diff --git a/docs/content/reference/dynamic-configuration/docker.md b/docs/content/reference/dynamic-configuration/docker.md index 93317e0f1..dd6c4bce1 100644 --- a/docs/content/reference/dynamic-configuration/docker.md +++ b/docs/content/reference/dynamic-configuration/docker.md @@ -7,6 +7,6 @@ The labels are case insensitive. ```yaml labels: ---8<-- "content/reference/dynamic-configuration/docker.yml" ---8<-- "content/reference/dynamic-configuration/labels.yml" + --8<-- "content/reference/dynamic-configuration/docker.yml" + --8<-- "content/reference/dynamic-configuration/docker-labels.yml" ``` diff --git a/docs/content/reference/dynamic-configuration/docker.yml b/docs/content/reference/dynamic-configuration/docker.yml index f91fef5b1..6f9e1c62f 100644 --- a/docs/content/reference/dynamic-configuration/docker.yml +++ b/docs/content/reference/dynamic-configuration/docker.yml @@ -1,3 +1,3 @@ - - "traefik.enable=true" - - "traefik.docker.network=foobar" - - "traefik.docker.lbswarm=true" +- "traefik.enable=true" +- "traefik.docker.network=foobar" +- "traefik.docker.lbswarm=true" diff --git a/docs/content/reference/dynamic-configuration/file.toml b/docs/content/reference/dynamic-configuration/file.toml index b9ada6726..033fe61e4 100644 --- a/docs/content/reference/dynamic-configuration/file.toml +++ b/docs/content/reference/dynamic-configuration/file.toml @@ -8,6 +8,15 @@ priority = 42 [http.routers.Router0.tls] options = "foobar" + certResolver = "foobar" + + [[http.routers.Router0.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] + + [[http.routers.Router0.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] [http.routers.Router1] entryPoints = ["foobar", "foobar"] middlewares = ["foobar", "foobar"] @@ -16,6 +25,15 @@ priority = 42 [http.routers.Router1.tls] options = "foobar" + certResolver = "foobar" + + [[http.routers.Router1.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] + + [[http.routers.Router1.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] [http.services] [http.services.Service0] [http.services.Service0.loadBalancer] @@ -186,31 +204,31 @@ commonName = true serialNumber = true domainComponent = true - [http.middlewares.Middleware14] - [http.middlewares.Middleware14.redirectRegex] + [http.middlewares.Middleware13] + [http.middlewares.Middleware13.redirectRegex] regex = "foobar" replacement = "foobar" permanent = true - [http.middlewares.Middleware15] - [http.middlewares.Middleware15.redirectScheme] + [http.middlewares.Middleware14] + [http.middlewares.Middleware14.redirectScheme] scheme = "foobar" port = "foobar" permanent = true - [http.middlewares.Middleware16] - [http.middlewares.Middleware16.replacePath] + [http.middlewares.Middleware15] + [http.middlewares.Middleware15.replacePath] path = "foobar" - [http.middlewares.Middleware17] - [http.middlewares.Middleware17.replacePathRegex] + [http.middlewares.Middleware16] + [http.middlewares.Middleware16.replacePathRegex] regex = "foobar" replacement = "foobar" - [http.middlewares.Middleware18] - [http.middlewares.Middleware18.retry] + [http.middlewares.Middleware17] + [http.middlewares.Middleware17.retry] attempts = 42 - [http.middlewares.Middleware19] - [http.middlewares.Middleware19.stripPrefix] + [http.middlewares.Middleware18] + [http.middlewares.Middleware18.stripPrefix] prefixes = ["foobar", "foobar"] - [http.middlewares.Middleware20] - [http.middlewares.Middleware20.stripPrefixRegex] + [http.middlewares.Middleware19] + [http.middlewares.Middleware19.stripPrefixRegex] regex = ["foobar", "foobar"] [tcp] @@ -222,6 +240,15 @@ [tcp.routers.TCPRouter0.tls] passthrough = true options = "foobar" + certResolver = "foobar" + + [[tcp.routers.TCPRouter0.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] + + [[tcp.routers.TCPRouter0.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] [tcp.routers.TCPRouter1] entryPoints = ["foobar", "foobar"] service = "foobar" @@ -229,6 +256,15 @@ [tcp.routers.TCPRouter1.tls] passthrough = true options = "foobar" + certResolver = "foobar" + + [[tcp.routers.TCPRouter1.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] + + [[tcp.routers.TCPRouter1.tls.domains]] + main = "foobar" + sans = ["foobar", "foobar"] [tcp.services] [tcp.services.TCPService0] [tcp.services.TCPService0.loadBalancer] @@ -265,14 +301,14 @@ sniStrict = true [tls.options.Options0.clientAuth] caFiles = ["foobar", "foobar"] - clientAuthType = "VerifyClientCertIfGiven" + clientAuthType = "foobar" [tls.options.Options1] minVersion = "foobar" cipherSuites = ["foobar", "foobar"] sniStrict = true [tls.options.Options1.clientAuth] caFiles = ["foobar", "foobar"] - clientAuthType = "VerifyClientCertIfGiven" + clientAuthType = "foobar" [tls.stores] [tls.stores.Store0] [tls.stores.Store0.defaultCertificate] diff --git a/docs/content/reference/dynamic-configuration/file.yaml b/docs/content/reference/dynamic-configuration/file.yaml index b3120bb61..a3e1d9b21 100644 --- a/docs/content/reference/dynamic-configuration/file.yaml +++ b/docs/content/reference/dynamic-configuration/file.yaml @@ -12,6 +12,16 @@ http: priority: 42 tls: options: foobar + certResolver: foobar + domains: + - main: foobar + sans: + - foobar + - foobar + - main: foobar + sans: + - foobar + - foobar Router1: entryPoints: - foobar @@ -24,6 +34,16 @@ http: priority: 42 tls: options: foobar + certResolver: foobar + domains: + - main: foobar + sans: + - foobar + - foobar + - main: foobar + sans: + - foobar + - foobar services: Service0: loadBalancer: @@ -212,32 +232,32 @@ http: commonName: true serialNumber: true domainComponent: true - Middleware14: + Middleware13: redirectRegex: regex: foobar replacement: foobar permanent: true - Middleware15: + Middleware14: redirectScheme: scheme: foobar port: foobar permanent: true - Middleware16: + Middleware15: replacePath: path: foobar - Middleware17: + Middleware16: replacePathRegex: regex: foobar replacement: foobar - Middleware18: + Middleware17: retry: attempts: 42 - Middleware19: + Middleware18: stripPrefix: prefixes: - foobar - foobar - Middleware20: + Middleware19: stripPrefixRegex: regex: - foobar @@ -253,6 +273,16 @@ tcp: tls: passthrough: true options: foobar + certResolver: foobar + domains: + - main: foobar + sans: + - foobar + - foobar + - main: foobar + sans: + - foobar + - foobar TCPRouter1: entryPoints: - foobar @@ -262,6 +292,16 @@ tcp: tls: passthrough: true options: foobar + certResolver: foobar + domains: + - main: foobar + sans: + - foobar + - foobar + - main: foobar + sans: + - foobar + - foobar services: TCPService0: loadBalancer: @@ -295,7 +335,7 @@ tls: caFiles: - foobar - foobar - clientAuthType: VerifyClientCertIfGiven + clientAuthType: foobar sniStrict: true Options1: minVersion: foobar @@ -306,7 +346,7 @@ tls: caFiles: - foobar - foobar - clientAuthType: VerifyClientCertIfGiven + clientAuthType: foobar sniStrict: true stores: Store0: diff --git a/docs/content/reference/dynamic-configuration/labels.yml b/docs/content/reference/dynamic-configuration/labels.yml deleted file mode 100644 index b62c36b2a..000000000 --- a/docs/content/reference/dynamic-configuration/labels.yml +++ /dev/null @@ -1,157 +0,0 @@ - - "traefik.http.middlewares.middleware00.addprefix.prefix=foobar" - - "traefik.http.middlewares.middleware01.basicauth.headerfield=foobar" - - "traefik.http.middlewares.middleware01.basicauth.realm=foobar" - - "traefik.http.middlewares.middleware01.basicauth.removeheader=true" - - "traefik.http.middlewares.middleware01.basicauth.users=foobar, foobar" - - "traefik.http.middlewares.middleware01.basicauth.usersfile=foobar" - - "traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes=42" - - "traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes=42" - - "traefik.http.middlewares.middleware02.buffering.memrequestbodybytes=42" - - "traefik.http.middlewares.middleware02.buffering.memresponsebodybytes=42" - - "traefik.http.middlewares.middleware02.buffering.retryexpression=foobar" - - "traefik.http.middlewares.middleware03.chain.middlewares=foobar, foobar" - - "traefik.http.middlewares.middleware04.circuitbreaker.expression=foobar" - - "traefik.http.middlewares.middleware05.compress=true" - - "traefik.http.middlewares.middleware06.digestauth.headerfield=foobar" - - "traefik.http.middlewares.middleware06.digestauth.realm=foobar" - - "traefik.http.middlewares.middleware06.digestauth.removeheader=true" - - "traefik.http.middlewares.middleware06.digestauth.users=foobar, foobar" - - "traefik.http.middlewares.middleware06.digestauth.usersfile=foobar" - - "traefik.http.middlewares.middleware07.errors.query=foobar" - - "traefik.http.middlewares.middleware07.errors.service=foobar" - - "traefik.http.middlewares.middleware07.errors.status=foobar, foobar" - - "traefik.http.middlewares.middleware08.forwardauth.address=foobar" - - "traefik.http.middlewares.middleware08.forwardauth.authresponseheaders=foobar, foobar" - - "traefik.http.middlewares.middleware08.forwardauth.tls.ca=foobar" - - "traefik.http.middlewares.middleware08.forwardauth.tls.caoptional=true" - - "traefik.http.middlewares.middleware08.forwardauth.tls.cert=foobar" - - "traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify=true" - - "traefik.http.middlewares.middleware08.forwardauth.tls.key=foobar" - - "traefik.http.middlewares.middleware08.forwardauth.trustforwardheader=true" - - "traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials=true" - - "traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders=foobar, foobar" - - "traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods=foobar, foobar" - - "traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin=foobar" - - "traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders=foobar, foobar" - - "traefik.http.middlewares.middleware09.headers.accesscontrolmaxage=42" - - "traefik.http.middlewares.middleware09.headers.addvaryheader=true" - - "traefik.http.middlewares.middleware09.headers.allowedhosts=foobar, foobar" - - "traefik.http.middlewares.middleware09.headers.browserxssfilter=true" - - "traefik.http.middlewares.middleware09.headers.contentsecuritypolicy=foobar" - - "traefik.http.middlewares.middleware09.headers.contenttypenosniff=true" - - "traefik.http.middlewares.middleware09.headers.custombrowserxssvalue=foobar" - - "traefik.http.middlewares.middleware09.headers.customframeoptionsvalue=foobar" - - "traefik.http.middlewares.middleware09.headers.customrequestheaders.name0=foobar" - - "traefik.http.middlewares.middleware09.headers.customrequestheaders.name1=foobar" - - "traefik.http.middlewares.middleware09.headers.customresponseheaders.name0=foobar" - - "traefik.http.middlewares.middleware09.headers.customresponseheaders.name1=foobar" - - "traefik.http.middlewares.middleware09.headers.forcestsheader=true" - - "traefik.http.middlewares.middleware09.headers.framedeny=true" - - "traefik.http.middlewares.middleware09.headers.hostsproxyheaders=foobar, foobar" - - "traefik.http.middlewares.middleware09.headers.isdevelopment=true" - - "traefik.http.middlewares.middleware09.headers.publickey=foobar" - - "traefik.http.middlewares.middleware09.headers.referrerpolicy=foobar" - - "traefik.http.middlewares.middleware09.headers.sslforcehost=true" - - "traefik.http.middlewares.middleware09.headers.sslhost=foobar" - - "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0=foobar" - - "traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1=foobar" - - "traefik.http.middlewares.middleware09.headers.sslredirect=true" - - "traefik.http.middlewares.middleware09.headers.ssltemporaryredirect=true" - - "traefik.http.middlewares.middleware09.headers.stsincludesubdomains=true" - - "traefik.http.middlewares.middleware09.headers.stspreload=true" - - "traefik.http.middlewares.middleware09.headers.stsseconds=42" - - "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth=42" - - "traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips=foobar, foobar" - - "traefik.http.middlewares.middleware10.ipwhitelist.sourcerange=foobar, foobar" - - "traefik.http.middlewares.middleware11.maxconn.amount=42" - - "traefik.http.middlewares.middleware11.maxconn.extractorfunc=foobar" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.sans=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber=true" - - "traefik.http.middlewares.middleware12.passtlsclientcert.pem=true" - - "traefik.http.middlewares.middleware14.redirectregex.permanent=true" - - "traefik.http.middlewares.middleware14.redirectregex.regex=foobar" - - "traefik.http.middlewares.middleware14.redirectregex.replacement=foobar" - - "traefik.http.middlewares.middleware15.redirectscheme.permanent=true" - - "traefik.http.middlewares.middleware15.redirectscheme.port=foobar" - - "traefik.http.middlewares.middleware15.redirectscheme.scheme=foobar" - - "traefik.http.middlewares.middleware16.replacepath.path=foobar" - - "traefik.http.middlewares.middleware17.replacepathregex.regex=foobar" - - "traefik.http.middlewares.middleware17.replacepathregex.replacement=foobar" - - "traefik.http.middlewares.middleware18.retry.attempts=42" - - "traefik.http.middlewares.middleware19.stripprefix.prefixes=foobar, foobar" - - "traefik.http.middlewares.middleware20.stripprefixregex.regex=foobar, foobar" - - "traefik.http.routers.router0.entrypoints=foobar, foobar" - - "traefik.http.routers.router0.middlewares=foobar, foobar" - - "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=foobar" - - "traefik.http.routers.router1.entrypoints=foobar, foobar" - - "traefik.http.routers.router1.middlewares=foobar, foobar" - - "traefik.http.routers.router1.priority=42" - - "traefik.http.routers.router1.rule=foobar" - - "traefik.http.routers.router1.service=foobar" - - "traefik.http.routers.router1.tls=true" - - "traefik.http.routers.router1.tls.options=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.stickiness=true" - - "traefik.http.services.service0.loadbalancer.stickiness.cookiename=foobar" - - "traefik.http.services.service0.loadbalancer.stickiness.httponlycookie=true" - - "traefik.http.services.service0.loadbalancer.stickiness.securecookie=true" - - "traefik.http.services.service0.loadbalancer.server.port=foobar" - - "traefik.http.services.service0.loadbalancer.server.scheme=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.stickiness=true" - - "traefik.http.services.service1.loadbalancer.stickiness.cookiename=foobar" - - "traefik.http.services.service1.loadbalancer.stickiness.httponlycookie=true" - - "traefik.http.services.service1.loadbalancer.stickiness.securecookie=true" - - "traefik.http.services.service1.loadbalancer.server.port=foobar" - - "traefik.http.services.service1.loadbalancer.server.scheme=foobar" - - "traefik.tcp.routers.tcprouter0.entrypoints=foobar, foobar" - - "traefik.tcp.routers.tcprouter0.rule=foobar" - - "traefik.tcp.routers.tcprouter0.service=foobar" - - "traefik.tcp.routers.tcprouter0.tls=true" - - "traefik.tcp.routers.tcprouter0.tls.options=foobar" - - "traefik.tcp.routers.tcprouter0.tls.passthrough=true" - - "traefik.tcp.routers.tcprouter1.entrypoints=foobar, foobar" - - "traefik.tcp.routers.tcprouter1.rule=foobar" - - "traefik.tcp.routers.tcprouter1.service=foobar" - - "traefik.tcp.routers.tcprouter1.tls=true" - - "traefik.tcp.routers.tcprouter1.tls.options=foobar" - - "traefik.tcp.routers.tcprouter1.tls.passthrough=true" - - "traefik.tcp.services.tcpservice0.loadbalancer.server.port=foobar" - - "traefik.tcp.services.tcpservice1.loadbalancer.server.port=foobar" \ No newline at end of file diff --git a/docs/content/reference/dynamic-configuration/marathon-labels.json b/docs/content/reference/dynamic-configuration/marathon-labels.json new file mode 100644 index 000000000..45570105b --- /dev/null +++ b/docs/content/reference/dynamic-configuration/marathon-labels.json @@ -0,0 +1,177 @@ +"traefik.http.middlewares.middleware00.addprefix.prefix": "foobar", +"traefik.http.middlewares.middleware01.basicauth.headerfield": "foobar", +"traefik.http.middlewares.middleware01.basicauth.realm": "foobar", +"traefik.http.middlewares.middleware01.basicauth.removeheader": "true", +"traefik.http.middlewares.middleware01.basicauth.users": "foobar, foobar", +"traefik.http.middlewares.middleware01.basicauth.usersfile": "foobar", +"traefik.http.middlewares.middleware02.buffering.maxrequestbodybytes": "42", +"traefik.http.middlewares.middleware02.buffering.maxresponsebodybytes": "42", +"traefik.http.middlewares.middleware02.buffering.memrequestbodybytes": "42", +"traefik.http.middlewares.middleware02.buffering.memresponsebodybytes": "42", +"traefik.http.middlewares.middleware02.buffering.retryexpression": "foobar", +"traefik.http.middlewares.middleware03.chain.middlewares": "foobar, foobar", +"traefik.http.middlewares.middleware04.circuitbreaker.expression": "foobar", +"traefik.http.middlewares.middleware05.compress": "true", +"traefik.http.middlewares.middleware06.digestauth.headerfield": "foobar", +"traefik.http.middlewares.middleware06.digestauth.realm": "foobar", +"traefik.http.middlewares.middleware06.digestauth.removeheader": "true", +"traefik.http.middlewares.middleware06.digestauth.users": "foobar, foobar", +"traefik.http.middlewares.middleware06.digestauth.usersfile": "foobar", +"traefik.http.middlewares.middleware07.errors.query": "foobar", +"traefik.http.middlewares.middleware07.errors.service": "foobar", +"traefik.http.middlewares.middleware07.errors.status": "foobar, foobar", +"traefik.http.middlewares.middleware08.forwardauth.address": "foobar", +"traefik.http.middlewares.middleware08.forwardauth.authresponseheaders": "foobar, foobar", +"traefik.http.middlewares.middleware08.forwardauth.tls.ca": "foobar", +"traefik.http.middlewares.middleware08.forwardauth.tls.caoptional": "true", +"traefik.http.middlewares.middleware08.forwardauth.tls.cert": "foobar", +"traefik.http.middlewares.middleware08.forwardauth.tls.insecureskipverify": "true", +"traefik.http.middlewares.middleware08.forwardauth.tls.key": "foobar", +"traefik.http.middlewares.middleware08.forwardauth.trustforwardheader": "true", +"traefik.http.middlewares.middleware09.headers.accesscontrolallowcredentials": "true", +"traefik.http.middlewares.middleware09.headers.accesscontrolallowheaders": "foobar, foobar", +"traefik.http.middlewares.middleware09.headers.accesscontrolallowmethods": "foobar, foobar", +"traefik.http.middlewares.middleware09.headers.accesscontrolalloworigin": "foobar", +"traefik.http.middlewares.middleware09.headers.accesscontrolexposeheaders": "foobar, foobar", +"traefik.http.middlewares.middleware09.headers.accesscontrolmaxage": "42", +"traefik.http.middlewares.middleware09.headers.addvaryheader": "true", +"traefik.http.middlewares.middleware09.headers.allowedhosts": "foobar, foobar", +"traefik.http.middlewares.middleware09.headers.browserxssfilter": "true", +"traefik.http.middlewares.middleware09.headers.contentsecuritypolicy": "foobar", +"traefik.http.middlewares.middleware09.headers.contenttypenosniff": "true", +"traefik.http.middlewares.middleware09.headers.custombrowserxssvalue": "foobar", +"traefik.http.middlewares.middleware09.headers.customframeoptionsvalue": "foobar", +"traefik.http.middlewares.middleware09.headers.customrequestheaders.name0": "foobar", +"traefik.http.middlewares.middleware09.headers.customrequestheaders.name1": "foobar", +"traefik.http.middlewares.middleware09.headers.customresponseheaders.name0": "foobar", +"traefik.http.middlewares.middleware09.headers.customresponseheaders.name1": "foobar", +"traefik.http.middlewares.middleware09.headers.forcestsheader": "true", +"traefik.http.middlewares.middleware09.headers.framedeny": "true", +"traefik.http.middlewares.middleware09.headers.hostsproxyheaders": "foobar, foobar", +"traefik.http.middlewares.middleware09.headers.isdevelopment": "true", +"traefik.http.middlewares.middleware09.headers.publickey": "foobar", +"traefik.http.middlewares.middleware09.headers.referrerpolicy": "foobar", +"traefik.http.middlewares.middleware09.headers.sslforcehost": "true", +"traefik.http.middlewares.middleware09.headers.sslhost": "foobar", +"traefik.http.middlewares.middleware09.headers.sslproxyheaders.name0": "foobar", +"traefik.http.middlewares.middleware09.headers.sslproxyheaders.name1": "foobar", +"traefik.http.middlewares.middleware09.headers.sslredirect": "true", +"traefik.http.middlewares.middleware09.headers.ssltemporaryredirect": "true", +"traefik.http.middlewares.middleware09.headers.stsincludesubdomains": "true", +"traefik.http.middlewares.middleware09.headers.stspreload": "true", +"traefik.http.middlewares.middleware09.headers.stsseconds": "42", +"traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.depth": "42", +"traefik.http.middlewares.middleware10.ipwhitelist.ipstrategy.excludedips": "foobar, foobar", +"traefik.http.middlewares.middleware10.ipwhitelist.sourcerange": "foobar, foobar", +"traefik.http.middlewares.middleware11.maxconn.amount": "42", +"traefik.http.middlewares.middleware11.maxconn.extractorfunc": "foobar", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.commonname": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.country": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.domaincomponent": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.locality": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.organization": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.province": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.issuer.serialnumber": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.notafter": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.notbefore": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.sans": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.commonname": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.country": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.domaincomponent": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.locality": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.organization": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.province": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.info.subject.serialnumber": "true", +"traefik.http.middlewares.middleware12.passtlsclientcert.pem": "true", +"traefik.http.middlewares.middleware13.redirectregex.permanent": "true", +"traefik.http.middlewares.middleware13.redirectregex.regex": "foobar", +"traefik.http.middlewares.middleware13.redirectregex.replacement": "foobar", +"traefik.http.middlewares.middleware14.redirectscheme.permanent": "true", +"traefik.http.middlewares.middleware14.redirectscheme.port": "foobar", +"traefik.http.middlewares.middleware14.redirectscheme.scheme": "foobar", +"traefik.http.middlewares.middleware15.replacepath.path": "foobar", +"traefik.http.middlewares.middleware16.replacepathregex.regex": "foobar", +"traefik.http.middlewares.middleware16.replacepathregex.replacement": "foobar", +"traefik.http.middlewares.middleware17.retry.attempts": "42", +"traefik.http.middlewares.middleware18.stripprefix.prefixes": "foobar, foobar", +"traefik.http.middlewares.middleware19.stripprefixregex.regex": "foobar, foobar", +"traefik.http.routers.router0.entrypoints": "foobar, foobar", +"traefik.http.routers.router0.middlewares": "foobar, foobar", +"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.certresolver": "foobar", +"traefik.http.routers.router0.tls.domains[0].main": "foobar", +"traefik.http.routers.router0.tls.domains[0].sans": "foobar, foobar", +"traefik.http.routers.router0.tls.domains[1].main": "foobar", +"traefik.http.routers.router0.tls.domains[1].sans": "foobar, foobar", +"traefik.http.routers.router0.tls.options": "foobar", +"traefik.http.routers.router1.entrypoints": "foobar, foobar", +"traefik.http.routers.router1.middlewares": "foobar, foobar", +"traefik.http.routers.router1.priority": "42", +"traefik.http.routers.router1.rule": "foobar", +"traefik.http.routers.router1.service": "foobar", +"traefik.http.routers.router1.tls": "true", +"traefik.http.routers.router1.tls.certresolver": "foobar", +"traefik.http.routers.router1.tls.domains[0].main": "foobar", +"traefik.http.routers.router1.tls.domains[0].sans": "foobar, foobar", +"traefik.http.routers.router1.tls.domains[1].main": "foobar", +"traefik.http.routers.router1.tls.domains[1].sans": "foobar, foobar", +"traefik.http.routers.router1.tls.options": "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.stickiness": "true", +"traefik.http.services.service0.loadbalancer.stickiness.cookiename": "foobar", +"traefik.http.services.service0.loadbalancer.stickiness.httponlycookie": "true", +"traefik.http.services.service0.loadbalancer.stickiness.securecookie": "true", +"traefik.http.services.service0.loadbalancer.server.port": "foobar", +"traefik.http.services.service0.loadbalancer.server.scheme": "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.stickiness": "true", +"traefik.http.services.service1.loadbalancer.stickiness.cookiename": "foobar", +"traefik.http.services.service1.loadbalancer.stickiness.httponlycookie": "true", +"traefik.http.services.service1.loadbalancer.stickiness.securecookie": "true", +"traefik.http.services.service1.loadbalancer.server.port": "foobar", +"traefik.http.services.service1.loadbalancer.server.scheme": "foobar", +"traefik.tcp.routers.tcprouter0.entrypoints": "foobar, foobar", +"traefik.tcp.routers.tcprouter0.rule": "foobar", +"traefik.tcp.routers.tcprouter0.service": "foobar", +"traefik.tcp.routers.tcprouter0.tls": "true", +"traefik.tcp.routers.tcprouter0.tls.certresolver": "foobar", +"traefik.tcp.routers.tcprouter0.tls.domains[0].main": "foobar", +"traefik.tcp.routers.tcprouter0.tls.domains[0].sans": "foobar, foobar", +"traefik.tcp.routers.tcprouter0.tls.domains[1].main": "foobar", +"traefik.tcp.routers.tcprouter0.tls.domains[1].sans": "foobar, foobar", +"traefik.tcp.routers.tcprouter0.tls.options": "foobar", +"traefik.tcp.routers.tcprouter0.tls.passthrough": "true", +"traefik.tcp.routers.tcprouter1.entrypoints": "foobar, foobar", +"traefik.tcp.routers.tcprouter1.rule": "foobar", +"traefik.tcp.routers.tcprouter1.service": "foobar", +"traefik.tcp.routers.tcprouter1.tls": "true", +"traefik.tcp.routers.tcprouter1.tls.certresolver": "foobar", +"traefik.tcp.routers.tcprouter1.tls.domains[0].main": "foobar", +"traefik.tcp.routers.tcprouter1.tls.domains[0].sans": "foobar, foobar", +"traefik.tcp.routers.tcprouter1.tls.domains[1].main": "foobar", +"traefik.tcp.routers.tcprouter1.tls.domains[1].sans": "foobar, foobar", +"traefik.tcp.routers.tcprouter1.tls.options": "foobar", +"traefik.tcp.routers.tcprouter1.tls.passthrough": "true", +"traefik.tcp.services.tcpservice0.loadbalancer.server.port": "foobar", +"traefik.tcp.services.tcpservice1.loadbalancer.server.port": "foobar" diff --git a/docs/content/reference/dynamic-configuration/marathon.json b/docs/content/reference/dynamic-configuration/marathon.json new file mode 100644 index 000000000..131344a7e --- /dev/null +++ b/docs/content/reference/dynamic-configuration/marathon.json @@ -0,0 +1,2 @@ +"traefik.enable": "true", +"traefik.marathon.ipaddressidx": "42", diff --git a/docs/content/reference/dynamic-configuration/marathon.md b/docs/content/reference/dynamic-configuration/marathon.md index a1d3d3da9..6d4e17c23 100644 --- a/docs/content/reference/dynamic-configuration/marathon.md +++ b/docs/content/reference/dynamic-configuration/marathon.md @@ -3,8 +3,9 @@ Dynamic configuration with Marathon Labels {: .subtitle } -```yaml -labels: ---8<-- "content/reference/dynamic-configuration/marathon.yml" ---8<-- "content/reference/dynamic-configuration/labels.yml" +```json +"labels": { + --8<-- "content/reference/dynamic-configuration/marathon.json" + --8<-- "content/reference/dynamic-configuration/marathon-labels.json" +} ``` diff --git a/docs/content/reference/dynamic-configuration/marathon.yml b/docs/content/reference/dynamic-configuration/marathon.yml deleted file mode 100644 index d6adde450..000000000 --- a/docs/content/reference/dynamic-configuration/marathon.yml +++ /dev/null @@ -1,2 +0,0 @@ - - "traefik.enable=true" - - "traefik.marathon.ipaddressidx=42" diff --git a/docs/content/reference/dynamic-configuration/rancher.md b/docs/content/reference/dynamic-configuration/rancher.md new file mode 100644 index 000000000..c6cd56736 --- /dev/null +++ b/docs/content/reference/dynamic-configuration/rancher.md @@ -0,0 +1,12 @@ +# Rancher Configuration Reference + +Dynamic configuration with Rancher Labels +{: .subtitle } + +The labels are case insensitive. + +```yaml +labels: + --8<-- "content/reference/dynamic-configuration/rancher.yml" + --8<-- "content/reference/dynamic-configuration/docker-labels.yml" +``` diff --git a/docs/content/reference/dynamic-configuration/rancher.yml b/docs/content/reference/dynamic-configuration/rancher.yml new file mode 100644 index 000000000..23efc00c6 --- /dev/null +++ b/docs/content/reference/dynamic-configuration/rancher.yml @@ -0,0 +1 @@ +- "traefik.enable=true" diff --git a/docs/content/reference/static-configuration/file.toml b/docs/content/reference/static-configuration/file.toml index 62f07e451..8c75d5170 100644 --- a/docs/content/reference/static-configuration/file.toml +++ b/docs/content/reference/static-configuration/file.toml @@ -96,7 +96,6 @@ labelSelector = "foobar" ingressClass = "foobar" [providers.rest] - entryPoint = "foobar" [providers.rancher] constraints = "foobar" watch = true @@ -108,18 +107,12 @@ prefix = "foobar" [api] - entryPoint = "foobar" dashboard = true debug = true - middlewares = ["foobar", "foobar"] - [api.statistics] - recentErrors = 42 [metrics] [metrics.prometheus] buckets = [42.0, 42.0] - entryPoint = "foobar" - middlewares = ["foobar", "foobar"] addEntryPointsLabels = true addServicesLabels = true [metrics.dataDog] @@ -144,8 +137,6 @@ addServicesLabels = true [ping] - entryPoint = "foobar" - middlewares = ["foobar", "foobar"] [log] level = "foobar" @@ -219,25 +210,32 @@ resolvConfig = "foobar" resolvDepth = 42 -[acme] - email = "foobar" - caServer = "foobar" - storage = "foobar" - entryPoint = "foobar" - keyType = "foobar" - [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"] +[certificatesResolvers] + [certificatesResolvers.CertificateResolver0] + [certificatesResolvers.CertificateResolver0.acme] + email = "foobar" + caServer = "foobar" + storage = "foobar" + keyType = "foobar" + [certificatesResolvers.CertificateResolver0.acme.dnsChallenge] + provider = "foobar" + delayBeforeCheck = 42 + resolvers = ["foobar", "foobar"] + disablePropagationCheck = true + [certificatesResolvers.CertificateResolver0.acme.httpChallenge] + entryPoint = "foobar" + [certificatesResolvers.CertificateResolver0.acme.tlsChallenge] + [certificatesResolvers.CertificateResolver1] + [certificatesResolvers.CertificateResolver1.acme] + email = "foobar" + caServer = "foobar" + storage = "foobar" + keyType = "foobar" + [certificatesResolvers.CertificateResolver1.acme.dnsChallenge] + provider = "foobar" + delayBeforeCheck = 42 + resolvers = ["foobar", "foobar"] + disablePropagationCheck = true + [certificatesResolvers.CertificateResolver1.acme.httpChallenge] + entryPoint = "foobar" + [certificatesResolvers.CertificateResolver1.acme.tlsChallenge] diff --git a/docs/content/reference/static-configuration/file.yaml b/docs/content/reference/static-configuration/file.yaml index bfb44c68e..f6a91a75c 100644 --- a/docs/content/reference/static-configuration/file.yaml +++ b/docs/content/reference/static-configuration/file.yaml @@ -102,8 +102,7 @@ providers: - foobar labelSelector: foobar ingressClass: foobar - rest: - entryPoint: foobar + rest: {} rancher: constraints: foobar watch: true @@ -114,23 +113,13 @@ providers: intervalPoll: true prefix: foobar api: - entryPoint: foobar dashboard: true debug: true - statistics: - recentErrors: 42 - middlewares: - - foobar - - foobar metrics: prometheus: buckets: - 42 - 42 - entryPoint: foobar - middlewares: - - foobar - - foobar addEntryPointsLabels: true addServicesLabels: true dataDog: @@ -153,11 +142,7 @@ metrics: password: foobar addEntryPointsLabels: true addServicesLabels: true -ping: - entryPoint: foobar - middlewares: - - foobar - - foobar +ping: {} log: level: foobar filePath: foobar @@ -228,28 +213,36 @@ hostResolver: cnameFlattening: true resolvConfig: foobar resolvDepth: 42 -acme: - email: foobar - caServer: foobar - storage: foobar - entryPoint: foobar - keyType: foobar - dnsChallenge: - provider: foobar - delayBeforeCheck: 42 - resolvers: - - foobar - - foobar - disablePropagationCheck: true - httpChallenge: - entryPoint: foobar - tlsChallenge: {} - domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar +certificatesResolvers: + CertificateResolver0: + acme: + email: foobar + caServer: foobar + storage: foobar + keyType: foobar + dnsChallenge: + provider: foobar + delayBeforeCheck: 42 + resolvers: + - foobar + - foobar + disablePropagationCheck: true + httpChallenge: + entryPoint: foobar + tlsChallenge: {} + CertificateResolver1: + acme: + email: foobar + caServer: foobar + storage: foobar + keyType: foobar + dnsChallenge: + provider: foobar + delayBeforeCheck: 42 + resolvers: + - foobar + - foobar + disablePropagationCheck: true + httpChallenge: + entryPoint: foobar + tlsChallenge: {} diff --git a/docs/content/routing/routers/index.md b/docs/content/routing/routers/index.md index 8ba971c97..1245c3000 100644 --- a/docs/content/routing/routers/index.md +++ b/docs/content/routing/routers/index.md @@ -287,10 +287,6 @@ Traefik will terminate the SSL connections (meaning that it will send decrypted !!! note "HTTPS & ACME" In the current version, with [ACME](../../https/acme.md) enabled, automatic certificate generation will apply to every router declaring a TLS section. - -!!! note "Passthrough" - - On TCP routers, you can configure a passthrough option so that Traefik doesn't terminate the TLS connection. !!! important "Routers for HTTP & HTTPS" @@ -463,7 +459,7 @@ http: ``` [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](./../../https/acme.md#dnschallenge). +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](../../https/acme.md#dnschallenge). Most likely the root domain should receive a certificate too, so it needs to be specified as SAN and 2 `DNS-01` challenges are executed. In this case the generated DNS TXT record for both domains is the same. @@ -471,10 +467,10 @@ Even though this behavior is [DNS RFC](https://community.letsencrypt.org/t/wildc it can lead to problems as all DNS providers keep DNS records cached for a given time (TTL) and this TTL can be greater than the challenge timeout making the `DNS-01` challenge fail. The Traefik ACME client library [LEGO](https://github.com/go-acme/lego) supports some but not all DNS providers to work around this issue. -The [Supported `provider` table](./../../https/acme.md#providers) indicates if they allow generating certificates for a wildcard domain and its root domain. +The [Supported `provider` table](../../https/acme.md#providers) indicates if they allow generating certificates for a wildcard domain and its root domain. !!! note - Wildcard certificates can only be verified through a `DNS-01` challenge. + Wildcard certificates can only be verified through a [`DNS-01` challenge](../../https/acme.md#dnschallenge). !!! note "Double Wildcard Certificates" It is not possible to request a double wildcard certificate for a domain (for example `*.*.local.com`). diff --git a/docs/content/user-guides/grpc.md b/docs/content/user-guides/grpc.md index 9012add8e..6748445df 100644 --- a/docs/content/user-guides/grpc.md +++ b/docs/content/user-guides/grpc.md @@ -34,7 +34,7 @@ api: {} ```yaml tab="CLI" --entryPoints.web.address=":80" --providers.file.filename=dynamic_conf.toml ---api +--api=true ``` `dynamic_conf.{toml,yml}`: @@ -157,7 +157,7 @@ api: {} # For secure connection on backend.local --serversTransport.rootCAs=./backend.cert --providers.file.filename=dynamic_conf.toml ---api +--api=true ``` `dynamic_conf.{toml,yml}`: diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 15191156b..44eff35fc 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -146,7 +146,7 @@ nav: - 'Data Collection': 'contributing/data-collection.md' - 'Advocating': 'contributing/advocating.md' - 'Maintainers': 'contributing/maintainers.md' - - 'Glossary': 'glossary.md' +# - 'Glossary': 'glossary.md' - 'References': - 'Static Configuration': - 'Overview': 'reference/static-configuration/overview.md' @@ -154,7 +154,8 @@ nav: - 'CLI': 'reference/static-configuration/cli.md' - 'Environment variables': 'reference/static-configuration/env.md' - 'Dynamic Configuration': - - 'Docker': 'reference/dynamic-configuration/docker.md' - - 'Marathon': 'reference/dynamic-configuration/marathon.md' - - 'Kubernetes CRD': 'reference/dynamic-configuration/kubernetes-crd.md' - 'File': 'reference/dynamic-configuration/file.md' + - 'Docker': 'reference/dynamic-configuration/docker.md' + - 'Kubernetes CRD': 'reference/dynamic-configuration/kubernetes-crd.md' + - 'Marathon': 'reference/dynamic-configuration/marathon.md' + - 'Rancher': 'reference/dynamic-configuration/rancher.md' diff --git a/traefik.sample.toml b/traefik.sample.toml index 57c90e9ac..bdc001eaf 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -1,6 +1,7 @@ ################################################################ # -# Configuration sample for Traefik v2 +# Configuration sample for Traefik v2. +# # For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml # ################################################################ @@ -22,7 +23,10 @@ # Default: [entryPoints] [entryPoints.web] - address = ":80" + address = ":80" + + [entryPoints.websecure] + address = ":443" ################################################################ # Traefik logs configuration @@ -35,27 +39,27 @@ # [log] -# Log level -# -# Optional -# Default: "ERROR" -# -# level = "DEBUG" + # Log level + # + # Optional + # Default: "ERROR" + # + # level = "DEBUG" -# Sets the filepath for the traefik log. If not specified, stdout will be used. -# Intermediate directories are created if necessary. -# -# Optional -# Default: os.Stdout -# -# filePath = "log/traefik.log" + # Sets the filepath for the traefik log. If not specified, stdout will be used. + # Intermediate directories are created if necessary. + # + # Optional + # Default: os.Stdout + # + # filePath = "log/traefik.log" -# Format is either "json" or "common". -# -# Optional -# Default: "common" -# -# format = "common" + # Format is either "json" or "common". + # + # Optional + # Default: "common" + # + # format = "json" ################################################################ # Access logs configuration @@ -69,20 +73,20 @@ # # [accessLog] -# Sets the file path for the access log. If not specified, stdout will be used. -# Intermediate directories are created if necessary. -# -# Optional -# Default: os.Stdout -# -# filePath = "/path/to/log/log.txt" + # Sets the file path for the access log. If not specified, stdout will be used. + # Intermediate directories are created if necessary. + # + # Optional + # Default: os.Stdout + # + # filePath = "/path/to/log/log.txt" -# Format is either "json" or "common". -# -# Optional -# Default: "common" -# -# format = "common" + # Format is either "json" or "common". + # + # Optional + # Default: "common" + # + # format = "json" ################################################################ # API and dashboard configuration @@ -126,23 +130,23 @@ # Enable Docker configuration backend [providers.docker] -# Docker server endpoint. Can be a tcp or a unix socket endpoint. -# -# Required -# Default: "unix:///var/run/docker.sock" -# -# endpoint = "tcp://10.10.10.10:2375" + # Docker server endpoint. Can be a tcp or a unix socket endpoint. + # + # Required + # Default: "unix:///var/run/docker.sock" + # + # endpoint = "tcp://10.10.10.10:2375" -# Default host rule. -# -# Optional -# Default: "" -# -# DefaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)" + # Default host rule. + # + # Optional + # Default: "Host(`{{ normalize .Name }}`)" + # + # defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)" -# Expose containers by default in traefik -# -# Optional -# Default: true -# -# exposedByDefault = true + # Expose containers by default in traefik + # + # Optional + # Default: true + # + # exposedByDefault = false From 28500989bca90eaec1a7081643fdb90c5119b412 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Mon, 22 Jul 2019 10:16:04 +0200 Subject: [PATCH 42/49] Improve acme logs. --- pkg/provider/acme/challenge_http.go | 2 +- pkg/provider/acme/provider.go | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pkg/provider/acme/challenge_http.go b/pkg/provider/acme/challenge_http.go index 669e3473a..e370883d0 100644 --- a/pkg/provider/acme/challenge_http.go +++ b/pkg/provider/acme/challenge_http.go @@ -42,7 +42,7 @@ func (p *Provider) Append(router *mux.Router) { Handler(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { vars := mux.Vars(req) - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) + ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme")) logger := log.FromContext(ctx) if token, ok := vars["token"]; ok { diff --git a/pkg/provider/acme/provider.go b/pkg/provider/acme/provider.go index 2fc2678bc..b20b8e8e0 100644 --- a/pkg/provider/acme/provider.go +++ b/pkg/provider/acme/provider.go @@ -115,8 +115,7 @@ func (p *Provider) ListenConfiguration(config dynamic.Configuration) { // Init for compatibility reason the BaseProvider implements an empty Init func (p *Provider) Init() error { - - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) + ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme")) logger := log.FromContext(ctx) if len(p.Configuration.Storage) == 0 { @@ -167,7 +166,7 @@ func isAccountMatchingCaServer(ctx context.Context, accountURI string, serverURI // Provide allows the file provider to provide configurations to traefik // using the given Configuration channel. func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error { - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme."+p.ResolverName)) + ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme")) p.pool = pool @@ -199,7 +198,7 @@ func (p *Provider) getClient() (*lego.Client, error) { p.clientMutex.Lock() defer p.clientMutex.Unlock() - ctx := log.With(context.Background(), log.Str(log.ProviderName, "acme")) + ctx := log.With(context.Background(), log.Str(log.ProviderName, p.ResolverName+".acme")) logger := log.FromContext(ctx) if p.client != nil { @@ -371,7 +370,7 @@ func (p *Provider) watchNewDomains(ctx context.Context) { domain := domains[i] safe.Go(func() { if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil { - log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName). + log.WithoutContext().WithField(log.ProviderName, p.ResolverName+".acme"). Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err) } }) @@ -400,7 +399,7 @@ func (p *Provider) watchNewDomains(ctx context.Context) { domain := domains[i] safe.Go(func() { if _, err := p.resolveCertificate(ctx, domain, tlsStore); err != nil { - log.WithoutContext().WithField(log.ProviderName, "acme."+p.ResolverName). + log.WithoutContext().WithField(log.ProviderName, p.ResolverName+".acme"). Errorf("Unable to obtain ACME certificate for domains %q : %v", strings.Join(domain.ToStrArray(), ","), err) } }) @@ -593,7 +592,7 @@ func (p *Provider) saveCertificates() error { func (p *Provider) refreshCertificates() { conf := dynamic.Message{ - ProviderName: "acme." + p.ResolverName, + ProviderName: p.ResolverName + ".acme", Configuration: &dynamic.Configuration{ HTTP: &dynamic.HTTPConfiguration{ Routers: map[string]*dynamic.Router{}, From 7c852fbf3348adc1686a1dafb9e3681a00e9c80e Mon Sep 17 00:00:00 2001 From: Antoine Caron Date: Mon, 22 Jul 2019 11:06:04 +0200 Subject: [PATCH 43/49] refactor(webui): use components to split Home concerns --- webui/package.json | 1 + webui/src/components/EntityStateDoughnut.vue | 79 +++++++ webui/src/components/Tile.vue | 22 ++ webui/src/main.js | 2 + webui/src/views/Home.vue | 213 +++++++------------ webui/yarn.lock | 5 + 6 files changed, 184 insertions(+), 138 deletions(-) create mode 100644 webui/src/components/EntityStateDoughnut.vue create mode 100644 webui/src/components/Tile.vue diff --git a/webui/package.json b/webui/package.json index bd145508b..43b07e585 100644 --- a/webui/package.json +++ b/webui/package.json @@ -18,6 +18,7 @@ "vuex": "^3.0.1" }, "devDependencies": { + "@fortawesome/fontawesome-free": "^5.9.0", "@vue/cli-plugin-babel": "^3.9.0", "@vue/cli-plugin-eslint": "^3.9.0", "@vue/cli-plugin-unit-jest": "^3.9.0", diff --git a/webui/src/components/EntityStateDoughnut.vue b/webui/src/components/EntityStateDoughnut.vue new file mode 100644 index 000000000..07c5bd333 --- /dev/null +++ b/webui/src/components/EntityStateDoughnut.vue @@ -0,0 +1,79 @@ + + + diff --git a/webui/src/components/Tile.vue b/webui/src/components/Tile.vue new file mode 100644 index 000000000..9f0fb612d --- /dev/null +++ b/webui/src/components/Tile.vue @@ -0,0 +1,22 @@ + + + diff --git a/webui/src/main.js b/webui/src/main.js index 0e9e1de81..730fe4d04 100644 --- a/webui/src/main.js +++ b/webui/src/main.js @@ -4,6 +4,8 @@ import router from "./router"; import store from "./store"; import "bulma/css/bulma.min.css"; +import "@fortawesome/fontawesome-free"; +import "@fortawesome/fontawesome-free/css/all.css"; Vue.config.productionTip = false; diff --git a/webui/src/views/Home.vue b/webui/src/views/Home.vue index 9f618c710..52b5e88f8 100644 --- a/webui/src/views/Home.vue +++ b/webui/src/views/Home.vue @@ -1,27 +1,35 @@