Long sgcluster names break backups
Summary
It's possible to create an sgcluster with such a long name, that the backups will then fail.
k get sgclusters.stackgres.io
NAME VERSION INSTANCES PROFILE DISK
fidhj23guiahsfguajuihugbzfhggs-dlcjx 15.5 1 fidhj23guiahsfguajuihugbzfhggs-dlcjx 20Gi
Acquiring lock...
sgcluster.stackgres.io/suadfhsaufhughurhuwehruasdffnjvn-cpsmv annotated
Lock acquired
Creating backup CR
The SGBackup "suadfhsaufhughurhuwehruasdffnjvn-cpsmv-2024-04-29-13-06-11" is invalid: metadata.name: Too long: may not be longer than 56
Lock released
cat: /tmp/backup-push: No such file or directory
Backup failed
Current Behaviour
- StackGres does not deny the creation of such a broken instance
Steps to reproduce
- create a sgcluister with a really long name (31+ characters)
- trigger a backup and see the logs
Expected Behaviour
- StackGres should not allow to create an instance with such a long name or
- the backup handler trims the names accordingly
Possible Solution
See expected behaviour.
Environment
- StackGres version: 1.7.0 (I did not see anything in the changelogs indicating that this issue has been addressed, if so, I'll close this issue.)