Skip to content

Commit 1a4f902

Browse files
author
Max Roby
committed
enable cert creation for multiple users
1 parent f8bed61 commit 1a4f902

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
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.3.8
5+
version: 0.3.9
66

77
maintainers:
88
- name: "cloudymax"

charts/cloudnative-pg-cluster/README.md

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

3-
![Version: 0.3.8](https://img.shields.io/badge/Version-0.3.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
3+
![Version: 0.3.9](https://img.shields.io/badge/Version-0.3.9-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

@@ -33,7 +33,7 @@ Create postgres tenant clusters managed by the CNPG Operator
3333
| certificates.server.serverCASecret | string | `""` | name of existing Kubernetes Secret for the postgresql server Certificate Authority cert, ignored if certificates.generate is true |
3434
| certificates.server.serverTLSSecret | string | `""` | name of existing Kubernetes Secret for the postgresql server TLS cert, ignored if certificates.generate is true |
3535
| certificates.user.enabled | bool | `false` | create a certificate for a user to connect to postgres using CertManager requires server and client certificate generation enabled |
36-
| certificates.user.username | string | `"app"` | name of the user to create a cert for, eg: the DbOwner specified earlier. This data populated into the commonName field of the certificate. |
36+
| 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. |
3737
| enableSuperuserAccess | bool | `false` | CNPG disables the postgres superuser by default must be explicitly enabled |
3838
| externalClusters | list | `[]` | |
3939
| imageName | string | `"ghcr.io/cloudnative-pg/postgresql:16.0"` | image to use for all tenant pods |
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{{- if and .Values.certificates.user.enabled }}
2+
{{- range .Values.certificates.user.username }}
23
---
34
apiVersion: v1
45
kind: Secret
56
metadata:
6-
name: "{{ .Values.name }}-{{ .Values.certificates.user.username }}-cert"
7+
name: "{{ $.Values.name }}-{{ . }}-cert"
78
labels:
89
cnpg.io/reload: ""
910
---
1011
apiVersion: cert-manager.io/v1
1112
kind: Certificate
1213
metadata:
13-
name: "{{ .Values.name }}-{{ .Values.certificates.user.username }}-cert"
14+
name: "{{ $.Values.name }}-{{ . }}-cert"
1415
spec:
15-
secretName: "{{ .Values.name }}-{{ .Values.certificates.user.username }}-cert"
16+
secretName: "{{ $.Values.name }}-{{ . }}-cert"
1617
usages:
1718
- client auth
18-
commonName: {{ .Values.certificates.user.username }}
19+
commonName: {{ . }}
1920
issuerRef:
20-
name: "{{ .Values.name }}-client-ca-issuer"
21+
name: "{{ $.Values.name }}-client-ca-issuer"
2122
kind: Issuer
2223
group: cert-manager.io
2324
{{- end }}
25+
{{- end }}

charts/cloudnative-pg-cluster/values.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ certificates:
114114
# -- create a certificate for a user to connect to postgres using CertManager
115115
# requires server and client certificate generation enabled
116116
enabled: false
117-
# -- name of the user to create a cert for, eg: the DbOwner specified earlier.
117+
# -- List of names of users to create a cert for, eg: the DbOwner specified earlier.
118118
# This data populated into the commonName field of the certificate.
119-
username: "app"
119+
username:
120+
- "app"
120121

121122
monitoring:
122123
# -- enable monitoring via Prometheus

0 commit comments

Comments
 (0)