Files
railiance-platform/helm/gitea-db-cluster.yaml
tegwick 1a5b65a338 RAILIANCE-WP-0003 T02-T06: provision shared apps-pg cnpg cluster
Adds the shared CloudNativePG cluster apps-pg for S5 application
databases:
- helm/apps-pg-cluster.yaml — Cluster CR, PG 16, 1 instance, 10Gi
- helm/apps-pg-networkpolicies.yaml — egress-to-kube-api +
  ingress-from-cnpg-operator + label-based ingress opt-in
  (railiance.io/postgres-client=apps-pg)
- helm/apps-pg-secret.sops.yaml.template — bootstrap credential
  template (encrypt with SOPS before committing the real .sops.yaml)
- Makefile targets: apps-pg-deploy, apps-pg-status (with cnpg-plugin
  fallback), apps-pg-shell (apps_admin/apps_meta), apps-pg-logs
- docs/apps-pg.md (codex) — consumer onboarding contract clarifying
  the CNPG 1.28 role/database lifecycle boundary

Also fixes helm/gitea-db-cluster.yaml: spec.postgresql.version is not
a valid CNPG v1 field (strict decoding rejects it). Replaced with
spec.imageName matching the live cluster (postgresql:18.1-system-trixie)
so make db-deploy is a no-op instead of an apply rejection.

Live state at commit time: Cluster apps-pg in healthy state, primary
apps-pg-1 Running, smoke-tested via psql from a labeled temp ns.

Co-Authored-By: codex <noreply@openai.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 04:50:40 +02:00

47 lines
1.5 KiB
YAML

---
# cnpg Cluster for Gitea database
# Managed by railiance-platform (S3). Operator lives in cnpg-system namespace.
#
# Apply: kubectl apply -f helm/gitea-db-cluster.yaml
# Status: kubectl cnpg status gitea-db -n databases
#
# Pre-condition: gitea-db-credentials Secret must exist in databases namespace.
# Create it (one-time, do NOT commit plaintext):
# kubectl create secret generic gitea-db-credentials \
# --namespace databases \
# --from-literal=username=gitea \
# --from-literal=password=<password>
# Then encrypt with SOPS and commit helm/gitea-db-secret.sops.yaml.
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: gitea-db
namespace: databases
labels:
app.kubernetes.io/name: gitea-db
app.kubernetes.io/component: database
app.kubernetes.io/managed-by: manual
railiance.io/layer: s3-platform
spec:
instances: 1 # bump to 3 when node RAM > 8GB
# spec.postgresql.version is not a real CNPG v1 field; use imageName.
# Live cluster was upgraded to PG 18.1; match the live state so
# `make db-deploy` (kubectl apply) is a no-op rather than a rejection.
imageName: ghcr.io/cloudnative-pg/postgresql:18.1-system-trixie
storage:
size: 10Gi
bootstrap:
initdb:
database: gitea
owner: gitea
secret:
name: gitea-db-credentials
# Connection pooler can be added later:
# managed:
# services:
# additional:
# - selectorType: rw
# serviceTemplate:
# metadata:
# name: gitea-db-pooler-rw