# Dedicated CNPG Postgres for Temporal (GitOps, wave 2 — before temporal w8). # Temporal needs TWO databases: `temporal` (initdb) + `temporal_visibility` # (Database CR). CNPG generates secret `temporal-db-app` + service # `temporal-db-rw` in ns temporal; temporal-values reads them locally. apiVersion: postgresql.cnpg.io/v1 kind: Cluster metadata: name: temporal-db namespace: temporal annotations: argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true spec: instances: 3 imageName: ghcr.io/cloudnative-pg/postgresql:16.2 bootstrap: initdb: database: temporal owner: app encoding: UTF8 localeCollate: C localeCType: C enableSuperuserAccess: false resources: requests: { memory: "512Mi", cpu: "250m" } limits: { memory: "2Gi", cpu: "1" } storage: size: 10Gi storageClass: longhorn-cnpg monitoring: enablePodMonitor: true affinity: podAntiAffinityType: preferred topologyKey: kubernetes.io/hostname tolerations: - key: node-role.kubernetes.io/control-plane operator: Exists effect: NoSchedule --- # Second database Temporal requires (visibility store), on the same cluster. apiVersion: postgresql.cnpg.io/v1 kind: Database metadata: name: temporal-visibility namespace: temporal spec: name: temporal_visibility owner: app cluster: name: temporal-db