mantl/mesos-consul

Duplicated Consul services

scalp42 opened this issue · 2 comments

I have one app in Marathon, two tasks/instances for it on 2 different Mesos slaves, yet I see 4 services for it:

Are there multiple ports for each task? Can you post the service id for these?

@ChrisAubuchon indeed there are two ports for the task:

      "portMappings": [
        {
          "containerPort": 8080,
          "servicePort": 60010,
          "hostPort": 0,
          "protocol": "tcp"
        },
        {
          "containerPort": 8081,
          "servicePort": 60011,
          "hostPort": 0,
          "protocol": "tcp"
        }
      ]

Unless I'm mistaken, wouldn't it be better to just return, let's say the first port ? In case of SRV records:

scalp@i-6a2965ae ~ $ dig audit-green-talkk-prod.service.consul SRV +tcp

; <<>> DiG 9.9.5-3ubuntu0.7-Ubuntu <<>> audit-green-talkk-prod.service.consul SRV +tcp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59118
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 4

;; QUESTION SECTION:
;audit-green-talkk-prod.service.consul. IN SRV

;; ANSWER SECTION:
audit-green-talkk-prod.service.consul. 10 IN SRV 1 1 31794 gz-prod-mesos-slave-i-0fe036d7.node.chef.consul.
audit-green-talkk-prod.service.consul. 10 IN SRV 1 1 31473 gz-prod-mesos-slave-i-5dc4bc87.node.chef.consul.
audit-green-talkk-prod.service.consul. 10 IN SRV 1 1 31793 gz-prod-mesos-slave-i-0fe036d7.node.chef.consul.
audit-green-talkk-prod.service.consul. 10 IN SRV 1 1 31474 gz-prod-mesos-slave-i-5dc4bc87.node.chef.consul.

;; ADDITIONAL SECTION:
gz-prod-mesos-slave-i-0fe036d7.node.chef.consul. 10 IN A 10.92.22.241
gz-prod-mesos-slave-i-5dc4bc87.node.chef.consul. 10 IN A 10.92.42.96
gz-prod-mesos-slave-i-0fe036d7.node.chef.consul. 10 IN A 10.92.22.241
gz-prod-mesos-slave-i-5dc4bc87.node.chef.consul. 10 IN A 10.92.42.96

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar 01 22:43:53 UTC 2016
;; MSG SIZE  rcvd: 723

Or maybe be able to specify the portIndex like Marathon does for the health checks. Just curious.

Thanks for quick answer! 😄