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 (istio#10720)
* support locality weighted loadbalancer * validate LocalityWeightSettings * set proxy locality * fix ci * address comments * EDS part * fix test * reduce locality string split * perf optimize * add ut * fix lint * mark TODO * fix nil pointer * optimize ApplyLocalityWeightSetting * per locality edsClusters cache * update validation ut * update Locality field * set locality Lb priority * fix build * fix build * fix panic * fix minor * add ut * address comments * use cloned endpoints * fix subset locality lb * shallow copy cluster to prevent r/w data race * fix frankbu comments * update Validate * update locality lb set * fix ut * bump istio api * update * fix nil pointer * fix build * add comments * perf improve * add more comments * move validate localityLbsetting to validation.go * fix lint
- Loading branch information
1 parent
2809bd0
commit 3f05706
Showing
40 changed files
with
2,719 additions
and
918 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.