HUP Gitaly when trusted certificates change

What does this MR do?

When a certificate is added to /etc/gitlab/trusted-certs, gitlab-ctl reconfigure links it into /opt/gitlab/embedded/ssl/certs/ and restarts Puma, GitLab Pages, and Workhorse, but not Gitaly. Gitaly reads its certificate pool once at startup, so internal API calls to an endpoint signed by the new CA keep failing with x509: certificate signed by unknown authority until Gitaly is restarted by hand.

This MR notifies Gitaly with a graceful :hup from the same ruby_block, which is how the Gitaly recipe already applies config.toml changes.

!10073 (merged) merged on 2026-11-12. It sets Gitaly's internal API ca_path and does not restart Gitaly when trusted certificates change, so the two changes remain independent.

Other Go services that get SSL_CERT_DIR (for example Praefect, KAS, and the registry) may have the same gap. I left those out of this MR to keep the change scoped to the issue; happy to follow up if maintainers want them included.

If CertificateHelper#link_certificates returns early because openssl rehash / c_rehash is missing (for example on some FIPS hosts), the stored cert hash is never updated, so new_certificate_added? stays true and this ruby_block runs on every reconfigure. Puma, Pages and Workhorse are already restarted in that state; this MR also HUPs Gitaly on each of those runs. A graceful restart is milder than a hard restart, and that side effect is accepted.

add_trusted_certs runs before gitaly::enable. A reconfigure that both changes trusted certs and Gitaly's env or secret therefore queues a delayed hup and then a delayed restart for Gitaly. Chef runs delayed notifications in order, so restart follows hup. I have not run a live Omnibus reconfigure to confirm Gitaly stays healthy if restart arrives while the graceful handoff is still draining (graceful_restart_timeout, 1m by default).

Closes #10225 (closed)

How to test

  1. Add a CA to /etc/gitlab/trusted-certs and run gitlab-ctl reconfigure.
  2. Confirm Gitaly is HUPed (graceful restart) along with the existing Puma / Pages / Workhorse restarts.
  3. A running Gitaly process should then trust the new CA without a manual restart.

Locally: bundle exec rspec spec/chef/cookbooks/gitlab/recipes/add_trusted_certs_spec.rb (6 examples, 0 failures) and bundle exec rubocop on the touched files (no offenses).

Checklist

  • MR title and description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • Tests added.
  • Latest Merge Result pipeline is green.
  • When ready for review, MR is marked as ready (not a draft) and a reviewer is requested.
Edited by Hossein Pursultani

Merge request reports

Loading
Loading