Cross-datacenter DNS service lookups. #675
Closed
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.
When performing a DNS lookup for consul services (
[%tag%.]*%service%.service.[%datacenter%.]consul
or_%service%._tcp.service.[%datacenter%.]consul
), if an explicit datacenter is not specified, perform "optional" lookups against all datacenters starting with the one from which the request originated. By "optional" we mean, if the lookup fails, the failure will be ignored.This could be the base of a solution to #208 and generally allows service-based lookups to locate all service providers across an entire cluster. One extension might be the addition of timeouts to any optional lookups to reduce the time required to satisfy the query.
To allow for services that may be local-only services for the containing datacenter, we're using a special tag ('availability.local').
Update dispatch():
Update serviceLookup():
Update filterServiceNodes():
Add a hasLocalTag() helper to check an array of tag strings for one that matches 'availability.local' indicating that the service should be restricted to the containing datacenter.