Skip to content

Fix precise-code-intel tmpdir PVC reclaim policy - #958

Merged
devdinu merged 1 commit into
mainfrom
fix/pci-worker-tmpdir-ephemeral-storageclass
Oct 9, 2026
Merged

devdinu merged 1 commit into
mainfrom
fix/pci-worker-tmpdir-ephemeral-storageclass

Conversation

@devdinu

@devdinu devdinu commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

The precise-code-intel-worker /tmp scratch volume is a generic ephemeral
volume, so its claim is created and deleted with the pod. It took its class
from storageClass.name, which is reclaimPolicy: Retain for stateful data.
Every worker restart left a Released PV and its backing disk behind, and the
disks accumulated until the cloud provider's SSD quota rejected new claims.

Changes

  • Add preciseCodeIntel.storageClassName for the /tmp scratch PVC, read instead of storageClass.name
  • Default empty, so the cluster default class applies. Cluster defaults are reclaimPolicy: Delete, so the volume is reclaimed with the pod

The value is deliberately not a concrete class name. Those differ per cloud
provider (premium-rwo on GKE, gp3 on EKS, managed-csi on AKS), and a
hardcoded default would leave a PVC permanently Pending on clusters that do
not define it. storageClass stays Retain and continues to back the
stateful volumes.

storageType defaults to emptyDir, so the default render is unchanged.
Pre-existing Released PVs are not reclaimed by the upgrade. Operators already
on a Retain class need to delete those and their backing disks separately.

Test Plan

  • Local minikube cluster
  • CI

The /tmp scratch volume is a generic ephemeral volume, so its claim is
created and deleted with the pod. It took its class from
storageClass.name, which is reclaimPolicy Retain for stateful data. Each
worker restart therefore left a Released PV and its backing disk behind,
and the disks accumulated until the cloud provider's SSD quota rejected
new claims.

The claim now reads preciseCodeIntel.storageClassName, which defaults to
empty so the cluster default class applies. Cluster defaults are
reclaimPolicy Delete, so the volume is reclaimed with the pod. The value
is deliberately not a concrete class name, since those differ per cloud
provider.

storageType defaults to emptyDir, so the default render is unchanged.
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

@devdinu
devdinu requested a review from a team October 8, 2026 19:34
@devdinu
devdinu marked this pull request as ready for review October 8, 2026 19:34
@devdinu
devdinu merged commit e98a009 into main Oct 9, 2026
8 checks passed
@devdinu
devdinu deleted the fix/pci-worker-tmpdir-ephemeral-storageclass branch October 9, 2026 00:04
filiphaftek added a commit that referenced this pull request Nov 3, 2026
The syntactic-code-intel-worker's `/tmp` scratch volume was always an
unbounded `emptyDir`, which places its writes on the node boot disk.
This brings it to parity with the precise-code-intel-worker options
added in #956 and #958.

## Changes

- Add `syntacticCodeIntel.storageType` to select the backing store for
`/tmp`: `emptyDir` (default) or `pvc`
- `pvc` mounts a generic ephemeral volume, so each pod gets its own
claim that is created and deleted with the pod
- Add `syntacticCodeIntel.storageSize`, required for `pvc` and applied
as `sizeLimit` when left on `emptyDir`
- Add `syntacticCodeIntel.storageClassName` for the scratch claim. Empty
uses the cluster default class (`reclaimPolicy: Delete`);
`storageClass.name` is `Retain` and is deliberately not used
- On `pvc`, the pod `fsGroup` defaults to the container `runAsGroup`
(with `fsGroupChangePolicy: OnRootMismatch`) so the non-root worker can
write to the freshly provisioned volume; a user-set
`podSecurityContext.fsGroup` wins

The default renders `emptyDir: {}` exactly as before, so existing
installs are unaffected. The mount path stays `/tmp`.

Example:

```yaml
syntacticCodeIntel:
  enabled: true
  storageType: pvc
  storageSize: 50Gi
```

### Checklist

- [x] Follow the [manual testing
process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md)
- [x] Update
[changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md)
- [ ] Update [Kubernetes update
doc](https://docs.sourcegraph.com/admin/updates/kubernetes)

### Test plan

- New `tests/syntacticCodeIntelStorage_test.yaml` (mirrors
`preciseCodeIntelStorage_test.yaml`); its 7 behavior tests fail against
the old template and pass with this change
- `helm unittest` on all four charts: 237 passed
- `helm lint charts/sourcegraph` with `storageType=pvc` passes
- `helm template` with `syntacticCodeIntel.enabled=true` and default
storage values is byte-identical before and after
- `./scripts/helm-docs.sh` leaves no diff
- CI

Co-authored-by: Amp <[email protected]>
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.

2 participants