When testing changes for
KEYCLOAK-12027 I noticed that collecting the KeycloakBackup Current State is very inconsistent.
The BackupState#Read method puts the same Job object in both LocalPersistentVolumeJob as well as AwsJob. This may lead to setting the ready flag in the CR too early.
Also, the BackupState#IsResourcesReady method should return false if none of the Jobs are found. Currently it returns true.
All the bugs mentioned the above makes the new, migrated Pod to start prematurely (before the actual backup is created).
Steps to reproduce:
- Spin up Keycloak using the Operator with Migration.Backups.Enabled set to true.
- Migrate to the a new version (I often use 10.0.0 and 9.0.2 and migrate between those two for the sake of this test).
- Observe that a new Keycloak Pods boot up before the actual backup is created.