Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 22 additions & 1 deletion database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,31 @@ helmfiles:
- path: git::https://github.com/stuttgart-things/helm.git@database/postgres.yaml.gotmpl
values:
- namespace: postgres
- version: 0.24.0
- version: 0.29.0
EOF
```

### DEPLOY CLUSTER

```bash
cat <<EOF > postgres-cluster.yaml
---
helmfiles:
- path: git::https://github.com/stuttgart-things/helm.git@database/postgres-cluster.yaml.gotmpl
values:
- namespace: postgres
- clusterName: postgres-cluster
- instances: 1
- database: app
- owner: app
- storageSize: 8Gi
- storageClass: openebs-hostpath
EOF
```

Connect through the `<clusterName>-rw` (primary), `-ro` (replicas) or `-r` (any) service;
the owner credentials land in the generated `<clusterName>-app` secret.

### CONFIGURE INSTANCE (EXAMPLE)

```bash
Expand Down
40 changes: 40 additions & 0 deletions database/postgres-cluster.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
environments:
default:
values:
- namespace: postgres
# renovate: datasource=helm depName=cluster registryUrl=https://cloudnative-pg.github.io/charts
- version: 0.8.1
- clusterName: postgres-cluster
- type: postgresql
- postgresqlVersion: "17"
- mode: standalone
- instances: 1
- storageSize: 8Gi
- storageClass: ""
- walStorageEnabled: false
- walStorageSize: 1Gi
- database: app
- owner: app
# existing basic-auth secret holding the owner credentials; empty = let cnpg generate one
- appSecretName: ""
- enableSuperuserAccess: false
- enablePDB: false
- monitoringEnabled: false
- podMonitorEnabled: false
- prometheusRuleEnabled: false
- backupsEnabled: false
---
repositories:
- name: cnpg
url: https://cloudnative-pg.github.io/charts
oci: false

releases:
- name: {{ .Values.clusterName }}
installed: true
namespace: {{ .Values.namespace }}
chart: cnpg/cluster
version: {{ .Values.version }}
values:
- "values/postgres-cluster.values.yaml.gotmpl"
2 changes: 1 addition & 1 deletion database/postgres.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ environments:
values:
- namespace: postgres
# renovate: datasource=helm depName=cloudnative-pg registryUrl=https://cloudnative-pg.github.io/charts
- version: 0.24.0
- version: 0.29.0
---
repositories:
- name: cnpg
Expand Down
42 changes: 42 additions & 0 deletions database/values/postgres-cluster.values.yaml.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
nameOverride: {{ .Values.clusterName }}
fullnameOverride: {{ .Values.clusterName }}

type: {{ .Values.type }}
mode: {{ .Values.mode }}

version:
postgresql: "{{ .Values.postgresqlVersion }}"

cluster:
instances: {{ .Values.instances }}

storage:
size: {{ .Values.storageSize }}
storageClass: "{{ .Values.storageClass }}"

walStorage:
enabled: {{ .Values.walStorageEnabled }}
size: {{ .Values.walStorageSize }}
storageClass: "{{ .Values.storageClass }}"

enableSuperuserAccess: {{ .Values.enableSuperuserAccess }}
enablePDB: {{ .Values.enablePDB }}

initdb:
database: {{ .Values.database }}
owner: {{ .Values.owner }}
{{- if .Values.appSecretName }}
secret:
name: {{ .Values.appSecretName }}
{{- end }}

monitoring:
enabled: {{ .Values.monitoringEnabled }}
podMonitor:
enabled: {{ .Values.podMonitorEnabled }}
prometheusRule:
enabled: {{ .Values.prometheusRuleEnabled }}

backups:
enabled: {{ .Values.backupsEnabled }}
Loading