Skip to content

Commit 9f3ceea

Browse files
[Postgres] support custom pg_hba.conf (CloudPirates-io#157)
* [postgres] add support for custom pg_hba config * [postgres] bump chart version * Update CHANGELOG.md Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --------- Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2a84b43 commit 9f3ceea

File tree

6 files changed

+74
-33
lines changed

6 files changed

+74
-33
lines changed

charts/postgres/CHANGELOG.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3-
## 0.5.2 (2025-09-24)
3+
## 0.5.3 (2025-09-25)
44

5-
* [postgres] fix: Change default name for CUSTOM_PASSWORD ([#144](https://github.com/CloudPirates-io/helm-charts/pull/144))
5+
* [Postgres] support custom pg_hba.conf ([#157](https://github.com/CloudPirates-io/helm-charts/pull/157))
6+
7+
## <small>0.2.1 (2025-08-26)</small>
8+
9+
* add first draft of postgres helm-chart ([ac297fa](https://github.com/CloudPirates-io/helm-charts/commit/ac297fa))
10+
* add postgres-secret lookup ([e628c3f](https://github.com/CloudPirates-io/helm-charts/commit/e628c3f))
11+
* added support for service account configuration (#15) ([541a9df](https://github.com/CloudPirates-io/helm-charts/commit/541a9df)), closes [#15](https://github.com/CloudPirates-io/helm-charts/issues/15)
12+
* fix common-parameter-test image tag ([5773314](https://github.com/CloudPirates-io/helm-charts/commit/5773314))
13+
* fix statefulset annotations ([b6cd6b8](https://github.com/CloudPirates-io/helm-charts/commit/b6cd6b8))
14+
* update chart to statefulset ([5a5b6ea](https://github.com/CloudPirates-io/helm-charts/commit/5a5b6ea))
15+
* Add ArtifactHub Badges to all Charts ([08b855b](https://github.com/CloudPirates-io/helm-charts/commit/08b855b))
16+
* Add ArtifactHub repo config ([15180a8](https://github.com/CloudPirates-io/helm-charts/commit/15180a8))
17+
* Add cosign signature READMEs ([5f82e7f](https://github.com/CloudPirates-io/helm-charts/commit/5f82e7f))
18+
* Add extensive chart testing ([a46efac](https://github.com/CloudPirates-io/helm-charts/commit/a46efac))
19+
* Add generated values.schema.json files from values.yaml ([aa79ac3](https://github.com/CloudPirates-io/helm-charts/commit/aa79ac3))
20+
* add logos to helm-charts ([fc70cdc](https://github.com/CloudPirates-io/helm-charts/commit/fc70cdc))
21+
* Fix image tag/digest handling ([a5c982b](https://github.com/CloudPirates-io/helm-charts/commit/a5c982b))
22+
* Fix imagePullSecrets format and pull always ([ce0d301](https://github.com/CloudPirates-io/helm-charts/commit/ce0d301))
23+
* fix readme.md install text, update chart.yaml home-website ([3511582](https://github.com/CloudPirates-io/helm-charts/commit/3511582))
24+
* Format README files ([04aacab](https://github.com/CloudPirates-io/helm-charts/commit/04aacab))
25+
* Release new chart versions / update sources ([dbb0e45](https://github.com/CloudPirates-io/helm-charts/commit/dbb0e45))
26+
* Remove leading $ from code blocks ([836b2e3](https://github.com/CloudPirates-io/helm-charts/commit/836b2e3))
27+
* Update docker.io/postgres Docker tag to v17.6 ([68b8e32](https://github.com/CloudPirates-io/helm-charts/commit/68b8e32))
28+
* Update postgres to 17.6 ([52b6e17](https://github.com/CloudPirates-io/helm-charts/commit/52b6e17))
29+
* update readme, chart.yaml texts and descriptions ([0179046](https://github.com/CloudPirates-io/helm-charts/commit/0179046))
30+
* Use existing secret ([024bd0f](https://github.com/CloudPirates-io/helm-charts/commit/024bd0f))
31+
* fix: chart icon urls ([cc38c0d](https://github.com/CloudPirates-io/helm-charts/commit/cc38c0d))

charts/postgres/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: postgres
33
description: The World's Most Advanced Open Source Relational Database
44
type: application
5-
version: 0.5.2
5+
version: 0.5.3
66
appVersion: "17.6"
77
keywords:
88
- postgres

charts/postgres/README.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ The following table lists the configurable parameters of the PostgreSQL chart an
7070

7171
### PostgreSQL image configuration
7272

73-
| Parameter | Description | Default |
74-
| -------------------- | -------------------------------------------- | ------------------------------------------------------------------------------ |
75-
| `image.registry` | PostgreSQL image registry | `docker.io` |
76-
| `image.repository` | PostgreSQL image repository | `postgres` |
77-
| `image.tag` | PostgreSQL image tag (immutable tags are recommended) | `"17.6@sha256:feff5b24fedd610975a1f5e743c51a4b360437f4dc3a11acf740dcd708f413f6"` |
78-
| `image.imagePullPolicy` | PostgreSQL image pull policy | `Always` |
73+
| Parameter | Description | Default |
74+
| ----------------------- | ----------------------------------------------------- | -------------------------------------------------------------------------------- |
75+
| `image.registry` | PostgreSQL image registry | `docker.io` |
76+
| `image.repository` | PostgreSQL image repository | `postgres` |
77+
| `image.tag` | PostgreSQL image tag (immutable tags are recommended) | `"17.6@sha256:feff5b24fedd610975a1f5e743c51a4b360437f4dc3a11acf740dcd708f413f6"` |
78+
| `image.imagePullPolicy` | PostgreSQL image pull policy | `Always` |
7979

8080
### Deployment configuration
8181

@@ -108,13 +108,13 @@ The following table lists the configurable parameters of the PostgreSQL chart an
108108

109109
### PostgreSQL Authentication
110110

111-
| Parameter | Description | Default |
112-
| ---------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------ |
113-
| `auth.username` | Name for a custom superuser to create at initialisation. (This will also create a database with the same name) | `"openfga"` |
114-
| `auth.password` | Password for the custom user to create | `""` |
115-
| `auth.database` | Alternative name for the default database to be created at initialisation | `""` |
116-
| `auth.existingSecret` | Name of existing secret to use for PostgreSQL credentials | `""` |
117-
| `auth.secretKeys.passwordKey` | Name of key in existing secret to use for PostgreSQL credentials | `"postgres-password"` |
111+
| Parameter | Description | Default |
112+
| ----------------------------- | -------------------------------------------------------------------------------------------------------------- | --------------------- |
113+
| `auth.username` | Name for a custom superuser to create at initialisation. (This will also create a database with the same name) | `"openfga"` |
114+
| `auth.password` | Password for the custom user to create | `""` |
115+
| `auth.database` | Alternative name for the default database to be created at initialisation | `""` |
116+
| `auth.existingSecret` | Name of existing secret to use for PostgreSQL credentials | `""` |
117+
| `auth.secretKeys.passwordKey` | Name of key in existing secret to use for PostgreSQL credentials | `"postgres-password"` |
118118

119119
### PostgreSQL Configuration
120120

@@ -133,24 +133,25 @@ The following table lists the configurable parameters of the PostgreSQL chart an
133133
| `config.postgresqlLogMinDurationStatement` | Sets the minimum execution time above which statements will be logged | `""` |
134134
| `config.extraConfig` | Additional PostgreSQL configuration parameters | `[]` |
135135
| `config.existingConfigmap` | Name of existing ConfigMap with PostgreSQL configuration | `""` |
136+
| `config.pgHbaConfig` | Content of a custom pg_hba.conf file to be used instead of the default config | `""` |
136137

137138
### Custom User Configuration
138-
| Parameter | Description | Default |
139-
| --------------------------------------------- | --------------------------------------------------------------------------------------- | ------- |
140-
| `customUser` | Optional user to be created at initialisation with a custom password and database | `{}` |
141-
| `customUser.name` | Name of the custom user to be created | `""` |
142-
| `customUser.database` | Name of the database to be created | `""` |
143-
| `customUser.password` | Password to be used for the custom user | `""` |
144-
| `customUser.existingSecret` | Existing secret, in which username, password and database name are saved | `""` |
145-
| `customUser.secretKeys` | Name of keys in existing secret to use the custom user name, password and database | `{name: "", database: "", password: ""}` |
139+
| Parameter | Description | Default |
140+
| --------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------- |
141+
| `customUser` | Optional user to be created at initialisation with a custom password and database | `{}` |
142+
| `customUser.name` | Name of the custom user to be created | `""` |
143+
| `customUser.database` | Name of the database to be created | `""` |
144+
| `customUser.password` | Password to be used for the custom user | `""` |
145+
| `customUser.existingSecret` | Existing secret, in which username, password and database name are saved | `""` |
146+
| `customUser.secretKeys` | Name of keys in existing secret to use the custom user name, password and database | `{name: "", database: "", password: ""}` |
146147

147148
### PostgreSQL Initdb Configuration
148149

149-
| Parameter | Description | Default |
150-
| ------------------------- | ----------------------------------------------------------------------------- | ------- |
150+
| Parameter | Description | Default |
151+
| ------------------------- | -------------------------------------------------------------------------------- | ------- |
151152
| `initdb.args` | Send arguments to postgres initdb. This is a space separated string of arguments | `""` |
152-
| `initdb.scripts` | Dictionary of initdb scripts | `{}` |
153-
| `initdb.scriptsConfigMap` | ConfigMap with scripts to be run at first boot | `""` |
153+
| `initdb.scripts` | Dictionary of initdb scripts | `{}` |
154+
| `initdb.scriptsConfigMap` | ConfigMap with scripts to be run at first boot | `""` |
154155

155156
### Service configuration
156157

@@ -193,7 +194,7 @@ The following table lists the configurable parameters of the PostgreSQL chart an
193194
### Persistent Volume Claim Retention Policy
194195

195196
| Parameter | Description | Default |
196-
| -------------------------------------------------- | ------------------------------------------------------------------------------ | -----------|
197+
| -------------------------------------------------- | ------------------------------------------------------------------------------ | ---------- |
197198
| `persistentVolumeClaimRetentionPolicy.enabled` | Enable Persistent volume retention policy for the Statefulset | `false` |
198199
| `persistentVolumeClaimRetentionPolicy.whenDeleted` | Volume retention behavior that applies when the StatefulSet is deleted | `"Retain"` |
199200
| `persistentVolumeClaimRetentionPolicy.whenScaled` | Volume retention behavior when the replica count of the StatefulSet is reduced | `"Retain"` |
@@ -246,10 +247,10 @@ The following table lists the configurable parameters of the PostgreSQL chart an
246247

247248
### Extra Configuration Parameters
248249

249-
| Parameter | Description | Default |
250-
|----------------------|------------------------------------------------------------------------|-----------|
251-
| `extraObjects` | Array of extra objects to deploy with the release | `[]` |
252-
| `extraEnvVarsSecret` | Name of an existing Secret containing additional environment variables | `` |
250+
| Parameter | Description | Default |
251+
| -------------------- | ---------------------------------------------------------------------- | ------- |
252+
| `extraObjects` | Array of extra objects to deploy with the release | `[]` |
253+
| `extraEnvVarsSecret` | Name of an existing Secret containing additional environment variables | `` |
253254

254255
#### Extra Objects
255256

charts/postgres/templates/configmap.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ metadata:
1111
{{- include "postgres.annotations" . | nindent 4 }}
1212
{{- end }}
1313
data:
14+
{{- if .Values.config.pgHbaConfig }}
15+
pg_hba.conf: |
16+
{{ .Values.config.pgHbaConfig | indent 4 }}
17+
{{- end }}
1418
postgresql.conf: |
1519
# PostgreSQL configuration file
1620
@@ -99,6 +103,11 @@ data:
99103
lc_time = 'en_US.utf8'
100104
default_text_search_config = 'pg_catalog.english'
101105
106+
{{ if .Values.config.pgHbaConfig }}
107+
# Set custom pg_hba.conf file to use
108+
hba_file = '{{ include "postgres.configDir" . }}/pg_hba.conf'
109+
{{- end }}
110+
102111
# Additional Configuration
103112
{{- range .Values.config.extraConfig }}
104113
{{ . }}

charts/postgres/templates/statefulset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ spec:
4242
{{- toYaml .Values.securityContext | nindent 12 }}
4343
image: {{ include "postgres.image" . }}
4444
imagePullPolicy: {{ .Values.image.imagePullPolicy }}
45+
args:
46+
- -c
47+
- 'config_file={{ include "postgres.configDir" . }}/postgresql.conf'
4548
env:
4649
- name: PGDATA
4750
value: {{ include "postgres.dataDir" . }}/pgdata

charts/postgres/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ config:
9999
extraConfig: []
100100
## @param config.existingConfigmap Name of existing ConfigMap with PostgreSQL configuration
101101
existingConfigmap: ""
102+
## @param config.pgHbaConfig Content of a custom pg_hba.conf file to be used instead of the default config
103+
pgHbaConfig: ""
102104

103105
## @section customUser Optional user to be created at initialisation with a custom password and database
104106
customUser: {}

0 commit comments

Comments
 (0)