Skip to content

codeintel-db: keep the PVC named codeintel-db regardless of codeIntelDB.name - #967

Merged
marcleblanc2 merged 1 commit into
mainfrom
marc/fix-codeintel-db-pvc-name
Oct 20, 2026
Merged

marcleblanc2 merged 1 commit into
mainfrom
marc/fix-codeintel-db-pvc-name

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

Closes #612

Problem

codeintel-db.PersistentVolumeClaim.yaml named the PVC {{ default "codeintel-db" .Values.codeIntelDB.name }}, but codeintel-db.StatefulSet.yaml always references claimName: codeintel-db. Setting a custom codeIntelDB.name therefore produced a PVC the StatefulSet never looked for, and the pod sat in Pending with persistentvolumeclaim "codeintel-db" not found.

Every other PVC-backed component (blobstore, codeinsights-db, pgsql, prometheus, redis-cache, redis-store) hardcodes both the PVC name and the claimName, and values.yaml documents every *.name as "Does not affect service names or PVCs." codeintel-db was the only one that broke that contract.

Fix

Hardcode the PVC name to codeintel-db, matching the StatefulSet and the other six components.

Chose this over templating claimName from .name because that would silently rename PVCs on helm upgrade for anyone with a custom name, leaving their data on an orphaned claim. Hardcoding is safe: no working deployment can have data in a custom-named codeintel-db PVC today, since that pod never scheduled.

Edge case noted in the changelog: anyone who worked around this by creating a codeintel-db PVC by hand needs to add the Helm ownership label and annotations so helm upgrade can adopt it.

Also answers the second comment on the issue: cache-<name>-searcher-0 style PVCs come from volumeClaimTemplates, which Kubernetes names <template>-<statefulset>-<ordinal>, so those picking up the custom name is expected.

Checklist

Test plan

  • Added charts/sourcegraph/tests/componentNamePVC_test.yaml: sets a custom name on all seven PVC-backed components and asserts the workload is renamed while the PVC name and claimName stay fixed. Confirmed the codeintel-db case fails on main without the template change and passes with it.
  • helm unittest charts/sourcegraph: 33 suites, 202 tests, 12 snapshots, all passing.
  • helm lint charts/sourcegraph: clean.
  • helm template sg charts/sourcegraph --set codeIntelDB.name=my-release-codeintel-db: PVC and claimName both render codeintel-db, StatefulSet renders my-release-codeintel-db.
  • ./scripts/helm-docs.sh: no README changes.

…DB.name

The PVC template applied codeIntelDB.name to the claim, but the
StatefulSet always references claimName codeintel-db, so setting a
custom name left the pod Pending on a missing claim. Every other
component hardcodes its PVC name, and values.yaml documents *.name as
not affecting PVCs, so align codeintel-db with that contract.

Add a helm-unittest suite asserting that a custom name on each
PVC-backed component renames the workload but not its PVC or claimName.

Closes #612

Amp-Thread-ID: https://ampcode.com/threads/T-01a15718-a970-736b-af0a-1b453f5ba94a
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

@marcleblanc2
marcleblanc2 requested a review from a team October 20, 2026 02:28
@marcleblanc2
marcleblanc2 merged commit a87a7e8 into main Oct 20, 2026
6 checks passed
@marcleblanc2
marcleblanc2 deleted the marc/fix-codeintel-db-pvc-name branch October 20, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing the name of codeintel-db causes PVC to misalign on name

2 participants