Skip to content

Comments

Pause scheduled backups#18

Merged
eminano merged 3 commits intomainfrom
pause-scheduled-backups
Aug 28, 2025
Merged

Pause scheduled backups#18
eminano merged 3 commits intomainfrom
pause-scheduled-backups

Conversation

@eminano
Copy link
Contributor

@eminano eminano commented Aug 27, 2025

This PR updates the scale to zero sidecar behaviour to suspend the cluster scheduled backups if any after the cluster is successfully hibernated to prevent errors.

https://cloudnative-pg.io/documentation/1.26/backup/#pause-scheduled-backups

@eminano eminano requested a review from Copilot August 27, 2025 16:01
Copy link
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 implements the ability to pause scheduled backups when a cluster is hibernated by the scale-to-zero sidecar, preventing backup errors on inactive clusters.

  • Adds RBAC permissions for scheduledbackups resources
  • Implements scheduled backup management functionality in the sidecar
  • Updates documentation to reflect the new backup pause behavior

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
manifest.yaml Adds scheduledbackups to RBAC resources
manifest-dev.yaml Adds scheduledbackups to RBAC resources
kubernetes/rbac.yaml Updates RBAC to include scheduledbackups with required verbs
internal/sidecar/sidecar.go Registers ScheduledBackup types in the runtime scheme
internal/sidecar/scale_to_zero_test.go Adds comprehensive test coverage for scheduled backup scenarios
internal/sidecar/scale_to_zero.go Implements core backup pause logic and cluster client interface
internal/sidecar/helper_test.go Adds mock methods for scheduled backup operations
internal/sidecar/cluster_client.go Implements scheduled backup client operations
doc/examples/cluster-example.yaml Adds example ScheduledBackup resource
doc/development.md Documents new scheduled backup management features
README.md Updates documentation with backup management information

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@simonapencea
Copy link

Not sure where to add this comment, so adding it here:there is a corner case where we may still have issues:

if we try to hibernate a cluster while a full backup that the scheduledbackup triggered is going on.

I think the easiest would be to not hibernate until the backup completes. However, it would be complicated to expose this to the customer as of right now, since we are not exposing backups to them yet.
After we expose the backups to the customer, we could go for something like that - basically say - we cannot hibernate your cluster, because it is during the backup window and there is an active backup
Is that easy to add?

Alternatively, we could hibernate and let the backup fail, but that would potentially give us some unusable files in S3. We need to probably test a bit to see exactly what happens and what would be more straightforward for us.

But for now, this is a big improvement already.

@eminano eminano merged commit 9a565e3 into main Aug 28, 2025
4 checks passed
@eminano eminano deleted the pause-scheduled-backups branch August 28, 2025 09:25
@github-actions
Copy link

🧹 PR Resources Cleaned Up

Since this PR has been merged, the following test resources have been automatically deleted:

  • Container images: pr-18-*
  • Kubernetes manifest artifacts

Thanks for testing! 🎉

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