Closed jfindley closed 1 year ago
This seems really useful. I deployed an version built from this branch and I think I'm finally getting closer to get my setup to work.
:+1: from me FWIW
:+1:
Just noticed an error with this code. Which port gets the "-port2" suffix does not depend on which order they where defined in the task but by the ordering of the port number allocated.
This appears to be a solution for a very real problem - @ChrisAubuchon do you have any thoughts on this? Would love to see something like this pushed through.
:+1:
In my opinion, the proper way for mesos-consul
to handle multi-port services is to register them under the same service name but with separate identifying tags. For example a web app listening on 80 and 443 would have two services registered:
mesos-consul::webapp:80
tagged with [ "http" ]
mesos-consul::webapp:443
tagged with [ "https" ]
This allows SRV DNS lookups to resolve:
_webapp._http.service.consul
_webapp._https.service.consul
The issue with this is that there hasn't been a way to map the dynamic port that Mesos assigns with the application port. So mesos-consul
sees two ports, say 30000 and 30001, and has no way of knowing which port maps to the http service and which maps to the https service.
Mesos has a DiscoveryInfo
block that addresses this (and mesos-consul
uses) but it hasn't been supported in marathon until 5 days ago via Marathon PR https://github.com/mesosphere/marathon/pull/3302
Better support for services with multiple ports.
This PR appends -portN to the service name for ports after the first. The first port is left un-prefixed, so that this doesn't break existing use-cases.