Skip to content

Commit f2b014f

Browse files
authored
Merge pull request #43 from small-hack/fix-test-app-and-docs
fix test app and docs
2 parents 0a7b1b6 + bb40930 commit f2b014f

File tree

8 files changed

+71
-26
lines changed

8 files changed

+71
-26
lines changed

.github/workflows/ci-helm-lint-test.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
- name: Install Helm
2323
uses: azure/setup-helm@v3.5
2424

25+
- name: Add dependency chart repos
26+
run: |
27+
helm repo add cnpg https://cloudnative-pg.github.io/charts
28+
2529
- name: Set up chart-testing
2630
uses: helm/chart-testing-action@v2.6.1
2731

@@ -49,7 +53,7 @@ jobs:
4953
kubectl get pods -A
5054
pwd
5155
ls -hal
52-
56+
5357
- name: Install Certmanager
5458
run: |
5559
helm repo add jetstack https://charts.jetstack.io
@@ -60,7 +64,7 @@ jobs:
6064
--set installCRDs=true \
6165
--set prometheus.enabled=false \
6266
--wait
63-
67+
6468
- name: Install CNPG Operator
6569
run: |
6670
helm repo add cnpg-operator https://cloudnative-pg.github.io/charts
@@ -95,7 +99,7 @@ jobs:
9599
replicationTLSSecret: ""
96100
user:
97101
enabled: true
98-
username:
102+
username:
99103
- "app"
100104
monitoring:
101105
enablePodMonitor: false
@@ -114,7 +118,7 @@ jobs:
114118
testApp:
115119
enabled: false
116120
EOF
117-
121+
118122
- name: Install CNPG cluster
119123
working-directory: ./charts/cloudnative-pg-cluster
120124
run: |
@@ -139,7 +143,7 @@ jobs:
139143
echo "$STATUS"
140144
(( ++ITER ))
141145
done
142-
146+
143147
- name: Run chart-testing (install)
144148
id: install
145149
if: steps.list-changed.outputs.changed == 'true'

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ cnpgCluster:
7070
# All other values here are passed directly to the their chart. See:
7171
# https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/values.yaml
7272
enabled: true
73-
type: postgresql
74-
mode: standalone
7573
# -- see: https://cloudnative-pg.io/docs/1.28/certificates#client-certificate
7674
certificates:
7775
## examples if using our certificates features of this chart.
@@ -80,21 +78,52 @@ cnpgCluster:
8078
serverCASecret: "app-postgres-server-ca-key-pair"
8179
clientCASecret: "app-postgres-client-ca-key-pair"
8280
replicationTLSSecret: "app-postgres-client-cert"
83-
84-
postgresql:
85-
# -- records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
86-
# this states that certs are required for access to the cluster,
87-
# but you can change it to still allow passwords if you'd like
88-
pg_hba:
89-
- hostnossl all all 0.0.0.0/0 reject
90-
- hostssl all all 0.0.0.0/0 cert clientcert=verify-full
81+
82+
cluster:
83+
initdb:
84+
# -- replace this with your database name
85+
database: app
86+
# -- replace this with your database username
87+
owner: app
88+
89+
postgresql:
90+
# -- records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
91+
# this states that certs are required for access to the cluster,
92+
# but you can change it to still allow passwords if you'd like
93+
pg_hba:
94+
- hostnossl all all 0.0.0.0/0 reject
95+
- hostssl all all 0.0.0.0/0 cert clientcert=verify-full
9196
```
9297
9398
### Using the test app
9499
95100
The test app may be enabled by certificates as well as setting `testApp.enabled=true` in your helm parameters or in the `values.yaml` like this:
96101
```yaml
102+
# -- name to use for templating certs
103+
name: "app-postgres"
104+
97105
testApp:
98106
enabled: true
107+
108+
cnpgCluster:
109+
# -- enable this to deploy the official CNPG cluster helm chart dep
110+
# All other values here are passed directly to the their chart. See:
111+
# https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/values.yaml
112+
enabled: true
113+
# -- see: https://cloudnative-pg.io/docs/1.28/certificates#client-certificate
114+
certificates:
115+
## examples if using our certificates features of this chart.
116+
## NOTE: app-postgres should be replaced with whatever you set Values.name to
117+
serverTLSSecret: "app-postgres-server-cert"
118+
serverCASecret: "app-postgres-server-ca-key-pair"
119+
clientCASecret: "app-postgres-client-ca-key-pair"
120+
replicationTLSSecret: "app-postgres-client-cert"
121+
122+
cluster:
123+
initdb:
124+
# -- replace this with your database name
125+
database: app
126+
# -- replace this with your database username
127+
owner: app
99128
```
100129
This will create a very basic Deployment of `ghcr.io/cloudnative-pg/webtest` [as described in the official docs](https://cloudnative-pg.io/docs/1.28/ssl_connections#testing-the-connection-via-a-tls-certificate) that attempts to connect to your postgres cluster using full mTLS.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: cluster
3+
repository: https://cloudnative-pg.github.io/charts
4+
version: 0.5.0
5+
digest: sha256:267917b68a642fca0e337cd78580f656a5084d3a84aa2df12a9291bee6ccbc56
6+
generated: "2026-01-18T10:52:01.555554815+01:00"

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: 1.0.0
5+
version: 1.0.1
66

77
dependencies:
88
- name: cluster

charts/cloudnative-pg-cluster/README.md

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

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

@@ -36,10 +36,12 @@ Create postgres tenant clusters managed by the CNPG Operator
3636
| cnpgCluster.additionalEnv[1].name | string | `"AWS_RESPONSE_CHECKSUM_VALIDATION"` | |
3737
| cnpgCluster.additionalEnv[1].value | string | `"when_required"` | |
3838
| cnpgCluster.certificates | object | `{}` | see: https://cloudnative-pg.io/docs/1.28/certificates#client-certificate |
39+
| cnpgCluster.cluster.initdb.database | string | `"app"` | |
40+
| cnpgCluster.cluster.initdb.owner | string | `"app"` | |
3941
| cnpgCluster.cluster.instances | int | `3` | Number of instances |
42+
| cnpgCluster.cluster.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 |
4043
| cnpgCluster.enabled | bool | `false` | enable this to deploy the official CNPG cluster helm chart dep All other values here are passed directly to the their chart. See: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/values.yaml |
4144
| cnpgCluster.mode | string | `"standalone"` | |
42-
| cnpgCluster.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 |
4345
| cnpgCluster.primaryUpdateStrategy | string | `"unsupervised"` | |
4446
| cnpgCluster.type | string | `"postgresql"` | |
4547
| cnpgCluster.version.postgresql | string | `"16"` | |
44.4 KB
Binary file not shown.

charts/cloudnative-pg-cluster/templates/test-app.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ spec:
3030
sslcert=/etc/secrets/app/tls.crt
3131
sslrootcert=/etc/secrets/ca/ca.crt
3232
host={{ .Values.name }}-rw.{{ .Release.Namespace }}.svc
33-
dbname={{ .Values.bootstrap.initdb.database }}
34-
user={{ .Values.bootstrap.initdb.owner }}
33+
dbname={{ .Values.cnpgCluster.cluster.initdb.database }}
34+
user={{ .Values.cnpgCluster.cluster.initdb.owner }}
3535
sslmode=verify-full
3636
- name: SQL_QUERY
3737
value: SELECT 1
@@ -50,6 +50,6 @@ spec:
5050
defaultMode: 0600
5151
- name: secret-volume-app
5252
secret:
53-
secretName: "{{ .Values.name }}-{{ .Values.bootstrap.initdb.owner }}-cert"
53+
secretName: "{{ .Values.name }}-{{ .Values.cnpgCluster.cluster.initdb.owner }}-cert"
5454
defaultMode: 0600
5555
{{- end }}

charts/cloudnative-pg-cluster/values.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ cnpgCluster:
6565
# -- Number of instances
6666
instances: 3
6767

68-
postgresql:
69-
# -- records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
70-
pg_hba:
71-
- hostnossl all all 0.0.0.0/0 reject
72-
- hostssl all all 0.0.0.0/0 cert clientcert=verify-full
68+
initdb:
69+
database: app
70+
owner: app
71+
72+
postgresql:
73+
# -- records for the pg_hba.conf file. ref: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html
74+
pg_hba:
75+
- hostnossl all all 0.0.0.0/0 reject
76+
- hostssl all all 0.0.0.0/0 cert clientcert=verify-full
7377

7478
primaryUpdateStrategy: unsupervised
7579

0 commit comments

Comments
 (0)