Skip to content

Allow precise-code-intel-worker /tmp scratch on a per-pod PVC - #956

Merged
devdinu merged 1 commit into
mainfrom
09-30/pci-worker-pvc-storage
Oct 2, 2026
Merged

devdinu merged 1 commit into
mainfrom
09-30/pci-worker-pvc-storage

Conversation

@devdinu

@devdinu devdinu commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The precise-code-intel-worker writes large SCIP uploads to /tmp before processing them in multiple passes, and /tmp was always an unbounded emptyDir. That places the write on the node boot disk, where a large upload competes with other pods on the node and can fill the disk.

Changes

  • Add preciseCodeIntel.storageType to select the backing store for the /tmp scratch volume. One of emptyDir (default) or pvc
  • pvc mounts a generic ephemeral volume, so each pod gets its own claim on storageClass.name that is created and deleted with the pod
  • Add preciseCodeIntel.storageSize, required for pvc and applied as sizeLimit when left on emptyDir

The default renders emptyDir: {} exactly as before, so existing installs are unaffected. The mount path stays /tmp, so the worker needs no TMPDIR redirect.

ref https://app.incident.io/sourcegraph/response/incidents/531
ref EPD2-427

Test Plan

  • Local against kind cluster
  • CI

Will follow up with controller PR to enable this based on toggle.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

@devdinu
devdinu requested a review from a team September 30, 2026 23:48
@devdinu
devdinu marked this pull request as ready for review September 30, 2026 23:48
The worker writes large SCIP uploads to /tmp before processing them in
multiple passes, and /tmp was always an unbounded emptyDir. That puts the
write on the node boot disk, where a large upload competes with every
other pod on the node and can fill the disk.

A new storageType value selects the backing store. emptyDir stays the
default, so rendered output is unchanged for existing installs. pvc
switches /tmp to a generic ephemeral volume, giving each pod its own
claim on storageClass.name that is discarded with the pod. storageSize
is required for pvc and sets sizeLimit when left on emptyDir.

The mount path stays /tmp, so the worker needs no TMPDIR redirect.

A freshly provisioned volume is root-owned and the worker runs as a
non-root user, so the pvc branch defaults the pod fsGroup to the
container runAsGroup (with fsGroupChangePolicy OnRootMismatch) to keep
/tmp writable. A user-set podSecurityContext.fsGroup still wins.

An unknown storageType now fails rendering instead of silently falling
back to emptyDir.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0f4b6-78bf-7109-82dc-4545a652ecdf
Co-authored-by: Dinesh Kumar <dinesh.kumar@sourcegraph.com>

@emidoots emidoots left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems reasonable 👍 thanks @devdinu

@filiphaftek filiphaftek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!
I did some follow up in diff-your, and looks like using 100GB size we can increase 4x throuput + fully offload the boot disk: https://sourcegraph.sourcegraph.com/deepsearch/a9003fa4-3d60-408c-8931-57ddc3034cbc

@devdinu
devdinu force-pushed the 09-30/pci-worker-pvc-storage branch from 1230ddf to bc7adc8 Compare October 2, 2026 01:05
@devdinu
devdinu merged commit 82837d4 into main Oct 2, 2026
6 checks passed
@devdinu
devdinu deleted the 09-30/pci-worker-pvc-storage branch October 2, 2026 01:13
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.

3 participants