CiscoCloud / marathon-consul

bridge Marathon information to Consul KV
Apache License 2.0
85 stars 18 forks source link

update task health status based on health_status_changed_event #25

Open ogrodnek opened 8 years ago

ogrodnek commented 8 years ago

Hi! Thanks again for the great project.

As mentioned in https://github.com/CiscoCloud/marathon-consul/issues/24 , when using marathon-consul with haproxy-consul , we see tasks added to haproxy before they are healthy.

This PR adds a HealthCheckResults field to the Task (already reported by marathon), as well as a convenience healthy flag to make it easier to work with in templates.

Tasks health information is updated on receiving health_status_changed_event from marathon.

healthy is currently a bool, but in reality it's more of a tri-state (unknown, healthy, unhealthy). currently it will report healthy=false unless there is a successful health check (again makes it easier to work with in templates).

I'd love any feedback to making this work better or to better integrate with the existing code.

thanks! larry

yogeshnath commented 7 years ago

I recently updated to this version to get rid of 503's, It works great if the healthcheck is http or tcp.

Though if healthcheck is based on command ( say curl), Marathon actually shows it as healthy but consul json has "healthCheckResults" set to null. So now Haproxy fails to pick it up based on healthy value ( "healthy":false).

any reason why?