Skip to content

Add in consul datacenter (AvailabilityZone) support#2384

Merged
istio-merge-robot merged 1 commit intoistio:masterfrom
liamawhite:master
Jan 10, 2018
Merged

Add in consul datacenter (AvailabilityZone) support#2384
istio-merge-robot merged 1 commit intoistio:masterfrom
liamawhite:master

Conversation

@liamawhite
Copy link
Copy Markdown
Member

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

@rshriram
Copy link
Copy Markdown
Member

rshriram commented Jan 3, 2018

I remember seeing dc1 being hardcoded in the init code for Consul (pilot-discovery/...)..

@GregHanson
Copy link
Copy Markdown
Member

@liamawhite
Copy link
Copy Markdown
Member Author

liamawhite commented Jan 6, 2018

@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?

@rshriram
Copy link
Copy Markdown
Member

rshriram commented Jan 7, 2018

@anubhavmishra any thoughts on this?

@anubhavmishra
Copy link
Copy Markdown

anubhavmishra commented Jan 7, 2018

@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 :)

@rshriram
Copy link
Copy Markdown
Member

rshriram commented Jan 8, 2018

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.

@anubhavmishra
Copy link
Copy Markdown

anubhavmishra commented Jan 8, 2018

A consul datacenter can span multiple AZs. So not sure if I would use datacenter as the zone identifier.

@liamawhite
Copy link
Copy Markdown
Member Author

liamawhite commented Jan 8, 2018

@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?

@anubhavmishra
Copy link
Copy Markdown

anubhavmishra commented Jan 8, 2018

@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
TLDR; you can figure out the roundtrip time information using Consul and do load balancing that way but I am sure this will require a lot of work to implement in Istio.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 9, 2018

Codecov Report

Merging #2384 into master will increase coverage by 1.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#broker 75.37% <100%> (-0.02%) ⬇️
#mixer 76.43% <100%> (+1.26%) ⬆️
#pilot 78.44% <100%> (+0.67%) ⬆️
#security 76.2% <100%> (+0.51%) ⬆️
Impacted Files Coverage Δ
pilot/platform/consul/conversion.go 90.41% <100%> (+0.13%) ⬆️
mixer/pkg/attribute/emptyBag.go 75% <0%> (-25%) ⬇️
pilot/cmd/pilot-discovery/server/monitoring.go 64% <0%> (-16%) ⬇️
mixer/pkg/pool/goroutine.go 88.88% <0%> (-11.12%) ⬇️
pilot/platform/cloudfoundry/controller.go 64.28% <0%> (-10.72%) ⬇️
mixer/adapter/kubernetesenv/cache.go 75.64% <0%> (-7.22%) ⬇️
mixer/template/sample/template.gen.go 42.66% <0%> (-7.07%) ⬇️
pilot/model/config.go 58.7% <0%> (-7%) ⬇️
pilot/platform/cloudfoundry/servicediscovery.go 91.48% <0%> (-5.29%) ⬇️
mixer/pkg/server/monitoring.go 80% <0%> (-3.34%) ⬇️
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 671e675...32a362c. Read the comment docs.

@liamawhite
Copy link
Copy Markdown
Member Author

@rshriram @GregHanson ready for review

@GregHanson
Copy link
Copy Markdown
Member

/lgtm

@istio-merge-robot
Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@istio-merge-robot
Copy link
Copy Markdown

/test all [submit-queue is verifying that this PR is safe to merge]

@istio-merge-robot
Copy link
Copy Markdown

Automatic merge from submit-queue.

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

Successfully merging this pull request may close these issues.

7 participants