Repository navigation
Commit 3ed73e4
committed
fix(kubernetes): preserve sandbox ownership when seeding workspace
The workspace-init container seeds a fresh PVC as root and extracted with
--no-same-owner, so every seeded path landed owned by uid 0. A mode-0700
home directory shipped by the image (~/.config, ~/.cache) was then
unreachable for the workload. fsGroup does not compensate: kubelet applies
it when the volume is mounted, which is before the init container writes
anything. Under the sidecar topology the supervisor's privileged workspace
reconciliation does not run, so the seeded ownership is load-bearing.
Rewrite ownership to the resolved sandbox identity while building the
transfer archive instead. Seeding stays root, so images that ship
root-owned private content still seed, and no recursive chown runs over the
workspace (the pattern that broke on read-only submounts in #2294). Modes
and timestamps are still not restored.
Two environments cannot restore ownership, and neither may turn a
permissions problem into a pod that will not start. --owner/--group are GNU
extensions and this init container runs the sandbox image itself, so the
script probes tar once and drops to the previous flags on a minimal base
such as Alpine, which provides BusyBox tar. A writable backend can also
accept the write but reject chown, root-squashed NFS being the usual case;
extraction retries without ownership, and the sentinel is recorded when
either attempt succeeds so a workspace that never seeded is never marked
initialized.
The script builder now takes its source and destination paths as arguments
so the retry and sentinel logic can be driven directly in tests with a stub
tar. A real tar cannot cover it: ownership is only restored under uid 0, so
an unprivileged run skips the chown and always succeeds.
Signed-off-by: loveRhythm1990 <[email protected]>1 parent 02b664b commit 3ed73e4
3 files changed
Lines changed: 452 additions & 34 deletions
File tree
- architecture
- crates/openshell-driver-kubernetes/src
- docs/reference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
428 | 447 | | |
429 | 448 | | |
430 | 449 | | |
| |||
0 commit comments