migrated pkg/controller/endpointslice to contextual logging

Signed-off-by: Naman <namanlakhwani@gmail.com>
This commit is contained in:
Naman
2023-01-24 19:09:00 +05:30
parent c95b16b280
commit 09849b09cf
15 changed files with 186 additions and 132 deletions

View File

@@ -77,7 +77,7 @@ func FormatWithAddressType(s string, addressType discovery.AddressType) string {
// 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(slices []*discovery.EndpointSlice, givingZones, receivingZones map[string]int) map[string]int {
func redistributeHints(logger klog.Logger, slices []*discovery.EndpointSlice, givingZones, receivingZones map[string]int) map[string]int {
redistributions := map[string]int{}
for _, slice := range slices {
@@ -91,7 +91,7 @@ func redistributeHints(slices []*discovery.EndpointSlice, givingZones, receiving
}
if endpoint.Zone == nil || *endpoint.Zone == "" {
// This should always be caught earlier in AddHints()
klog.Warningf("Endpoint found without zone specified")
logger.Info("Endpoint found without zone specified")
continue
}