-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for docker healthcheck 👼 #708
Conversation
3b6f439
to
5530915
Compare
@@ -214,6 +215,9 @@ func (provider *Docker) Provide(configurationChan chan<- types.ConfigMessage, po | |||
} | |||
eventHandler.Handle("start", startStopHandle) | |||
eventHandler.Handle("die", startStopHandle) | |||
eventHandler.Handle("health_status: healthy", startStopHandle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way health_status
event are sent via the docker api is a little buggy, see moby/moby#25800 👼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @vdemeester :) Just a little comment.
@@ -378,6 +382,10 @@ func (provider *Docker) containerFilter(container dockerData) bool { | |||
return false | |||
} | |||
|
|||
if container.Health != "" && container.Health != "healthy" { | |||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a debug log here to inform why the container has been filtered ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👼
Tested, it works nicely, thanks! 💯
|
- React to health_status events - Filter container that have a health status *and* that are not healthy Signed-off-by: Vincent Demeester <vincent@sbr.pm>
5530915
to
d68389d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #666 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I like how simple this is.
This add the simplest support for
HEALTHCHECK
for the docker provider.Fixes #666.
It works like the other provider that support healthchecks (marathon for example) — if healthcheck are not supported, then it work as usual and if a container supports it, it filters the container if it's not healthy.
Update documentation(it's actually not documented on other providers, so…)Add integration tests(too much extra work on that, I need to update libkermit and add support for atestRequire
thingy with a check on docker >= 1.12 — will do in a follow up)/cc @containous/traefik
🐸
Signed-off-by: Vincent Demeester vincent@sbr.pm