Praefect: set the PostgreSQL SSL mode in the Praefect block

What does this MR do?

Adds gitlab.praefect.psql.sslMode, so the Praefect database SSL mode can be set in the Praefect block. It is read local first, then global.praefect.psql.sslMode, which defaults to disable. An empty value stays empty, and pgx applies prefer. Existing values that set only the global key render the same config.

gitlab:
  praefect:
    psql:
      sslMode: verify-full

The mount of the server CA and client certificate is unchanged (global.psql.ssl).

Note: host and port already read a Praefect-block value, but only after the global one. This key follows the usual chart rule instead, where the block overrides the global value.

Proof

Praefect on k3s against an external PostgreSQL 16 that accepts TLS connections only (private CA, pg_hba hostssl). Server-side TLS state comes from pg_stat_ssl.

Chart Values Rendered sslmode Result
master block key verify-full disable key ignored; server refuses (no pg_hba.conf entry)
branch block key verify-full verify-full connects; ssl=t, TLSv1.3
branch global key only verify-full connects; ssl=t, TLSv1.3
branch block verify-full, global disable verify-full connects; ssl=t, TLSv1.3 (block wins)
branch block disable, global verify-full disable server refuses (block wins)
branch neither disable server refuses, as on master

With the global key only, or nothing set, the rendered Praefect ConfigMap and StatefulSet are byte-identical to master.

How to test

bundle exec rspec spec/configuration/praefect_spec.rb   # 28 examples, 0 failures

helm template test . -f <values with global.praefect.enabled> \
  --set gitlab.praefect.psql.sslMode=verify-full \
  -s charts/gitlab/charts/praefect/templates/configmap.yaml | grep sslmode
# sslmode = 'verify-full'; drop the --set for 'disable'; set only
# global.praefect.psql.sslMode to see the fallback

An AI coding assistant wrote this change. The assistant also checked each claim against a running Praefect on a k3s test VM with a TLS-only PostgreSQL 16, and ran the Praefect spec and markdownlint on the changed files.

Closes #6451

Part of #6438

Author checklist

For general guidance, please follow our Contributing guide.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • MR has a green pipeline.
  • Documentation created/updated.
  • Tests added/updated.
  • Have you validated that your change works end-to-end on a real cluster deployment? See Proof.
  • Equivalent MR/issue for omnibus-gitlab opened.
  • When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.

Reviewers checklist

Edited by Andrew Dunn

Merge request reports

Loading
Loading