Support multi-port service routing for containers running on Marathon

This commit is contained in:
Alex Antonov 2017-08-21 10:46:03 +02:00 committed by Traefiker
parent 0367034f93
commit ec3e2c08b8
9 changed files with 498 additions and 134 deletions

View file

@ -1,8 +1,10 @@
package marathon
import (
"strings"
"time"
"github.com/containous/traefik/types"
"github.com/gambol99/go-marathon"
)
@ -42,6 +44,17 @@ func label(key, value string) func(*marathon.Application) {
}
}
func labelWithService(key, value string, serviceName string) func(*marathon.Application) {
if len(serviceName) == 0 {
panic("serviceName can not be empty")
}
property := strings.TrimPrefix(key, types.LabelPrefix)
return func(app *marathon.Application) {
app.AddLabel(types.LabelPrefix+serviceName+"."+property, value)
}
}
func healthChecks(checks ...*marathon.HealthCheck) func(*marathon.Application) {
return func(app *marathon.Application) {
for _, check := range checks {