K8SPG-954 | add backup type to snapshot backup#1465
Merged
Conversation
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the PerconaPGBackup status reporting so that snapshot-based backups (volumeSnapshot method) populate .status.backupType, aligning them with pgBackRest backups that already expose backup type in status.
Changes:
- Add a new
PGBackupTypeSnapshotconstant to represent snapshot backups. - Set
.status.backupTypetosnapshotwhen a snapshot backup transitions toStarting.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/apis/pgv2.percona.com/v2/perconapgbackup_types.go | Adds PGBackupTypeSnapshot to the backup type constants used in status. |
| percona/controller/pgbackup/snapshots/reconcile.go | Sets Status.BackupType for snapshot backups during the initial status transition. |
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Comment on lines
152
to
156
| if updErr := r.backup.UpdateStatus(ctx, r.cl, func(bcp *v2.PerconaPGBackup) { | ||
| bcp.Status.State = v2.BackupStarting | ||
| bcp.Status.BackupType = v2.PGBackupTypeSnapshot | ||
| }); updErr != nil { | ||
| return reconcile.Result{}, errors.Wrap(updErr, "failed to update backup status") |
There was a problem hiding this comment.
- Problem:
BackupTypeis only set during theBackupNew -> BackupStartingtransition, so snapshot backups that are already inStarting/Running/Succeeded/Failed(e.g., during an operator upgrade) will still keep an empty.status.backupType. - Why it matters: This can leave the status inconsistent with the intended fix and makes upgrade behavior dependent on which state the backup was in at the time of reconciliation.
- Fix: Ensure
.status.backupTypeis populated for snapshot backups whenever it is empty (e.g., set it at the beginning ofreconcile()or inreconcileStarting/reconcileRunningupdateStatus calls as well).
egegunes
approved these changes
Mar 3, 2026
nmarukovich
approved these changes
Mar 3, 2026
Collaborator
commit: 62aafb6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGE DESCRIPTION
Problem:
Backups taken using the snapshot method do not have the
.status.backupTypestatusSolution:
Add this information to the status
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability