Repository navigation
Implement plugin based backups - #510
DRSchlaubi wants to merge 10 commits into
Conversation
Signed-off-by: Michael Rittmeister <[email protected]>
There was a problem hiding this comment.
🟡 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]>
There was a problem hiding this comment.
🟡 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
Honor plugin backup method and skip snapshot-only setup · New Propagate additional CNPG plugins through cluster rendering and reconciliation · New Add and propagate a required name for additional plugins · New Copy plugin settings when creating scheduled backups · New Fix the method enum marker and regenerate CRD schemas · New Regenerate deep-copy code for updated specs in both API packages · New Preserve explicit false for the plugin enabled flag · New
3 resolved since last review
3 files not reviewed
operator/src/api/preview/backup_types.go: Generated fileoperator/src/api/preview/documentdb_types.go: Generated fileoperator/src/api/preview/scheduledbackup_types.go: Generated file
Review effort: Balanced
| // can either be 'volumeSnapshot' or 'plugin' | ||
| // defaults to 'volumeSnapshot' | ||
| // +kubebuilder:default=volumeSnapshot | ||
| Method BackupMethod `json:"method"` |
|
|
||
| // AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded | ||
| // +optional | ||
| AdditionalCNPGPlugins []AdditionalPluginSpec `json:"additionalCNPGPlugins,omitempty"` |
| } | ||
|
|
||
| // 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"` |
|
|
||
| // AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded | ||
| // +optional | ||
| AdditionalCNPGPlugins []AdditionalPluginSpec `json:"additionalCNPGPlugins,omitempty"` |
Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
|
Any feedback on the new schema before I start work on the actual implementation |
There was a problem hiding this comment.
🟡 Changes recommended
Critical defaulting regressions break existing scheduled backups, while reconciliation ignores the selected backup method and plugin configurations.
7 open issues
Empty method prevents scheduled backups from receiving the CRD default · New Empty method causes scheduled Backup admission to fail · New Copy plugin settings when creating scheduled backups Add and propagate a required name for additional plugins Propagate additional CNPG plugins through cluster rendering and reconciliation Honor plugin backup method and skip snapshot-only setup Regenerate deep-copy code for updated specs in both API packages
2 resolved since last review
5 files not reviewed
operator/src/api/preview/backup_types.go: Generated fileoperator/src/api/preview/documentdb_types.go: Generated fileoperator/src/api/preview/scheduledbackup_types.go: Generated fileoperator/src/api/preview/zz_generated.deepcopy.go: Generated fileoperator/src/api/v1/zz_generated.deepcopy.go: Generated file
Review effort: Balanced
| // 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]>
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (api, manifests); effort from diff stats (378+0 LOC, 14 files) If a label is wrong, ping |
WentingWu666666
left a comment
There was a problem hiding this comment.
Thanks for contributing this! I’ve left two small API questions for discussion, but the overall direction looks good to me.
| // PluginConfiguration defines additional parameters passed to the plugin | ||
| // only relevant if method=plugin | ||
| // +optional | ||
| PluginConfiguration map[string]string `json:"pluginConfiguration,omitempty"` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
|
||
| // AdditionalCNPGPlugins defines which additional CNPG plugins should be loaded | ||
| // +optional | ||
| AdditionalCNPGPlugins []cnpgv1.PluginConfiguration `json:"additionalCNPGPlugins,omitempty"` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I never liked additionalCNPG plugins myself but couldn't think of anything better, but yeah plugins.additional probably is better
Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
Signed-off-by: Michael Rittmeister <[email protected]>
|
Also can any one explain how these govulncheck warnings are related to this or, because they look unrelated to me |
hossain-rayhan
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
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! |


Fixes #498