Skip to content

Commit

Permalink
Added pooler parameters and documentation (cloudnative-pg#416)
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Grudev <[email protected]>
  • Loading branch information
itay-grudev authored and hapeho committed Dec 18, 2024
1 parent 2e1c52d commit 4fb10b7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
23 changes: 13 additions & 10 deletions charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| imageCatalog.images | list | `[]` | List of images to be provisioned in an image catalog. |
| mode | string | `"standalone"` | Cluster mode of operation. Available modes: * `standalone` - default mode. Creates new or updates an existing CNPG cluster. * `replica` - Creates a replica cluster from an existing CNPG cluster. # TODO * `recovery` - Same as standalone but creates a cluster from a backup, object store or via pg_basebackup. |
| nameOverride | string | `""` | Override the name of the chart |
| pooler.enabled | bool | `false` | Whether to enable PgBouncer |
| pooler.instances | int | `3` | Number of PgBouncer instances |
| pooler.monitoring.enabled | bool | `false` | Whether to enable monitoring |
| pooler.monitoring.podMonitor.enabled | bool | `true` | Whether to enable the PodMonitor |
| pooler.monitoring.podMonitor.metricRelabelings | list | `[]` | The list of metric relabelings for the PodMonitor. Applied to samples before ingestion. |
| pooler.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. |
| pooler.parameters | object | `{"default_pool_size":"25","max_client_conn":"1000"}` | PgBouncer configuration parameters |
| pooler.poolMode | string | `"transaction"` | PgBouncer pooling mode |
| pooler.template | object | `{}` | Custom PgBouncer deployment template. Use to override image, specify resources, etc. |
| pooler.type | string | `"rw"` | PgBouncer type of service to forward traffic to. |
| poolers | list | `[]` | List of PgBouncer poolers |
| recovery.azure.connectionString | string | `""` | |
| recovery.azure.containerName | string | `""` | |
| recovery.azure.inheritFromAzureAD | bool | `false` | |
Expand Down Expand Up @@ -251,6 +242,18 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| version.postgis | string | `"3.4"` | If using PostGIS, specify the version |
| version.postgresql | string | `"16"` | PostgreSQL major version to use |
| version.timescaledb | string | `"2.15"` | If using TimescaleDB, specify the version |
| poolers[].name | string | `` | Name of the pooler resource |
| poolers[].instances | number | `1` | The number of replicas we want |
| poolers[].type | [PoolerType][PoolerType] | `rw` | Type of service to forward traffic to. Default: `rw`. |
| poolers[].poolMode | [PgBouncerPoolMode][PgBouncerPoolMode] | `session` | The pool mode. Default: `session`. |
| poolers[].authQuerySecret | [LocalObjectReference][LocalObjectReference] | `{}` | The credentials of the user that need to be used for the authentication query. |
| poolers[].authQuery | string | `{}` | The credentials of the user that need to be used for the authentication query. |
| poolers[].parameters | map[string]string | `{}` | Additional parameters to be passed to PgBouncer - please check the CNPG documentation for a list of options you can configure |
| poolers[].template | [PodTemplateSpec][PodTemplateSpec] | `{}` | The template of the Pod to be created |
| poolers[].template | [ServiceTemplateSpec][ServiceTemplateSpec] | `{}` | Template for the Service to be created |
| poolers[].pg_hba | []string | `{}` | PostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file) |
| poolers[].monitoring.enabled | bool | `false` | Whether to enable monitoring for the Pooler. |
| poolers[].monitoring.podMonitor.enabled | bool | `true` | Create a podMonitor for the Pooler. |

## Maintainers

Expand Down
13 changes: 12 additions & 1 deletion charts/cluster/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,18 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat


{{ template "chart.valuesSection" . }}

| poolers[].name | string | `` | Name of the pooler resource |
| poolers[].instances | number | `1` | The number of replicas we want |
| poolers[].type | [PoolerType][PoolerType] | `rw` | Type of service to forward traffic to. Default: `rw`. |
| poolers[].poolMode | [PgBouncerPoolMode][PgBouncerPoolMode] | `session` | The pool mode. Default: `session`. |
| poolers[].authQuerySecret | [LocalObjectReference][LocalObjectReference] | `{}` | The credentials of the user that need to be used for the authentication query. |
| poolers[].authQuery | string | `{}` | The credentials of the user that need to be used for the authentication query. |
| poolers[].parameters | map[string]string | `{}` | Additional parameters to be passed to PgBouncer - please check the CNPG documentation for a list of options you can configure |
| poolers[].template | [PodTemplateSpec][PodTemplateSpec] | `{}` | The template of the Pod to be created |
| poolers[].template | [ServiceTemplateSpec][ServiceTemplateSpec] | `{}` | Template for the Service to be created |
| poolers[].pg_hba | []string | `{}` | PostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file) |
| poolers[].monitoring.enabled | bool | `false` | Whether to enable monitoring for the Pooler. |
| poolers[].monitoring.podMonitor.enabled | bool | `true` | Create a podMonitor for the Pooler. |

{{ template "chart.maintainersSection" . }}

Expand Down
12 changes: 12 additions & 0 deletions charts/cluster/templates/pooler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@ spec:
type: {{ default "rw" .type }}
pgbouncer:
poolMode: {{ default "session" .poolMode }}
{{- with .authQuerySecret }}
authQuerySecret:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .authQuery }}
authQuery:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .parameters }}
parameters:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .pg_hba }}
pg_hba:
{{- toYaml . | nindent 6 }}
{{- end }}
{{ with .monitoring }}
monitoring:
{{- if not (empty .podMonitor) }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cluster/test/pooler/01-pooler_cluster-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
name: pooler-cluster
instances: 2
pgbouncer:
poolMode: session
poolMode: transaction
type: rw
---
apiVersion: postgresql.cnpg.io/v1
Expand Down
1 change: 1 addition & 0 deletions charts/cluster/test/pooler/01-pooler_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ poolers:
- name: rw
type: rw
instances: 2
poolMode: transaction
- name: ro
type: ro
instances: 2
1 change: 1 addition & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ imageCatalog:
# - image: ghcr.io/your_repo/your_image:your_tag
# major: 16

# -- List of PgBouncer poolers
poolers: []
# -
# # -- Pooler name
Expand Down

0 comments on commit 4fb10b7

Please sign in to comment.