The database reef
Every command of the database reef: a PostgreSQL per Database, owned by a node of the tenancy tree
O reef database
Todos os comandos do reef database: um PostgreSQL por Database, de um nó da árvore de tenancy
nereus database create keycloak gives Keycloak a PostgreSQL that keeps its data (#653, for #498 (a persistent Keycloak)). The contract is small (owner, engine); the provider is the Mandate's (ADR 0017: resource reefs, a small contract kind per family, the provider in the Mandate).
O nereus database create keycloak dá ao Keycloak um PostgreSQL que guarda os dados (#653, para o #498 (um Keycloak persistente)). O contrato é pequeno (owner, engine); o provedor é do Mandate (ADR 0017: resource reefs, um kind de contrato pequeno por família, o provedor no Mandate).
What makes a Database?
O que faz uma Database?
The database reef: one kind, Database
O reef database: um kind, Database
# The release reef with flux comes first: the Nereid releases the operator through it$ nereus reef apply database✓ core/reefs/database 0.1.0 created (database.getnereus.dev/v1alpha1: databases) Next steps: nereus database --help nereus nereid apply <nereid> --reef database
nereus init --profile internal-developer-platform runs this, the Nereid and its Mandate, a line each.
O nereus init --profile internal-developer-platform roda isto, a Nereid e o seu Mandate, uma linha cada.
The cloudnative-pg Nereid makes the reef's default Mandate
A Nereid cloudnative-pg cria o Mandate default do reef
# CloudNativePG's operator, its chart pinned by version and SHA-256$ nereus nereid apply cloudnative-pg \ --reef database✓ core/nereids/cloudnative-pg created, Ready, pinned to sha256:4908bacf6ac8: see 'nereus database --help' core/mandates/cloudnative-pg created (reef: database, nereid: cloudnative-pg, default) Next steps: nereus database create <name> --owner project/<name> --engine postgres
An admission policy holds the Nereid to its own objects: Secrets, Clusters and release objects labelled core.getnereus.dev/nereid=cloudnative-pg, and only the chart and values its image declares.
Uma admission policy segura a Nereid nos próprios objetos: Secrets, Clusters e objetos do release com o label core.getnereus.dev/nereid=cloudnative-pg, e só o chart e os values que a sua imagem declara.
How does a Workload get one and reach it?
Como um Workload pede uma e chega a ela?
A Database names its owner in the tenancy tree
Uma Database diz o seu owner na árvore de tenancy
# In nereus-system, for Keycloak$ nereus database create keycloak \ --owner project/nereids \ --engine postgres✓ database/databases/keycloak created (mandate: cloudnative-pg, nereid: cloudnative-pg) Next steps: nereus database get keycloak
The Nereid makes a CloudNativePG Cluster db-keycloak (one instance, 1Gi, the Mandate's params.storage to change it); the db- prefix keeps it off the Nereids' ServiceAccounts.
A Nereid cria um Cluster db-keycloak do CloudNativePG (uma instância, 1Gi, o params.storage do Mandate para mudar); o prefixo db- o mantém longe das ServiceAccounts das Nereids.
Ready, with its connection in a Secret
Ready, com a conexão num Secret
$ nereus database get keycloakName: keycloakOwner: Project/nereidsEngine: postgresMandate: cloudnative-pgNereid: cloudnative-pgReady: TrueConnection: secret nereus-system/keycloak-database (host, port, dbname, username, password, uri) $ nereus database listDATABASE OWNER ENGINE MANDATE READYkeycloak Project/nereids postgres cloudnative-pg True
keycloak-database follows the Service Binding layout (type: postgresql, provider: cloudnative-pg). The scene writes a row through its uri, deletes the PostgreSQL pod, and reads the row back.
O keycloak-database segue o layout do Service Binding (type: postgresql, provider: cloudnative-pg). O scene grava uma linha pelo seu uri, apaga o pod do PostgreSQL e lê a linha de volta.
An owner missing from the tree is refused
Um owner fora da árvore é recusado
$ nereus database create orders \ --owner project/missing \ --engine postgres✗ database/databases/orders: owner Project/missing does not exist. To fix it, run: nereus tenancy project list Nothing was changed.
The CLI checks the owner; the API does not yet, the same open point as the tenancy tree's missing parent (#651).
O CLI confere o owner; a API ainda não, o mesmo ponto em aberto do parent inexistente da árvore de tenancy (#651).
Delete removes the Secret, then the Cluster and its volume
O delete remove o Secret, depois o Cluster e o seu volume
$ nereus database delete keycloak \ --dry-rundatabase/databases/keycloak deleted (dry run) $ nereus database delete keycloak2026-10-31T03:37:50Z … secret Deleting the Secret nereus-system/keycloak-database.2026-10-31T03:37:50Z … cluster Deleting the CloudNativePG Cluster nereus-system/db-keycloak: CloudNativePG removes its pods and volumes.✓ database/databases/keycloak deleted Next steps: nereus database list
The data goes with it: deletionPolicy: retain is its own issue (#560 point 9).
Os dados vão junto: o deletionPolicy: retain é uma issue à parte (#560 ponto 9).