Can server-template using consul identify port?


I’m doing some experimenting using HAProxy 1.8.5 and automatic service discovery against consul

I’m using the following code which works fine
resolvers consuldns
nameserver dns
resolve_retries 3
hold valid 100ms

frontend web
   bind   *:8080
   mode   http
   option http-server-close
   option forceclose

   default_backend sampleservice

backend sampleservice
   server-template srv 1-2 pingpong.service.dc1.consul:8000 inter 1s resolvers consuldns resolve-prefer ipv4 check

what i’d like to know is if it is possible to have server-template detect the port from the SRV record.
I have multiple instance running on the same host for some services so this setup wouldn’t work for what I want to do.
If I drop the :800 of the server-template then it complains that it can’t find any valid servers
Does anyone know if it is possible to do this or if its on a roadmap?


You can use this configuration

server-template srv 1-2 _pingpong._tcp.service.dc1.consul inter 1s resolvers consuldns resolve-prefer ipv4 resolve-opts allow-dup-ip check