feat: restore topic selection and per-CR job service account (0.2.8)#28
Merged
Conversation
Two gaps reported against multi-purpose use of the operator: KafkaRestore had no way to restore a subset of topics even though the kafka-backup CLI honours target.topics include/exclude filtering. Add spec.topics (shared TopicSelection: glob or ~-prefixed regex patterns, matched against source topic names before topicMapping renames) and emit target.topics in the generated restore config. Backup/restore Jobs run in the CR's namespace but always referenced the operator-wide service account (BACKUP_JOB_SERVICE_ACCOUNT), which is namespace-scoped — so any CR outside the operator's namespace produced Jobs whose pods could never be created. Add spec.template.pod.serviceAccountName to both CRDs, applied as a pod template override that takes precedence over the operator-wide default. Sync the regenerated CRDs into the Helm chart, document the multi-namespace service account behaviour, and add builder- and config-level regression tests for both features. Release 0.2.8. Fixes #26, #27. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two additive CRD features, released together as 0.2.8:
KafkaRestore.spec.topics— restore specific topics (#26)The kafka-backup CLI has always honoured
target.topicsinclude/exclude filtering on restore, but the operator never exposed it — every restore pulled all topics from the backup.KafkaRestorenow accepts the sameTopicSelectiontheKafkaBackupCRD uses:Patterns match source topic names in the backup manifest, before
topicMappingrenames. Omitted = restore everything (unchanged default). Verified the pinned default image (kafka-backup:v0.15.6) supports this on both restore paths.spec.template.pod.serviceAccountNameon both CRDs (#27)Backup/restore Jobs run in the CR's namespace but always referenced the operator-wide service account (
BACKUP_JOB_SERVICE_ACCOUNT). Service accounts are namespace-scoped, so any CR outside the operator's namespace produced Jobs whose pods could never be created:Both CRDs now accept a per-resource override that takes precedence over the operator-wide default, applied uniformly to backup Jobs, restore Jobs, and scheduled CronJobs:
Compatibility
helm templateoutput is unchanged for existing values (default and custombackupJobs.serviceAccountName).deploy/helm/.../crds/) are synced with the regenerateddeploy/crds/. As usual, Helm only installs CRDs on first install — existing deployments shouldkubectl apply -f deploy/crds/when upgrading.Verification
cargo fmt --check, clippy (zero warnings),helm lint, andscripts/release-gate.shall pass.backup-system:KafkaBackup/KafkaRestorein a different namespace (kafka) with the SA override: Jobs created with the per-CR SA, pods scheduled (SuccessfulCreate) — previously a hardFailedCreate.target.topicswith the include/exclude lists; aspec.topicsmanifest that the API server previously rejected withunknown fieldnow validates.Follow-up (not in this PR)
A missing service account currently leaves the CR reporting the job as running while the Job controller retries pod creation forever. Worth a separate issue: surface
FailedCreateJob events as aReady=Falsecondition.Fixes #26. Fixes #27.
🤖 Generated with Claude Code