Repository navigation
fix(backups): migrate CNPG backups from native barmanObjectStore to the barman-cloud plugin (#3300) - #3308
Closed
Andrey Kolkov (androndo) wants to merge 4 commits into
Closed
fix(backups): migrate CNPG backups from native barmanObjectStore to the barman-cloud plugin (#3300)#3308Andrey Kolkov (androndo) wants to merge 4 commits into
Andrey Kolkov (androndo) wants to merge 4 commits into
Conversation
Native spec.backup.barmanObjectStore is deprecated in CNPG 1.27 and removed in 1.29, and the standard postgresql image variant this platform pins no longer ships the barman-cloud-* binaries (cozystack#3300). Vendor the CloudNativePG Barman Cloud plugin (chart plugin-barman-cloud 0.7.0, appVersion v0.13.0) alongside the CNPG operator so it is co-located in cozy-postgres-operator — CNPG discovers plugins by the cnpg.io/pluginName Service label in its own namespace. Ships the ObjectStore CRD, the plugin Deployment, and cert-manager-issued mTLS between operator and plugin. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
Replace the deprecated native spec.backup.barmanObjectStore path with the CloudNativePG barman-cloud plugin across the CNPG backup surface (cozystack#3300). - backup driver (internal/backupcontroller): SSA-apply a barmancloud.cnpg.io ObjectStore carrying the S3/barman config and SSA-patch the Cluster's spec.plugins to reference it, instead of writing spec.backup.barmanObjectStore; Backup CRs now use method=plugin + pluginConfiguration. cnpgtypes gains ObjectStore, spec.plugins and Backup.pluginConfiguration (hand-written deepcopy). serverName rides on the Cluster plugin parameter (the plugin forbids it in the ObjectStore). - backupstrategy-controller: grant the driver RBAC over barmancloud.cnpg.io/objectstores; regenerate the CNPG strategy CRD doc. - apps/postgres: render spec.plugins + a backup ObjectStore (and a recovery ObjectStore for bootstrap via externalClusters[].plugin), and a method=plugin ScheduledBackup, replacing the inline barmanObjectStore. - Update driver unit tests and chart tests to the plugin/ObjectStore shape. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
The scheduler-admission mutating webhook shipped by linstor-scheduler-extender v0.3.2 decodes every incoming pod through a stale vendored k8s.io/api (v0.25) and re-encodes it, emitting a JSON patch that removes any field unknown to that schema — including initContainers[].restartPolicy — from ALL pods cluster-wide (empty objectSelector, no namespaceSelector). That strips native/restartable sidecars, which the CloudNativePG barman-cloud plugin relies on, so CNPG instance Pods are rejected with 'startupProbe forbidden without restartPolicy=Always'. This is a hard prerequisite for cozystack#3300. v0.3.5 (piraeus linstor-scheduler-extender PR cozystack#19) rewrites the webhook to emit a targeted RFC 6902 JSON patch that only sets spec.schedulerName, preserving every other pod field. Pin extender.image.tag to v0.3.5. See piraeusdatastore/piraeus-operator#1025 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…mission webhook Supersedes the interim extender.image.tag override with a full vendored-chart bump to upstream 0.2.5 (appVersion v0.3.5) — 'as in upstream'. Upstream removed the scheduler-admission mutating webhook in this release (piraeus-operator#1025): that webhook (extender v0.3.2) decoded every pod through a stale vendored k8s.io/api (v0.25) and re-encoded it, stripping fields unknown to that schema — including initContainers[].restartPolicy — from ALL pods cluster-wide, which broke the CloudNativePG barman-cloud plugin's native sidecar (cozystack#3300) and collapsed image VolumeSources (KubeVirt). Consequence of dropping the webhook: pods are no longer auto-assigned spec.schedulerName=linstor-scheduler; they use the default scheduler and LINSTOR data locality becomes advisory (the extender still runs as a kube-scheduler plugin for workloads that opt in via schedulerName). Also drops the obsolete disable-ca-key-rotation patch (targeted the removed admission cert). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Andrey Kolkov <[email protected]>
11 tasks
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.
Fixes #3300.
Problem
CNPG backups are broken on 1.6: the pinned
*-standard-*PostgreSQL image no longer ships thebarman-cloud-*binaries, but cozystack still configures the nativespec.backup.barmanObjectStore, so backups (and WAL archiving) fail withexec: "barman-cloud-backup": executable file not found in $PATH. Native Barman Cloud is deprecated in CNPG 1.27 and removed in 1.29.What this does
Adopts the CloudNativePG Barman Cloud Plugin across the CNPG backup surface.
feat(postgres-operator): vendor CloudNativePG barman-cloud plugin— vendors theplugin-barman-cloudchart (0.7.0 / appVersion v0.13.0) alongside the CNPG operator so it is co-located incozy-postgres-operator(CNPG discovers plugins by thecnpg.io/pluginNameService label in its own namespace). Ships theObjectStoreCRD, the plugin Deployment, and cert-manager-issued mTLS between operator and plugin.fix(backups): migrate CNPG backups to the barman-cloud plugin— the core migration:internal/backupcontroller): SSA-applies abarmancloud.cnpg.io/ObjectStorecarrying the S3/barman config and SSA-patches the Cluster'sspec.pluginsto reference it, instead of writingspec.backup.barmanObjectStore.BackupCRs now usemethod: plugin+pluginConfiguration.cnpgtypesgainsObjectStore,spec.plugins, andBackup.pluginConfiguration.serverNamerides on the Cluster plugin parameter (the plugin forbids it in the ObjectStore).barmancloud.cnpg.io/objectstores; strategy CRD doc regenerated. Thecozy-default-cnpgstrategy template is unchanged (its barman config maps 1:1 onto the ObjectStore).spec.plugins+ a backupObjectStore(and a recoveryObjectStorefor bootstrap viaexternalClusters[].plugin) and amethod: pluginScheduledBackup.fix(linstor-scheduler): bump linstor-scheduler-extender to v0.3.5— required prerequisite (see below).The barman-cloud plugin injects its backup/WAL sidecar as a native (restartable) sidecar — an init container with
restartPolicy: Always+ astartupProbe. This is not configurable on the plugin side.The
linstor-scheduler-admissionmutating webhook shipped by linstor-scheduler-extender v0.3.2 (current) decodes every pod through a stale vendoredk8s.io/api(v0.25) and re-encodes it, emitting a patch that strips any field unknown to that schema — includinginitContainers[].restartPolicy— from ALL pods cluster-wide (empty objectSelector, no namespaceSelector). That silently removes the sidecar'srestartPolicy, so the API server then rejects the CNPG instance Pod withstartupProbe ... Forbidden ... without restartPolicy=Always. This affects any cozystack cluster using LINSTOR, not just backups (it also collapsesimagevolume sources → broke KubeVirt containerDisks).v0.3.5 (piraeus linstor-scheduler-extender#19, fixing piraeus-operator#1025) rewrites the webhook to emit a targeted RFC 6902 JSON patch that only sets
spec.schedulerName, preserving every other field. This PR pinsextender.image.tag: v0.3.5. Without it, the plugin cannot run on cozystack. (This bump is arguably worth landing on its own regardless of #3300.)Verification
go build/go test ./internal/backupcontroller/...green;gofmt/go vetclean.helm unittestgreen: apps/postgres (26), postgres-operator (22), backupstrategy-controller (10), linstor-scheduler (2).Registered plugin: barman-cloud.cloudnative-pg.io. TheObjectStoreCRD installs and a Cluster getsspec.pluginswired.restartPolicy-stripping bug above; it needs the linstor-scheduler-extender v0.3.5 bump deployed to the (shared) cluster to complete. The root cause is fully diagnosed and the fix is in this PR.Notes
main(fork-sync couldn't fast-forward past workflow-scope-gated commits); happy to rebase.main, so there is nothing to convert there; they simply must not reintroduce native barman.🤖 Generated with Claude Code