Skip to content

feat(sandbox): ask for the L2 golden store's volume instead of naming a cloud - #5806

Merged
nicacioliveira merged 2 commits into
mainfrom
refactor/sandbox-golden-remote-pv-in-chart
Aug 6, 2026
Merged

nicacioliveira merged 2 commits into
mainfrom
refactor/sandbox-golden-remote-pv-in-chart

Conversation

@nicacioliveira

@nicacioliveira nicacioliveira commented Aug 6, 2026 •

Copy link
Copy Markdown

depsCache.remote now asks for a volume instead of having one handed over by terraform. Chart 0.11.0. Still default off.

Infra side: decocms/terraform-eks-cluster#92 (merged) removes the four kubectl_manifest resources and keeps the bucket.

Why move them here

Those objects were created by terraform (decocms/terraform-eks-cluster#88) under one namespace-wide name, sandbox-golden-ro. agent-sandbox-system holds a release per environment, so that made prod and stg mount the same store root — stg could publish an archive that prod then restored, and stg is where broken builds live. Only this chart knows the release, so only this chart can name the objects apart and scope their keys.

It also closes an unenforced contract: pvcName pointed at an object this chart did not own, so a rename on the terraform side left helm template passing while the pod failed at mount time. And since this chart is delivered by Argo, a foreign-owned PVC sat outside self-heal, prune, and the UI next to the workload it serves.

The split is now clean: installing a CSI driver is infrastructure; asking for a volume is workload config.

Three sources, exactly one

value chart renders when
storageClassName PVC only driver with dynamic provisioning — the self-host path
volume.{driver,attributes,mountOptions} PV + PVC driver with no provisioner — the AWS path, default
pvcName nothing a claim managed elsewhere

Why the static path has to exist. mountpoint-S3 is static-provisioning only — the cluster has no StorageClass for s3.csi.aws.com and the driver ships no provisioner, so there is nothing to claim against and the PV must be declared by hand. The PV is what names the driver, which is the one genuinely cloud-specific part of the whole feature; everything else was already agnostic (the daemon writes a tarball to a path via GOLDEN_CACHE_REMOTE).

Why the dynamic path is the self-host answer. It renders only a PVC, so nothing in the template names a cloud. Bring EFS, gcsfuse, Azure Blob, NFS CSI, JuiceFS — install the driver, create a StorageClass, name it here.

Two sources set fails the render as ambiguous authority. None set fails too, rather than emitting a PVC with neither a StorageClass nor a volumeName — that would sit Pending forever with no obvious cause. (Previously the required on pvcName covered this; dropping it without a replacement would have regressed into a silent failure.)

mountOptions are load-bearing, and not portable

Mountpoint synthesises ownership, so a PV without uid=1000 / gid=1000 presents every object as root-owned and the sandbox uid cannot open it. Publish is best-effort and swallows the resulting EACCES, so the symptom is "the cache never hits" rather than a permission error — this already cost a debug cycle on the terraform version. allow-other is required for a non-root process to touch a FUSE mount it didn't create. read-only is set at the mount as well as at the pod's volumeMount, so a consumer that forgets readOnly: true still cannot write.

Option names are per-driver, though, so the defaults are documented as mountpoint syntax and meant to be replaced wholesale rather than extended. Each entry passes through tpl, so a driver can express per-release scoping in its own syntax — the default is prefix={{ envName }}/, which is what stops two releases from reading each other's archives.

uid/gid are hardcoded to 1000 with a comment tracking the pod securityContext in sandbox-template.yaml, which hardcodes them too. Not worth a value until something needs to disagree.

Docs refresh

The depsCache.remote block still described EFS throughout, and claimed the daemon's prune keeps a live lockfile alive because "a restore touches mtime". True on EFS, false on mountpoint — there is no utimes, so the store's own lifecycle policy is the only reaper and an archive in active use still expires (14d in terraform today), costing one cold install before it republishes.

Kept as-is: the CROSS-REPO READS note. That trade-off was already stated and accepted, and this change doesn't move it — the mount still exposes the whole store, because warm-pool pods are bound before they know their repo. What it does add is that cross-release reads are now impossible.

Verification

helm template, every path:

case result
default (off) nothing rendered
static, envName=prod PV + PVC studio-sandbox-golden-prod, driver: s3.csi.aws.com, bucket, prefix=prod/
static, envName=stg studio-sandbox-golden-stg, prefix=stg/ — distinct from prod
dynamic PVC only, storageClassName: "efs-sc", no driver named anywhere
pvcName neither rendered, claimName: legacy

All four validation failures produce their intended message: remote without depsCache.enabled, two sources, zero sources, attributes without driver. helm lint clean.

Not validated on a real pod. Enabling this is gated on a first mountpoint mount actually working on the sandbox NodePool — that pool carries decocms.com/sandbox=true:NoSchedule, and no mountpoint volume has ever been mounted in that cluster (the mount-s3 namespace is empty), so whether the driver's Mountpoint Pod tolerates the taint is unverified. That test comes before flipping enabled, not in this PR.

depsCache.remote now takes `bucketName` and renders the mountpoint-S3 PV and
its PVC, named per release and mounted under `prefix=<envName>/`.

Those objects used to be created by terraform under one namespace-wide name
(`sandbox-golden-ro`). agent-sandbox-system holds a release per environment, so
that made prod and stg mount the same bucket root — stg could publish an
archive that prod then restored. Only the chart knows the release, so only the
chart can name them apart and scope their keys. It also closes an unenforced
contract: `pvcName` pointed at an object this chart did not own, so a rename on
the other side left `helm template` passing while the pod failed at mount time.

`pvcName` stays as the escape hatch for a claim this chart does not manage, now
mutually exclusive with `bucketName`. Setting both fails the render (ambiguous
authority) and setting neither fails too, instead of mounting an empty
claimName.

mountOptions are load-bearing, not decoration: mountpoint synthesises
ownership, so without uid/gid 1000 every object presents as root-owned and the
sandbox uid cannot open it — and publish is best-effort, so it swallows the
EACCES and the failure surfaces as "the cache never hits". `read-only` is set
at the mount as well as at the volumeMount so a consumer that forgets
`readOnly: true` still cannot write.

Also refreshes the values.yaml docs, which still described EFS and claimed a
restore touches mtime to keep a live lockfile alive — true on EFS, false here:
mountpoint has no utimes, so the bucket's lifecycle policy is the only reaper
and an in-use archive still expires.

Still default off; nothing renders unless depsCache.remote.enabled.

Verified with `helm template` across all four paths (off, bucketName for prod
and stg, pvcName) and all three validation failures, plus `helm lint`.

Infra side: decocms/terraform-eks-cluster removes the four kubectl_manifest
resources and keeps the bucket.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Replaces `bucketName` with three mutually-exclusive sources, so the chart stops
being AWS-only:

- `storageClassName` — dynamic. Renders only the PVC and lets the cluster's
  provisioner create the volume. Nothing in the template names a driver, so any
  RWX CSI backend works (EFS, gcsfuse, Azure Blob, NFS, JuiceFS). This is the
  idiomatic self-host path: infrastructure installs the driver and a
  StorageClass, the chart just claims.
- `volume.{driver,attributes,mountOptions}` — static. Renders PV + PVC. Needed
  for drivers with no dynamic provisioner, which is exactly the AWS case:
  mountpoint-S3 is static-provisioning only (the cluster has no StorageClass for
  s3.csi.aws.com and the driver ships no provisioner), so the PV has to be
  declared by hand and it is the PV that names the driver. Defaults keep the
  AWS path batteries-included; only `attributes.bucketName` is needed.
- `pvcName` — an existing claim, unchanged.

Two set fails the render as ambiguous authority; none set fails too, rather
than emitting a PVC with neither a StorageClass nor a volumeName, which would
sit Pending forever without an obvious cause.

mountOptions are per-driver syntax, not portable, so the annotated defaults are
documented as mountpoint-specific and meant to be replaced wholesale. Each entry
passes through `tpl` so a driver can express per-release scoping in its own
syntax — the default uses `prefix={{ envName }}/`, which is what keeps two
releases sharing agent-sandbox-system from reading each other's archives.

Verified with `helm template`: off renders nothing; static renders PV + PVC with
the driver, bucket and prefix; dynamic renders only the PVC with the
StorageClass and names no driver; pvcName renders neither. All four validation
failures produce their intended message. `helm lint` clean.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@nicacioliveira nicacioliveira changed the title feat(sandbox): own the L2 golden store's PV/PVC in this chart feat(sandbox): ask for the L2 golden store's volume instead of naming a cloud Aug 6, 2026
@nicacioliveira
nicacioliveira merged commit 50b94a8 into main Aug 6, 2026
26 checks passed
@nicacioliveira
nicacioliveira deleted the refactor/sandbox-golden-remote-pv-in-chart branch August 6, 2026 16:01
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