mysql-operator
mysql-operator copied to clipboard
Change BackupRemoteDeletePolicy but didn't work
If I specify under crontab to take backups. I noticed that the following fields need to be set
https://github.com/bitpoke/mysql-operator/blob/d8ec7b442aa2130a406442e58396336b555ff13b/pkg/apis/mysql/v1alpha1/mysqlcluster_types.go#L74-L96
When I edit the BackupRemoteDeletePolicy
(The default is retain
but I want to change it to delete
). This modification didn't work.The remoteDeletePolicy
inside the new mysqlbackup
object is still the same as the original value.I have tried several times with the same result. Is it just me, or is this the desired result?
I think the cause of the problem may be here.
This function could add a logic to compare whether j.BackupRemoteDeletePolicy
is the same or not
https://github.com/bitpoke/mysql-operator/blob/d8ec7b442aa2130a406442e58396336b555ff13b/pkg/controller/mysqlbackupcron/mysqlbackupcron_controller.go#L154-L199
Or we can set the default value of RemoteDeletePolicy
in this function.
https://github.com/bitpoke/mysql-operator/blob/d8ec7b442aa2130a406442e58396336b555ff13b/pkg/internal/mysqlbackup/defaults.go#L24-L30
RemoteDeletePolicy
belongs to MysqlBackupSpec
. I think this approach might be better?(not sure)
Nice catch! May be the first method is better, because it's better to unit test and it's more consistent with already code.