Skip to content

Commit

Permalink
improve disableRestore
Browse files Browse the repository at this point in the history
  • Loading branch information
pooknull committed Dec 20, 2024
1 parent 0e32ee7 commit 37af2e4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions percona/controller/pgrestore/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,25 @@ func disableRestore(ctx context.Context, c client.Client, pg *v2.PerconaPGCluste
fvar := false
pg.Spec.Backups.PGBackRest.Restore.Enabled = &fvar

delete(pg.Annotations, naming.LabelPGBackRestRestore)

if err := c.Patch(ctx, pg, client.MergeFrom(orig)); err != nil {
return errors.Wrap(err, "patch PGCluster")
}

postgresCluster := new(v1beta1.PostgresCluster)
if err := c.Get(ctx, client.ObjectKeyFromObject(pg), postgresCluster); err != nil {
return errors.Wrap(err, "get PostgresCluster")
}

origPostgres := postgresCluster.DeepCopy()

postgresCluster.Status.PGBackRest.Restore = new(v1beta1.PGBackRestJobStatus)

if err := c.Status().Patch(ctx, postgresCluster, client.MergeFrom(origPostgres)); err != nil {
return errors.Wrap(err, "patch PGCluster")
}

return nil
}

Expand Down

0 comments on commit 37af2e4

Please sign in to comment.