Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

AboutBits PostgreSQL Operator is a Kubernetes operator that helps you manage PostgreSQL databases, schemas, roles (users), and privileges in a declarative way using Custom Resource Definitions (CRDs).

## Compatibility

| Component | Supported Versions |
|----------------|--------------------|
| **PostgreSQL** | 15, 16, 17, 18 |
| **Kubernetes** | 1.29+ |

> **Note:** Kubernetes 1.29+ is required due to the use of CRD CEL validations (GA in 1.29, Beta in 1.25).

## Architecture

```
Expand Down
28 changes: 14 additions & 14 deletions docs/cluster-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ Other Custom Resources (like `Database`, `Role`, `Schema`, `Grant`, `DefaultPriv

## Spec

| Field | Type | Description | Required |
|------------------|---------------------|-----------------------------------------------------------------------|----------|
| `host` | `string` | The hostname of the PostgreSQL instance. | Yes |
| `port` | `integer` | The port of the PostgreSQL instance (1-65535). | Yes |
| `database` | `string` | The database to connect to (usually `postgres` for admin operations). | Yes |
| `adminSecretRef` | `SecretRef` | Reference to the secret containing admin credentials. | Yes |
| `parameters` | `map[string]string` | Additional connection parameters. | No |

### SecretRef

| Field | Type | Description | Required |
|-------------|----------|---------------------------------------------------------------------|----------|
| `name` | `string` | Name of the secret. | Yes |
| `namespace` | `string` | Namespace of the secret. If not specified, uses the CR's namespace. | No |
| Field | Type | Description | Required | Mutable |
|------------------|---------------------|-----------------------------------------------------------------------|----------|---------|
| `host` | `string` | The hostname of the PostgreSQL instance. | Yes | Yes |
| `port` | `integer` | The port of the PostgreSQL instance (1-65535). | Yes | Yes |
| `database` | `string` | The database to connect to (usually `postgres` for admin operations). | Yes | Yes |
| `adminSecretRef` | `ResourceRef` | Reference to the Kubernetes Secret containing the admin credentials. | Yes | Yes |
| `parameters` | `map[string]string` | Additional connection parameters. | No | Yes |

### ResourceRef (`adminSecretRef`)

| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------------------------|----------|
| `namespace` | `string` | Namespace of the referenced Kubernetes `Secret`. If not specified, uses the owning CR's namespace. | No |
| `name` | `string` | Name of the referenced Kubernetes `Secret`. | Yes |

The referenced secret must be of type `kubernetes.io/basic-auth` and contain the keys `username` and `password`.

Expand Down
26 changes: 13 additions & 13 deletions docs/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ The `Database` Custom Resource Definition (CRD) is responsible for managing Post

## Spec

| Field | Type | Description | Required | Immutable |
|-----------------|--------------------|------------------------------------------------------------------------------------------------------|----------|-----------|
| `clusterRef` | `ClusterReference` | Reference to the `ClusterConnection` to use. | Yes | No |
| `name` | `string` | The name of the database to create. | Yes | Yes |
| `owner` | `string` | The owner of the database. | No | No |
| `reclaimPolicy` | `string` | The policy for reclaiming the database when the CR is deleted. Values: `Retain` (Default), `Delete`. | No | No |

### ClusterReference

| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------|----------|
| `name` | `string` | Name of the `ClusterConnection`. | Yes |
| `namespace` | `string` | Namespace of the `ClusterConnection`. If not specified, uses the CR's namespace. | No |
| Field | Type | Description | Required | Mutable |
|-----------------|---------------|------------------------------------------------------------------------------------------------------|----------|---------|
| `clusterRef` | `ResourceRef` | Reference to the `ClusterConnection` to use. | Yes | Yes |
| `name` | `string` | The name of the database to create. | Yes | No |
| `owner` | `string` | The owner of the database. | No | Yes |
| `reclaimPolicy` | `string` | The policy for reclaiming the database when the CR is deleted. Values: `Retain` (Default), `Delete`. | No | Yes |

### ResourceRef (`clusterRef`)

| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------------------------|----------|
| `namespace` | `string` | Namespace of the referenced `ClusterConnection`. If not specified, uses the owning CR's namespace. | No |
| `name` | `string` | Name of the referenced `ClusterConnection`. | Yes |

### Reclaim Policy

Expand Down
28 changes: 14 additions & 14 deletions docs/default-privilege.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ The `DefaultPrivilege` Custom Resource Definition (CRD) manages default privileg

## Spec

| Field | Type | Description | Required | Immutable |
|--------------|--------------------|---------------------------------------------------------------------------------------------------------|-------------|-----------|
| `clusterRef` | `ClusterReference` | Reference to the `ClusterConnection` to use. | Yes | No |
| `database` | `string` | The database where default privileges apply. | Yes | Yes |
| `role` | `string` | The role to which default privileges are granted. | Yes | Yes |
| `owner` | `string` | The role that owns the objects (the creator). Default privileges apply to objects created by this role. | Yes | Yes |
| `schema` | `string` | The schema where default privileges apply. Required, unless `objectType` is `schema`. | Conditional | Yes |
| `objectType` | `string` | The type of object. | Yes | Yes |
| `privileges` | `array[string]` | List of privileges to grant. | Yes | No |
| Field | Type | Description | Required | Mutable |
|--------------|-----------------|---------------------------------------------------------------------------------------------------------|-------------|---------|
| `clusterRef` | `ResourceRef` | Reference to the `ClusterConnection` to use. | Yes | Yes |
| `database` | `string` | The database where default privileges apply. | Yes | No |
| `role` | `string` | The role to which default privileges are granted. | Yes | No |
| `owner` | `string` | The role that owns the objects (the creator). Default privileges apply to objects created by this role. | Yes | No |
| `schema` | `string` | The schema where default privileges apply. Required, unless `objectType` is `schema`. | Conditional | No |
| `objectType` | `string` | The type of object. | Yes | No |
| `privileges` | `array[string]` | List of privileges to grant. | Yes | Yes |

### Object Types

Expand All @@ -39,12 +39,12 @@ Supported privileges depend on the `objectType`:
- `update`
- `usage`

### ClusterReference
### ResourceRef (`clusterRef`)

| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------|----------|
| `name` | `string` | Name of the `ClusterConnection`. | Yes |
| `namespace` | `string` | Namespace of the `ClusterConnection`. If not specified, uses the CR's namespace. | No |
| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------------------------|----------|
| `namespace` | `string` | Namespace of the referenced `ClusterConnection`. If not specified, uses the owning CR's namespace. | No |
| `name` | `string` | Name of the referenced `ClusterConnection`. | Yes |

## Example

Expand Down
28 changes: 14 additions & 14 deletions docs/grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ The `Grant` Custom Resource Definition (CRD) is responsible for managing privile

## Spec

| Field | Type | Description | Required | Immutable |
|--------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------|-------------|-----------|
| `clusterRef` | `ClusterReference` | Reference to the `ClusterConnection` to use. | Yes | No |
| `database` | `string` | The database containing the objects. | Yes | Yes |
| `role` | `string` | The role to which privileges are granted. | Yes | Yes |
| `schema` | `string` | The schema containing the objects. Required, unless `objectType` is `database`. | Conditional | Yes |
| `objectType` | `string` | The type of object. | Yes | Yes |
| `objects` | `array[string]` | List of object names. If empty, all objects of this `objectType` will be granted. Required, unless `objectType` is `database` or `schema`. | Conditional | No |
| `privileges` | `array[string]` | List of privileges to grant. | Yes | No |
| Field | Type | Description | Required | Mutable |
|--------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|-------------|---------|
| `clusterRef` | `ResourceRef` | Reference to the `ClusterConnection` to use. | Yes | Yes |
| `database` | `string` | The database containing the objects. | Yes | No |
| `role` | `string` | The role to which privileges are granted. | Yes | No |
| `schema` | `string` | The schema containing the objects. Required, unless `objectType` is `database`. | Conditional | No |
| `objectType` | `string` | The type of object. | Yes | No |
| `objects` | `array[string]` | List of object names. If empty, all objects of this `objectType` will be granted. Required, unless `objectType` is `database` or `schema`. | Conditional | Yes |
| `privileges` | `array[string]` | List of privileges to grant. | Yes | Yes |

### Object Types

Expand Down Expand Up @@ -40,12 +40,12 @@ Supported privileges depend on the `objectType`:
- `update`
- `usage`

### ClusterReference
### ResourceRef (`clusterRef`)

| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------|----------|
| `name` | `string` | Name of the `ClusterConnection`. | Yes |
| `namespace` | `string` | Namespace of the `ClusterConnection`. If not specified, uses the CR's namespace. | No |
| Field | Type | Description | Required |
|-------------|----------|----------------------------------------------------------------------------------------------------|----------|
| `namespace` | `string` | Namespace of the referenced `ClusterConnection`. If not specified, uses the owning CR's namespace. | No |
| `name` | `string` | Name of the referenced `ClusterConnection`. | Yes |

## Example

Expand Down
Loading