Restore from latest backup onto new cluster


I’m trying to create an automatic distaster recovery setup using the operator and Argo CD. In such setup, Argo CD should deploy a manifest which deploys a cluster and restores its latest backup.

The backups have been performed beforehands by the original cluster using the schedule feature of the PXC CRD. In that way, the backup folders are all named like “cluster4-2023-07-26-19:12:07-full”, for example.

My problem is the following: the Restore CRD, as it stands today, has to explicilty include the folder name fo the backup it needs to restore. If there are several different folders, it has to point to the most recent one. Is there a way that it automatically retrieves the most recent one without needing to declare it?

The reason I ask for that is that it would be much simpler to have a general manifest that doesn’t have to be updated for each cluster as new backups are created.


I will suggest creating a symlink like “latest” after your backup ends add some script to create the symlink every time your backups end. So your recent backup will point to the latest. e.g

latest → cluster4-2023-07-26-19:12:07-full

Thanks for your suggestion. Is there a way to configure the CRD such that a script or a pod is run after the backup ends to automate this task?