Skip to content

Commit

Permalink
Fix marathon provider
Browse files Browse the repository at this point in the history
    The IP-Per-Task PR introduced a bug using the marathon application
port mapping. This port should be used only in the proxy server, the
downstream connection should be always made with the task port.

    This commit fix the regression and adds a unit test to prevent new
problems in this setup.
  • Loading branch information
Diego de Oliveira authored and vdemeester committed Feb 4, 2017
1 parent 89ec25f commit cbbb5f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 0 additions & 5 deletions provider/marathon.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,6 @@ func (provider *Marathon) getCircuitBreakerExpression(application marathon.Appli

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
if task.Ports != nil && len(task.Ports) > 0 {
return task.Ports
Expand Down
13 changes: 13 additions & 0 deletions provider/marathon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,19 @@ func TestMarathonGetPort(t *testing.T) {
Ports: []int{80, 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",
},
}

Expand Down

0 comments on commit cbbb5f4

Please sign in to comment.