mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-27 08:37:36 +00:00
apiserver/peerproxy: avoid shadowing math/rand with local variable\n\nThis change renames a local variable named 'rand' to 'endpointIndex' to avoid shadowing the imported math/rand package in peer proxy handler when selecting a random peer endpoint. Behavior is unchanged; this improves readability and prevents future confusion.\n\n/kind cleanup\n/area apiserver\n/sig api-machinery\n\n/release-note-none\n
This commit is contained in:
@@ -177,8 +177,8 @@ func (h *peerProxyHandler) WrapHandler(handler http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
|
||||
rand := rand.Intn(len(peerEndpoints))
|
||||
peerEndpoint := peerEndpoints[rand]
|
||||
endpointIndex := rand.Intn(len(peerEndpoints))
|
||||
peerEndpoint := peerEndpoints[endpointIndex]
|
||||
h.proxyRequestToDestinationAPIServer(r, w, peerEndpoint)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user