Skip to content

Commit

Permalink
Changes endpointslice logging level in transformK8sEndpoints()
Browse files Browse the repository at this point in the history
Signed-off-by: Daneyon Hansen <[email protected]>
  • Loading branch information
danehans committed Nov 26, 2024
1 parent 2635711 commit 2529525
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
6 changes: 6 additions & 0 deletions changelog/v1.18.0-rc3/issue_7286_logging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/7286
resolvesIssue: false
description: >-
Changes endpointslice logging level to debug for transformK8sEndpoints() function.
19 changes: 4 additions & 15 deletions projects/gateway2/krtcollections/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/binary"
"encoding/json"
"fmt"
"hash/fnv"

envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
Expand Down Expand Up @@ -229,24 +228,15 @@ func transformK8sEndpoints(ctx context.Context, inputs EndpointsInputs) func(kct
return nil
}

svcNs := spec.GetServiceNamespace()
svcName := spec.GetServiceName()
// Fetch all EndpointSlices for the service
key := types.NamespacedName{
Namespace: svcNs,
Name: svcName,
Namespace: spec.GetServiceNamespace(),
Name: spec.GetServiceName(),
}

endpointSlices := krt.Fetch(kctx, inputs.EndpointSlices, krt.FilterIndex(inputs.EndpointSlicesByService, key))
if len(endpointSlices) == 0 {
warnsToLog = append(warnsToLog, fmt.Sprintf("EndpointSlices not found for service %v/%v", svcNs, svcName))
return nil
}

if len(endpointSlices) == 0 {
warnsToLog = append(warnsToLog, fmt.Sprintf("EndpointSlices not found for service %v/%v", svcNs, svcName))
logger.Debug("EndpointSlices not found for service")
return nil
logger.Debug("no EndpointSlices found for service", zap.String("name", key.Name), zap.String("namespace", key.Namespace))
}

// Initialize the returned EndpointsForUpstream
Expand All @@ -261,8 +251,7 @@ func transformK8sEndpoints(ctx context.Context, inputs EndpointsInputs) func(kct
for _, endpointSlice := range endpointSlices {
port := findPortInEndpointSlice(endpointSlice, singlePortSvc, kubeSvcPort)
if port == 0 {
warnsToLog = append(warnsToLog, fmt.Sprintf("port %v not found for service %v/%v in EndpointSlice %v",
spec.GetServicePort(), svcNs, svcName, endpointSlice.Name))
logger.Debug("no port found in EndpointSlice", zap.String("name", endpointSlice.Name), zap.String("namespace", endpointSlice.Namespace))
continue
}

Expand Down

0 comments on commit 2529525

Please sign in to comment.