skynetservices/skydns

Support direct CNAME lookups

therc opened this issue · 3 comments

therc commented

I can't seem to get any results for direct CNAME lookups unless I have previously issued an A lookup for the same host. Even then, the CNAME gets returned only until its TTL expires.

Is this because of the last two comments here, i.e. direct lookups were not in the original implementation and haven't been added since? Or was it added and I'm simply doing something wrong?

#21 (comment)

For more context, this is for e2e testing in Kubernetes of a new service type:

kubernetes/kubernetes#30931 (comment)

miekg commented

But SkyDNS does not cache anything... So if these records live in etcd and the first time you get the correct answer, I can't see why it would be failing later. Is k8s doing some intermediate caching?

Can you replicate this behavior by directly using SkyDNS and dig?

And why do you want to directly query a CNAME?

therc commented

I need to query directly for end-to-end testing. I create a CNAME service that aliases to foo.example.com and verify that I get the right result. Then I change the service to alias to bar.example.com and verify that the CNAME record changes. Then, finally, instead of changing the canonical name, I change the service type to ClusterIP, which should start returning an A record instead, then veriify that, too. All tests are done for now using dig +notcp +short +tries=12 +norecurse .

The manual tests I did were using 9.9.5-9+deb8u6-Debian against a kube-dns binary that incorporates my changes. kube-dns does have a simple cache (it lives in treecache.go), populated with skydns.msg.Service entries.

I'll try some more testing, but perhaps I should just bite the bullet and do regular A lookups, dealing with the CNAME+A answers.

therc commented

Nevermind, it was a problem in the caching done in kube-dns and how I was using it. Closing.