Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Random suffix for snapshot/backup names is not random #82

Closed
kayrus opened this issue Jul 5, 2023 · 0 comments · Fixed by #83
Closed

[BUG] Random suffix for snapshot/backup names is not random #82

kayrus opened this issue Jul 5, 2023 · 0 comments · Fixed by #83
Labels
bug Something isn't working

Comments

@kayrus
Copy link
Contributor

kayrus commented Jul 5, 2023

Describe the bug

Golang prior to 1.20 has a fixed seed for math/rand.globalRand and backup/snapshots have the same suffix in a name.

Try to run https://go.dev/play/p/qKmDuwawK4H?v=goprev (go 1.19) several times and every time it will:

5577006791947779410
8674665223082153551
15352856648520921629
13260572831089785859
3916589616287113937

Comparing to https://go.dev/play/p/qKmDuwawK4H (go 1.20)

Steps to reproduce the behavior

Restore a snapshot and restart the velero. Then restore a new snapshot, the resulting snapshot names will have the same suffix:

2d9835a7-65e1-4728-97a0-9010a0e2a418.backup.5577006791947779410
2d9835a7-65e1-4728-97a0-9010a0e2a418.backup.5577006791947779410

Expected behavior

Velero plugin must generate unpredictable suffixes for volume/snapshot names.

This can be done by upgrading the go version to 1.20, or using the private rand object with its own seed based on timestamp.

See also golang/go#54880

@kayrus kayrus added the bug Something isn't working label Jul 5, 2023
@kayrus kayrus changed the title [BUG] Random prefix for snapshots/backups name are not random [BUG] Random prefix for snapshot/backup names is not random Jul 5, 2023
@kayrus kayrus changed the title [BUG] Random prefix for snapshot/backup names is not random [BUG] Random suffix for snapshot/backup names is not random Jul 5, 2023
@Lirt Lirt closed this as completed in #83 Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant