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.
This commit is contained in:
devops 2026-11-19 17:58:12 -05:00
commit c45255242b
11 changed files with 1312 additions and 51 deletions

View file

@ -0,0 +1,51 @@
# The WAL archive for Cluster sirius-growth/portal, in the CNPG-I Barman Cloud
# plugin's own CR instead of Cluster.spec.backup.barmanObjectStore.
#
# Same store, same layout: destinationPath is the *bucket root* and the plugin
# appends the server name (Cluster.spec.plugins[].parameters.serverName, set to
# `portal`), so the existing objects stay exactly where the in-tree archiver put
# them — s3://pg-wal-archive/portal/{base,wals}/... . Anything that changes the
# prefix silently abandons the 14-day window that is already in the bucket.
#
# `spec.configuration` is the literal translation of the retired
# `spec.backup.barmanObjectStore` block (same schema, same Secret), and
# `retentionPolicy` moved here from Cluster.spec.backup.retentionPolicy — in the
# plugin architecture retention is a property of the store, not the cluster.
#
# Credentials: Secret sirius-growth/portal-wal-s3 (Garage key `cnpg-portal-wal`,
# id GK7f2b4bb1fc9abaec50fde37b, RW on bucket `pg-wal-archive` only), created
# out of band. The key values are deliberately not in git.
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: portal-wal
namespace: sirius-growth
spec:
configuration:
destinationPath: s3://pg-wal-archive
endpointURL: http://10.10.0.5:3900
s3Credentials:
accessKeyId:
name: portal-wal-s3
key: ACCESS_KEY_ID
secretAccessKey:
name: portal-wal-s3
key: ACCESS_SECRET_KEY
region:
name: portal-wal-s3
key: REGION
# gzip on both directions: this is a WAL stream over the WireGuard mesh into
# a 20 GB store on the Linode, so bytes on the wire and in the bucket are
# the cost. Must match what the in-tree archiver wrote (gzip) — the
# archive is read by segment, but a mismatch in base-backup compression
# would make the existing base backups unrestorable.
wal:
compression: gzip
maxParallel: 2
data:
compression: gzip
jobs: 2
# Enforced by the plugin instance sidecar every 30 min (default
# retentionPolicyIntervalSeconds) with barman-cloud's retention logic, i.e.
# the same 14-day window the in-tree archiver maintained.
retentionPolicy: "14d"