fix(restore): label each Velero Restore with the id of its restore
FA
5d ago+68+68+01234567890123456789-5-5-0123456789
Stacked on #631. This pull request targets the branch of #631 (034-backup-rename-description). After #631 merges, retarget it to develop.
Summary
ADR-073 requires every Kubernetes object that Styrmin creates for a record to carry a label with the record's id. #631 adds the label styrmin.io/backup-id to the Velero Backup. The Velero Restore was already named styrmin-<restore id>, but it had no label with the restore's id. With this change, an operator can select the Velero Restore of a restore by its id:
kubectl get restores.velero.io -n styrmin -l styrmin.io/restore-id=<restore id>
Key changes
- Every new Velero
Restorehas the labelstyrmin.io/restore-idwith the id of the Styrmin restore. This applies to in-place restores, environment restores and the restores that an environment clone runs.build_velero_restoretakes the new required argumentrestore_id.execute_restore_workflowpasses the id of the Restore record that it read.
- Velero
Restoreobjects that earlier versions created keep their labels. Nothing in Styrmin updates or deletes VeleroRestoreobjects, so the older objects need no migration.
Documentation updates
docs/docs/concepts-and-architecture/backups-and-restores.md, "What happens when you restore": the name and the label of the VeleroRestore, with thekubectlcommand.dev/knowledge/backend/backup-restore.md, "Builders": the label thatbuild_velero_restoresets.- Changelog fragment
changelog/+velero-restore-id-label.added.md.
Test plan
- Unit tests:
backend/tests/unit/agent/test_backup_builders.pychecks the label on in-place and cross-target restores.test_restore_workflow_labels_the_velero_restore_with_the_restore_idinbackend/tests/unit/workflows/test_restore_steps.pychecks that the flow passes the restore's id.- The backend unit suite passed locally: 5318 passed, 1 skipped.
uv run invoke format lintpassed locally.- E2E:
test_backup_and_restore_lifecycle(shardbackup) now reads the VeleroRestorestyrmin-<restore id>after the restore completes and checks itsstyrmin.io/restore-idlabel.- The test did not run locally. The local Docker uses the classic (non-containerd) image store, so vCluster in Docker turns off its registry proxy, and the images that the fixtures build never reach the cluster. The
chart-serverpod stayed inImagePullBackOffduring fixture setup, before the test body ran. - This pull request relies on the CI shard
E2E Tests (api / backup)and its UI variant for this test.
- The test did not run locally. The local Docker uses the classic (non-containerd) image store, so vCluster in Docker turns off its registry proxy, and the images that the fixtures build never reach the cluster. The