Merge pull request #1090 from diegooliveira/IP-Per-Task-Fix
Fix marathon provider
This commit is contained in:
commit
71a185c70e
2 changed files with 13 additions and 5 deletions
|
@ -496,11 +496,6 @@ func (provider *Marathon) getCircuitBreakerExpression(application marathon.Appli
|
||||||
|
|
||||||
func processPorts(application marathon.Application, task marathon.Task) []int {
|
func processPorts(application marathon.Application, task marathon.Task) []int {
|
||||||
|
|
||||||
// First using application ports
|
|
||||||
if len(application.Ports) > 0 {
|
|
||||||
return application.Ports
|
|
||||||
}
|
|
||||||
|
|
||||||
// Using default port configuration
|
// Using default port configuration
|
||||||
if task.Ports != nil && len(task.Ports) > 0 {
|
if task.Ports != nil && len(task.Ports) > 0 {
|
||||||
return task.Ports
|
return task.Ports
|
||||||
|
|
|
@ -1077,6 +1077,19 @@ func TestMarathonGetPort(t *testing.T) {
|
||||||
Ports: []int{80, 443},
|
Ports: []int{80, 443},
|
||||||
},
|
},
|
||||||
expected: "443",
|
expected: "443",
|
||||||
|
}, {
|
||||||
|
applications: []marathon.Application{
|
||||||
|
{
|
||||||
|
ID: "application-with-port",
|
||||||
|
Ports: []int{9999},
|
||||||
|
Labels: &map[string]string{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
task: marathon.Task{
|
||||||
|
AppID: "application-with-port",
|
||||||
|
Ports: []int{7777},
|
||||||
|
},
|
||||||
|
expected: "7777",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue