Skip to content

Commit 8ee1919

Browse files
authored
Merge pull request #19 from small-hack/add-test-deployment
add a test deployment for validation, bump chart
2 parents e7f1781 + 6068dbc commit 8ee1919

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
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.0
5+
version: 0.3.1
66

77
maintainers:
88
- name: "cloudymax"

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

@@ -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 | 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. |
3737
| instances | int | `3` | |
3838
| monitoring.enablePodMonitor | bool | `false` | enable monitoring via Prometheus |
3939
| name | string | `"cnpg"` | |
@@ -44,6 +44,8 @@ Create postgres tenant clusters managed by the CNPG Operator
4444
| scheduledBackup.spec.schedule | string | `"0 0 0 * * *"` | crontab style schedule to run the backups |
4545
| storage.size | string | `"1Gi"` | how much storage to allocate to the postgresql cluster |
4646
| superuserSecret.name | string | `"superuser-secret"` | |
47+
| testApp.enabled | bool | `false` | |
48+
| testApp.namespace | string | `"default"` | |
4749

4850
----------------------------------------------
4951
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{- if and .Values.testApp.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: "{{ .Values.name }}-cert-test"
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: "{{ .Values.name}}-webtest"
11+
template:
12+
metadata:
13+
labels:
14+
app: "{{ .Values.name}}-webtest"
15+
spec:
16+
containers:
17+
- image: ghcr.io/cloudnative-pg/webtest:1.6.0
18+
name: cert-test
19+
volumeMounts:
20+
- name: secret-volume-root-ca
21+
mountPath: /etc/secrets/ca
22+
- name: secret-volume-app
23+
mountPath: /etc/secrets/app
24+
ports:
25+
- containerPort: 8080
26+
env:
27+
- name: DATABASE_URL
28+
value: >
29+
sslkey=/etc/secrets/app/tls.key
30+
sslcert=/etc/secrets/app/tls.crt
31+
sslrootcert=/etc/secrets/ca/ca.crt
32+
host={{ .Values.name }}-rw.{{ .Values.testApp.namespace }}.svc
33+
dbname={{ .Values.bootstrap.initdb.database }}
34+
user={{ .Values.bootstrap.initdb.owner }}
35+
sslmode=verify-full
36+
- name: SQL_QUERY
37+
value: SELECT 1
38+
readinessProbe:
39+
httpGet:
40+
port: 8080
41+
path: /tx
42+
volumes:
43+
- name: secret-volume-root-ca
44+
secret:
45+
secretName: "{{ .Values.name }}-server-cert"
46+
defaultMode: 0600
47+
- name: secret-volume-app
48+
secret:
49+
secretName: "{{ .Values.name }}-{{ .Values.bootstrap.initdb.owner }}-cert"
50+
defaultMode: 0600
51+
{{- end }}

charts/cloudnative-pg-cluster/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,11 @@ postgresql:
9090
storage:
9191
# -- how much storage to allocate to the postgresql cluster
9292
size: 1Gi
93+
94+
testApp:
95+
## -- create a test deployment to verify db connectivity.
96+
# Populates user and DB from the Initdb owner and database values
97+
# Requires server, client, and user certificate generation to be enabled.
98+
enabled: false
99+
## -- namespace where the read-write postgres service exists
100+
namespace: "default"

0 commit comments

Comments
 (0)