chore: remove deprecated rand.Seed#10142
chore: remove deprecated rand.Seed#10142YurDuiachenko wants to merge 1 commit intokubernetes-sigs:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: YurDuiachenko The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @YurDuiachenko. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/release-note-none |
|
/assign nilo19 |
elmiko
left a comment
There was a problem hiding this comment.
this seems like a reasonable cleanup but i'm not familiar enough with the rand deprecation to know if we should be using something else.
| ) | ||
|
|
||
| func main() { | ||
| rand.Seed(time.Now().UnixNano()) // FIXME: should use crypto/rand for better randomness |
There was a problem hiding this comment.
is there anything to the comment here about using crypto/rand instead of rand?
There was a problem hiding this comment.
Thank you a lot for taking a look, @elmiko,
In this case I don't think crypto/rand is needed, because this randomness is not used for anything security-sensitive. It is only used for non-cryptographic behavior such as jitter/resync timing.
The cleanup here is only removing the explicit top-level rand.Seed(...) call. With modern Go, the global math/rand generator is already automatically seeded at startup, so behavior should remain the same without requiring a replacement. https://pkg.go.dev/math/rand#Seed
|
/ok-to-test |
|
Hm, this looks flaky |
|
/retest-required |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Removes the deprecated top-level
rand.Seedcall from cloud-controller-manager and node-manager startup.The project builds with a modern Go version, where the global
math/randgenerator is already auto-seeded, so the explicitrand.Seed(...)call is no longer needed.Which issue(s) this PR fixes:
NONE
Special notes for your reviewer:
This is a cleanup-only change and does not change runtime behavior.
rand.Float64()is still used for resync jitter and continues to work as expected without an explicit seed.Does this PR introduce a user-facing change?