mirror of
https://github.com/containous/traefik.git
synced 2025-03-19 18:50:12 +03:00
Use first port by default
If no information is given, use first index of ports
This commit is contained in:
parent
1c8d3ded3d
commit
5641af437e
@ -219,10 +219,7 @@ func (provider *Marathon) taskFilter(task marathon.Task, applications *marathon.
|
||||
log.Debugf("Filtering marathon task %s specifying both traefik.portIndex and traefik.port labels", task.AppID)
|
||||
return false
|
||||
}
|
||||
if portIndexLabel == "" && portValueLabel == "" && len(application.Ports) > 1 {
|
||||
log.Debugf("Filtering marathon task %s with more than 1 port and no traefik.portIndex or traefik.port label", task.AppID)
|
||||
return false
|
||||
}
|
||||
|
||||
if portIndexLabel != "" {
|
||||
index, err := strconv.Atoi((*application.Labels)["traefik.portIndex"])
|
||||
if err != nil || index < 0 || index > len(application.Ports)-1 {
|
||||
|
@ -372,7 +372,7 @@ func TestMarathonTaskFilter(t *testing.T) {
|
||||
{
|
||||
task: marathon.Task{
|
||||
AppID: "multiple-ports",
|
||||
Ports: []int{80},
|
||||
Ports: []int{80, 443},
|
||||
},
|
||||
applications: &marathon.Applications{
|
||||
Apps: []marathon.Application{
|
||||
@ -383,7 +383,7 @@ func TestMarathonTaskFilter(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: false,
|
||||
expected: true,
|
||||
exposedByDefault: true,
|
||||
},
|
||||
{
|
||||
@ -927,12 +927,12 @@ func TestMarathonGetPort(t *testing.T) {
|
||||
{
|
||||
applications: []marathon.Application{
|
||||
{
|
||||
ID: "test1",
|
||||
ID: "multiple-ports-take-first",
|
||||
Labels: &map[string]string{},
|
||||
},
|
||||
},
|
||||
task: marathon.Task{
|
||||
AppID: "test1",
|
||||
AppID: "multiple-ports-take-first",
|
||||
Ports: []int{80, 443},
|
||||
},
|
||||
expected: "80",
|
||||
|
Loading…
x
Reference in New Issue
Block a user