Add in consul datacenter (AvailabilityZone) support#2384
Add in consul datacenter (AvailabilityZone) support#2384istio-merge-robot merged 1 commit intoistio:masterfrom liamawhite:master
Conversation
|
I remember seeing dc1 being hardcoded in the init code for Consul (pilot-discovery/...).. |
|
pilot-discovery code shriram mentioned: https://github.com/istio/istio/blob/master/pilot/cmd/pilot-discovery/server/server.go#L434 |
|
@GregHanson @rshriram so how should we be retrieving the datacenter and remove that hardcoding? You can only get the dc by retrieving a service in the consul API from what I can see. Is that right? |
|
@anubhavmishra any thoughts on this? |
|
@rshriram I am not sure about the context when it comes to what AZ support means with respect to Consul. But here are some insights into Consul API for getting datacenter information.
I hope this helps. I would love to get more context on what we are trying to achieve here :) |
|
sorry for the lack of context.. We are trying to enable availability zone aware load balancing in Envoy. To do so, we need to provide envoy with the availability zone of the node its running on, so that it will attempt to load balance requests to other services in teh same AZ. (In consul terminology, DC is same as the AZ being discussed here). Hope that helps. |
|
A consul datacenter can span multiple AZs. So not sure if I would use datacenter as the zone identifier. |
|
@anubhavmishra So the idea of this feature is to keep requests within the same datacenter (mostly for latency reason) by preferring to route to upstream services within the same AZ if possible. In kube its implemented using the region and zone labels which in Bluemix is something like us-south/dal-12. From what you have said DC maps more towards the region label? Is there anything that identifies a specific geographic availability zone like the zone label? |
|
@liamawhite yea, so DC doesn't mean an AZ but you can totally create a datacenter that has nodes in only one AZ. In Consul itself there is no identifier to figure out what AZ a node is running in, it is not seen as Consul's responsibility to figure out cloud provider level implementation details. You can totally tag Consul services in the catalog to have this data. Another thing you can take a look at is Network Tomography data that Consul provides in a first class way. Here are the docs: https://www.consul.io/docs/internals/coordinates.html |
Codecov Report
@@ Coverage Diff @@
## master #2384 +/- ##
==========================================
+ Coverage 75.16% 76.43% +1.26%
==========================================
Files 221 219 -2
Lines 21408 19679 -1729
==========================================
- Hits 16092 15042 -1050
+ Misses 4270 3818 -452
+ Partials 1046 819 -227
Continue to review full report at Codecov.
|
|
@rshriram @GregHanson ready for review |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: GregHanson The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
|
/test all [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue. |
What this PR does / why we need it: Currently we only support AZ routing for kube based service registries. This enables it for consul.
Which issue this PR fixes:
Continues on from: istio/old_pilot_repo#1230, #2054 and #1815
Working towards: #1473
Release note:
Enable consul intra-datacenter routing with AvailabilityZone