Skip to content

Commit 0a7b1b6

Browse files
authored
Merge pull request #42 from small-hack/reduce-chart-functionality
update chart functionality to only do test app and certs
2 parents 853a4ba + e15994f commit 0a7b1b6

File tree

6 files changed

+153
-283
lines changed

6 files changed

+153
-283
lines changed

README.md

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,100 @@
11
# CloudNativePG Cluster Chart
22

3-
This [helm chart](https://small-hack.github.io/cloudnative-pg-tenant-chart/) is intended to be the Cluster helm chart component to the [CloudNativePG operator helm chart](https://github.com/cloudnative-pg/charts).
3+
This [helm chart](https://small-hack.github.io/cloudnative-pg-tenant-chart/) was intended to be the Cluster helm chart component to the [CloudNativePG operator helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg), but now serves mostly as a wrapper for their official [CloudNativePG cluster helm chart](https://github.com/cloudnative-pg/charts/tree/main/charts/cluster) that provides certificate and test app functionality.
44

5-
Docs autogeneratated from the [values.yaml](charts/cloudnative-pg-cluster/values.yaml) are slowly being put together in the chart directory's [README.md](./charts/cloudnative-pg-cluster/README.md).
5+
Docs auto-generated from the [values.yaml](charts/cloudnative-pg-cluster/values.yaml) are available in the chart directory's [README.md](./charts/cloudnative-pg-cluster/README.md).
66

77
## TLDR
88

99
```bash
1010
# add the helm repo locally
11-
helm repo add cnpg https://small-hack.github.io/cloudnative-pg-cluster-chart
11+
helm repo add cnpg-wrapper https://small-hack.github.io/cloudnative-pg-cluster-chart
1212

1313
# get the values and edit them if needed
14-
helm show values cnpg/cnpg-cluster > values.yaml
14+
helm show values cnpg-wrapper/cnpg-cluster > values.yaml
1515

1616
# install the chart
17-
helm install cnpg cnpg/cnpg-cluster --values values.yaml
17+
helm install cnpg cnpg-wrapper/cnpg-cluster --values values.yaml
1818
```
1919

2020
## Notes
2121

22-
### You must specify a bootstrap section
22+
### Using the certficates
2323

24-
To use this chart you _have_ to specify either `bootstrap.initdb.database`/`bootstrap.initdb.owner` OR `bootstrap.recovery.source` in your helm parameters or values.yaml but you can't do both.
24+
Certificates are generated using [CertManager](https://cert-manager.io/) to bootstrap self-signed CAs, Issuers and certs. To use them, please provide the following via your helm `values.yaml`:
2525

26-
You can see checkout the [CloudNativePG docs](https://cloudnative-pg.io/documentation/1.23/bootstrap/) for more info on the bootstrap section.
26+
```yaml
27+
# -- name to use for templating certs
28+
name: "app-postgres"
29+
30+
certificates:
31+
server:
32+
# -- enable using server certificates
33+
enabled: true
34+
# -- generate server certs using cert-manager. if true the following
35+
# are ignored: certificates.serverTLSSecret, certificates.serverCASecret
36+
generate: true
37+
# -- name of existing Kubernetes Secret for the postgresql server TLS cert,
38+
# ignored if certificates.generate is true
39+
serverTLSSecret: ""
40+
# -- name of existing Kubernetes Secret for the postgresql server Certificate
41+
# Authority cert, ignored if certificates.generate is true
42+
serverCASecret: ""
43+
client:
44+
# -- enable using client certificates
45+
enabled: true
46+
# -- generate client certs using cert-manager. if true the following are
47+
# ignored: certificates.clientCASecret, certificates.replicationTLSSecret
48+
generate: true
49+
# -- name of existing Kubernetes Secret for the postgresql client Certificate
50+
# Authority cert, ignored if certificates.generate is true
51+
clientCASecret: ""
52+
# -- name of existing Kubernetes Secret for the postgresql replication TLS
53+
# cert ignored if certificates.generate is true
54+
replicationTLSSecret: ""
55+
user:
56+
# -- create a certificate for a user to connect to postgres using CertManager
57+
# requires server and client certificate generation enabled
58+
enabled: true
59+
# -- List of names of users to create a cert for, eg: the DbOwner specified earlier.
60+
# This data populated into the commonName field of the certificate.
61+
username:
62+
- "my-app"
63+
```
64+
65+
Then, if you're using our bundled upstream CNPG cluster chart, make sure you provide the following:
66+
67+
```yaml
68+
cnpgCluster:
69+
# -- enable this to deploy the official CNPG cluster helm chart dep
70+
# All other values here are passed directly to the their chart. See:
71+
# https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/values.yaml
72+
enabled: true
73+
type: postgresql
74+
mode: standalone
75+
# -- see: https://cloudnative-pg.io/docs/1.28/certificates#client-certificate
76+
certificates:
77+
## examples if using our certificates features of this chart.
78+
## NOTE: app-postgres should be replaced with whatever you set Values.name to
79+
serverTLSSecret: "app-postgres-server-cert"
80+
serverCASecret: "app-postgres-server-ca-key-pair"
81+
clientCASecret: "app-postgres-client-ca-key-pair"
82+
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
91+
```
92+
93+
### Using the test app
94+
95+
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:
96+
```yaml
97+
testApp:
98+
enabled: true
99+
```
100+
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.

charts/cloudnative-pg-cluster/Chart.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ apiVersion: v2
22
name: cnpg-cluster
33
description: Create postgres tenant clusters managed by the CNPG Operator
44
type: application
5-
version: 0.8.0
5+
version: 1.0.0
6+
7+
dependencies:
8+
- name: cluster
9+
alias: cnpgCluster
10+
version: 0.5.0
11+
repository: https://cloudnative-pg.github.io/charts
12+
condition: cnpgCluster.enabled
613

714
maintainers:
815
- name: "cloudymax"
9-
url: "https://github.com/cloudymax"
16+
url: "https://cloudydev.net"
1017
- name: "jessebot"
1118
url: "https://jessebot.work"
Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
# cnpg-cluster
22

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

55
Create postgres tenant clusters managed by the CNPG Operator
66

77
## Maintainers
88

99
| Name | Email | Url |
1010
| ---- | ------ | --- |
11-
| cloudymax | | <https://github.com/cloudymax> |
11+
| cloudymax | | <https://cloudydev.net> |
1212
| jessebot | | <https://jessebot.work> |
1313

14+
## Requirements
15+
16+
| Repository | Name | Version |
17+
|------------|------|---------|
18+
| https://cloudnative-pg.github.io/charts | cnpgCluster(cluster) | 0.5.0 |
19+
1420
## Values
1521

1622
| Key | Type | Default | Description |
1723
|-----|------|---------|-------------|
18-
| annotations."cnpg.io/skipEmptyWalArchiveCheck" | string | `"enabled"` | |
19-
| backup | object | `{}` | if we should backup up this cluster, please see values.yaml for example |
20-
| bootstrap | object | `{}` | boostrap method. see: https://cloudnative-pg.io/documentation/1.23/bootstrap/ |
2124
| certificates.client.clientCASecret | string | `""` | name of existing Kubernetes Secret for the postgresql client Certificate Authority cert, ignored if certificates.generate is true |
2225
| certificates.client.enabled | bool | `false` | enable using client certificates |
2326
| certificates.client.generate | bool | `false` | generate client certs using cert-manager. if true the following are ignored: certificates.clientCASecret, certificates.replicationTLSSecret |
@@ -28,26 +31,20 @@ Create postgres tenant clusters managed by the CNPG Operator
2831
| certificates.server.serverTLSSecret | string | `""` | name of existing Kubernetes Secret for the postgresql server TLS cert, ignored if certificates.generate is true |
2932
| certificates.user.enabled | bool | `false` | create a certificate for a user to connect to postgres using CertManager requires server and client certificate generation enabled |
3033
| 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. |
31-
| enableSuperuserAccess | bool | `false` | CNPG disables the postgres superuser by default must be explicitly enabled |
32-
| externalClusters | list | `[]` | |
33-
| imageCatalog.create | bool | `true` | Whether to provision an image catalog. If imageCatalog.images is empty this option will be ignored. |
34-
| imageCatalog.images | list | `[]` | List of images to be provisioned in an image catalog. |
35-
| instances | int | `3` | number of postgres replicas minimum 1 required |
36-
| managed | object | `{"roles":[]}` | See https://cloudnative-pg.io/documentation/current/cloudnative-pg.v1/#postgresql-cnpg-io-v1-RoleConfiguration for explanation of all options |
37-
| monitoring.enablePodMonitor | bool | `false` | enable monitoring via Prometheus |
38-
| name | string | `"cnpg"` | |
39-
| postgresGID | int | `-1` | The GID of the postgres user inside the image, defaults to 26 |
40-
| postgresUID | int | `-1` | The UID of the postgres user inside the image, defaults to 26 |
41-
| 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 |
42-
| primaryUpdateStrategy | string | `"unsupervised"` | |
43-
| resources | object | `{}` | |
44-
| scheduledBackup | object | `{}` | schduled backups section, please see values.yaml for example |
45-
| storage.size | string | `"1Gi"` | how much storage to allocate to the postgresql cluster |
46-
| storage.storageClass | string | `"default"` | set the storage class of the PVC. |
47-
| superuserSecret | string | `""` | name of existing secret to use as superuser redentials will be randomly generated if not specified. |
34+
| cnpgCluster.additionalEnv[0].name | string | `"AWS_REQUEST_CHECKSUM_CALCULATION"` | |
35+
| cnpgCluster.additionalEnv[0].value | string | `"when_required"` | |
36+
| cnpgCluster.additionalEnv[1].name | string | `"AWS_RESPONSE_CHECKSUM_VALIDATION"` | |
37+
| cnpgCluster.additionalEnv[1].value | string | `"when_required"` | |
38+
| cnpgCluster.certificates | object | `{}` | see: https://cloudnative-pg.io/docs/1.28/certificates#client-certificate |
39+
| cnpgCluster.cluster.instances | int | `3` | Number of instances |
40+
| 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 |
41+
| 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 |
43+
| cnpgCluster.primaryUpdateStrategy | string | `"unsupervised"` | |
44+
| cnpgCluster.type | string | `"postgresql"` | |
45+
| cnpgCluster.version.postgresql | string | `"16"` | |
46+
| name | string | `"app-postgres"` | name to use for templating certs |
4847
| testApp.enabled | bool | `false` | |
49-
| type | string | `"postgresql"` | Type of the CNPG database. Available types: * `postgresql` * `postgis` * `timescaledb` |
50-
| version.postgresql | int | `17` | version of postgres to run in all tenant pods |
5148

5249
----------------------------------------------
5350
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)

charts/cloudnative-pg-cluster/templates/cnpg_cluster.yaml

Lines changed: 0 additions & 83 deletions
This file was deleted.

charts/cloudnative-pg-cluster/templates/scheduled_backups.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)