stashed / stash

đź›… Backup your Kubernetes Stateful Applications
https://stash.run
Other
1.31k stars 86 forks source link

NewReconcilableHandler should not be used for BackupConfiguration Informer #1404

Open Legion2 opened 2 years ago

Legion2 commented 2 years ago

Currently the custom NewReconcilableHandler informer event handler is used to filter the reconciliation events of the BackupConfiguration CR. The "optimization" which only reconciles the BC on changes, has the side effect, that all the resources which are created by the BC (CronJob...) are only updated if the BC is updated. However, if Stash itself is updated to a new version, the BC is not reconciled again resulting in inconsistent configuration for the CronJob resources. In particular, the image version in the CronJob is not updated. Example, I updated to Stash 0.17.0, however the CronJob still uses Stash 0.15.0 container images and the changes introduced in #1396 are not applied to existing CronJobs. However more critical is, that Stash does not reconcile (recreate) the state (CronJob) if someone deleted it, leaving the cluster in an inconsistent state.

Therefore it is better to delete the NewReconcilableHandler and just use a default handler, which periodically reconciles the BC.

https://github.com/stashed/stash/blob/56eeababb207ec3f9b25b4393c3e103655099ca7/pkg/controller/backup_configuration.go#L61

The current workaround is to delete and recreate the BackupConfiguration

hossainemruz commented 2 years ago

Thank you @Legion2 for reporting the issue. We will look into it.