remove unused endpoint when using constraints in marathon

This commit is contained in:
tuier 2016-09-23 22:05:11 +01:00
parent 83aabefcc5
commit 1624c51cb5

View file

@ -188,7 +188,7 @@ func (provider *Marathon) taskFilter(task marathon.Task, applications *marathon.
log.Errorf("Unable to get marathon application from task %s", task.AppID) log.Errorf("Unable to get marathon application from task %s", task.AppID)
return false return false
} }
if label, err := provider.getLabel(application, "traefik.tags"); err == nil { label, _ := provider.getLabel(application, "traefik.tags")
constraintTags := strings.Split(label, ",") constraintTags := strings.Split(label, ",")
if ok, failingConstraint := provider.MatchConstraints(constraintTags); !ok { if ok, failingConstraint := provider.MatchConstraints(constraintTags); !ok {
if failingConstraint != nil { if failingConstraint != nil {
@ -196,7 +196,6 @@ func (provider *Marathon) taskFilter(task marathon.Task, applications *marathon.
} }
return false return false
} }
}
if !isApplicationEnabled(application, exposedByDefaultFlag) { if !isApplicationEnabled(application, exposedByDefaultFlag) {
log.Debugf("Filtering disabled marathon task %s", task.AppID) log.Debugf("Filtering disabled marathon task %s", task.AppID)
@ -258,7 +257,8 @@ func (provider *Marathon) taskFilter(task marathon.Task, applications *marathon.
} }
func (provider *Marathon) applicationFilter(app marathon.Application, filteredTasks []marathon.Task) bool { func (provider *Marathon) applicationFilter(app marathon.Application, filteredTasks []marathon.Task) bool {
constraintTags := strings.Split((*app.Labels)["traefik.tags"], ",") label, _ := provider.getLabel(app, "traefik.tags")
constraintTags := strings.Split(label, ",")
if ok, failingConstraint := provider.MatchConstraints(constraintTags); !ok { if ok, failingConstraint := provider.MatchConstraints(constraintTags); !ok {
if failingConstraint != nil { if failingConstraint != nil {
log.Debugf("Application %v pruned by '%v' constraint", app.ID, failingConstraint.String()) log.Debugf("Application %v pruned by '%v' constraint", app.ID, failingConstraint.String())