-
Notifications
You must be signed in to change notification settings - Fork 119
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
chore: Create a new DnsResolver class that wraps the Java DNS API #2045
Conversation
300da39
to
cb75da8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I'd want to try testing the DNS resolver with an integration test to remove the additional indirection between InstanceConnectionNamerResolver -> DNS Resolver -> DNS resolution. If you tested with a real DNS record, you could remove the indrection.
I'll leave this to @jackwotherspoon to sign-off on.
13f3828
to
cb75da8
Compare
cb75da8
to
b5c6b97
Compare
import javax.naming.NameNotFoundException; | ||
|
||
interface DnsResolver { | ||
Collection<String> resolveTxt(String domainName) throws NameNotFoundException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are using dnsName
in other places, is domainName
the same thing or is it a different meaning? If they are one and the same we should consolidate usage to one naming pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go connector uses DomainName
as the configuration field.
I considered fqdn
, dnsName
, domainName
, host
, and hostname
. FQDN or FullyQualifiedDomainName is too wordy, and dnsName is an expands to "domain name system name", which is self-redundant. I was tempted host
, or hostname
because that is commonly what it is called as part of the a URL RFC 1738. I decided against it because I wanted to be specific that it needs to contain the domain name.
Go connector uses DNSInstanceConnectionNameResolver
for the resolver class name, and DNSResolver
for the singleton instance. This refers to the fact that it uses the DNS system to resolve the DomainName
into an instance connection name. In retrospect, this felt too wordy, so the class name is DNSResolver
in java.
} | ||
|
||
/** | ||
* Returns DNS records for a domain name, sorted alphabetically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a domain name, we should only get 1 TXT record if one exists. Why do we have Collection for the return type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We expect exactly 1 DNS record for an instance. However, it is possible that the connector could receive 0, 1, or many DNS records. Other application logic will gracefully handle cases where the number of responses is not 1 as expected. This class is only responsible for resolving DNS and reporting the results. Thus its data model is in line with the DNS protocol, returning a collection that may contain 0 or more responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b69274f
to
35ceacf
Compare
…API. Part of GoogleCloudPlatform#2043. (GoogleCloudPlatform#2045) This is a prerequisite for other implementation steps in the Automatic Failover with DNS Configuration story. Part of GoogleCloudPlatform#2043.
This is a prerequisite for other implementation steps in the Automatic Failover with DNS Configuration story.
Part of #2043.