Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS resolver doesn't use target address in SRV record #1518

Open
d-uzlov opened this issue Sep 28, 2023 · 0 comments
Open

DNS resolver doesn't use target address in SRV record #1518

d-uzlov opened this issue Sep 28, 2023 · 0 comments

Comments

@d-uzlov
Copy link
Contributor

d-uzlov commented Sep 28, 2023

Expected Behavior

NSM should connect successfully when you setup DNS like this:

registry.nsm-system.my.cluster2. 86400 IN SRV 10 0 30002 some.real.domain.
some.real.domain. IN A 1.2.3.4

NSM should connect to 1.2.3.4:30002, resolved via some.real.domain.

Current Behavior

NSM can't resolve address:

failed to look up a host using a local resolver for a registry.nsm-system.my.cluster2

For NSM to work I have to use the same A/AAAA record name as for SRV:

registry.nsm-system.my.cluster2. 86400 IN SRV 10 0 30002 can.be.whatever.
registry.nsm-system.my.cluster2. IN A 1.2.3.4

Failure Information (for bugs)

NSM uses only port from SRV record.

When you try to connect to netsvcname@my.cluster2, NSM resolves SRV for registry.nsm-system.my.cluster2, and then IP for registry.nsm-system.my.cluster2, regardless of value in records[0].Target

_, records, err := r.LookupSRV(ctx, "", "", serviceDomain)
if err != nil {
return nil, errors.Wrapf(err, "failed to resolve a SRV query for a %s", serviceDomain)
}
if len(records) == 0 {
return nil, errors.New("resolver.LookupSERV return empty result")
}
port = strconv.Itoa(int(records[0].Port))
ips, err := r.LookupIPAddr(ctx, serviceDomain)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant