Skip to content

Commit c6a8c3b

Browse files
authored
Merge pull request #38 from small-hack/update-cnpg-options
update cnpg options to match upstream chart better
2 parents 46955d1 + 9970555 commit c6a8c3b

File tree

5 files changed

+70
-3
lines changed

5 files changed

+70
-3
lines changed

charts/cloudnative-pg-cluster/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: cnpg-cluster
33
description: Create postgres tenant clusters managed by the CNPG Operator
44
type: application
5-
version: 0.4.0
5+
version: 0.5.0
66

77
maintainers:
88
- name: "cloudymax"

charts/cloudnative-pg-cluster/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cnpg-cluster
22

3-
![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
3+
![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
44

55
Create postgres tenant clusters managed by the CNPG Operator
66

@@ -29,18 +29,23 @@ Create postgres tenant clusters managed by the CNPG Operator
2929
| certificates.user.username | list | `["app"]` | List of names of users to create a cert for, eg: the DbOwner specified earlier. This data populated into the commonName field of the certificate. |
3030
| enableSuperuserAccess | bool | `false` | CNPG disables the postgres superuser by default must be explicitly enabled |
3131
| externalClusters | list | `[]` | |
32+
| imageCatalog.create | bool | `true` | Whether to provision an image catalog. If imageCatalog.images is empty this option will be ignored. |
33+
| imageCatalog.images | list | `[]` | List of images to be provisioned in an image catalog. |
3234
| imageName | string | `"ghcr.io/cloudnative-pg/postgresql:16.0"` | image to use for all tenant pods |
3335
| instances | int | `3` | number of postgres replicas minimum 1 required |
3436
| managed | object | `{"roles":[]}` | See https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-RoleConfiguration for explanation of all options |
3537
| monitoring.enablePodMonitor | bool | `false` | enable monitoring via Prometheus |
3638
| name | string | `"cnpg"` | |
39+
| postgresGID | int | `-1` | The GID of the postgres user inside the image, defaults to 26 |
40+
| postgresUID | int | `-1` | The UID of the postgres user inside the image, defaults to 26 |
3741
| postgresql.pg_hba | list | `["hostnossl all all 0.0.0.0/0 reject","hostssl all all 0.0.0.0/0 cert clientcert=verify-full"]` | records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html |
3842
| primaryUpdateStrategy | string | `"unsupervised"` | |
3943
| resources | object | `{}` | |
4044
| scheduledBackup | object | `{}` | schduled backups section, please see values.yaml for example |
4145
| storage.size | string | `"1Gi"` | how much storage to allocate to the postgresql cluster |
4246
| superuserSecret | string | `""` | name of existing secret to use as superuser redentials will be randomly generated if not specified. |
4347
| testApp.enabled | bool | `false` | |
48+
| type | string | `"postgresql"` | Type of the CNPG database. Available types: * `postgresql` * `postgis` * `timescaledb` |
4449

4550
----------------------------------------------
46-
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
51+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/cloudnative-pg-cluster/templates/_helpers.tpl

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,36 @@ Create the name of the service account to use
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}
6262
{{- end }}
63+
64+
{{/*
65+
Whether we need to use TimescaleDB defaults
66+
*/}}
67+
{{- define "cluster.useTimescaleDBDefaults" -}}
68+
{{ and (eq .Values.type "timescaledb") .Values.imageCatalog.create (empty .Values.imageCatalog.images) }}
69+
{{- end -}}
70+
71+
{{/*
72+
Postgres UID
73+
*/}}
74+
{{- define "cluster.postgresUID" -}}
75+
{{- if ge (int .Values.postgresUID) 0 -}}
76+
{{- .Values.postgresUID }}
77+
{{- else if and (eq (include "cluster.useTimescaleDBDefaults" .) "true") (eq .Values.type "timescaledb") -}}
78+
{{- 1000 -}}
79+
{{- else -}}
80+
{{- 26 -}}
81+
{{- end -}}
82+
{{- end -}}
83+
84+
{{/*
85+
Postgres GID
86+
*/}}
87+
{{- define "cluster.postgresGID" -}}
88+
{{- if ge (int .Values.postgresGID) 0 -}}
89+
{{- .Values.postgresGID }}
90+
{{- else if and (eq (include "cluster.useTimescaleDBDefaults" .) "true") (eq .Values.type "timescaledb") -}}
91+
{{- 1000 -}}
92+
{{- else -}}
93+
{{- 26 -}}
94+
{{- end -}}
95+
{{- end -}}

charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ kind: Cluster
44
metadata:
55
name: {{ .Values.name }}
66
spec:
7+
# this solves an issue with an old boto version
8+
env:
9+
- name: AWS_REQUEST_CHECKSUM_CALCULATION
10+
value: when_required
11+
- name: AWS_RESPONSE_CHECKSUM_VALIDATION
12+
value: when_required
13+
14+
postgresUID: {{ include "cluster.postgresUID" . }}
15+
postgresGID: {{ include "cluster.postgresGID" . }}
716
instances: {{ .Values.instances }}
817
imageName: {{ .Values.imageName }}
918
enableSuperuserAccess: {{ .Values.enableSuperuserAccess }}

charts/cloudnative-pg-cluster/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,27 @@ enableSuperuserAccess: false
1515
# will be randomly generated if not specified.
1616
superuserSecret: ""
1717

18+
imageCatalog:
19+
# -- Whether to provision an image catalog. If imageCatalog.images is empty this option will be ignored.
20+
create: true
21+
# -- List of images to be provisioned in an image catalog.
22+
images: []
23+
# - image: ghcr.io/your_repo/your_image:your_tag
24+
# major: 16
25+
1826
# Examples of rolling update strategy:
1927
# unsupervised: automated update of the primary once all
2028
# replicas have been upgraded (default)
2129
# supervised: requires manual supervision to perform
2230
# the switchover of the primary
2331
primaryUpdateStrategy: unsupervised
2432

33+
# -- Type of the CNPG database. Available types:
34+
# * `postgresql`
35+
# * `postgis`
36+
# * `timescaledb`
37+
type: postgresql
38+
2539
# -- boostrap method. see: https://cloudnative-pg.io/documentation/1.23/bootstrap/
2640
bootstrap: {}
2741
# -- for initializing a fresh cluster
@@ -135,6 +149,12 @@ certificates:
135149
username:
136150
- "app"
137151

152+
# -- The UID of the postgres user inside the image, defaults to 26
153+
postgresUID: -1
154+
155+
# -- The GID of the postgres user inside the image, defaults to 26
156+
postgresGID: -1
157+
138158
monitoring:
139159
# -- enable monitoring via Prometheus
140160
enablePodMonitor: false

0 commit comments

Comments
 (0)