skynetservices / skydns

DNS service discovery for etcd
MIT License
2.2k stars 307 forks source link

SKYDNS_PATH_PREFIX doesn't support multiple portion, like "/app1/skydns" #285

Open nearbyfly opened 8 years ago

nearbyfly commented 8 years ago

Hi,

I was trying to share one etcd/skydns with multiple applications. The procedure is to set SKYDNS_PATH_PREFIX like "/app1/skydns", "/app2/skydns".

The DNS A query to skydns is OK. But DNS SRV query response is incorrect, which includes un-necessary “skydns” at the rightmost portion. Please see following SRV query output.

nnie@xubuntu:~$ dig +tries=1 +time=60 @localhost SRV stdn.rf.dtd.tas01.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> +tries=1 +time=60 @localhost SRV stdn.rf.dtd.tas01.local ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16176 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION: ;stdn.rf.dtd.tas01.local. IN SRV

;; ANSWER SECTION: stdn.rf.dtd.tas01.local. 3600 IN SRV 10 100 3868 1.stdn.rf.dtd.tas01.local.skydns.

;; ADDITIONAL SECTION: 1.stdn.rf.dtd.tas01.local.skydns. 3600 IN A 10.1.1.99

;; Query time: 5003 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Sat Jul 02 07:23:46 CDT 2016 ;; MSG SIZE rcvd: 109

I tried the private code (github.com/skynetservices/skydns/msg/service.go) change to strip the 2 right most portions. Then SkyDNS SRV answer can return correct target hostname w/o “skydns”.

Can you help to check this issue?

Regards, Neil

miekg commented 8 years ago

Take a look at TargetStrip in the README. That should do (partly?) what you need.

nearbyfly commented 8 years ago

Hi Miek,

When I added targetstrip into value, the strip is from left-most side. Following are examples:

etcdctl set /tas01/skydns/local/tas01/dtd/rf/stdn/1 '{"host": "10.1.1.88", "port":3868, "targetstrip":2}' {"host": "10.1.1.88", "port":3868, "targetstrip":2}

dig +tries=1 +time=60 @localhost SRV stdn.rf.dtd.tas01.local

; <<>> DiG 9.10.3-P4-Ubuntu <<>> +tries=1 +time=60 @localhost SRV stdn.rf.dtd.tas01.local ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44212 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION: ;stdn.rf.dtd.tas01.local. IN SRV

;; ANSWER SECTION: stdn.rf.dtd.tas01.local. 3600 IN SRV 10 100 3868 rf.dtd.tas01.local.skydns. <-the intention is to remove right most portion "skydns".

;; ADDITIONAL SECTION: rf.dtd.tas01.local.skydns. 3600 IN A 10.1.1.88

;; Query time: 1 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Tue Jul 19 20:32:57 CDT 2016 ;; MSG SIZE rcvd: 102

The source code also indicates that "// targetStrip strips "targetstrip" labels from the left side of the fully qualified name.".

Any other ideas?

Regards, Neil

janosi commented 8 years ago

+1 for accepting and handling more than a single directory in the prefix config. Especially considering etcdv3, where the keyspace is flat (no more directories as we knew them in etcdv2), it would be anyway more natural to strip off the whole prefix from the etcd entry.

miekg commented 8 years ago

[ Quoting notifications@github.com in "Re: [skynetservices/skydns] SKYDNS_..." ]

+1 for accepting and handling more than a single directory in the prefix config. Especially considering etcdv3, where the keyspace is flat (no more directories as we knew them in etcdv2), it would be anyway more natural to strip off the whole prefix from the etcd entry.

Can this be something that is better (and prolly less hacky) handled in CoreDNS? (github.com/miekg/coredns)

janosi commented 8 years ago

Hmmm, does it mean that SkyDNS is not developed actively anymore? Should we consider it as an abandoned project?

miekg commented 8 years ago

Uhm, no.

On 21 Jul 2016 8:42 a.m., "Laszlo Janosi" notifications@github.com wrote:

Hmmm, does it mean that SkyDNS is not developed actively anymore? Should we consider it as an abandoned project?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/skynetservices/skydns/issues/285#issuecomment-234180415, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVkW50wscDD59mNl9KCZyDgzo80H9-aks5qXyLTgaJpZM4JJDeC .

janosi commented 8 years ago

OK, cool :)

nearbyfly commented 8 years ago

Can this be added to skyDNS enhancements lit:-)

miekg commented 8 years ago

[ Quoting notifications@github.com in "Re: [skynetservices/skydns] SKYDNS_..." ]

Can this be added to skyDNS enhancements lit:-)

I'm not sure how cleanly this can be added. Please feel free to send a PR and we can discuss actual code. If the patch is small I'm inclined to accept.