Skip to content

fix: suspending KafkaBackup now suspends the underlying CronJob#25

Merged
sionsmith merged 1 commit into
mainfrom
fix/suspend-cronjob
Jun 10, 2026
Merged

fix: suspending KafkaBackup now suspends the underlying CronJob#25
sionsmith merged 1 commit into
mainfrom
fix/suspend-cronjob

Conversation

@sionsmith

Copy link
Copy Markdown
Contributor

Summary

Fixes #24 — setting spec.schedule.suspend: true on a KafkaBackup left the previously-created CronJob with suspend: false, so scheduled backups kept running.

The reconciler only applied the CronJob when the schedule was not suspended, so the (already correct) suspend value from build_backup_cronjob never reached the live resource. This PR:

  • Always applies the CronJob whenever spec.schedule is set, so spec.schedule.suspend propagates to the live CronJob via server-side apply.
  • Reports a Ready condition with the new BackupSuspended reason while suspended, and clears status.nextScheduledBackup (explicit null in a merge patch, since the status type skips None fields when serializing).
  • Releases 0.2.7 (Cargo.toml, Cargo.lock, Helm chart version/appVersion, CHANGELOG) — scripts/release-gate.sh passes locally.

Reproduction / verification

Reproduced on a kind cluster before the fix: created a KafkaBackup with a */1 * * * * schedule, patched suspend: true, and observed the CronJob stay at suspend: false and spawn a backup Job a minute later. With the fix, the suspend flag propagates on the next reconcile.

Tests

  • test_reconcile_propagates_suspend_to_cronjob / test_reconcile_applies_active_cronjob_when_not_suspended (new tests/integration/reconcile_backup_test.rs): runs the real reconcile_backup against a tower-test mock API server, recording every request — asserts the CronJob PATCH carries the CR's suspend value and the status reflects suspension. Verified the suspended-path test fails against the pre-fix code.
  • test_backup_cronjob_propagates_suspend: builder-level check that spec.schedule.suspend maps onto CronJob.spec.suspend.

🤖 Generated with Claude Code

Suspending a KafkaBackup left its previously-created CronJob with
suspend: false, so scheduled backups kept running. Always apply the
CronJob when a schedule is set so the suspend flag reaches the live
resource, report a BackupSuspended condition, and clear
nextScheduledBackup while suspended.

Add a reconciler-level regression test that runs reconcile_backup
against a mock API server and asserts the CronJob patch carries the
CR's suspend value, plus a builder-level suspend propagation test.

Release 0.2.7. Fixes #24.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sionsmith sionsmith merged commit a4d1577 into main Jun 10, 2026
7 checks passed
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.

Suspending KafkaBackup does not suspend the underlying CronJob

1 participant