Skip to content

Implement plugin based backups - #510

Draft
DRSchlaubi wants to merge 10 commits into
documentdb:mainfrom
DRSchlaubi:feature/plugins
Draft

DRSchlaubi wants to merge 10 commits into
documentdb:mainfrom
DRSchlaubi:feature/plugins

Conversation

@DRSchlaubi

@DRSchlaubi DRSchlaubi commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #498

Signed-off-by: Michael Rittmeister <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 19:06
@DRSchlaubi
DRSchlaubi marked this pull request as draft November 12, 2026 19:07

Copilot AI left a comment

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.

🟡 Changes recommended

Critical API and propagation gaps prevent plugin options from taking effect: backups still use volume snapshots, scheduled backups omit plugin configuration, and additional plugins are never loaded.

3 open issues
What changed in this PR

This PR extends DocumentDB CRD schemas with settings for plugin-based backups and additional CloudNative-PG plugins.

Changes:

  • Adds backup-method selection and plugin configuration to the v1 Backup and preview ScheduledBackup schemas.
  • Adds additional CNPG plugin configuration to the preview DocumentDB schema.
File Description
operator/​src/​config/​crd/​bases/​documentdb.io_scheduledbackups.yaml Adds method and plugin settings for scheduled backups.
operator/​src/​config/​crd/​bases/​documentdb.io_dbs.yaml Adds additional CNPG plugin settings, including WAL archiver selection.
operator/​src/​config/​crd/​bases/​documentdb.io_backups.yaml Adds method and plugin settings for individual backups.

Review effort: Balanced

Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>

Copilot AI left a comment

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.

🟡 Changes recommended

Critical integration gaps leave additional CNPG plugins unapplied, route plugin backups through snapshot logic, and cause schedules to discard the requested backend configuration.

7 open issues
3 resolved since last review
3 files not reviewed
  • operator/src/api/preview/backup_types.go: Generated file
  • operator/src/api/preview/documentdb_types.go: Generated file
  • operator/src/api/preview/scheduledbackup_types.go: Generated file

Review effort: Balanced

Comment thread operator/src/api/v1/backup_types.go Outdated
// can either be 'volumeSnapshot' or 'plugin'
// defaults to 'volumeSnapshot'
// +kubebuilder:default=volumeSnapshot
Method BackupMethod `json:"method"`
Comment thread operator/src/api/v1/documentdb_types.go Outdated

// AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded
// +optional
AdditionalCNPGPlugins []AdditionalPluginSpec `json:"additionalCNPGPlugins,omitempty"`
Comment thread operator/src/api/v1/documentdb_types.go Outdated
}

// AdditionalPluginSpec defines how to install an additional plugin.
type AdditionalPluginSpec struct {
// can either be 'volumeSnapshot' or 'plugin'
// defaults to 'volumeSnapshot'
// +kubebuilder:default=volumeSnapshot
Method BackupMethod `json:"method"`
Comment thread operator/src/api/v1/backup_types.go Resolved
Comment thread operator/src/api/v1/documentdb_types.go Outdated

// AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded
// +optional
AdditionalCNPGPlugins []AdditionalPluginSpec `json:"additionalCNPGPlugins,omitempty"`
Comment thread operator/src/api/v1/documentdb_types.go Resolved
Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
@DRSchlaubi

Copy link
Copy Markdown
Contributor Author

Any feedback on the new schema before I start work on the actual implementation

Copilot AI left a comment

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.

🟡 Changes recommended

Critical defaulting regressions break existing scheduled backups, while reconciliation ignores the selected backup method and plugin configurations.

7 open issues
2 resolved since last review
5 files not reviewed
  • operator/src/api/preview/backup_types.go: Generated file
  • operator/src/api/preview/documentdb_types.go: Generated file
  • operator/src/api/preview/scheduledbackup_types.go: Generated file
  • operator/src/api/preview/zz_generated.deepcopy.go: Generated file
  • operator/src/api/v1/zz_generated.deepcopy.go: Generated file

Review effort: Balanced

Comment thread operator/src/api/v1/backup_types.go Outdated
// can either be 'volumeSnapshot' or 'plugin'
// defaults to 'volumeSnapshot'
// +kubebuilder:default=volumeSnapshot
Method BackupMethod `json:"method"`
// can either be 'volumeSnapshot' or 'plugin'
// defaults to 'volumeSnapshot'
// +kubebuilder:default=volumeSnapshot
Method BackupMethod `json:"method"`
Signed-off-by: Michael Rittmeister <[email protected]>
@documentdb-triage-tool documentdb-triage-tool Bot added the go Pull requests that update go code label Nov 12, 2026
@documentdb-triage-tool

Copy link
Copy Markdown

🤖 Auto-triaged by documentdb-triage-tool.

Applied: go
Project fields suggested: Component api · Priority P2 · Effort L · Status In Progress
Confidence: 0.95 (deterministic)

Reasoning

component from path globs (api, manifests); effort from diff stats (378+0 LOC, 14 files)

If a label is wrong, ping @patty-chow so the rules can be tuned. Issues with component labels are left alone; PR component labels are reconciled from changed paths on every run.

@WentingWu666666 WentingWu666666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for contributing this! I’ve left two small API questions for discussion, but the overall direction looks good to me.

Comment thread operator/src/api/v1/backup_types.go Outdated
// PluginConfiguration defines additional parameters passed to the plugin
// only relevant if method=plugin
// +optional
PluginConfiguration map[string]string `json:"pluginConfiguration,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was wondering whether there’s a reason to use map[string]string for pluginConfiguration instead of CNPG’s BackupPluginConfiguration https://github.com/cloudnative-pg/cloudnative-pg/blob/v1.29.2/api/v1/backup_types.go#L147 in both Backup and ScheduledBackup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The very simple reason is, that I simply forgot to change it there, initially I didn't know that there is cnpg already imported, so I mapped everything manually, but totally valid point will fix

Comment thread operator/src/api/v1/documentdb_types.go Outdated

// AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded
// +optional
AdditionalCNPGPlugins []cnpgv1.PluginConfiguration `json:"additionalCNPGPlugins,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I understand why you chose AdditionalCNPGPlugins, since spec.plugins is already used. Would spec.plugins.additional work instead? That would keep plugin settings grouped together while preserving the familiar configuration structure for CNPG users.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I never liked additionalCNPG plugins myself but couldn't think of anything better, but yeah plugins.additional probably is better

@DRSchlaubi DRSchlaubi changed the title Update CRDs Implement plugin based backups Nov 16, 2026
@DRSchlaubi

Copy link
Copy Markdown
Contributor Author

Also can any one explain how these govulncheck warnings are related to this or, because they look unrelated to me

@hossain-rayhan hossain-rayhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No blocking comment. Just two wording/comment.

Lets add the implementation.

method:
default: volumeSnapshot
description: |-
Method defines with method should be used to create a backup

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: reads a little odd. Do we need to reward or break sentences?

properties:
additional:
description: Additional defines which additional CNPG plugins
should be loaded

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is an interesting config. A clear message would be helpful.

// Additional lists extra CloudNativePG plugins to load on the cluster, alongside
// the built-in sidecar injector, for example the Barman Cloud plugin for WAL
// archiving and object-store backups. Names must be unique and must not match
// the built-in plugins.
// +listType=map
// +listMapKey=name

@WentingWu666666

Copy link
Copy Markdown
Collaborator

Also can any one explain how these govulncheck warnings are related to this or, because they look unrelated to me

You’re right—those failures were unrelated to your changes. We fixed the underlying Go vulnerability in #508, and all govulncheck jobs now pass on your PR. Thanks for flagging it!

This branch has not been deployed

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

Labels

go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Barman Cloud backups

4 participants