forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Location based Load Balancing (cherry-pick istio#10720 from release-1…
….1 to master) (istio#11256) * Location based Load Balancing (istio#10720) Implement locality aware routing based on Envoy lbEndpoints priority. Traffic will be routed to endpoints in same subzone, then failover to all in same zone, then failover to all in same region. This is the typical expected behavior for most setups. The explicit failover to a specific region allows people to maintain traffic within the same country if desired. Support Locality weighted load balancing. In order to use this feature, DestinationRule.TrafficPolicy.LoadBalancer.LocalityWeightSettings has to be configured. Currently we support specifying each groups of locality endpoints with a weight. For example , traffic locality A --> locality A with 80% locality A --> locality B with 10% locality A --> locality C with 10% * run dep ensure
- Loading branch information
1 parent
4f3f609
commit 3b46519
Showing
50 changed files
with
4,724 additions
and
937 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright 2019 Istio Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package model | ||
|
||
type LocalityInterface interface { | ||
GetRegion() string | ||
GetZone() string | ||
GetSubZone() string | ||
} | ||
|
||
// Identifies location of where either Envoy runs or where upstream hosts run. | ||
type Locality struct { | ||
// Region this proxy belongs to. | ||
Region string | ||
// Defines the local service zone where Envoy is running. Though optional, it | ||
// should be set if discovery service routing is used and the discovery | ||
// service exposes :ref:`zone data <envoy_api_field_endpoint.LocalityLbEndpoints.locality>`, | ||
// either in this message or via :option:`--service-zone`. The meaning of zone | ||
// is context dependent, e.g. `Availability Zone (AZ) | ||
// <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html>`_ | ||
// on AWS, `Zone <https://cloud.google.com/compute/docs/regions-zones/>`_ on | ||
// GCP, etc. | ||
Zone string | ||
// When used for locality of upstream hosts, this field further splits zone | ||
// into smaller chunks of sub-zones so they can be load balanced | ||
// independently. | ||
SubZone string | ||
} | ||
|
||
func (l *Locality) GetRegion() string { | ||
if l != nil { | ||
return l.Region | ||
} | ||
return "" | ||
} | ||
|
||
func (l *Locality) GetZone() string { | ||
if l != nil { | ||
return l.Zone | ||
} | ||
return "" | ||
} | ||
|
||
func (l *Locality) GetSubZone() string { | ||
if l != nil { | ||
return l.SubZone | ||
} | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.