Skip to content

Documentdb backup-restore addons - #2431

Open
Sabnaj-42 wants to merge 7 commits into
masterfrom
documentdb-backup
Open

Documentdb backup-restore addons#2431
Sabnaj-42 wants to merge 7 commits into
masterfrom
documentdb-backup

Conversation

@Sabnaj-42

@Sabnaj-42 Sabnaj-42 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added backup and restore support for DocumentDB databases.
    • Supports logical, physical, and manifest-based backup and restore workflows.
    • Added DocumentDB version 17.2 catalog support for compatible operations.
    • Enabled DocumentDB support by default in the KubeStash catalog.
    • Added configurable backup and restore command arguments.
    • Added DocumentDB settings and schema support across supported database configurations.
    • Updated DocumentDB version metadata to use the PostgreSQL plugin version field.

Sabnaj-42 and others added 2 commits September 1, 2026 19:22
The addon was applied by hand; add it to kubedb-kubestash-catalog so it installs
with KubeDB/KubeStash like every other database. Adds the DocumentDB feature gate
(present in kubedb-catalog but missing here), a documentdb values section, and
five templates following the postgres naming convention: documentdb-backup,
documentdb-restore, documentdb-physical-backup, documentdb-physical-backup-restore
and documentdb-addon.

The logical tasks are declared for parity and are not usable - the plugin refuses
a DocumentDB target because pg_dump cannot capture the extension-owned collection
catalog, so a logical snapshot would restore with no collections. Shipping them
named correctly means selecting one fails immediately with that reason instead of
the task simply not existing.

documentdb-physical-backup-restore pins its tag instead of using .
A physical restore targets the data PVC directly, since the database does not
exist while waitForInitialRestore holds the gate closed, and KubeStash resolves
 from an AppBinding named after the target - so it looks for
AppBinding/data-<db>-0 and the session fails before the job is created.

DocumentDBVersion gains addonPostgresVersion: "17.2", the version published on
the <db>-admin AppBinding and the one that resolves  for the backup
Functions. Without it the operator does not create that AppBinding at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: sabnaj <sabnaj@appscode.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 12:01

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.

🟡 Changes recommended

Generated artifacts/API schema sources aren’t updated to fully reflect the new DocumentDB values/addon behavior, and there’s conflicting documentation in the new values section.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds DocumentDB backup/restore addon support by extending the KubeStash catalog chart and DocumentDBVersion metadata so KubeStash can dispatch the Postgres-based plugin correctly for DocumentDB.

Changes:

  • Enable DocumentDB via chart feature gates and add DocumentDB-specific values.
  • Introduce DocumentDB KubeStash Addon + Functions (logical + physical backup/restore) using kubedb/postgres-restic-plugin.
  • Add spec.addonPostgresVersion to DocumentDBVersion CRD/manifests (and set it for DocumentDB 0.109.0).
File summaries
File Description
charts/kubedb-kubestash-catalog/values.yaml Enables DocumentDB and adds chart values for DocumentDB backup/restore args.
charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-addon.yaml Defines the documentdb-addon with logical/physical backup+restore tasks.
charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-backup.yaml Adds the logical backup Function for DocumentDB.
charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-restore.yaml Adds the logical restore Function for DocumentDB.
charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-physical-backup.yaml Adds the physical backup Function for DocumentDB.
charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-physical-backup-restore.yaml Adds the physical restore Function for DocumentDB with a pinned backend version tag.
charts/kubedb-crds/crds/catalog.kubedb.com_documentdbversions.yaml Extends the DocumentDBVersion CRD schema with addonPostgresVersion.
charts/kubedb-certified-crds/crds/catalog.kubedb.com_documentdbversions.yaml Mirrors the CRD schema change for the certified CRDs chart.
charts/kubedb-catalog/crds/catalog.kubedb.com_documentdbversions.yaml Mirrors the CRD schema change for the catalog chart.
charts/kubedb-catalog/templates/documentdb/documentdb-0.109.0.yaml Sets addonPostgresVersion: "17.2" for DocumentDB 0.109.0 in the chart template.
catalog/kubedb/raw/documentdb/documentdb-0.109.0.yaml Sets addonPostgresVersion: "17.2" in the raw catalog manifest (with explanatory comment).
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

featureGates:
ClickHouse: true
Cassandra: true
DocumentDB: true
Comment on lines +6 to +10
# The Postgres version the backend actually runs, in the x.y form the KubeStash addon dispatches
# on. Published as spec.version on the <db>-admin AppBinding, which is what resolves ${DB_VERSION}
# in the documentdb-* Function image tags. Without it the operator does not create that
# AppBinding at all and backup has nothing to target.
addonPostgresVersion: "17.2"
Comment thread charts/kubedb-kubestash-catalog/values.yaml Outdated
Sabnaj-42 and others added 3 commits September 2, 2026 18:56
Signed-off-by: sabnaj <sabnaj@appscode.com>
Signed-off-by: sabnaj <sabnaj@appscode.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sabnaj-42 <106393405+Sabnaj-42@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 3ffd74e0-0df7-413f-91f2-9eaa395d79cd

📥 Commits

Reviewing files that changed from the base of the PR and between 8696b75 and e1d4609.

📒 Files selected for processing (7)
  • catalog/kubedb/raw/documentdb/documentdb-0.109.0.yaml
  • catalog/kubestash/raw/documentdb/documentdb-physical-backup-function.yaml
  • catalog/kubestash/raw/documentdb/documentdb-physical-backup-restore-function.yaml
  • charts/kubedb-catalog/crds/catalog.kubedb.com_documentdbversions.yaml
  • charts/kubedb-catalog/templates/documentdb/documentdb-0.109.0.yaml
  • charts/kubedb-certified-crds/crds/catalog.kubedb.com_documentdbversions.yaml
  • charts/kubedb-crds/crds/catalog.kubedb.com_documentdbversions.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • catalog/kubestash/raw/documentdb/documentdb-physical-backup-restore-function.yaml
  • catalog/kubestash/raw/documentdb/documentdb-physical-backup-function.yaml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The catalog adds the postgresPluginVersion contract and DocumentDB version metadata. It adds configuration support, gated KubeStash Functions, and an Addon for logical, physical, and manifest backup and restore workflows.

Changes

DocumentDB backup and restore

Layer / File(s) Summary
DocumentDB version contract
charts/kubedb-catalog/..., charts/kubedb-crds/..., charts/kubedb-certified-crds/..., catalog/kubedb/raw/documentdb/...
The DocumentDBVersion schemas now define spec.postgresPluginVersion. The pg17-0.109.0 catalog entry sets it to 17.2.
DocumentDB catalog configuration
apis/installer/..., bundle/manifests/..., config/crd/..., charts/kubedb-kubestash-catalog/values.yaml, charts/kubedb-kubestash-catalog/values.openapiv3_schema.yaml, charts/kubedb-kubestash-catalog/README.md, charts/kubedb/values.openapiv3_schema.yaml, catalog/kubestash/fmt/main.go
DocumentDB becomes a configured database with backup and restore argument fields. The feature gate is enabled by default. The API, generated deep copy, schemas, documentation, and formatter include the new configuration.
DocumentDB KubeStash Functions
catalog/kubestash/raw/documentdb/*, charts/kubedb-kubestash-catalog/templates/documentdb/*
The catalog adds gated logical and physical backup and restore Functions. The Functions use postgres-restic-plugin, version 17.2, and configurable arguments.
DocumentDB Addon workflows
catalog/kubestash/raw/documentdb/documentdb-addon.yaml, charts/kubedb-kubestash-catalog/templates/documentdb/documentdb-addon.yaml
The Addon connects logical, physical, and manifest backup and restore tasks. Physical restore mounts the ${PVC_NAME} data volume.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant DocumentDBVersion
  participant DocumentDBAddon
  participant KubeStashFunction
  participant PostgresResticPlugin
  DocumentDBVersion->>DocumentDBAddon: provide postgresPluginVersion 17.2
  DocumentDBAddon->>KubeStashFunction: dispatch backup or restore task
  KubeStashFunction->>PostgresResticPlugin: execute configured operation
  PostgresResticPlugin-->>DocumentDBAddon: process backup or restore data
Loading

Suggested reviewers: sheikh-arman, 1gtm

Merge Risk: ⚪ Minimal · up to e1d46

The DocumentDB backup and restore catalog additions have no established merge-blocking failure in the current change.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (7 skipped: 7 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding DocumentDB backup and restore addons. It is concise and specific enough for the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (7 skipped: 7 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch documentdb-backup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

# Nothing here passes a DocumentDB-specific parameter - the plugin branches on the AppBinding's
# appRef Kind, the same way it does for Druid.
apiVersion: addons.kubestash.com/v1alpha1
kind: Addon

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

addon, function should be included in catalog/kubestash/raw/documentdb

Signed-off-by: sabnaj <sabnaj@appscode.com>
Signed-off-by: sabnaj <sabnaj@appscode.com>
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