Skip to content

Commit

Permalink
feat( cluster ): Added support to customise pg_hba (#321)
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Trangoni <[email protected]>
Signed-off-by: Itay Grudev <[email protected]>
Co-authored-by: Itay Grudev <[email protected]>
  • Loading branch information
mjtrangoni and itay-grudev authored Sep 4, 2024
1 parent 932bc82 commit eb2f245
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
3 changes: 2 additions & 1 deletion charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| cluster.monitoring.prometheusRule.excludeRules | list | `[]` | Exclude specified rules |
| cluster.postgresGID | int | `26` | The GID of the postgres user inside the image, defaults to 26 |
| cluster.postgresUID | int | `26` | The UID of the postgres user inside the image, defaults to 26 |
| cluster.postgresql | object | `{}` | Configuration of the PostgreSQL server. See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-PostgresConfiguration |
| cluster.postgresql.parameters | object | `{}` | PostgreSQL configuration options (postgresql.conf) |
| cluster.postgresql.pg_hba | list | `[]` | PostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file) |
| cluster.primaryUpdateMethod | string | `"switchover"` | Method to follow to upgrade the primary server during a rolling update procedure, after all replicas have been successfully updated. It can be switchover (default) or restart. |
| cluster.primaryUpdateStrategy | string | `"unsupervised"` | Strategy to follow to upgrade the primary server during a rolling update procedure, after all replicas have been successfully updated: it can be automated (unsupervised - default) or manual (supervised) |
| cluster.priorityClassName | string | `""` | |
Expand Down
4 changes: 3 additions & 1 deletion charts/cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ spec:
{{- end }}
{{- with .Values.cluster.postgresql }}
parameters:
{{- toYaml . | nindent 6 }}
{{- toYaml .parameters | nindent 6 }}
pg_hba:
{{- toYaml .pg_hba | nindent 6 }}
{{ end }}

managed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ spec:
postgresql:
parameters:
max_connections: "42"
pg_hba:
- host all 1.2.3.4/32 trust
bootstrap:
initdb:
database: mydb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ cluster:
- pg_monitor
- pg_signal_backend
postgresql:
max_connections: "42"
parameters:
max_connections: "42"
pg_hba:
- host all 1.2.3.4/32 trust
initdb:
database: mydb
owner: dante
Expand Down
10 changes: 9 additions & 1 deletion charts/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,15 @@
"type": "integer"
},
"postgresql": {
"type": "object"
"type": "object",
"properties": {
"parameters": {
"type": "object"
},
"pg_hba": {
"type": "array"
}
}
},
"primaryUpdateMethod": {
"type": "string"
Expand Down
11 changes: 7 additions & 4 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ cluster:
# usage: GAUGE
# description: "Cache hit ratio"

# -- Configuration of the PostgreSQL server.
# See: https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-PostgresConfiguration
postgresql: {}
# max_connections: 300
postgresql:
# -- PostgreSQL configuration options (postgresql.conf)
parameters: {}
# max_connections: 300
# -- PostgreSQL Host Based Authentication rules (lines to be appended to the pg_hba.conf file)
pg_hba: []
# - host all all 10.244.0.0/16 md5

# -- BootstrapInitDB is the configuration of the bootstrap process when initdb is used.
# See: https://cloudnative-pg.io/documentation/current/bootstrap/
Expand Down

0 comments on commit eb2f245

Please sign in to comment.