diff --git a/docs/toml.md b/docs/toml.md index 0d71cd995..7355cf6ba 100644 --- a/docs/toml.md +++ b/docs/toml.md @@ -195,6 +195,51 @@ entryPoint = "https" main = "local4.com" ``` +## Constraints + +In a micro-service architecture, with a central service discovery, setting constraints limits Træfɪk scope to a smaller number of routes. + +Træfɪk filters services according to service attributes/tags set in your configuration backends. + +Supported backends: + +- Consul Catalog + +Supported filters: + +- ```tag``` + +``` +# Constraints definition + +# +# Optional +# + +# Simple matching constraint +# constraints = ["tag==api"] + +# Simple mismatching constraint +# constraints = ["tag!=api"] + +# Globbing +# constraints = ["tag==us-*"] + +# Backend-specific constraint +# [consulCatalog] +# endpoint = 127.0.0.1:8500 +# constraints = ["tag==api"] + +# Multiple constraints +# - "tag==" must match with at least one tag +# - "tag!=" must match with none of tags +# constraints = ["tag!=us-*", "tag!=asia-*"] +# [consulCatalog] +# endpoint = 127.0.0.1:8500 +# constraints = ["tag==api", "tag!=v*-beta"] +``` + + # Configuration backends ## File backend @@ -741,6 +786,13 @@ domain = "consul.localhost" # Optional # prefix = "traefik" + +# Constraint on Consul catalog tags +# +# Optional +# +constraints = ["tag==api", "tag==he*ld"] +# Matching with containers having this tag: "traefik.tags=api,helloworld" ``` This backend will create routes matching on hostname based on the service name