Skip to main content

PostgresDatabase

resourceType postgresql · provider azure-shared · sharing Private · cleanup Orphan

Provisions a PostgreSQL database and a scoped login role that owns it on a shared PostgreSQL server (via provider-sql). The target server is discovered at reconcile time from the shared cluster's published EnvironmentConfig — its host and the provider-sql ProviderConfig name are NOT baked in and NOT set here; only which shared cluster to select (sharedProvider) is. Server-side database/role names are namespaced to avoid collisions — read dbname/username from the connection secret rather than assuming the literal dbName.

Request it​

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

resourceRequirements:
- resourceType: postgresql
provider: azure-shared # selects this backend — the cluster default may differ
resourceName: my-postgresql # your handle — drives the env-var prefix + secret name

Parameters​

NameTypeRequiredDefaultDescription
dbNamestringno—Application database name. Defaults to the claim name. The actual server-side name is namespaced ({namespace}-{dbName}) to avoid collisions on a shared server — read dbname from the connection secret for the real value.
ownerstringno—Role/owner name for the database (also namespaced). Defaults to dbName.
sharedProviderstringno—Which shared PostgreSQL backend this database lands on — selects that backend's published EnvironmentConfig (matched on its provider label) for the server host/port and provider-sql ProviderConfig. No default: the value comes from the requesting capability's defaultParameters (postgresql--azure-shared supplies azure), never baked into this backend-agnostic XRD.

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
databaseNameServer-side database name created.
roleNameServer-side role name created.

Auto-generated from the PostgresDatabase XRD + postgresql--azure-shared ResourceCapability. Do not edit by hand.