[ci skip] codify CNPG PostgreSQL in Terraform, decommission old NFS-backed PG

Phase 1 complete — PostgreSQL fully migrated off NFS:

dbaas module changes:
- Replace old kubernetes_deployment.postgres with null_resource.pg_cluster
  (CNPG Cluster CR managed via kubectl apply due to webhook mutation issues)
- Update postgresql Service selector: app=postgresql → cnpg primary
- Update backup CronJob: use postgres user + read password from CNPG secret
  (pg-cluster-superuser) instead of hardcoded root password
- Add kube_config_path variable for kubectl in null_resource
- Old deployment deleted from cluster (was scaled to 0)

CNPG cluster status:
- 2 instances: primary (k8s-node4), replica (k8s-node2)
- PostGIS image (ghcr.io/cloudnative-pg/postgis:16)
- 20Gi local-path storage per instance
- All 13 dependent services verified running
- Backup CronJob verified working with new endpoint
This commit is contained in:
Viktor Barzin 2026-02-28 19:23:36 +00:00
parent 2d3be0ca74
commit 5be70fb955
No known key found for this signature in database
GPG key ID: 0EB088298288D958
2 changed files with 94 additions and 93 deletions

View file

@ -141,6 +141,7 @@ module "dbaas" {
dbaas_root_password = var.dbaas_root_password
postgresql_root_password = var.dbaas_postgresql_root_password
pgadmin_password = var.dbaas_pgadmin_password
kube_config_path = var.kube_config_path
tier = local.tiers.cluster
}