Add docker service discovery to UI
Fixes #191
This is an initial docker service discovery .. service .. It has been modeled after the current K8s discovery service, and as such it will:
- Iterate docker containers on a fixed interval (5 minutes by default)
- Calculate the health check endpoint given labels from the Container
- Verify that docker containers return 200 OK or 500 Server Error on their Health check endpoints
- Not make any updates to existing configurations, only add new ones (identified by Uri)
Todos
- [ ] Add documentation
- [x] Add tests
- [ ] Identify which parts of nuget package-lock to commit
- [ ] Should endpoints be updated, if they change IP's?
Operation
It will enumerate (running) containers from a docker socket using Docker.DotNet, and read out some labels to configure the final monitor configuration. It will read the following labels (with a configurable prefix):
Configuration by labels
| Label | Note | Default |
|---|---|---|
HealthChecks.Enabled |
Set this to enable the container | false |
HealthChecks.Name |
Name of the check | container name or id |
HealthChecks.Network |
Network to use to get the IP of the container | first network |
HealthChecks.Scheme |
Scheme of the health check service | http |
HealthChecks.Port |
first exposed port, or scheme default (80 for http, 443 for https) |
|
HealthChecks.Path |
/hc (configured in options) |
Hi @CarlosLanderas can you checkout this PR? It is related with K8S feature you implemented!
@LordMike thanks for the contribution, I'll review the PR these days. I've been busy sorry :/
@LordMike Hi. I help to maintain this repo for some time. I have never used docker/k8s or UI stuff from this repo so feedback from core team is required here. Ping @carlosrecuero @unaizorrilla .
FYI, I've been using this PR in production for years without problems. Since it's semi-isolated in it's features (opt-in) AND it works well -- I'm not sure why it couldn't be merged.
It can be merged but only by those who has knowledge and can take responsibility to support these changes. Unfortunately, I have no experience in k8s.