[postgresql-ha] Use pgpool service as db connection proxy #542

Merged
pat-s merged 2 commits from justusbunsi/helm-chart:fix-502 into main 2023-10-14 16:06:00 +00:00
Contributor

Description of the change

The postgresql-ha provides a dedicated deployment and service called pgpool. This application is a proxy that routes the db queries to the active database replica. There's a note about that in their README1 .

Issue #502 is a side-effect of not using that proxy.

Possible drawbacks

Using the Charts' default configuration, the pgpool deployment has 1 replica, making this a single-point of failure. But users can change the related postgresql-ha.pgpool.replicaCount to their needs.

Applicable issues

Checklist

  • Templating unittests are added
### Description of the change The `postgresql-ha` provides a dedicated deployment and service called `pgpool`. This application is a proxy that routes the db queries to the active database replica. There's a note about that in their README[^1]. Issue #502 is a side-effect of not using that proxy. ### Possible drawbacks Using the Charts' default configuration, the `pgpool` deployment has 1 replica, making this a single-point of failure. But users can change the related `postgresql-ha.pgpool.replicaCount` to their needs. ### Applicable issues - fixes #502 ### Checklist - [x] Templating unittests are added [^1]: https://github.com/bitnami/charts/blob/main/bitnami/postgresql-ha/templates/postgresql/statefulset.yaml#introduction
justusbunsi added 1 commit 2023-10-14 15:36:42 +00:00
[postgresql-ha] Add tests ensuring correct rendering
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 22s
eb8273b7e1
Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com>
Author
Contributor

The build failed because the added test failed.

FAIL config template | database section (postgresql-ha)	unittests/config/database-section_postgresql-ha.yaml	- connects to pgpool service	- asserts[0] `matchRegex` fail	Template:	gitea/templates/gitea/config.yaml	DocumentIndex:	0	Path:	stringData.database	Expected to match:	HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.cluster.local:5432	Actual:	DB_TYPE=postgres	HOST=gitea-unittests-postgresql-ha-postgresql.testing.svc.cluster.local:5432	NAME=gitea	PASSWD=gitea	USER=gitea 

I wanted to verify that the build actually fails. Adding the actual fix now...

The build failed because the added test failed. ``` FAIL config template | database section (postgresql-ha) unittests/config/database-section_postgresql-ha.yaml - connects to pgpool service - asserts[0] `matchRegex` fail Template: gitea/templates/gitea/config.yaml DocumentIndex: 0 Path: stringData.database Expected to match: HOST=gitea-unittests-postgresql-ha-pgpool.testing.svc.cluster.local:5432 Actual: DB_TYPE=postgres HOST=gitea-unittests-postgresql-ha-postgresql.testing.svc.cluster.local:5432 NAME=gitea PASSWD=gitea USER=gitea ``` I wanted to verify that the build actually fails. Adding the actual fix now...
justusbunsi added 1 commit 2023-10-14 15:39:16 +00:00
Apply fix
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 26s
b219314e2d
Signed-off-by: justusbunsi <sk.bunsenbrenner@gmail.com>
justusbunsi changed title from [postgresql-ha] Add tests ensuring correct rendering to [postgresql-ha] Use pgpool service as db connection proxy 2023-10-14 15:39:54 +00:00
justusbunsi requested review from pat-s 2023-10-14 15:40:05 +00:00
justusbunsi added the
kind
bug
priority
critical
labels 2023-10-14 15:40:38 +00:00
Collaborator

Oh wow, another deep dive and 🚀 -like find of yours! 👏
That indeed all makes sense and should fix #502.

Also great to see the power of helm-unittest - using it like this is really great.

Oh wow, another deep dive and 🚀 -like find of yours! 👏 That indeed all makes sense and should fix #502. Also great to see the power of `helm-unittest` - using it like this is really great.
pat-s approved these changes 2023-10-14 16:05:49 +00:00
pat-s merged commit b68b9d91cf into main 2023-10-14 16:06:00 +00:00
justusbunsi deleted branch fix-502 2023-10-14 16:27:31 +00:00
Sign in to join this conversation.
No description provided.