Skip to content

Commit

Permalink
Remove health check filter from Marathon tasks.
Browse files Browse the repository at this point in the history
When available, Traefik uses the last Marathon health check result to
decide whether a task should be filtered or not. This behavior is
incorrect, however, as it ignores the failure threshold denoting the
number of failed health checks it would take for Marathon to actually
consider a task as failing and trigger a restart. With Traefik not
taking the threshold into account, a task is removed from the
configuration already while Marathon may still deem it healthy.

Delaying the filtering until the moment when the failure threshold is
exceeded does not buy us much: At that point, Marathon will decide to
restart the unhealthy task anyway and cause a task state change that
will lead to a Traefik configuration update excluding the task in
question.

Consequently, we can remove the filter logic.
  • Loading branch information
timoreimann authored and traefiker committed Feb 13, 2018
1 parent 7d3dd5a commit 2e16430
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 58 deletions.
1 change: 0 additions & 1 deletion docs/user-guide/marathon.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ As such, there is no way to handle this situation deterministically.
Finally, Marathon health checks are not mandatory (the default is to use the task state as reported by Mesos), so requiring them for Traefik would raise the entry barrier for Marathon users.

Traefik used to use the health check results as a strict requirement but moved away from it as [users reported the dramatic consequences](https://github.com/containous/traefik/issues/653).
If health check results are known to exist, however, they will be used to signal task availability.

#### Draining

Expand Down
12 changes: 0 additions & 12 deletions provider/marathon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,6 @@ func (p *Provider) taskFilter(task marathon.Task, application marathon.Applicati
return false
}

// Filter task with existing, bad health check results.
if application.HasHealthChecks() {
if task.HasHealthCheckResults() {
for _, healthCheck := range task.HealthCheckResults {
if !healthCheck.Alive {
log.Debugf("Filtering Marathon task %s from application %s with bad health check", task.ID, application.ID)
return false
}
}
}
}

if ready := p.readyChecker.Do(task, application); !ready {
log.Infof("Filtering unready task %s from application %s", task.ID, application.ID)
return false
Expand Down
45 changes: 0 additions & 45 deletions provider/marathon/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,51 +935,6 @@ func TestTaskFilter(t *testing.T) {
),
expected: true,
},
{
desc: "healthcheck available",
task: task(taskPorts(80)),
application: application(
appPorts(80),
healthChecks(marathon.NewDefaultHealthCheck()),
),
expected: true,
},
{
desc: "healthcheck result false",
task: task(
taskPorts(80),
healthCheckResultLiveness(false),
),
application: application(
appPorts(80),
healthChecks(marathon.NewDefaultHealthCheck()),
),
expected: false,
},
{
desc: "healthcheck results mixed",
task: task(
taskPorts(80),
healthCheckResultLiveness(true, false),
),
application: application(
appPorts(80),
healthChecks(marathon.NewDefaultHealthCheck()),
),
expected: false,
},
{
desc: "healthcheck result true",
task: task(
taskPorts(80),
healthCheckResultLiveness(true),
),
application: application(
appPorts(80),
healthChecks(marathon.NewDefaultHealthCheck()),
),
expected: true,
},
{
desc: "readiness check false",
task: task(taskPorts(80)),
Expand Down

0 comments on commit 2e16430

Please sign in to comment.