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:
parent
f3a8233e37
commit
c45255242b
11 changed files with 1312 additions and 51 deletions
|
|
@ -245,9 +245,9 @@ cnpg = [
|
|||
{"h": 5, "w": 4, "x": 16, "y": 1},
|
||||
desc="1 = the operator is asking for a manual switchover (e.g. after a fencing event).",
|
||||
thresholds=[{"color": "green", "value": None}, {"color": "red", "value": 1}]),
|
||||
stat("Last available backup", [target('max by (namespace) (cnpg_collector_last_available_backup_timestamp{%s})' % CLUSTER_NS)],
|
||||
stat("Last available backup", [target('max by (namespace) (cnpg_collector_last_available_backup_timestamp{%s} or barman_cloud_cloudnative_pg_io_last_available_backup_timestamp{%s})' % (CLUSTER_NS, CLUSTER_NS))],
|
||||
{"h": 5, "w": 4, "x": 20, "y": 1}, unit="dateTimeAsIso",
|
||||
desc="0 = never. There are NO Backup/Cluster backup resources in this cluster (verified: `kubectl get backups.postgresql.cnpg.io -A` is empty), so a 0 here is the honest answer, not a broken panel.",
|
||||
desc="0 = never. sirius-growth/portal archives through the CNPG-I Barman Cloud plugin, which exposes its own metric family `barman_cloud_cloudnative_pg_io_*`; the in-tree `cnpg_collector_*` name is kept in the `or` for any cluster still on the deprecated path. A 0 means neither series exists.",
|
||||
thresholds=[{"color": "red", "value": None}, {"color": "green", "value": 1}]),
|
||||
|
||||
row("Throughput", 6),
|
||||
|
|
@ -280,10 +280,10 @@ cnpg = [
|
|||
desc="pg_database_size. Both PVs are 10Gi (forgejo/pg) and 5Gi (sirius-growth/portal) — this is the trend that fills them."),
|
||||
ts("WAL generation", [target('sum by (namespace) (rate(cnpg_collector_wal_bytes{%s}[5m]))' % CLUSTER_NS, "{{namespace}}")],
|
||||
{"h": 8, "w": 8, "x": 8, "y": 25}, unit="Bps",
|
||||
desc="Bytes of WAL written per second. On a cluster with no backups, WAL has nothing archiving it away."),
|
||||
desc="Bytes of WAL written per second. sirius-growth/portal archives its WAL to the Linode Garage; forgejo/pg does not archive, so its WAL only ever fills the pg_wal directory."),
|
||||
ts("WAL archiver failures", [target('max by (namespace) (cnpg_pg_stat_archiver_failed_count{%s})' % CLUSTER_NS, "{{namespace}}")],
|
||||
{"h": 8, "w": 8, "x": 16, "y": 25}, unit="short",
|
||||
desc="pg_stat_archiver.failed_count. Archiving is not configured on either cluster (no ObjectStore/backup), so treat non-zero here as 'something was attempted and failed'."),
|
||||
desc="pg_stat_archiver.failed_count. Archiving is configured only on sirius-growth/portal (Barman Cloud plugin -> Linode Garage); forgejo/pg has no archiver, so any non-zero value is the honest signal that WAL failed to reach the archive."),
|
||||
|
||||
row("Replication (single instance — panels are honest about it)", 33),
|
||||
ts("Replication lag", [target('max by (namespace) (cnpg_pg_replication_lag{%s})' % CLUSTER_NS, "{{namespace}}")],
|
||||
|
|
@ -294,9 +294,11 @@ cnpg = [
|
|||
{"h": 6, "w": 8, "x": 8, "y": 34}, unit="short",
|
||||
desc="Both clusters run instances: 1, so 0 streaming replicas and in_recovery=0 is the correct reading. A future replica would light these up with no dashboard change."),
|
||||
note("Known unknowns on the CNPG board", """\
|
||||
- **No backups exist.** `kubectl get backups.postgresql.cnpg.io -A` returns nothing; neither Cluster
|
||||
declares `spec.backup`. The "Last available backup" stat therefore reads 0 (never) — that is the
|
||||
real state, not a missing metric.
|
||||
- **Backups exist on one cluster only.** `sirius-growth/portal` archives WAL + daily base backups
|
||||
through the CNPG-I Barman Cloud plugin (`ObjectStore portal-wal`) into the Linode Garage;
|
||||
`forgejo/pg` has no archiver by design. The "Last available backup" stat reads 0 only if neither
|
||||
the plugin's `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` nor the legacy
|
||||
`cnpg_collector_last_available_backup_timestamp` series exists.
|
||||
- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas /
|
||||
in recovery are structurally zero. The panels show the zero and say so instead of hiding them.
|
||||
- **Query age vs transaction age.** CNPG's default query set exposes
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ data:
|
|||
"id": 29,
|
||||
"type": "stat",
|
||||
"title": "Last available backup",
|
||||
"description": "0 = never. There are NO Backup/Cluster backup resources in this cluster (verified: `kubectl get backups.postgresql.cnpg.io -A` is empty), so a 0 here is the honest answer, not a broken panel.",
|
||||
"description": "0 = never. sirius-growth/portal archives through the CNPG-I Barman Cloud plugin, which exposes its own metric family `barman_cloud_cloudnative_pg_io_*`; the in-tree `cnpg_collector_*` name is kept in the `or` for any cluster still on the deprecated path. A 0 means neither series exists.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
|
|
@ -440,7 +440,7 @@ data:
|
|||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "max by (namespace) (cnpg_collector_last_available_backup_timestamp{namespace=~\"$namespace\"})",
|
||||
"expr": "max by (namespace) (cnpg_collector_last_available_backup_timestamp{namespace=~\"$namespace\"} or barman_cloud_cloudnative_pg_io_last_available_backup_timestamp{namespace=~\"$namespace\"})",
|
||||
"refId": "A",
|
||||
"editorMode": "code",
|
||||
"range": true,
|
||||
|
|
@ -937,7 +937,7 @@ data:
|
|||
"id": 40,
|
||||
"type": "timeseries",
|
||||
"title": "WAL generation",
|
||||
"description": "Bytes of WAL written per second. On a cluster with no backups, WAL has nothing archiving it away.",
|
||||
"description": "Bytes of WAL written per second. sirius-growth/portal archives its WAL to the Linode Garage; forgejo/pg does not archive, so its WAL only ever fills the pg_wal directory.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
|
|
@ -994,7 +994,7 @@ data:
|
|||
"id": 41,
|
||||
"type": "timeseries",
|
||||
"title": "WAL archiver failures",
|
||||
"description": "pg_stat_archiver.failed_count. Archiving is not configured on either cluster (no ObjectStore/backup), so treat non-zero here as 'something was attempted and failed'.",
|
||||
"description": "pg_stat_archiver.failed_count. Archiving is configured only on sirius-growth/portal (Barman Cloud plugin -> Linode Garage); forgejo/pg has no archiver, so any non-zero value is the honest signal that WAL failed to reach the archive.",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
|
|
@ -1203,7 +1203,7 @@ data:
|
|||
"showLineNumbers": false,
|
||||
"showMiniMap": false
|
||||
},
|
||||
"content": "- **No backups exist.** `kubectl get backups.postgresql.cnpg.io -A` returns nothing; neither Cluster\n declares `spec.backup`. The \"Last available backup\" stat therefore reads 0 (never) \u2014 that is the\n real state, not a missing metric.\n- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas /\n in recovery are structurally zero. The panels show the zero and say so instead of hiding them.\n- **Query age vs transaction age.** CNPG's default query set exposes\n `cnpg_backends_max_tx_duration_seconds` (transaction age). Per-statement `query_start` age is not in\n the default set; adding it would need another custom query in the cluster's\n `customQueriesConfigMap`.\n- **Permissions.** Custom queries run as `cnpg_metrics_exporter`, not superuser. See\n docs/monitoring-dashboards.md for the GRANT the Forgejo Actions metrics need.\n"
|
||||
"content": "- **Backups exist on one cluster only.** `sirius-growth/portal` archives WAL + daily base backups\n through the CNPG-I Barman Cloud plugin (`ObjectStore portal-wal`) into the Linode Garage;\n `forgejo/pg` has no archiver by design. The \"Last available backup\" stat reads 0 only if neither\n the plugin's `barman_cloud_cloudnative_pg_io_last_available_backup_timestamp` nor the legacy\n `cnpg_collector_last_available_backup_timestamp` series exists.\n- **Single instance.** Both clusters run `instances: 1`, so replication lag / streaming replicas /\n in recovery are structurally zero. The panels show the zero and say so instead of hiding them.\n- **Query age vs transaction age.** CNPG's default query set exposes\n `cnpg_backends_max_tx_duration_seconds` (transaction age). Per-statement `query_start` age is not in\n the default set; adding it would need another custom query in the cluster's\n `customQueriesConfigMap`.\n- **Permissions.** Custom queries run as `cnpg_metrics_exporter`, not superuser. See\n docs/monitoring-dashboards.md for the GRANT the Forgejo Actions metrics need.\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue