homek8s/apps/base/sirius-growth/scheduled-backup.yaml
devops c45255242b db(portal): migrate WAL archiving to the CNPG-I Barman Cloud plugin
CloudNativePG 1.30 deprecates spec.backup.barmanObjectStore and 1.31 removes
it, so the pin on 1.30.0 was a hard gate. This closes that gate:

- Vendors plugin-barman-cloud v0.16.0 verbatim into
  infrastructure/databases/base/upstream/ (the operator manifest's pattern),
  with a kustomize patch only for --log-level=info and resource bounds.
  v0.16.0 requires CNPG >= 1.30 and is registered through Service
  annotations; its operator<->plugin mTLS pair comes from cert-manager
  (previous commit).
- Adds ObjectStore sirius-growth/portal-wal: the literal translation of the
  retired barmanObjectStore block, with retentionPolicy 14d moved off the
  Cluster (in the plugin, retention belongs to the store).
- Cluster portal drops spec.backup entirely and gains spec.plugins
  (barman-cloud.cloudnative-pg.io, isWALArchiver, barmanObjectName
  portal-wal, serverName portal). The server name is the barman prefix, so
  the plugin keeps writing s3://pg-wal-archive/portal/{base,wals}/... — the
  same objects the in-tree archiver left behind; the 14-day window stays
  readable.
- ScheduledBackup portal-daily switches to method: plugin.
- databases waits on cert-manager; apps waits on databases (the ObjectStore
  CRD ships with the plugin).
- CNPG dashboard: the backup timestamp metric family changes name under the
  plugin, so the panel now accepts both.
2026-11-19 17:58:12 -05:00

24 lines
1,009 B
YAML

apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: portal-daily
namespace: sirius-growth
spec:
# Six-field cron (seconds first — CNPG, not standard cron). 03:20 UTC, clear
# of the 02:37 forgejo/cluster-backup CronJob so the two do not fight for the
# primary's I/O on a laptop disk.
schedule: "0 20 3 * * *"
cluster:
name: portal
# `self`: the Backup objects are owned by this ScheduledBackup, so deleting the
# schedule (or the namespace) does not leave orphaned Backups pointing at the
# cluster. Retention/cleanup of the archive itself is the ObjectStore's
# spec.retentionPolicy (14d), enforced by the plugin's sidecar.
backupOwnerReference: self
# Plugin method, not `barmanObjectStore`: the in-tree method is removed in
# CNPG 1.31. `pluginConfiguration` names the CNPG-I plugin, whose
# ObjectStore is referenced by the Cluster's spec.plugins.
method: plugin
pluginConfiguration:
name: barman-cloud.cloudnative-pg.io
immediate: false