Skip to content

Commit

Permalink
K8SPG-493: disable scheduled backups when .spec.pause: true
Browse files Browse the repository at this point in the history
  • Loading branch information
pooknull committed Jan 19, 2024
1 parent 8c8c59f commit 62dd837
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions percona/controller/pgcluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ func (r *PGClusterReconciler) SetupWithManager(mgr manager.Manager) error {
if err := r.CrunchyController.Watch(source.Kind(mgr.GetCache(), &batchv1.Job{}), r.watchBackupJobs()); err != nil {
return errors.Wrap(err, "unable to watch jobs")
}
if err := r.CrunchyController.Watch(source.Kind(mgr.GetCache(), &v2.PerconaPGBackup{}), r.watchPGBackups()); err != nil {
return errors.Wrap(err, "unable to watch pg-backups")
}

return builder.ControllerManagedBy(mgr).
For(&v2.PerconaPGCluster{}).
Expand Down
4 changes: 4 additions & 0 deletions percona/controller/pgcluster/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ func (r *PGClusterReconciler) createScheduledBackup(log logr.Logger, backupName,
}
return err
}
if cr.Status.State != v2.AppStateReady {
log.Info("Cluster is not ready. Can't start scheduled backup")
return nil
}

pb := &v2.PerconaPGBackup{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 62dd837

Please sign in to comment.