Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalSharedSliceAlgorithm ¶
type LocalSharedSliceAlgorithm struct {
// contains filtered or unexported fields
}
LocalSharedSliceAlgorithm is one variation of LocalSliceAlgorithm which 'borrows' and 'rents' endpoints from other zones to make the local EndpointSliceGroup balanced with the incoming traffic (number of nodes distribution). This variation deals with failed corner cases by sharing endpoints to zones that have no endpoints.
func (LocalSharedSliceAlgorithm) CreateSliceGroups ¶
func (alg LocalSharedSliceAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups creates sliceGroups with 'one local EndpointSliceGroup per zone' policy. Zones with no endpoints allocated will be treated as a whole that shares a shared-SG.
type LocalSliceAlgorithm ¶
type LocalSliceAlgorithm struct {
// contains filtered or unexported fields
}
LocalSliceAlgorithm 'borrows' and 'rents' endpoints from other zones to make the local EndpointSlice balanced with the incoming traffic (number of nodes distribution): 1. The proportion of incoming traffic for a zone is calculated based on the proportion of nodes or cores in the zone. 2. This is compared with the proportion of endpoints in the zone to calculate the deviation from the expected number of endpoints in a perfectly balanced system. 3. EndpointSlices in zones with less endpoints than expected will receive endpoints from zones that have more endpoints than expected.
func (LocalSliceAlgorithm) CreateSliceGroups ¶
func (alg LocalSliceAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups creates sliceGroups with 'one local EndpointSliceGroup per zone' policy
type LocalSliceAlgorithmOpt ¶
type LocalSliceAlgorithmOpt struct{}
LocalSliceAlgorithmOpt is a variation of LocalSliceAlgorithm which 'borrows' and 'rents' endpoints from other zones to make the local EndpointSlice balanced with the incoming traffic (number of nodes distribution). This variation distributes extra endpoints available after local-slice distribution to a global SG with a lower weight that every zone can reach.
func (LocalSliceAlgorithmOpt) CreateSliceGroups ¶
func (alg LocalSliceAlgorithmOpt) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups creates sliceGroups with 'one local EndpointSliceGroup per zone' policy
type LocalWeightedSliceAlgorithm ¶
type LocalWeightedSliceAlgorithm struct{}
LocalWeightedSliceAlgorithm is a variation of LocalSliceAlgorithm which 'borrows' and 'rents' endpoints from other zones to make the local EndpointSlice balanced with the incoming traffic. This variation uses weights to make precise distribution without float to int approximation
func (LocalWeightedSliceAlgorithm) CreateSliceGroups ¶
func (alg LocalWeightedSliceAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups creates sliceGroups with weights to indicate float endpoints. Zones will have local sliceGroup representing integer number of endpoints while having a shared sliceGroup with weights representing float number of endpoints
type OriginalAlgorithm ¶
type OriginalAlgorithm struct{}
OriginalAlgorithm equally distributes the traffic to all endpoints behind a servie, serving as a benchmark to evaluate other algorithms
func (OriginalAlgorithm) CreateSliceGroups ¶
func (alg OriginalAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups puts all endpoints into a global EndpointSliceGroup
type RoutingAlgorithm ¶
type RoutingAlgorithm interface { // CreateSliceGroups translates RegionInfo into EndpointSliceGroups CreateSliceGroups(types.RegionInfo) (map[string]types.EndpointSliceGroup, error) }
RoutingAlgorithm interface for different routing algorithms
func NewAlgorithm ¶
func NewAlgorithm(name string) RoutingAlgorithm
NewAlgorithm serves as an algorithm constructor based on the algroithm name
type SharedGlobalAlgorithm ¶
type SharedGlobalAlgorithm struct {
// contains filtered or unexported fields
}
SharedGlobalAlgorithm works on SharedGlobalAlgorithmCore with consuming the global EndpointSliceGroup.
func (SharedGlobalAlgorithm) CreateSliceGroups ¶
func (alg SharedGlobalAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups takes a region of zones as input and output EndpointSliceGroups
type SharedMultiZoneAlgorithm ¶
type SharedMultiZoneAlgorithm struct {
// contains filtered or unexported fields
}
SharedMultiZoneAlgorithm works on SharedGlobalAlgorithmCore without consuming the global EndpointSliceGroup if a zone has contributed endpoints to it.
func (SharedMultiZoneAlgorithm) CreateSliceGroups ¶
func (alg SharedMultiZoneAlgorithm) CreateSliceGroups(region types.RegionInfo) (map[string]types.EndpointSliceGroup, error)
CreateSliceGroups takes a region of zones as input and output EndpointSliceGroups
type ZonePriorityQueue ¶
type ZonePriorityQueue struct { SliceGroups map[string]types.EndpointSliceGroup Region types.RegionInfo // ZoneNames with min/max ratio deviation should be placed first ZoneNames []string // ReceiveEndpoint indicates if the zone is going to receive endpoints or give // out endpoints ReceiveEndpoint bool }
ZonePriorityQueue sorts zone based on endpoints distribution ratio deviation compared to nodes ratio
func (ZonePriorityQueue) Len ¶
func (pq ZonePriorityQueue) Len() int
Len is number of zones in the queue
func (ZonePriorityQueue) Less ¶
func (pq ZonePriorityQueue) Less(i, j int) bool
Less returns true if i should be ahead of j
func (*ZonePriorityQueue) Pop ¶
func (pq *ZonePriorityQueue) Pop() interface{}
Pop returns the first element in the queue and erases it
func (*ZonePriorityQueue) Push ¶
func (pq *ZonePriorityQueue) Push(x interface{})
Push adds one element to the end of slice
func (*ZonePriorityQueue) Swap ¶
func (pq *ZonePriorityQueue) Swap(i, j int)
Swap swaps zone names at index i and j