Added events publishing for topologyHints changes

This commit is contained in:
Lior Lieberman
2022-11-02 12:15:40 +00:00
parent 6691876326
commit 4faede03fa
7 changed files with 220 additions and 36 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package topologycache
import (
"fmt"
"math"
v1 "k8s.io/api/core/v1"
@@ -67,6 +68,11 @@ func RemoveHintsFromSlices(si *SliceInfo) ([]*discovery.EndpointSlice, []*discov
return si.ToCreate, si.ToUpdate
}
// FormatWithAddressType foramts a given string by adding an addressType to the end of it.
func FormatWithAddressType(s string, addressType discovery.AddressType) string {
return fmt.Sprintf("%s, addressType: %s", s, addressType)
}
// 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