Skip to content

Commit

Permalink
docs: add docs for crunchy-postgres chart configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellmueller committed Apr 18, 2023
1 parent 778c6ba commit f7f86dd
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 79 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A tested helm chart for Crunchy Postgres

### Crunchy Postgres chart

A chart to deploy a high availability Crunchy Postgres cluster

[Crunchy Postgres Documentation](charts/crunchy-postgres/README.md)

### Crunchy Postgres tools chart
Expand Down
117 changes: 117 additions & 0 deletions charts/crunchy-postgres/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,118 @@
# Crunchy Postgres chart

A chart to provision a [Crunchy Postgres](https://www.crunchydata.com/) cluster.

## Configuration

### Crunchy Options

| Parameter | Description | Default |
| ------------------ | ---------------------- | ------------------------------------ |
| `fullnameOverride` | Override release name | `crunchy-postgres` |
| `crunchyImage` | Crunchy Postgres image | `...crunchy-postgres:centos8-14.1-0` |
| `postgresVersion` | Postgres version | `14` |

---

###w Instances

| Parameter | Description | Default |
| ------------------------------------------- | ------------------------------ | ------------------------ |
| `instances.name` | Instance name | `ha` (high availability) |
| `instances.replicas` | Number of replicas | `2` |
| `instances.dataVolumeClaimSpec.storage` | Amount of storage for each PVC | `480Mi` |
| `instances.requests.cpu` | CPU requests | `1m` |
| `instances.requests.memory` | Memory requests | `256Mi` |
| `instances.limits.cpu` | CPU limits | `100m` |
| `instances.limits.memory` | Memory limits | `512Mi` |
| `instances.replicaCertCopy.requests.cpu` | replicaCertCopy CPU requests | `1m` |
| `instances.replicaCertCopy.requests.memory` | replicaCertCopyMemory requests | `32Mi` |
| `instances.replicaCertCopy.limits.cpu` | replicaCertCopyCPU limits | `50m` |
| `instances.replicaCertCopy.limits.memory` | replicaCertCopy Memory limits | `64Mi` |

---

### pgBackRest - Reliable PostgreSQL Backup & Restore

[pgBackRest site](https://pgbackrest.org/)
[Crunchy pgBackRest docs](https://access.crunchydata.com/documentation/pgbackrest/latest/)

| Parameter | Description | Default |
| ---------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------- |
| `pgBackRest.image` | Crunchy pgBackRest | `...crunchy-pgbackrest:centos8-2.36-0` |
| `pgBackRest.retention` | Number of backups/days to keep depending on retentionFullType | `2` |
| `pgBackRest.retentionFullType` | Either 'count' or 'time' | `count` |
| `pgBackRest.repos.schedules.full` | Full backup schedule | `0 8 * * *` |
| `pgBackRest.repos.schedules.incremental` | Incremental backup schedule | `0 0,4,12,16,20 * * *` |
| `pgBackRest.repos.schedules.volume.addessModes` | Access modes | `ReadWriteOnce` |
| `pgBackRest.repos.schedules.volume.storage` | Access modes | `64Mi` |
| `pgBackRest.repos.schedules.volume.storageClassName` | Storage class name modes | `netapp-file-backup` |
| `instances.requests.cpu` | CPU requests | `1m` |
| `pgBackRest.repoHost.requests.memory` | Memory requests | `256Mi` |
| `pgBackRest.repoHost.limits.cpu` | CPU limits | `100m` |
| `pgBackRest.repoHost.limits.memory` | Memory limits | `512Mi` |
| `pgBackRest.sidecars.requests.cpu` | sidecars CPU requests | `1m` |
| `pgBackRest.sidecars.requests.memory` | sidecars Memory requests | `32Mi` |
| `pgBackRest.sidecars.limits.cpu` | sidecars CPU limits | `50m` |
| `pgBackRest.sidecars.limits.memory` | sidecars Memory limits | `64Mi` |

---

### Patroni

[Patroni docs](https://patroni.readthedocs.io/en/latest/)
[Crunchy Patroni docs](https://access.crunchydata.com/documentation/patroni/latest/)

| Parameter | Description | Default |
| ------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------ |
| `patroni.postgresql.pg_hba` | pg_hba permissions | `"host all all 0.0.0.0/0 md5"` |
| `crunchyImage` | Crunchy Postgres image | `...crunchy-postgres:centos8-14.1-0` |
| `patroni.parameters.shared_buffers` | The number of shared memory buffers used by the server | `16MB` |
| `patroni.parameters.wal_buffers` | The number of disk-page buffers in shared memory for WAL | `64KB` |
| `patroni.parameters.min_wal_size` | The minimum size to shrink the WAL to | `32MB` |
| `patroni.parameters.max_wal_size` | Sets the WAL size that triggers a checkpoint | `64MB` |
| `patroni.parameters.max_slot_wal_keep_size` | Sets the maximum WAL size that can be reserved by replication slots | `128MB` |

---

### pgBouncer

A lightweight connection pooler for PostgreSQL

[pgBouncer site](https://www.pgbouncer.org/)
[Crunchy Postgres pgBouncer docs](https://access.crunchydata.com/documentation/pgbouncer/latest/)

| Parameter | Description | Default |
| --------------------------------- | ----------------------- | ------------------------------------- |
| `proxy.pgBouncer.image` | Crunchy pgBouncer image | `...crunchy-pgbouncer:centos8-1.16-0` |
| `proxy.pgBouncer.replicas` | Number of replicas | `2` |
| `proxy.pgBouncer.requests.cpu` | CPU requests | `1m` |
| `proxy.pgBouncer.requests.memory` | Memory requests | `64Mi` |
| `proxy.pgBouncer.limits.cpu` | CPU limits | `50m` |
| `proxy.pgBouncer.limits.memory` | Memory limits | `128Mi` |

---

## PG Monitor

[Crunchy Postgres PG Monitor docs](https://access.crunchydata.com/documentation/pgmonitor/latest/)

| Parameter | Description | Default |
| ------------------- | ---------------------------------------------- | ------- |
| `pgmonitor.enabled` | Enable PG Monitor (currently only PG exporter) | `false` |

#### Postgres Exporter

A [Prometheus](https://prometheus.io/) exporter for PostgreSQL

[Postgres Exporter](https://github.com/prometheus-community/postgres_exporter)

| Parameter | Description | Default |
| ------------------------------------ | ------------------------- | ------------------------------------------- |
| `pgmonitor.exporter.image` | Crunchy PG Exporter image | `...crunchy-postgres-exporter:ubi8-5.0.4-0` |
| `pgmonitor.exporter.requests.cpu` | CPU requests | `1m` |
| `pgmonitor.exporter.requests.memory` | Memory requests | `64Mi` |
| `pgmonitor.exporter.limits.cpu` | CPU limits | `50m` |
| `pgmonitor.exporterr.limits.memory` | Memory limits | `128Mi` |

---
66 changes: 26 additions & 40 deletions charts/crunchy-postgres/templates/PostgresCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ spec:
replicaCertCopy:
resources:
requests:
cpu: {{ .Values.instances.sidecars.replicaCertCopy.requests.cpu }}
memory: {{ .Values.instances.sidecars.replicaCertCopy.requests.memory }}
cpu: {{ .Values.instances.replicaCertCopy.requests.cpu }}
memory: {{ .Values.instances.replicaCertCopy.requests.memory }}
limits:
cpu: {{ .Values.instances.sidecars.replicaCertCopy.limits.cpu }}
memory: {{ .Values.instances.sidecars.replicaCertCopy.limits.memory }}
cpu: {{ .Values.instances.replicaCertCopy.limits.cpu }}
memory: {{ .Values.instances.replicaCertCopy.limits.memory }}
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: {{ .Values.dataVolumeClaimSpec.storage }}
storageClassName: netapp-block-standard
storage: {{ .Values.instances.dataVolumeClaimSpec.storage }}
storageClassName: {{ .Values.instances.dataVolumeClaimSpec.storageClassName }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -63,6 +63,7 @@ spec:
postgres-operator.crunchydata.com/cluster:
{{ template "crunchy-postgres.fullname" . }}
postgres-operator.crunchydata.com/instance-set: {{ .Values.instances.name }}-ha

users:
- name: {{ template "crunchy-postgres.fullname" . }}
databases:
Expand All @@ -71,66 +72,50 @@ spec:
- name: postgres
databases:
- {{ template "crunchy-postgres.fullname" . }}

backups:
pgbackrest:
image: {{ .Values.pgbackrest.image }}
image: {{ .Values.pgBackRest.image }}
global:
# hardcoding repo1 until we solution allowing multiple repos
repo1-retention-full: {{ .Values.pgbackrest.retention | quote }}
repo1-retention-full-type: {{ .Values.pgbackrest.retentionFullType }}
repo1-retention-full: {{ .Values.pgBackRest.retention | quote }}
repo1-retention-full-type: {{ .Values.pgBackRest.retentionFullType }}

repos:
# hardcoding repo1 until we solution allowing multiple repos
- name: repo1
schedules:
full: {{ .Values.pgbackrest.repos.schedules.full }}
incremental: {{ .Values.pgbackrest.repos.schedules.incremental }}
full: {{ .Values.pgBackRest.repos.schedules.full }}
incremental: {{ .Values.pgBackRest.repos.schedules.incremental }}
volume:
volumeClaimSpec:
accessModes:
- {{ .Values.pgbackrest.repos.volume.accessModes }}
- {{ .Values.pgBackRest.repos.volume.accessModes }}
resources:
requests:
storage: {{ .Values.pgbackrest.repos.volume.storage }}
storageClassName: {{ .Values.pgbackrest.repos.volume.storageClassName }}

# Storage buckets backup
{{- if .Values.pgbackrest.repos.s3.enabled }}
s3:
bucket: {{ .Values.pgbackrest.repos.s3.bucket | quote }}
endpoint: {{ .Values.pgbackrest.repos.s3.endpoint | quote }}
region: {{ .Values.pgbackrest.repos.s3.s3.region | quote }}
{{- end }}

{{- if .Values.pgbackrest.repos.gcs.enabled }}
gcs:
bucket: {{ .Values.pgbackrest.repos.gcs.bucket | quote }}
{{- end }}

{{- if .Values.pgbackrest.repos.azure.enabled }}
azure:
container: {{ .Values.pgbackrest.repos.azure.container | quote }}
{{- end }}
storage: {{ .Values.pgBackRest.repos.volume.storage }}
storageClassName: {{ .Values.pgBackRest.repos.volume.storageClassName }}

# this stuff is for the "pgbackrest" container (the only non-init container) in the "postgres-crunchy-repo-host" pod
repoHost:
resources:
requests:
cpu: {{ .Values.pgbackrest.repoHost.requests.cpu }}
memory: {{ .Values.pgbackrest.repoHost.requests.memory }}
cpu: {{ .Values.pgBackRest.repoHost.requests.cpu }}
memory: {{ .Values.pgBackRest.repoHost.requests.memory }}
limits:
cpu: {{ .Values.pgbackrest.repoHost.limits.cpu }}
memory: {{ .Values.pgbackrest.repoHost.limits.memory }}
cpu: {{ .Values.pgBackRest.repoHost.limits.cpu }}
memory: {{ .Values.pgBackRest.repoHost.limits.memory }}
sidecars:
# this stuff is for the "pgbackrest" container in the "postgres-crunchy-ha" set of pods
pgbackrest:
resources:
requests:
cpu: {{ .Values.pgbackrest.sidecars.requests.cpu }}
memory: {{ .Values.pgbackrest.sidecars.requests.memory }}
cpu: {{ .Values.pgBackRest.sidecars.requests.cpu }}
memory: {{ .Values.pgBackRest.sidecars.requests.memory }}
limits:
cpu: {{ .Values.pgbackrest.sidecars.limits.cpu }}
memory: {{ .Values.pgbackrest.sidecars.limits.memory }}
cpu: {{ .Values.pgBackRest.sidecars.limits.cpu }}
memory: {{ .Values.pgBackRest.sidecars.limits.memory }}

patroni:
dynamicConfiguration:
postgresql:
Expand All @@ -142,6 +127,7 @@ spec:
min_wal_size: {{ .Values.patroni.postgresql.parameters.min_wal_size }}
max_wal_size: {{ .Values.patroni.postgresql.parameters.max_wal_size }}
max_slot_wal_keep_size: {{ .Values.patroni.postgresql.parameters.max_slot_wal_keep_size }}

proxy:
pgBouncer:
config:
Expand Down
61 changes: 23 additions & 38 deletions charts/crunchy-postgres/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,42 @@ fullnameOverride: crunchy-postgres

crunchyImage: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-postgres:centos8-14.1-0

# If userInterface is enabled it is important to know that pgAdmin is currently incompatible with Postgresql 15
# https://access.crunchydata.com/documentation/postgres-operator/v5/architecture/pgadmin4/
postgresVersion: 14

# Postgres Cluster resource values:
pgmonitor:
enabled: false
exporter:
image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-postgres-exporter:ubi8-5.0.4-0
requests:
cpu: 1m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi

instances:
name: ha # high availability
replicas: 2
dataVolumeClaimSpec:
storage: 480Mi
storageClassName: netapp-block-standard
requests:
cpu: 1m
memory: 256Mi
limits:
cpu: 100m
memory: 512Mi
sidecars:
replicaCertCopy:
requests:
cpu: 1m
memory: 32Mi
limits:
cpu: 50m
memory: 64Mi

dataVolumeClaimSpec:
storage: 480Mi
replicaCertCopy:
requests:
cpu: 1m
memory: 32Mi
limits:
cpu: 50m
memory: 64Mi

pgbackrest:
pgBackRest:
image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-pgbackrest:centos8-2.36-0
retention: "2" # Ideally a larger number such as 30 backups/days
# If retention-full-type set to 'count' then the oldest backups will expire when the number of backups reach the number defined in retention
# If retention-full-type set to 'time' then the number defined in retention will take that many days worth of full backups before expiration
retentionFullType: count
repos:
name: repo1
schedules:
full: 0 8 * * *
incremental: 0 0,4,12,16,20 * * *
volume:
accessModes: "ReadWriteOnce"
storage: 64Mi
storageClassName: netapp-file-backup
s3:
enabled: false
bucket:
endpoint:
region:
gcs:
enabled: false
bucket:
azure:
enabled: false
container:
repoHost:
requests:
cpu: 1m
Expand Down Expand Up @@ -100,3 +73,15 @@ proxy:
limits:
cpu: 50m
memory: 128Mi

# Postgres Cluster resource values:
pgmonitor:
enabled: false
exporter:
image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-postgres-exporter:ubi8-5.0.4-0
requests:
cpu: 1m
memory: 64Mi
limits:
cpu: 50m
memory: 128Mi
2 changes: 1 addition & 1 deletion charts/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ OpenShift route whitch allows you to host your application at a public URL.

| Parameter | Description | Default |
| ------------------ | ------------------------------------------ | ------------------------ |
| `fullnameOverride` | Name of the tools deployment | `crunchy-postgres-tools` |
| `fullnameOverride` | Override release name | `crunchy-postgres-tools` |
| `deploymentName` | The name of your dev/test/prod deployments | `crunchy-postgres` |

0 comments on commit f7f86dd

Please sign in to comment.