The comment on issue
MGI-404 by [~mbabineau] sums this up well – reproduced here:
> The desired port mappings are LB port -> app port. Because of Mesos/Docker indirection, we query Marathon to determine the task port -> app port mappings, then use that to drive a LB port -> task port configuration file.
> /v1/endpoints provides the task port -> app port mappings, so we can get everything we need from there in just one call. As far as I can tell, there isn't a single place we can check in the V2 API:
> /v2/tasks doesn't include the app ports
> /v2/apps doesn't include the task ports
> /v2/apps/<app_id> has the task port -> app port mappings, but must be called once for each app
> You can "cheat" by configuring your LB based on port index instead of by app port, but this means updating your LB configuration every time a port is added with a lower index than existing ports.
> To use the V2 API, we'd need to do one of the following:
> Reference by port index instead of by value
> Call both /v2/tasks and /v2/apps
> Call /v2/apps/<app_id> for each app
> Ideally, we'd have a fourth option that requires only one API call
> In case an example would help, I'll be open sourcing our LB config generator in the next couple of days.