Skip to main content

PostgresCluster

resourceType postgresql · provider cnpg · sharing Private · cleanup Orphan

Provisions a dedicated CloudNativePG cluster with an application database and owner role (via bootstrap.initdb), continuous backups to object storage, and the cloud backup storage + identity primitives.

Request it​

Add this to your PlatformApplication's spec.resourceRequirements (optional parameters are in the table below):

resourceRequirements:
- resourceType: postgresql
provider: cnpg # selects this backend — the cluster default may differ
resourceName: my-postgresql # your handle — drives the env-var prefix + secret name
parameters:
dbName: "<value>"

Parameters​

NameTypeRequiredDefaultDescription
dbNamestringyes—Name of the application database to create on the dedicated cluster.
ownerstringno—Owner role (application user) for the database. Defaults to dbName.
instancesstringno3Number of Postgres instances (1 primary + replicas).
storageSizestringno20GiPersistent volume size per instance (e.g. 20Gi).
postgresVersionstringno16PostgreSQL major version (CNPG image tag).
backupRetentionstringno30dBackup retention policy (e.g. 30d).
provisionStoragestringnotrueProvision the backup bucket + identity and enable managed backups: 'true' or 'false'. When 'false', the cluster is created without backups.
nodeCapacityTypestringno—Pin instance pods to a Karpenter capacity type via a nodeSelector on 'karpenter.sh/capacity-type'. Leave unset to accept whatever the NodePool offers. The target NodePool must permit the requested type, or the pods stay Pending.
doNotDisruptstringnofalseAnnotate instance pods with 'karpenter.sh/do-not-disrupt' so Karpenter will not voluntarily disrupt the nodes running them. This blocks consolidation AND drift, so those nodes stop picking up AMI/config rollouts until the pods move — prefer it as a targeted fix for churn, not a default.

Connection​

On grant, a connection secret is published with these tokens and injected into your workload as {RESOURCENAME}_{TOKEN} (UPPER_SNAKE) — e.g. resourceName: my-postgresql → MY_POSTGRESQL_HOST, MY_POSTGRESQL_PORT, …:

  • host
  • port
  • username
  • password
  • dbname

Status​

FieldDescription
clusterNameName of the CNPG cluster.
databaseNameName of the application database.

Auto-generated from the PostgresCluster XRD + postgresql--cnpg ResourceCapability. Do not edit by hand.