Skip to content

Commit

Permalink
exposing pg_ident and shared_preload_libraries (#377)
Browse files Browse the repository at this point in the history
* Added `cluster.postgresql.pg_ident`
* Added `cluster.postgresql.shared_preload_libraries`

---------

Signed-off-by: Neal <[email protected]>
Signed-off-by: Itay Grudev <[email protected]>
Co-authored-by: Itay Grudev <[email protected]>
  • Loading branch information
nealcm and itay-grudev authored Sep 9, 2024
1 parent 7fa44fe commit f4a74a3
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
| cluster.postgresUID | int | `-1` | The UID of the postgres user inside the image, defaults to 26 |
| 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.postgresql.pg_ident | list | `[]` | PostgreSQL User Name Maps rules (lines to be appended to the pg_ident.conf file) |
| cluster.postgresql.shared_preload_libraries | list | `[]` | Lists of shared preload libraries to add to the default ones |
| 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
5 changes: 5 additions & 0 deletions charts/cluster/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ spec:
{{- if eq .Values.type "timescaledb" }}
- timescaledb
{{- end }}
{{- with .Values.cluster.postgresql.shared_preload_libraries }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.cluster.postgresql }}
parameters:
{{- toYaml .parameters | nindent 6 }}
pg_hba:
{{- toYaml .pg_hba | nindent 6 }}
pg_ident:
{{- toYaml .pg_ident | nindent 6 }}
{{ end }}

managed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ spec:
max_connections: "42"
pg_hba:
- host all 1.2.3.4/32 trust
pg_ident:
- mymap /^(.*)@mydomain\.com$ \1
shared_preload_libraries:
- pgaudit
bootstrap:
initdb:
database: mydb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ cluster:
max_connections: "42"
pg_hba:
- host all 1.2.3.4/32 trust
pg_ident:
- mymap /^(.*)@mydomain\.com$ \1
shared_preload_libraries:
- pgaudit
initdb:
database: mydb
owner: dante
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
- describe:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
- podLogs:
selector: cnpg.io/cluster=timescale-cluster
- name: Verify timescale extensions are installed
timeouts:
apply: 1s
Expand Down Expand Up @@ -101,6 +103,12 @@ spec:
recovery-backup-pitr ../../
- assert:
file: ./07-recovery_backup_pitr_cluster-assert.yaml
catch:
- describe:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
- podLogs:
selector: cnpg.io/cluster=recovery-backup-pitr-cluster
- name: Verify the pre-backup data on the recovery cluster exists but not the post-backup data
try:
- apply:
Expand Down
6 changes: 6 additions & 0 deletions charts/cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@
},
"pg_hba": {
"type": "array"
},
"pg_ident": {
"type": "array"
},
"shared_preload_libraries": {
"type": "array"
}
}
},
Expand Down
4 changes: 4 additions & 0 deletions charts/cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ cluster:
# -- 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
pg_ident: []
# - mymap /^(.*)@mydomain\.com$ \1
shared_preload_libraries: []
# - pgaudit

# -- 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 f4a74a3

Please sign in to comment.