ahmetb / wagl

:bee: DNS Service Discovery for Docker Swarm. Works out of the box. (NOW OBSOLETE, USE SWARM MODE)
http://ahmetb.github.io/wagl
Apache License 2.0
284 stars 21 forks source link

SRV records RFC compliance #14

Open loukash opened 8 years ago

loukash commented 8 years ago

Hi Ahmet, Sorry for my awful english.

A target in SRV record must be a domain name (not ip address). Consequently target ends in a dot.

dig +short SRV _api._tcp.billing.swarm
1 1 80 192.168.99.102.
1 1 80 192.168.99.103.

Sure I can delete last char in template, but it poor hack. https://www.ietf.org/rfc/rfc2782.txt

ahmetb commented 8 years ago

@loukash Hi, you're probably right, I totally did not read the RFC. Do you have a use case for SRV records, because I am planning to remove them entirely from the project.

loukash commented 8 years ago

@ahmetalpbalkan I paln to used a SRV in template of load balancer. Example:

dig +short SRV _webui._tcp.swarm.docker | awk 'BEGIN { FS= " "}; { print $4":"$3 }' > balancer.conf
192.168.20.161.:8080
192.168.20.161.:32769

wagl is a cool dns discovery tool. I can not make configuration changes with simple method. Unfortunately consul/confd didn't support a value in SRV records.

If you will remove a support of SRV, then I can't use a wagl. I like create a containers with random ports.

ahmetb commented 8 years ago

@loukash I see. I was planning to remove SRV because docker now has multi-host networking (means you will not need random ports anymore). But I guess it's still sane to have it.

Actually I realized the code I have reads: https://github.com/ahmetalpbalkan/wagl/blob/7407c3fb52832a513d5ebb3d8d411fb7cb741f13/rrtype/rrtype.go#L54


func formatSRV(name, rec string) (dns.RR, error) {
    ...
    host = dns.Fqdn(host) // have . suffix per SRV RFC
    ...

So if I return an IP address for a SRV record, should I keep the trailing dot or not?

loukash commented 8 years ago

So if I return an IP address for a SRV record, should I keep the trailing dot or not?

If I have understood the RFC, Target must have a domain name (test.example.com), but not ip address.

dig +short SRV _api._tcp.billing.swarm
1 1 80 node01.domain.ltd.
1 1 80 nod02.domain.ltd.
ahmetb commented 8 years ago

@loukash Hmm I'm not sure how I can solve that. mesos-dns does the same, they return IP addresses for SRV responses: https://mesosphere.github.io/mesos-dns/docs/naming.html

loukash commented 8 years ago

mesos-dns don't compliance with rfc too :)

ahmetb commented 8 years ago

@loukash yeah, in this case I'm not sure how much we can solve that problem. Maybe start a thread in mesos-dns for comments? I agree that we are nowhere close to implementing RFC 2782.

For your use case, it appears like you can get it working by removing the trailing period, right?

I will think about this, maybe we can find a way to return domain names for each node (host) somehow. Thanks for bringing this to my attention.

loukash commented 8 years ago

@ahmetalpbalkan I think to use consul/consul-template/registrator or etcd/confd/registrator or wagl/static_published_port. In my view, wagl is the simplest tool for discovery. I want to use it. Wagl is a UNIX-way style :)

I am a newbie in docker, and can't make easy way to generate a config for load balancer. I want to run a containers with random published ports. Unfortunately HAProxy and Nginx didn't work with SRV records.

Probably I will use a wagl (A-record) and static published ports.

I can't start a thread in mesos-dns because of my english skills :)

funkytaco commented 8 years ago

@ahmetalpbalkan Do you still recommend using wagl. It sounds like Docker is building in its own DNS system

https://github.com/docker/docker/issues/19474#issuecomment-173094817

ahmetb commented 8 years ago

@funkytaco I believe it's not like wagl yet (or I'm not aware). The issue you linked is just container name resolution through dns server instead of /etc/resolv.conf.

But I wouldn't be surprised if the situation changes soon and docker offers the same functionality.