mw/kubernetes: add configurable TTL (#995)

* mw/kubernetes: add configurable TTL

Add ttl option to kubernetes. This defaults to 5s but allows
configuration to go up to 3600.

Configure the tests so that a few actually check for the 5s, while the
rest use the TTL of 303 which is ignored by the checking code.

Fixes #935

* fix tests

* and more
This commit is contained in:
Miek Gieben
2017-08-27 01:32:46 +01:00
committed by Yong Tang
parent 01f6e8cba5
commit 4049ed4f4b
6 changed files with 90 additions and 27 deletions

View File

@@ -28,6 +28,7 @@ kubernetes [ZONES...] {
labels EXPRESSION
pods POD-MODE
upstream ADDRESS...
ttl TTL
fallthrough
}
```
@@ -62,6 +63,8 @@ kubernetes [ZONES...] {
* `upstream` **ADDRESS [ADDRESS...]** defines the upstream resolvers used for resolving services
that point to external hosts (External Services). **ADDRESS** can be an ip, an ip:port, or a path
to a file structured like resolv.conf.
* `ttl` allows you to set a custom TTL for responses. The default (and allowed minimum) is to use
5 seconds, the maximum is capped at 3600 seconds.
* `fallthrough` If a query for a record in the cluster zone results in NXDOMAIN, normally that is
what the response will be. However, if you specify this option, the query will instead be passed
on down the middleware chain, which can include another middleware to handle the query.