Skip to content

Fix expire not running when target PVC is deleted before backup expires#276

Merged
molpako merged 4 commits into
mainfrom
fix-expire
Jun 11, 2026
Merged

Fix expire not running when target PVC is deleted before backup expires#276
molpako merged 4 commits into
mainfrom
fix-expire

Conversation

@llamerada-jp

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes MantleBackup expiration handling so backups can still be deleted (or scheduled for deletion) even when the backup’s target PVC disappears before the backup reaches its expiry time.

Changes:

  • Update expire to return a boolean indicating whether reconciliation should stop after requesting deletion.
  • Invoke expire earlier in reconcileLocalBackup and reconcileAsSecondary, before attempting to resolve the snapshot target (PVC/PV).
  • Remove the later expire calls that could be skipped when getSnapshotTarget fails.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/mantlebackup_controller.go Outdated
Comment thread internal/controller/mantlebackup_controller.go Outdated
Comment thread internal/controller/mantlebackup_controller.go
Comment thread internal/controller/mantlebackup_controller.go Outdated
@llamerada-jp llamerada-jp force-pushed the fix-expire branch 3 times, most recently from 05b0bd9 to 96e4490 Compare May 8, 2026 04:58
@llamerada-jp llamerada-jp requested a review from molpako May 8, 2026 07:12
@llamerada-jp llamerada-jp marked this pull request as ready for review May 8, 2026 07:13
@llamerada-jp llamerada-jp requested a review from a team as a code owner May 8, 2026 07:13
@llamerada-jp llamerada-jp force-pushed the fix-expire branch 2 times, most recently from 43ea3fc to cc1c6ed Compare May 18, 2026 11:08
@llamerada-jp llamerada-jp requested a review from Copilot May 18, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

internal/controller/mantlebackup_controller.go:521

  • This early expiration path has the same cleanup gap for secondary backups: if the target PVC is gone, finalization gets targetPVCNotFound=true and skips removeRBDSnapshot, so the MantleBackup can be removed while the imported RBD snapshot remains. Please make the deletion path clean up the snapshot using persisted manifest/status data instead of relying on the live PVC lookup.
	if stopProcessing, err := r.expire(ctx, backup); stopProcessing || err != nil {
		return requeueReconciliation(), err
	}

Comment thread internal/controller/mantlebackup_controller.go
Comment thread internal/controller/mantlebackup_controller_test.go
@molpako molpako removed their request for review May 22, 2026 02:50
@llamerada-jp llamerada-jp removed the request for review from molpako May 22, 2026 02:50
@llamerada-jp llamerada-jp requested a review from Copilot June 4, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown

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 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread internal/testutil/resources.go
Comment thread internal/controller/mantlebackup_controller.go

Copilot AI left a comment

Copy link
Copy Markdown

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 10 out of 11 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • internal/ceph/ceph_mock.go: Language not supported

Comment thread internal/testutil/resources.go
Comment thread internal/controller/mantlebackup_controller.go
Comment thread internal/controller/mantlebackup_controller.go
@llamerada-jp llamerada-jp requested a review from molpako June 9, 2026 09:19
Comment thread internal/controller/mantlebackup_controller.go Outdated
Comment thread internal/controller/mantlebackup_controller.go
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
Comment thread internal/controller/mantlebackup_controller.go Outdated
Comment thread internal/testutil/resources.go
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
@molpako molpako merged commit 134eca9 into main Jun 11, 2026
15 checks passed
@molpako molpako deleted the fix-expire branch June 11, 2026 06:37
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.

3 participants