Documentation ¶
Index ¶
- Constants
- func EndpointReady(endpoint discovery.Endpoint) bool
- func FormatWithAddressType(s string, addressType discovery.AddressType) string
- func RemoveHintsFromSlices(si *SliceInfo) ([]*discovery.EndpointSlice, []*discovery.EndpointSlice)
- type EndpointZoneInfo
- type EventBuilder
- type SliceInfo
- type TopologyCache
- func (t *TopologyCache) AddHints(logger klog.Logger, si *SliceInfo) ([]*discovery.EndpointSlice, []*discovery.EndpointSlice, []*EventBuilder)
- func (t *TopologyCache) GetOverloadedServices() []string
- func (t *TopologyCache) HasPopulatedHints(serviceKey string) bool
- func (t *TopologyCache) RemoveHints(serviceKey string, addrType discovery.AddressType)
- func (t *TopologyCache) SetHints(serviceKey string, addrType discovery.AddressType, ...)
- func (t *TopologyCache) SetNodes(logger klog.Logger, nodes []*v1.Node)
Constants ¶
const ( NoZoneSpecified = "One or more endpoints do not have a zone specified" NoAllocatedHintsForZones = "No hints allocated for zones" TopologyAwareHintsEnabled = "Topology Aware Hints has been enabled" TopologyAwareHintsDisabled = "Topology Aware Hints has been disabled" InsufficientNodeInfo = "Insufficient Node information: allocatable CPU or zone not specified on one or more nodes" NodesReadyInOneZoneOnly = "Nodes only ready in one zone" InsufficientNumberOfEndpoints = "Insufficient number of endpoints" MinAllocationExceedsOverloadThreshold = "Unable to allocate minimum required endpoints to each zone without exceeding overload threshold" )
TopologyAwareHints events messages list.
Variables ¶
This section is empty.
Functions ¶
func EndpointReady ¶
EndpointReady returns true if an Endpoint has the Ready condition set to true.
func FormatWithAddressType ¶
func FormatWithAddressType(s string, addressType discovery.AddressType) string
FormatWithAddressType foramts a given string by adding an addressType to the end of it.
func RemoveHintsFromSlices ¶
func RemoveHintsFromSlices(si *SliceInfo) ([]*discovery.EndpointSlice, []*discovery.EndpointSlice)
RemoveHintsFromSlices removes topology hints on EndpointSlices and returns updated lists of EndpointSlices to create and update.
Types ¶
type EndpointZoneInfo ¶
EndpointZoneInfo tracks the distribution of endpoints across zones for a Service.
type EventBuilder ¶
EventBuilder let's us construct events in the code. We use it to build events and return them from a function instead of publishing them from within it. EventType, Reason, and Message fields are equivalent to the v1.Event fields - https://pkg.go.dev/k8s.io/api/core/v1#Event.
type SliceInfo ¶
type SliceInfo struct { ServiceKey string AddressType discovery.AddressType ToCreate []*discovery.EndpointSlice ToUpdate []*discovery.EndpointSlice Unchanged []*discovery.EndpointSlice }
SliceInfo stores information about EndpointSlices for the reconciliation process.
type TopologyCache ¶
type TopologyCache struct {
// contains filtered or unexported fields
}
TopologyCache tracks the distribution of Nodes and endpoints across zones.
func NewTopologyCache ¶
func NewTopologyCache() *TopologyCache
NewTopologyCache initializes a new TopologyCache.
func (*TopologyCache) AddHints ¶
func (t *TopologyCache) AddHints(logger klog.Logger, si *SliceInfo) ([]*discovery.EndpointSlice, []*discovery.EndpointSlice, []*EventBuilder)
AddHints adds or updates topology hints on EndpointSlices and returns updated lists of EndpointSlices to create and update.
func (*TopologyCache) GetOverloadedServices ¶
func (t *TopologyCache) GetOverloadedServices() []string
GetOverloadedServices returns a list of Service keys that refer to Services that have crossed the overload threshold for any zone.
func (*TopologyCache) HasPopulatedHints ¶
func (t *TopologyCache) HasPopulatedHints(serviceKey string) bool
HasPopulatedHints checks whether there are populated hints for a given service in the cache.
func (*TopologyCache) RemoveHints ¶
func (t *TopologyCache) RemoveHints(serviceKey string, addrType discovery.AddressType)
RemoveHints removes topology hints for the provided serviceKey and addrType from this cache.
func (*TopologyCache) SetHints ¶
func (t *TopologyCache) SetHints(serviceKey string, addrType discovery.AddressType, allocatedHintsByZone EndpointZoneInfo)
SetHints sets topology hints for the provided serviceKey and addrType in this cache.
func (*TopologyCache) SetNodes ¶
func (t *TopologyCache) SetNodes(logger klog.Logger, nodes []*v1.Node)
SetNodes updates the Node distribution for the TopologyCache.