Skip to content

feat: Make the max_connections of the shared PostgreSQL configurable - #516

Merged
pbusko merged 3 commits into
cloudfoundry:mainfrom
ZPascal:postgres-max-connections
Oct 8, 2026
Merged

pbusko merged 3 commits into
cloudfoundry:mainfrom
ZPascal:postgres-max-connections

Conversation

@ZPascal

@ZPascal ZPascal commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

All Cloud Foundry components share one PostgreSQL instance. With its default of 100 connections, it can run out during a long load, and UAA (and then everything that needs a token) fails with FATAL: sorry, too many clients already.

I ran into this when running the integration tests of cf-java-client against kind-deployment (cloudfoundry/cf-java-client#1381, related to #339): after roughly 30-50 minutes, every Spring test context failed with scim: Failed to obtain JDBC Connection, and 529 to 901 of 903 tests errored.

The default stays as it is. This PR only makes max_connections configurable, so a workflow that needs more connections can ask for them when PostgreSQL is installed. The alternative is to raise the limit after the deployment with ALTER SYSTEM, restart PostgreSQL, and then restart every component that holds pooled connections (the cloud controller does not validate pooled connections and answers a 500 for each dead one).

Verification

cloudfoundry/cf-java-client#1381

@ZPascal
ZPascal requested a review from a team as a code owner October 8, 2026 03:43
ZPascal added a commit to ZPascal/cf-java-client that referenced this pull request Oct 8, 2026
Deploy Cloud Foundry from the ZPascal/kind-deployment fork, which has
cloudfoundry/kind-deployment#516, and drop the Postgres restart
workaround. Revert to the cloudfoundry/kind-deployment pin once cloudfoundry#516 is
merged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ZPascal ZPascal changed the title fix: Raise the max_connections of the shared PostgreSQL fix: Raise the max_connections of the shared PostgreSQL and make it configurable Oct 8, 2026
@ZPascal
ZPascal force-pushed the postgres-max-connections branch from cd113ec to 15c6f6b Compare October 8, 2026 04:01
@ZPascal ZPascal changed the title fix: Raise the max_connections of the shared PostgreSQL and make it configurable feat: Make the max_connections of the shared PostgreSQL configurable Oct 8, 2026
…nnections

Don't change the PostgreSQL default of 100 connections for everybody.
max_connections is only set when POSTGRES_MAX_CONNECTIONS (or the
postgres.maxConnections Helmfile value) is given, and the setup-cf
action exposes it as the postgres-max-connections input.
@c0d1ngm0nk3y

Copy link
Copy Markdown
Contributor

Hi,

I see the use case and this will work of course. But for this rather specific case, it is a bit too much imho. The environment variable and the changes to the github action are only convinience, so I am not sure if this is worth it.

Alternative: additional-values-files is already supported. What is missing is that we pass a postgresql property down to the chart in case it is present. So, I guess 4 lines and the if is probably not even necessary :)

WDYT?

…ted input

Drops the setup-cf input and env var; max_connections is now set through
additional-values-files. Documented in the README.
@ZPascal

ZPascal commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Hi,

I see the use case and this will work of course. But for this rather specific case, it is a bit too much imho. The environment variable and the changes to the github action are only convinience, so I am not sure if this is worth it.

Alternative: additional-values-files is already supported. What is missing is that we pass a postgresql property down to the chart in case it is present. So, I guess 4 lines and the if is probably not even necessary :)

WDYT?

I've updated the implementation.

@pbusko
pbusko merged commit 9b335b8 into cloudfoundry:main Oct 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants