Keep PostgreSQL transactions below maxParallel

What does this MR do?

It keeps OpenBao's PostgreSQL transactions below maxParallel, so the HA lock renewal always gets a connection.

OpenBao's PostgreSQL storage uses one connection pool for transactions and for the HA lock renewal. With the chart defaults, max_parallel is 5 and transaction_max_parallel is unset, so OpenBao allows up to 64 transactions. A burst of requests can then hold all 5 connections. Every KV read runs in a transaction, so a burst of secret reads is enough. The lock renewal has a 10 s deadline that includes waiting for a connection. When it can't get one, the active node loses its HA lock and steps down.

Settings Rendered transaction_max_parallel
maxParallel: 3 2
Chart defaults (maxParallel: 5) 3
maxParallel: 20 18
maxParallel: 20, transactionMaxParallel: 15 15
maxParallel: null, transactionMaxParallel: null Not rendered. OpenBao's defaults already leave room: 64 transactions out of 128 connections.
  • Default maxParallel - 2: the 2 reserved connections let the lock renewal and a keyring write get one at the same time. The lock checks before commits are short and fit in between.
  • At least 2 transactions: like OpenBao itself, which never derives a limit below 2 (openbao@5de61eb, in v2.7.0). Waiting for a transaction never times out, and some code paths start one while holding another, such as a lease tidy revoking a database engine lease. With a single transaction, they would hang forever.
  • Validation: the render fails when transactionMaxParallel isn't lower than maxParallel (or OpenBao's default of 128). It also fails when maxParallel is below 3 and transactionMaxParallel is unset, because that leaves no room for both the reserve and 2 transactions. The schema rejects a transactionMaxParallel below 2.
  • Version: the chart is bumped to 1.2.0, a minor version, because it adds the transactionMaxParallel value.

This MR doesn't change maxParallel or maxIdleConnections, so OpenBao doesn't open more connections to a PostgreSQL server shared with GitLab. Raising maxIdleConnections is discussed in #47.

Upgrade impact

Installs that keep the defaults go from up to 5 transactions at once to 3. Bursts of reads may queue slightly longer, but they can no longer take every connection and cost the active node its HA lock.

Installs that set maxParallel get maxParallel - 2 transactions, and at least 2. Installs that now fail to render, with an error that says why:

  • maxParallel below 3, with transactionMaxParallel unset;
  • transactionMaxParallel set to maxParallel or higher;
  • transactionMaxParallel set below 2.

How to verify

  1. Run helm unittest .. The new tests in tests/configmap_test.yaml cover the default, the computed value, the floor of 2, an explicit value, both values unset, and the four failure cases.
  2. Run helm template t . | grep max_parallel. It shows "max_parallel": 5 and "transaction_max_parallel": 3.

Locally, all 114 tests pass and helm lint --strict . reports no errors.

Follow-ups

Author's Checklist

Required

  • Ensure a release milestone is set.
  • MR title and description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline on GitLab.com.
  • If the MR changes the packaged chart (templates/, values.yaml, values.schema.json), version in Chart.yaml is bumped per the release process.
  • When ready for review, MR is labeled workflowready for review per the MR workflow.

Expected

  • Test plan indicating conditions for success has been posted and passes.
  • Documentation is created or updated. The docs live in other projects; see the follow-ups.
  • Tests are added.
  • Related to #47

🤖 Generated with Claude Code

Edited by Fabien Catteau

Merge request reports

Loading
Loading