[client] Support dns upstream failover for nameserver groups with same match domain #3178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Failover between nameserver groups handling the same match domain. The old behavior was non-deterministic about which one was picked.
This is achieved by creating an upstream handler for each domain per nameserver group with decreasing priorities in the handler chain.
Example:
Received network map with 2 groups:
#1: [1.1.1.1, 1.0.0.1] for [example.org]
#2: [8.8.8.8, 8.8.4.4] for [example.org, example.com]
Results in the following handlers:
#1: domain=example.org upstream=[1.1.1.1, 1.0.0.1] priority=50
#2: domain=example.org upstream=[8.8.8.8, 8.8.4.4] priority=49
#3: domain=example.com upstream=[8.8.8.8, 8.8.4.4] priority=50
Where priority/domain pairs are unique
Should one of the handlers detect failure (failed attempts >=5), the original server group (handling all the domains) will be marked unavailable and the handler will be deregistered.
Return a DNS error when all upstream handlers fail instead of silently dropping the packet (here)
Handler chain cleanup
Improved log messages
Issue ticket number and link
Checklist