coredns / coredns/multicluster

Zones cannot match qname

Open
#16 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
57
Forks
9
PR merge metrics
No merged PRs in 30d

Description

When I use multiycluster, and I andd a serviceImport, I found it cannot reslove the domain name.
And I had a doubt:

the code is following,and I add some log:
```golang
func (m MultiCluster) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
state := request.Request{W: w, Req: r}

qname := state.QName()

zone := plugin.Zones(m.Zones).Matches(qname)
log.Warningf("haha===ServeDNS qname:%+v,m.Zones:%+v", qname, m.Zones)
log.Warningf("haha===ServeDNS CompareDomainName:%+v,CountLabel:%+v", dns.CompareDomainName("cluster.local.", qname), dns.CountLabel("cluster.local."))
log.Warningf("haha===ServeDNS dns.Msg:r(%+v)", r)
log.Warningf("haha===ServeDNS state: %+v", state.Req)
if zone == "" {
return plugin.NextOrFailure(m.Name(), m.Next, ctx, w, r)
}
zone = qname[len(qname)-len(zone):] // maintain case of original query
....
```

And the logs are:
```tex
[WARNING] plugin/multicluster: haha===ServeDNS zone:cluster.local
[WARNING] plugin/multicluster: haha===ServeDNS qname:3629697582728363839.1269917840174598765.,m.Zones:[cluster.local.]
[WARNING] plugin/multicluster: haha===ServeDNS CompareDomainName:0,CountLabel:2
[WARNING] plugin/multicluster: haha===ServeDNS dns.Msg:r(;; opcode: QUERY, status: NOERROR, id: 21087
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;3629697582728363839.1269917840174598765. IN HINFO
)
```

I'm confused about why qname is "3629697582728363839.1269917840174598765", not like "cluster.local"?

version: k8s v1.26, coredns v1.9.3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.