// RemoveHintsFromSlices removes topology hints on EndpointSlices and returns // updated lists of EndpointSlices to create and update. func RemoveHintsFromSlices(si *SliceInfo) ([]*discovery.EndpointSlice, []*discovery.EndpointSlice) { … } // FormatWithAddressType foramts a given string by adding an addressType to the end of it. func FormatWithAddressType(s string, addressType discovery.AddressType) string { … } // redistributeHints redistributes hints based in the provided EndpointSlices. // It allocates endpoints from the provided givingZones to the provided // receivingZones. This returns a map that represents the changes in allocated // endpoints by zone. func redistributeHints(logger klog.Logger, slices []*discovery.EndpointSlice, givingZones, receivingZones map[string]int) map[string]int { … } // getGivingAndReceivingZones returns the number of endpoints each zone should // give to other zones along with the number of endpoints each zone should // receive from other zones. This is calculated with the provided allocations // (desired state) and allocatedHintsByZone (current state). func getGivingAndReceivingZones(allocations map[string]allocation, allocatedHintsByZone map[string]int) (map[string]int, map[string]int) { … } // getMost accepts a map[string]float64 and returns the string and float64 that // represent the greatest value in this provided map. This function is not very // efficient but it is expected that len() will rarely be greater than 2. func getMost(zones map[string]float64) (string, float64) { … } // getHintsByZone returns the number of hints allocated to each zone by the // provided EndpointSlice. This function returns nil to indicate that the // current allocations are invalid and that the EndpointSlice needs to be // updated. This could be caused by: // - A hint for a zone that no longer requires any allocations. // - An endpoint with no hints. // - Hints that would make minimum allocations impossible. func getHintsByZone(slice *discovery.EndpointSlice, allocatedHintsByZone EndpointZoneInfo, allocations map[string]allocation) map[string]int { … } // serviceOverloaded returns true if the Service has an insufficient amount of // endpoints for any zone. func serviceOverloaded(ezi EndpointZoneInfo, zoneRatios map[string]float64) bool { … } // isNodeReady returns true if a node is ready; false otherwise. func isNodeReady(node *v1.Node) bool { … } // numReadyEndpoints returns the number of Endpoints that are ready from the // specified list. func numReadyEndpoints(endpoints []discovery.Endpoint) int { … } // EndpointReady returns true if an Endpoint has the Ready condition set to // true. func EndpointReady(endpoint discovery.Endpoint) bool { … }