Added cluster/leader endpoint

This commit is contained in:
Alex Antonov 2018-03-22 13:00:05 -04:00 committed by Traefiker Bot
parent 0fa0c2256a
commit 9699dc2a85
3 changed files with 55 additions and 0 deletions

View file

@ -43,6 +43,7 @@ For more customization, see [entry points](/configuration/entrypoints/) document
| Path | Method | Description |
|-----------------------------------------------------------------|------------------|-------------------------------------------|
| `/` | `GET` | Provides a simple HTML frontend of Træfik |
| `/cluster/leader` | `GET` | JSON leader true/false response |
| `/health` | `GET` | JSON health metrics |
| `/api` | `GET` | Configuration for all providers |
| `/api/providers` | `GET` | Providers |
@ -222,6 +223,25 @@ curl -s "http://localhost:8080/api" | jq .
}
```
### Cluster Leadership
```shell
curl -s "http://localhost:8080/cluster/leader" | jq .
```
```shell
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Date: xxx
< Content-Length: 15
```
If the given node is not a cluster leader, an HTTP status of `429-Too-Many-Requests` will be returned.
```json
{
// current leadership status of the queried node
"leader": true
}
```
### Health
```shell