mantl / mesos-consul

Mesos to Consul bridge for service discovery
Apache License 2.0
338 stars 95 forks source link

Using mesos label to filter port exposed to consul #105

Closed awdrius closed 7 years ago

awdrius commented 7 years ago

Hi, I wanted to (c)lean up my consul service registry and hide some ports allocated by mesos.

My use case is that some of the service have 2 or more ports assigned to them but only one is used for external communication; other ports are used for clustering or deduplication for same service instances.

--service-port-label =string setting denotes mesos label that indicates which of service ports to expose to consul. string should contain a list of ints (comma separated) that map to port index, e.g.:

mesos-consul

--service-port-label =cport

mesos:

     "resources": {
        "cpus": 0.2,
        "memoryMb": 256,
        "numPorts": 3
    }

Mesos deploy (we are using Singularity scheduler, but similar/same should exists for Marathon):

    "labels": {
            "cport": "0,1"
    }

This configuration would only expose PORT0 and PORT1 to consul and leave PORT2 off it.

psalaberria002 commented 7 years ago

+1