-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4713c57
commit 15e8427
Showing
25 changed files
with
6,309 additions
and
553 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
product_docs/docs/postgres_for_kubernetes/1/declarative_database_management.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: 'Declarative Database Management' | ||
originalFilePath: 'src/declarative_database_management.md' | ||
--- | ||
|
||
Declarative database management enables users to control the lifecycle of | ||
databases via a new Custom Resource Definition (CRD) called `Database`. | ||
|
||
A `Database` object is managed by the instance manager of the cluster's | ||
primary instance. This feature is not supported in replica clusters, | ||
as replica clusters lack a primary instance to manage the `Database` object. | ||
|
||
### Example: Simple Database Declaration | ||
|
||
Below is an example of a basic `Database` configuration: | ||
|
||
```yaml | ||
apiVersion: postgresql.k8s.enterprisedb.io/v1 | ||
kind: Database | ||
metadata: | ||
name: db-one | ||
spec: | ||
name: one | ||
owner: app | ||
cluster: | ||
name: cluster-example | ||
``` | ||
Once the reconciliation cycle is completed successfully, the `Database` | ||
status will show a `applied` field set to `true` and an empty `message` field. | ||
|
||
### Database Deletion and Reclaim Policies | ||
|
||
A finalizer named `k8s.enterprisedb.io/deleteDatabase` is automatically added | ||
to each `Database` object to control its deletion process. | ||
|
||
By default, the `databaseReclaimPolicy` is set to `retain`, which means | ||
that if the `Database` object is deleted, the actual PostgreSQL database | ||
is retained for manual management by an administrator. | ||
|
||
Alternatively, if the `databaseReclaimPolicy` is set to `delete`, | ||
the PostgreSQL database will be automatically deleted when the `Database` | ||
object is removed. | ||
|
||
### Example: Database with Delete Reclaim Policy | ||
|
||
The following example illustrates a `Database` object with a `delete` | ||
reclaim policy: | ||
|
||
```yaml | ||
apiVersion: postgresql.k8s.enterprisedb.io/v1 | ||
kind: Database | ||
metadata: | ||
name: db-one-with-delete-reclaim-policy | ||
spec: | ||
databaseReclaimPolicy: delete | ||
name: two | ||
owner: app | ||
cluster: | ||
name: cluster-example | ||
``` | ||
|
||
In this case, when the `Database` object is deleted, the corresponding PostgreSQL database will also be removed automatically. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.