mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 20:00:07 +00:00
refactor(kube-proxy): remove redundant empty endpoints check in topologyModeFromHints
The len(endpoints) == 0 check is now redundant since the hasReadyEndpoints check handles this case when the slice is empty, the loop executes zero times, hasReadyEndpoints stays false, and returns "" via the same path.
This commit is contained in:
@@ -162,12 +162,6 @@ func CategorizeEndpoints(endpoints []Endpoint, svcInfo ServicePort, nodeName str
|
||||
// hinted for this node's zone, then it returns "PreferSameZone".
|
||||
// - Otherwise it returns "" (meaning, no topology / default traffic distribution).
|
||||
func topologyModeFromHints(svcInfo ServicePort, endpoints []Endpoint, nodeName, zone string) string {
|
||||
if len(endpoints) == 0 {
|
||||
// The code below assumes at least 1 endpoint; if there are no endpoints,
|
||||
// there are no hints.
|
||||
return ""
|
||||
}
|
||||
|
||||
hasReadyEndpoints := false
|
||||
hasEndpointForNode := false
|
||||
allEndpointsHaveNodeHints := true
|
||||
|
||||
Reference in New Issue
Block a user