Support for watching instead of polling Nomad
This commit is contained in:
parent
f8a78b3b25
commit
fbf6757ce9
6 changed files with 214 additions and 22 deletions
|
@ -56,6 +56,8 @@ _Optional, Default=15s_
|
|||
|
||||
Defines the polling interval.
|
||||
|
||||
!!! note "This option is ignored when the [watch](#watch) mode is enabled."
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
nomad:
|
||||
|
@ -74,6 +76,62 @@ providers:
|
|||
# ...
|
||||
```
|
||||
|
||||
### `watch`
|
||||
|
||||
_Optional, Default=false_
|
||||
|
||||
Enables the watch mode to refresh the configuration on a per-event basis.
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
nomad:
|
||||
watch: true
|
||||
# ...
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.nomad]
|
||||
watch = true
|
||||
# ...
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.nomad.watch
|
||||
# ...
|
||||
```
|
||||
|
||||
### `throttleDuration`
|
||||
|
||||
_Optional, Default=0s_
|
||||
|
||||
The `throttleDuration` option defines how often the provider is allowed to handle service events from Nomad.
|
||||
This prevents a Nomad cluster that updates many times per second from continuously changing your Traefik configuration.
|
||||
|
||||
If left empty, the provider does not apply any throttling and does not drop any Nomad service events.
|
||||
|
||||
The value of `throttleDuration` should be provided in seconds or as a valid duration format,
|
||||
see [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration).
|
||||
|
||||
!!! warning "This option is only compatible with the [watch](#watch) mode."
|
||||
|
||||
```yaml tab="File (YAML)"
|
||||
providers:
|
||||
nomad:
|
||||
throttleDuration: 2s
|
||||
# ...
|
||||
```
|
||||
|
||||
```toml tab="File (TOML)"
|
||||
[providers.nomad]
|
||||
throttleDuration = "2s"
|
||||
# ...
|
||||
```
|
||||
|
||||
```bash tab="CLI"
|
||||
--providers.nomad.throttleDuration=2s
|
||||
# ...
|
||||
```
|
||||
|
||||
### `prefix`
|
||||
|
||||
_required, Default="traefik"_
|
||||
|
|
|
@ -918,6 +918,12 @@ Interval for polling Nomad API. (Default: ```15```)
|
|||
`--providers.nomad.stale`:
|
||||
Use stale consistency for catalog reads. (Default: ```false```)
|
||||
|
||||
`--providers.nomad.throttleduration`:
|
||||
Watch throttle duration. (Default: ```0```)
|
||||
|
||||
`--providers.nomad.watch`:
|
||||
Watch Nomad Service events. (Default: ```false```)
|
||||
|
||||
`--providers.plugin.<name>`:
|
||||
Plugins configuration.
|
||||
|
||||
|
|
|
@ -918,6 +918,12 @@ Interval for polling Nomad API. (Default: ```15```)
|
|||
`TRAEFIK_PROVIDERS_NOMAD_STALE`:
|
||||
Use stale consistency for catalog reads. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_PROVIDERS_NOMAD_THROTTLEDURATION`:
|
||||
Watch throttle duration. (Default: ```0```)
|
||||
|
||||
`TRAEFIK_PROVIDERS_NOMAD_WATCH`:
|
||||
Watch Nomad Service events. (Default: ```false```)
|
||||
|
||||
`TRAEFIK_PROVIDERS_PLUGIN_<NAME>`:
|
||||
Plugins configuration.
|
||||
|
||||
|
|
|
@ -203,6 +203,8 @@
|
|||
exposedByDefault = true
|
||||
refreshInterval = "42s"
|
||||
allowEmptyServices = true
|
||||
watch = true
|
||||
throttleDuration = "42s"
|
||||
namespaces = ["foobar", "foobar"]
|
||||
[providers.nomad.endpoint]
|
||||
address = "foobar"
|
||||
|
|
|
@ -236,6 +236,8 @@ providers:
|
|||
exposedByDefault: true
|
||||
refreshInterval: 42s
|
||||
allowEmptyServices: true
|
||||
watch: true
|
||||
throttleDuration: 42s
|
||||
namespaces:
|
||||
- foobar
|
||||
- foobar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue