Add a shared Service Ping internal API key setting
What does this MR do?
What
Adds global.appConfig.servicePing.jwtSecret and generates the Service Ping internal API key at install, so the Webservice, Sidekiq and toolbox pods use the same key. An admin can point the chart at their own Secret instead.
charts/gitlab/templates/_service_ping.tpl: mounts the Secret at/etc/gitlab/service_ping/.gitlab_service_ping_secretand setsservice_ping.secret_fileingitlab.yml. The mount is optional, so the pods start when the Secret is missing. The Secret name defaults to<release>-gitlab-service-ping-secretandjwtSecret.keydefaults tosecret, also when empty.templates/shared-secrets/_manifest.tpl: generates the default Secret with 32 random bytes in base64, like the Workhorse secret.jwtSecret.secretonly renames the Secret. An existing Secret of that name is kept and the key is added only if missing.
Why
Every instance has Service Ping, so the key is treated like the Workhorse secret: consistent across pods, with an admin override. Unlike the Workhorse secret, GitLab does not need it to run. Without it, only the Service Ping internal API rejects requests.
This matches the Linux package, which generates the key on reconfigure in gitlab-org/omnibus-gitlab!10032 (merged).
Design choices for review
- Generated by
shared-secrets, not admin-created. Orbit uses an opt-in Secret because Orbit is an add-on. Service Ping ships in every instance, so a Helm install that never sets a value still gets one shared key. - Mounted in
webservice,sidekiqandtoolbox. Onlywebserviceserves the endpoint, but every Rails process runs the initializer that reads the key. Without the mount,sidekiqandtoolboxlog a failed write on every boot since the Rails root is read-only for thegituser. This matches the Workhorse and KAS secrets. - No
enabledflag.global.appConfig.enableUsagePingonly controls sending. The endpoint still answers withservice_ping_enabled: false, and the exporter needs the key to read that. - Not mounted in
migrationsorgeo-logcursor. Neither serves or verifies the endpoint, and the Rails initializer only logs a warning when it cannot write the file. This matches the knowledge graph and iam-auth secrets. - Helpers stay in
charts/gitlab/templates/. That is where the otherappConfigsecret helpers are, such as_iam_auth.tpland_mailroom.tpl, rather than the top-leveltemplates/. - Optional mount. Rails does not need the key to start.
ServicePing::InternalApiAuthenticator.ensure_secret!only logs a warning when it cannot write the file, and the endpoint then returns401. A required mount would leave new pods in Init on upgrade for anyone who disabled the shared-secrets job, and Toolbox (Recreate) would stay down. With optional: true, default installs still get the shared key, and those users keep a working upgrade. This matches gitlab-org/omnibus-gitlab!10032 (merged), which provides the key by default but never blocks GitLab without it.
Out of scope
- Admin steps to copy the key to the exporter cluster. These go in the Service Ping exporter docs.
- The Omnibus equivalent, handled in gitlab-org/omnibus-gitlab!10032 (merged).
- The Orbit
jwtSecret.keyrow inglobals.mdleaves the Default column empty, though the template defaults tosecret. Separate fix.
Related issues
Depends on gitlab-org/gitlab!266694 (merged).
Related to gitlab-org/analytics-section/analytics-instrumentation/internal#1000
Author checklist
For general guidance, please follow our Contributing guide.
Required
For anything in this list which will not be completed, please provide a reason in the MR discussion.
- 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?
- Describe how you did it in a comment.
- Equivalent MR/issue for omnibus-gitlab opened. gitlab-org/omnibus-gitlab!10032 (merged)
- When ready for review, MR is marked as ready (not a draft) and assigned to a reviewer.
Reviewers checklist
- As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
- MR has a green pipeline on https://gitlab.com/gitlab-org/charts/gitlab.
- Consider downstream impact to the Operator, as per evaluating impact from changes to GitLab chart.