Skip to content

K8SPS-435: don't run scheduled backup when cluster is not ready#1234

Draft
pooknull wants to merge 1 commit intomainfrom
K8SPS-435
Draft

K8SPS-435: don't run scheduled backup when cluster is not ready#1234
pooknull wants to merge 1 commit intomainfrom
K8SPS-435

Conversation

@pooknull
Copy link
Contributor

https://perconadev.atlassian.net/browse/K8SPS-435

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

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 PS version?
  • Does the change support oldest and newest supported Kubernetes version?

Copilot AI review requested due to automatic review settings March 13, 2026 15:33
@pull-request-size pull-request-size bot added the size/S 10-29 lines label Mar 13, 2026
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

Adds a readiness gate for scheduled backups so they don’t run while the PerconaServerMySQL cluster is not Ready, with an opt-out unsafe flag to preserve prior behavior when needed.

Changes:

  • Skip scheduled backup execution when status.state != Ready unless spec.unsafeFlags.backupIfUnhealthy is enabled.
  • Introduce unsafeFlags.backupIfUnhealthy in the API type and CRD OpenAPI schemas.
  • Update sample CR (deploy/cr.yaml) to document the new unsafe flag.

Reviewed changes

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

Show a summary per file
File Description
pkg/controller/ps/backup.go Adds the runtime check to skip scheduled backups when the cluster isn’t ready (unless overridden).
api/v1/perconaservermysql_types.go Adds BackupIfUnhealthy to UnsafeFlags API.
config/crd/bases/ps.percona.com_perconaservermysqls.yaml Updates CRD base schema to include unsafeFlags.backupIfUnhealthy.
deploy/crd.yaml Updates shipped CRD manifest with the new field schema.
deploy/bundle.yaml Updates operator bundle CRD schema with the new field.
deploy/cw-bundle.yaml Updates CW bundle CRD schema with the new field.
deploy/cr.yaml Documents the new unsafe flag in the example CR.

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

You can also share your feedback on Copilot code review. Take the survey.

}

if cr.Status.State != apiv1.StateReady && !cr.Spec.Unsafe.BackupIfUnhealthy {
log.Info("Skipping scheduled backup because cluster is not ready", "cluster", cr.Name, "namespace", cr.Namespace, "state", cr.Status.State, "job", backupJob.Name)
Comment on lines +89 to +92
if cr.Status.State != apiv1.StateReady && !cr.Spec.Unsafe.BackupIfUnhealthy {
log.Info("Skipping scheduled backup because cluster is not ready", "cluster", cr.Name, "namespace", cr.Namespace, "state", cr.Status.State, "job", backupJob.Name)
return
}
@JNKPercona
Copy link
Collaborator

Test Name Result Time
async-ignore-annotations-8-4 failure 00:00:00
async-global-metadata-8-4 failure 00:00:00
async-upgrade-8-0 failure 00:00:00
async-upgrade-8-4 failure 00:00:00
auto-config-8-4 failure 00:00:00
config-8-4 failure 00:00:00
config-router-8-0 failure 00:00:00
config-router-8-4 failure 00:00:00
demand-backup-minio-8-0 failure 00:00:00
demand-backup-minio-8-4 failure 00:00:00
demand-backup-cloud-8-4 failure 00:00:00
demand-backup-retry-8-4 skipped 00:00:00
async-data-at-rest-encryption-8-0 skipped 00:00:00
async-data-at-rest-encryption-8-4 skipped 00:00:00
gr-global-metadata-8-4 skipped 00:00:00
gr-data-at-rest-encryption-8-0 skipped 00:00:00
gr-data-at-rest-encryption-8-4 skipped 00:00:00
gr-demand-backup-minio-8-4 skipped 00:00:00
gr-demand-backup-cloud-8-4 skipped 00:00:00
gr-demand-backup-haproxy-8-4 skipped 00:00:00
gr-finalizer-8-4 skipped 00:00:00
gr-haproxy-8-0 skipped 00:00:00
gr-haproxy-8-4 skipped 00:00:00
gr-ignore-annotations-8-4 skipped 00:00:00
gr-init-deploy-8-0 skipped 00:00:00
gr-init-deploy-8-4 skipped 00:00:00
gr-one-pod-8-4 skipped 00:00:00
gr-recreate-8-4 skipped 00:00:00
gr-scaling-8-4 skipped 00:00:00
gr-scheduled-backup-8-4 skipped 00:00:00
gr-security-context-8-4 skipped 00:00:00
gr-self-healing-8-4 skipped 00:00:00
gr-tls-cert-manager-8-4 skipped 00:00:00
gr-users-8-4 skipped 00:00:00
gr-upgrade-8-0 skipped 00:00:00
gr-upgrade-8-4 skipped 00:00:00
haproxy-8-0 skipped 00:00:00
haproxy-8-4 skipped 00:00:00
init-deploy-8-0 skipped 00:00:00
init-deploy-8-4 skipped 00:00:00
limits-8-4 skipped 00:00:00
monitoring-8-4 skipped 00:00:00
one-pod-8-0 skipped 00:00:00
one-pod-8-4 skipped 00:00:00
operator-self-healing-8-4 skipped 00:00:00
pvc-resize-8-4 skipped 00:00:00
recreate-8-4 skipped 00:00:00
scaling-8-4 skipped 00:00:00
scheduled-backup-8-0 skipped 00:00:00
scheduled-backup-8-4 skipped 00:00:00
service-per-pod-8-4 skipped 00:00:00
sidecars-8-4 skipped 00:00:00
smart-update-8-4 skipped 00:00:00
storage-8-4 skipped 00:00:00
telemetry-8-4 skipped 00:00:00
tls-cert-manager-8-4 skipped 00:00:00
users-8-0 skipped 00:00:00
users-8-4 skipped 00:00:00
version-service-8-4 skipped 00:00:00
Summary Value
Tests Run 11/59
Job Duration 00:09:51
Total Test Time N/A

commit: ba00f80
image: perconalab/percona-server-mysql-operator:PR-1234-ba00f804

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S 10-29 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants