Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ deploy_operator() {
fi
yq eval '.spec.template.spec.containers[0].image = "'${IMAGE}'"' "${DEPLOY_DIR}/${cw_prefix}operator.yaml" \
| yq eval '(.spec.template.spec.containers[] | select(.name=="operator") | .env[] | select(.name=="DISABLE_TELEMETRY") | .value) = "'${disable_telemetry}'"' - \
| yq eval '(.spec.template.spec.containers[] | select(.name=="operator") | .env[] | select(.name=="LOG_LEVEL") | .value) = "DEBUG"' - \
| kubectl -n "${OPERATOR_NS:-$NAMESPACE}" apply -f -
}

Expand Down
1 change: 0 additions & 1 deletion percona/controller/pgbackup/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func (r *PGBackupReconciler) Reconcile(ctx context.Context, request reconcile.Re
if err != nil {
return reconcile.Result{}, errors.Wrap(err, "failed to create exec client")
}

latestRestorableTime, err := watcher.GetLatestCommitTimestamp(ctx, r.Client, execCli, pgCluster, pgBackup)
if err == nil {
log.Info("Got latest restorable timestamp", "timestamp", latestRestorableTime)
Expand Down
4 changes: 4 additions & 0 deletions percona/controller/pgcluster/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func (r *PGClusterReconciler) reconcileBackups(ctx context.Context, cr *v2.Perco
func (r *PGClusterReconciler) cleanupOutdatedBackups(ctx context.Context, cr *v2.PerconaPGCluster) error {
log := logging.FromContext(ctx)

if !cr.Spec.Backups.IsEnabled() {
return nil
}

if cr.Status.State != v2.AppStateReady {
return nil
}
Expand Down
10 changes: 9 additions & 1 deletion percona/watcher/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func GetWALWatcher(cr *pgv2.PerconaPGCluster) (string, WALWatcher) {
func WatchCommitTimestamps(ctx context.Context, cli client.Client, eventChan chan event.GenericEvent, stopChan chan event.DeleteEvent, cr *pgv2.PerconaPGCluster) {
log := logging.FromContext(ctx).WithName("WALWatcher")

if !cr.Spec.Backups.IsEnabled() {
return
}

log.Info("Watching commit timestamps")

execCli, err := clientcmd.NewClient()
Expand All @@ -61,6 +65,11 @@ func WatchCommitTimestamps(ctx context.Context, cli client.Client, eventChan cha
return
}

if !localCr.Spec.Backups.IsEnabled() {
log.Info("Backups are disabled, stopping WAL watcher")
return
}

latestBackup, err := getLatestBackup(ctx, cli, localCr)
if err != nil {
if !errors.Is(err, errRunningBackup) && !errors.Is(err, errNoBackups) {
Expand All @@ -69,7 +78,6 @@ func WatchCommitTimestamps(ctx context.Context, cli client.Client, eventChan cha

continue
}

ts, err := GetLatestCommitTimestamp(ctx, cli, execCli, localCr, latestBackup)
if err != nil {
switch {
Expand Down
Loading