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

Merged
justusbunsi merged 2 commits from refs/pull/542/head into main 2023-10-14 16:06:00 +00:00
justusbunsi commented 2023-10-14 15:36:42 +00:00 (Migrated from gitea.com)

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 commented 2023-10-14 15:38:23 +00:00 (Migrated from gitea.com)

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...
pat-s (Migrated from gitea.com) reviewed 2023-10-14 15:40:05 +00:00
pat-s commented 2023-10-14 16:05:41 +00:00 (Migrated from gitea.com)

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 (Migrated from gitea.com) approved these changes 2023-10-14 16:05:49 +00:00
Sign in to join this conversation.
No description provided.