Bug #114363 MySQL Operator - Cleanup backup jobs
Submitted: 15 Mar 2024 5:26 Modified: 15 Mar 2024 20:26
Reporter: Prasad Kris Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Operator Severity:S4 (Feature request)
Version:8.3.0-2.1.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: innodb, mysql-operator

[15 Mar 2024 5:26] Prasad Kris
Description:
We have got a handful of InnoDB clusters managed by the mysql operator, and it works great in general. We have defined daily backups into our minio cluster (using InnoDBCluster.spec.backupProfiles and InnoDBCluster.spec.backupSchedules). The backups work fine, but the issue is that there is currently no way to provide a backup retention in the manifests, and it doesn't clean up the kubernetes job created by the backup process once the backup is completed, leaving us to manually take care of the cleanup. It would be great if the operator takes care of the cleanup of the unwanted k8s job once the backup process is complete, or provide a way to specify the retention in the InnoDBCluster.spec.backupProfile or in InnoDBCluster.spec.backupSchedules, so that we can configure it. This way, the mysqlbackups.mysql.oracle.com job and the corresponding k8s job are cleaned up automatically by the operator once the retention is met.

As you can see from below, we have about 10 clusters and there are around 2500+ kubernetes laying around unnecessarily:)

```
kubectl get jobs.batch| grep backup | wc -l
2574
```

How to repeat:
This behavior can be observed by creating a cluster with a backup schedule
[15 Mar 2024 20:26] MySQL Verification Team
Thanks. I will be filing this under feature request. I think we already have it in the list.