Skip to content

K8SPG-954 | add backup type to snapshot backup#1465

Merged
mayankshah1607 merged 4 commits into
mainfrom
K8SPG-954
Mar 3, 2026
Merged

K8SPG-954 | add backup type to snapshot backup#1465
mayankshah1607 merged 4 commits into
mainfrom
K8SPG-954

Conversation

@mayankshah1607
Copy link
Copy Markdown
Member

CHANGE DESCRIPTION

Problem:
Backups taken using the snapshot method do not have the .status.backupType status

Solution:
Add this information to the status

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings March 2, 2026 13:56
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PGBackupTypeSnapshot constant to represent snapshot backups.
  • Set .status.backupType to snapshot when a snapshot backup transitions to Starting.

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.

Comment thread percona/controller/pgbackup/snapshots/reconcile.go
Comment thread percona/controller/pgbackup/snapshots/reconcile.go
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
@mayankshah1607 mayankshah1607 marked this pull request as ready for review March 3, 2026 04:56
Copilot AI review requested due to automatic review settings March 3, 2026 04:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

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")
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Problem: BackupType is only set during the BackupNew -> BackupStarting transition, so snapshot backups that are already in Starting/Running/Succeeded/Failed (e.g., during an operator upgrade) will still keep an empty .status.backupType.
  2. 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.
  3. Fix: Ensure .status.backupType is populated for snapshot backups whenever it is empty (e.g., set it at the beginning of reconcile() or in reconcileStarting/reconcileRunning updateStatus calls as well).

Copilot uses AI. Check for mistakes.
@egegunes egegunes added this to the v2.9.0 milestone Mar 3, 2026
@JNKPercona
Copy link
Copy Markdown
Collaborator

Test Name Result Time
backup-enable-disable passed 00:10:24
builtin-extensions passed 00:05:30
cert-manager-tls passed 00:06:17
custom-envs passed 00:19:33
custom-extensions passed 00:14:32
custom-tls passed 00:06:07
database-init-sql passed 00:02:28
demand-backup passed 00:23:17
demand-backup-offline-snapshot passed 00:13:25
dynamic-configuration passed 00:03:17
finalizers passed 00:04:19
init-deploy passed 00:02:59
huge-pages passed 00:03:40
monitoring passed 00:07:45
monitoring-pmm3 passed 00:08:36
one-pod passed 00:06:09
operator-self-healing passed 00:10:30
pg-tde passed 00:09:21
pitr passed 00:11:45
scaling passed 00:05:18
scheduled-backup passed 00:31:48
self-healing passed 00:10:05
sidecars passed 00:03:02
standby-pgbackrest passed 00:12:05
standby-streaming passed 00:09:44
start-from-backup passed 00:14:28
tablespaces passed 00:07:17
telemetry-transfer passed 00:04:27
upgrade-consistency passed 00:05:36
upgrade-minor passed 00:05:21
users passed 00:05:38
Summary Value
Tests Run 31/31
Job Duration 01:35:38
Total Test Time 04:44:56

commit: 62aafb6
image: perconalab/percona-postgresql-operator:PR-1465-62aafb623

@mayankshah1607 mayankshah1607 merged commit 3b0607b into main Mar 3, 2026
16 checks passed
@mayankshah1607 mayankshah1607 deleted the K8SPG-954 branch March 3, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants