-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Describe the bug
When you have a wildcard A record and a CNAME pointing to a non-wildcard A record all in the same DNS zone, Gravity returns the results of both the wildcard A record and the non-wildcard A record when looking up the CNAME. As I understand it only the non-wildcard A record result should be returned in this case since the CNAME is a more specific match.
Note this issue is specifically with CNAMEs. Looking up a more specific A record returns only the IP of that record as expected.
To Reproduce
Steps to reproduce the behavior:
- Create a wildcard A record (e.g. *.example.com. with IP 192.168.0.252)
- Create a non-wildcard A record (e.g. service1.example.com. with IP 192.168.0.251)
- Create a CNAME record pointing to the non-wildcard A record (e.g. service2.example.com. pointing to service1.example.com.)
- Lookup the CNAME
- Both the wildcard A record and non-wildcard A record results are returned.
Expected behavior
Only the result of the non-wildcard A record should be returned when looking up the CNAME.
Screenshots
Querying the CNAME:
$ nslookup service2.example.com.
Server: 192.168.0.250
Address: 192.168.0.250#53
Non-authoritative answer:
Name: service2.example.com
Address: 192.168.0.252
service2.example.com canonical name = service1.example.com.
Name: service1.example.com
Address: 192.168.0.251
Querying the non-wildcard A record:
$ nslookup service1.example.com.
Server: 192.168.0.250
Address: 192.168.0.250#53
Non-authoritative answer:
Name: service1.example.com
Address: 192.168.0.251
Logs
{"level":"info","ts":1763255686.0002294,"logger":"role.dns","msg":"DNS Query","instance":"","version":"0.28.7","runtime":8,"client":"192.168.0.205","response":"NOERROR","queryNames":["service2.example.com."],"queryTypes":["A"],"answerRecords":["192.168.0.252","service1.example.com.","192.168.0.251"],"answerTypes":["A","CNAME","A"]}
{"level":"info","ts":1763255686.0326798,"logger":"role.dns","msg":"DNS Query","instance":"","version":"0.28.7","runtime":30,"client":"192.168.0.205","response":"NOERROR","queryNames":["service1.example.com."],"queryTypes":["AAAA"],"answerRecords":[],"answerTypes":[]}
Version and Deployment (please complete the following information):
- Gravity version: 0.28.7
- Deployment: kubernetes deployment with external etcd
Additional context
Add any other context about the problem here.