Allow for consecutive dashes in normalizeForDns
This is a question regarding the following code:
https://github.com/spring-cloud/spring-cloud-consul/blob/master/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/serviceregistry/ConsulAutoRegistration.java#L154
It seems that all non letters or numbers are transalated into dashes (SEPARATOR) and also that several contigous dashes are translated into a single dash. We intended to register in consul a spring boot service with a name that contains two contigous dashes, i.e. for example: service--test and we found it was not possible. Since using other tools this name can be registered to Consul without problems (at least that we could see), therefore we are wondering what is the purpose of the normalizeForDns logic in spring.cloud.consul.
Thanks!
Consul runs a dns server. Those rules are for dns names, otherwise, they won't be available via dns.
Ok. Thanks. I've found it well explainted in https://www.consul.io/docs/agent/services.html#service-and-tag-names-with-dns However, does this include also collapsing two consecutive dashes? I haven't tested it but it looks like a name like "service--test" would be legal.
I believe I ported that test from consul. Let me know if that is valid in consul and we can change.
We have a service registered with the name "aif2-gen--vip" and I can ping it on the Consul DNS domain:
> ping aif2-gen--vip.service.testaws.discovery
Pinging aif2-gen--vip.service.testaws.discovery [xxx.xxx.xxx.xxx] with 32 bytes of data:
Reply from xxx.xxx.xxx.xxx: bytes=32 time=70ms TTL=52
[...]
However I haven't found the code where consul checks whether a name is compliant or not ...
Thanks for the response.