hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.26k stars 4.41k forks source link

allow multiple service tags to be used together #13674

Open tgross opened 2 years ago

tgross commented 2 years ago

In https://github.com/hashicorp/nomad/issues/13604, @maxadamo wrote the following proposal, but I wasn't able to transfer the issue over here for some reason 😊


Proposal

According to the following links: https://docs.ldap.com/ldap-sdk/docs/javadoc/index.html?com/unboundid/ldap/sdk/DNSSRVRecordServerSet.html https://ldap.com/dns-srv-records-for-ldap/

a DNS SRV record for LDAP should contain 2 tags at the same time _ldap._tcp (or _ldaps._tcp)

service tag in Nomad is a list and it tried to define: ["ldap", "tcp"]

but I get an unexpected result. The name can be resolved either as:

_host._tcp.example.com
_host._ldap.example.com

but it cannot be resolved as:

_host._ldap._tcp.example.com

Furthermore, the above documentation says that in order to get a list of DNS records for a domain, the tag should be prepended. For instance:

_ldap._tcp.example.com

Use-cases

use proper LDAP SRV record (with escapes as follows):

ldap:///dc%3Dexample%2Cdc%3Dcom

Attempted Solutions

could you make the multiple tags work together, and maybe even one at once? For instance, we can resolve these all:

_host._tcp.example.com
_host._ldap.example.com
_host._ldap._tcp.example.com

p.s.: maybe the prepending "_" is enough and we don't need to prepend the tags. I don't have it clear yet.

maxadamo commented 2 years ago

I got it! From RFC 2782:

The format of the SRV RR

Here is the format of the SRV RR, whose DNS type code is 33: _Service._Proto.Name TTL Class SRV Priority Weight Port Target

I can simply call my service ldap, call the tag tcp, and I'm gonna get: _ldap._tcp.domain.org

I think you can close this one.