Skip to content

Commit

Permalink
all completed until custom version
Browse files Browse the repository at this point in the history
Signed-off-by: Hiranmoy Das Chowdhury <[email protected]>
  • Loading branch information
HiranmoyChowdhury committed Nov 26, 2024
1 parent cc1802f commit 973bcce
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 22 deletions.
15 changes: 15 additions & 0 deletions docs/examples/pgbouncer/sync-users/pgbouncer-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kubedb.com/v1
kind: PgBouncer
metadata:
name: pgbouncer-sync
namespace: demo
spec:
version: "1.23.1"
replicas: 1
database:
syncUsers: true
databaseName: "postgres"
databaseRef:
name: "ha-postgres"
namespace: demo
deletionPolicy: WipeOut
11 changes: 11 additions & 0 deletions docs/examples/pgbouncer/sync-users/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/instance: ha-postgres
app.kubernetes.io/name: postgreses.kubedb.com
name: sync-secret
namespace: demo
stringData:
password: "12345"
username: "john"
23 changes: 15 additions & 8 deletions docs/guides/pgbouncer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ KubeDB operator now comes bundled with PgBouncer crd to handle connection poolin

## PgBouncer Features

| Features | Availability |
|------------------------------------|:------------:|
| Clustering | &#10003; |
| Multiple PgBouncer Versions | &#10003; |
| Customizable Pooling Configuration | &#10003; |
| Custom docker images | &#10003; |
| Builtin Prometheus Discovery | &#10003; |
| Using Prometheus operator | &#10003; |
| Features | Availability |
|-------------------------------------------------------------| :----------: |
| Multiple PgBouncer Versions | &#10003; |
| Custom Configuration | &#10003; |
| Externally manageable Auth Secret | &#10003; |
| Reconfigurable Health Checker | &#10003; |
| Integrate with externally managed PostgreSQL | &#10003; |
| Sync Postgres Users to PgBouncer | &#10003; |
| Custom docker images | &#10003; |
| TLS: Add ( [Cert Manager]((https://cert-manager.io/docs/))) | &#10003; |
| Monitoring with Prometheus & Grafana | &#10003; |
| Builtin Prometheus Discovery | &#10003; |
| Using Prometheus operator | &#10003; |
| Alert Dashboard | &#10003; |
| Grafana Dashboard | &#10003; |

## User Guide

Expand Down
4 changes: 1 addition & 3 deletions docs/guides/pgbouncer/concepts/appbinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ An `AppBinding` is a Kubernetes `CustomResourceDefinition`(CRD) which points to

If you deploy a database using [KubeDB](https://kubedb.com/docs/latest/welcome/), `AppBinding` object will be created automatically for it. Otherwise, you have to create an `AppBinding` object manually pointing to your desired database.

KubeDB uses [Stash](https://appscode.com/products/stash/) to perform backup/recovery of databases. Stash needs to know how to connect with a target database and the credentials necessary to access it. This is done via an `AppBinding`.

## AppBinding CRD Specification

Like any official Kubernetes resource, an `AppBinding` has `TypeMeta`, `ObjectMeta` and `Spec` sections. However, unlike other Kubernetes resources, it does not have a `Status` section.
Expand Down Expand Up @@ -71,7 +69,7 @@ An `AppBinding` object has the following fields in the `spec` section:

#### spec.type

`spec.type` is an optional field that indicates the type of the app that this `AppBinding` is pointing to. Stash uses this field to resolve the values of `TARGET_APP_TYPE`, `TARGET_APP_GROUP` and `TARGET_APP_RESOURCE` variables of [BackupBlueprint](https://appscode.com/products/stash/latest/concepts/crds/backupblueprint/) object.
`spec.type` is an optional field that indicates the type of the app that this `AppBinding` is pointing to. PgBouncer operator uses this field to recognise the desired postgres database.

This field follows the following format: `<app group>/<resource kind>`. The above AppBinding is pointing to a `postgres` resource under `kubedb.com` group.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/pgbouncer/concepts/pgbouncer.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ metadata:
namespace: demo
spec:
version: "1.18.0"
replicas: 2
replicas: 1
database:
syncUsers: true
databaseName: "postgres"
Expand Down
12 changes: 6 additions & 6 deletions docs/guides/pgbouncer/custom-versions/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PgBouncerVersions are KubeDB crds that define the docker images KubeDB will use
If you want to create a custom image of pgbouncer with additional features, the best way is to build on top of the existing kubedb image.

```docker
FROM kubedb/pgbouncer:1.17.0
FROM kubedb/pgbouncer:1.23.1
ENV SOME_VERSION_VAR 0.9.1
Expand All @@ -32,18 +32,18 @@ RUN set -ex \
bash
```

From there, we would define a PgBouncerVersion that contains this new image. Let's say we tagged it as `myco/pgbouncer:custom-1.17.0`. You can also build exporter image yourself using [pgbouncer_exporter](https://github.com/kubedb/pgbouncer_exporter) repository.
From there, we would define a PgBouncerVersion that contains this new image. Let's say we tagged it as `myco/pgbouncer:custom-1.23.1`. You can also build exporter image yourself using [pgbouncer_exporter](https://github.com/kubedb/pgbouncer_exporter) repository.

```yaml
apiVersion: catalog.kubedb.com/v1alpha1
kind: PgBouncerVersion
metadata:
name: "1.17.0"
name: "1.23.1"
spec:
deprecated: false
version: "1.17.0"
version: "1.23.1"
pgBouncer:
image: "myco/pgbouncer:custom-1.17.0"
image: "myco/pgbouncer:custom-1.23.1"
exporter:
image: "myco/pgbouncer_exporter:v0.1.1"
```
Expand All @@ -57,7 +57,7 @@ metadata:
name: pgbouncer-server
namespace: demo
spec:
version: "1.17.0"
version: "1.23.1"
replicas: 1
connectionPool:
poolMode: session
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/pgbouncer/quickstart/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $ kubectl get pgbouncerversions
NAME VERSION PGBOUNCER_IMAGE DEPRECATED AGE
1.17.0 1.17.0 ghcr.io/kubedb/pgbouncer:1.17.0 22h
1.18.0 1.18.0 ghcr.io/kubedb/pgbouncer:1.18.0 22h
1.23.1 1.23.1 ghcr.io/kubedb/pgbouncer:1.23.1 22h

```

Expand Down Expand Up @@ -258,9 +259,8 @@ Following table show what KubeDB does when you delete Postgres crd for different
| Behavior | DoNotTerminate | Delete | WipeOut |
|---------------------------| :------------: | :------: | :------: |
| 1. Block Delete operation | &#10003; | &#10007; | &#10007; |
| 2. Delete PetSet | &#10007; | &#10003; | &#10003; |
| 2. Delete PetSet | &#10007; | &#10003; | &#10003; |
| 3. Delete Services | &#10007; | &#10003; | &#10003; |
| 4. Delete PVCs | &#10007; | &#10003; | &#10003; |
| 5. Delete Secrets | &#10007; | &#10007; | &#10003; |


Expand Down
4 changes: 2 additions & 2 deletions docs/guides/pgbouncer/sync-users/sync-users-pgbouncer.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ Now, wait until `pgbouncer-sync` has status `Ready`. i.e,

```bash
$ kubectl get pb -n demo
NAME TYPE VERSION STATUS AGE
pgbouncer-sync kubedb.com/v1 1.18.0 Ready 41s
NAME TYPE VERSION STATUS AGE
pgbouncer-sync kubedb.com/v1 1.18.0 Ready 41s
```

### Sync Users
Expand Down

0 comments on commit 973bcce

Please sign in to comment.