Repository navigation
Allow separate configuration for the replica connection pooler - #3188
Open
omkar619-dev wants to merge 5 commits into
Open
omkar619-dev wants to merge 5 commits into
omkar619-dev wants to merge 5 commits into
Conversation
Signed-off-by: Omkar Shendge <omkarshendge619@gmail.com>
Signed-off-by: Omkar Shendge <omkarshendge619@gmail.com>
Signed-off-by: Omkar Shendge <omkarshendge619@gmail.com>
Signed-off-by: Omkar Shendge <omkarshendge619@gmail.com>
omkar619-dev
marked this pull request as ready for review
September 19, 2026 08:27
omkar619-dev
requested review from
FxKu,
Jan-M,
hughcapet,
idanovinda,
jopadi and
mikkeloscar
as code owners
September 19, 2026 08:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
replicaConnectionPoolersection to the Postgres manifest so the replica pooler can be configured independently of the master pooler.The new type carries
numberOfInstances,mode,dockerImage,maxDBConnectionsandresources. It deliberately does not carryuserorschema: those are cluster-scoped rather than per-pooler. The two places that read them —poolerUser, and the lookup-function install insyncConnectionPooler— create objects once per cluster that both poolers share, so leaving those two fields out means neither site has to become role-aware.Fields are pointer-typed so unset means "inherit from connectionPooler" rather than "zero". A manifest using
enableReplicaConnectionPooler: truewith only aconnectionPoolersection behaves exactly as it does today.How it works
effectiveConnectionPoolerSpec(spec, role)resolves the settings for a role: master returnsconnectionPoolerunchanged, replica returnsconnectionPoolerwith any field explicitly set inreplicaConnectionPoolerlaid over it. It returns the existingConnectionPoolertype, soneedSyncConnectionPoolerSpecsandneedSyncConnectionPoolerDefaultskeep their signatures, and it never returns nil, which replaces a nil check that four call sites each repeated.Those four are
getConnectionPoolerEnvVars(the only signature change — it gains the role, and has a single caller),generateConnectionPoolerPodTemplate(already took the role and ignored it),generateConnectionPoolerDeployment(has it via
connectionPooler.Role), and the spec comparison insyncConnectionPoolerWorker.That last one though is the subtle one. If the comparison keeps looking only at
spec.ConnectionPooler, editingreplicaConnectionPooleron a live cluster produces no diff, the deployment is never regenerated, and the replica poolersilently keeps its old settings — correct on create, inert on update.
TestReplicaConnectionPoolerSyncOnOverrideChangedrivessyncConnectionPooleragainst the fake client and asserts the replica deployment moves from 2 to 4instances while the master stays at 2. I confirmed it fails (expected 4, actual 2) with the role argument removed.
Also included
TestEffectiveConnectionPoolerSpec: six cases covering inherit, partial override, full override and the empty-section cases.replicaConnectionPoolersection in the manifest reference, an example in the user guide, and a commented block in the complete manifest.Left out deliberately
Setting
connectionPooleron its own implicitly enables the master pooler, but there is no replica equivalent, soenableReplicaConnectionPoolerremains required and areplicaConnectionPoolersection alone won't switch anything on.That felt outside the scope of this change, but happy to make the two symmetric if you'd prefer.
Closes #3113