New constraints management.
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
parent
e9792b446f
commit
fe68e9e243
40 changed files with 658 additions and 630 deletions
|
@ -2,7 +2,6 @@ package marathon
|
|||
|
||||
import (
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"github.com/containous/traefik/pkg/config/label"
|
||||
"github.com/gambol99/go-marathon"
|
||||
|
@ -10,7 +9,6 @@ import (
|
|||
|
||||
type configuration struct {
|
||||
Enable bool
|
||||
Tags []string
|
||||
Marathon specificConfiguration
|
||||
}
|
||||
|
||||
|
@ -23,23 +21,16 @@ func (p *Provider) getConfiguration(app marathon.Application) (configuration, er
|
|||
|
||||
conf := configuration{
|
||||
Enable: p.ExposedByDefault,
|
||||
Tags: nil,
|
||||
Marathon: specificConfiguration{
|
||||
IPAddressIdx: math.MinInt32,
|
||||
},
|
||||
}
|
||||
|
||||
err := label.Decode(labels, &conf, "traefik.marathon.", "traefik.enable", "traefik.tags")
|
||||
err := label.Decode(labels, &conf, "traefik.marathon.", "traefik.enable")
|
||||
if err != nil {
|
||||
return configuration{}, err
|
||||
}
|
||||
|
||||
if p.FilterMarathonConstraints && app.Constraints != nil {
|
||||
for _, constraintParts := range *app.Constraints {
|
||||
conf.Tags = append(conf.Tags, strings.Join(constraintParts, ":"))
|
||||
}
|
||||
}
|
||||
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue