Bug 1970338: Fix lookup for migmigration by UID so it returns true when exists #1191
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background info on fix:
At the beginning of the migration process we try to clean up old Velero CRs to unblock the system.
We use various tests to determine if a backup is "stale" and worthy of deletion. One of those tests is to check if there is another running migration linked with an in-progress Backup. If we find this, we won't delete the Backup.
The function responsible for checking whether a migration is associated with the backup was always returning false because it was doing a lookup on migmigrations with an invalid labelSelector that would never return any results.
This means that when two migrations are running, one of them in the BackupCreated phase, one of them in the CleanStaleBackups phase, the second migration will clobber the first migrations active backup
To resolve this, I added a usable label to the migmigration so we can lookup by UID, then used that label in the faulty function. I am no longer seeing failures when running parallel migrations.