eds

package
v0.0.0-...-5fbf753 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClusterLoadAssignment

func CreateClusterLoadAssignment(edsServiceName string, servingPort uint32, nodeHash string, localityPriorityMapper LocalityPriorityMapper, endpoints []applications.ApplicationEndpoints) *endpointv3.ClusterLoadAssignment

CreateClusterLoadAssignment for EDS. `edsServiceName` must match the `ServiceName` in the `EDSClusterConfig` in the CDS Cluster resource. [gRFC A27]: https://github.com/grpc/proposal/blob/972b69ab1f0f7f6079af81a8c2b8a01a15ce3bec/A27-xds-global-load-balancing.md#clusterloadassignment-proto

Types

type FixedLocalityPriority

type FixedLocalityPriority struct{}

FixedLocalityPriority returns an empty map. Lookups in the map will always return 0 as the value, so all localities can be assigned the highest priority.

func (FixedLocalityPriority) BuildPriorityMap

func (f FixedLocalityPriority) BuildPriorityMap(_ string, _ []string) map[string]uint32

type LocalityMatch

type LocalityMatch int

LocalityMatch defines the priority order of matching or part-matching locality. In other words, the priority order is as follows:

  • same zone
  • same region
  • same super-region
  • same multi-region
  • other
const (
	Zone LocalityMatch = iota
	Region
	SuperRegion
	MultiRegion
	Other
)

type LocalityPriorityByZone

type LocalityPriorityByZone struct{}

LocalityPriorityByZone determines EDS ClusterLoadAssignment locality priorites, based on the zone of the requesting node.

Priorities start from 0 (highest), and must increase without any gaps. Multiple localities can share the same priority.

Zone and region are names of cloud provider locations, e.g., the `us-central1-f` zone, and the `us-central1` region.

Super-region is an invented term for this implementation. It is essentially the cloud provider region, excluding the numeric suffix. E.g., for the `us-west1` region, the super-region is `us-west`. This means that the `us-west1` and `us-west2` regions are in the same super-region. The intention is to provide a next level of priority, after considering zone and region. E.g., if traffic originates from `us-west1`, but no healthy endpoints are available in that region, we may prefer to send traffic to a nearby region, such as, e.g., `us-west2`, before considering other regions that are geographically more distant, e.g., `us-east1`.

Multi-region is an invented term for this implementation. It is essentially the first part of the cloud provider region name, up to the first hyphen (`-`). E.g., for the region `us-east1`, the multi-region is `us`. This means that the `us-west1` and `us-east1` regions are in the same multi-region. The intention is to provide a next level of priority, after considering zone, region, and super-region. E.g., if traffic originates from `us-west1`, but no healthy endpoints are available in any of the `us-west1*` regions, we may prefer to send traffic to another region on the same continent, such as, e.g., `us-east1`, before considering regions on other continents, e.g., `europe-west1`.

func (LocalityPriorityByZone) BuildPriorityMap

func (l LocalityPriorityByZone) BuildPriorityMap(nodeZone string, zonesToPrioritize []string) map[string]uint32

BuildPriorityMap constructs the priority map for the provided zones, based on the zone of the requesting node. Assumption: The nodeHash value (the first argument) is the zone name of the requesting node.

type LocalityPriorityMapper

type LocalityPriorityMapper interface {
	// BuildPriorityMap constructs the priority map for the provided zones, based on the node hash.
	BuildPriorityMap(nodeHash string, zones []string) map[string]uint32
}

LocalityPriorityMapper determines EDS ClusterLoadAssignment locality priorites.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL