feat: workspace volumes for prod#86
Conversation
Risk Assessment: LowSummary: Adds an optional Factors supporting Low risk:
Minor considerations (not escalating risk):
|
Greptile SummaryThis PR ports workspace volume support from the main branch to
Confidence Score: 4/5Safe to merge after adding CEL uniqueness/reserved-name validation on the Volumes field to match the existing Remotes pattern. One P1 finding: the api/v1alpha1/workspace_types.go — missing XValidation markers on the Volumes field. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[WorkspaceSpec.Volumes] -->|loop over wv| B[append corev1.Volume to pod spec]
B --> C[append VolumeMount to agent container]
D[Built-in workspace EmptyDir] -->|added first| B
E{agentConfig plugins/skills?} -->|yes| F[append kelos-plugin EmptyDir]
F --> B
G[No uniqueness/reserved-name validation] -.->|duplicate or reserved name| H[Kubernetes rejects pod spec at creation]
B --> I[Job created successfully]
I -->|Kubernetes validates pod spec| H
I -->|valid names| J[Pod scheduled]
Reviews (1): Last reviewed commit: "feat: workspace volumes for prod" | Re-trigger Greptile |
* feat: workspace volumes for prod * fix: review comments
* feat: workspace volumes for prod * fix: review comments
* feat: workspace volumes for prod * fix: review comments
* feat: workspace volumes for prod * fix: review comments
Equivalent to: kelos-dev#921 but for our prod branhc
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds a new optional
spec.volumesfield to the Workspace CRD, allowing users to mount additional volumes (PVCs, ConfigMaps, Secrets, EmptyDirs) into the agent container.This enables use cases like:
node_modulesor other dependency cachesUser-defined volumes are supplementary — the workspace EmptyDir is unchanged and the repo is always freshly cloned for isolation.
Changes:
api/v1alpha1/workspace_types.go: NewWorkspaceVolumetype andVolumesfield onWorkspaceSpecinternal/controller/job_builder.go: Appends user volumes to pod spec and mounts them into the agent containerinternal/controller/job_builder_test.go: 4 new tests (single PVC, multiple volumes, volumes + plugins, empty volumes backward compat)examples/12-workspace-with-volumes/: Example workspace with a PVC volumemake updateWhich issue(s) this PR is related to:
Part of kelos-dev#774
This is the first of two PRs for kelos-dev#774. The second PR will add
spec.setup(init containers) which will also receive these volume mounts.Special notes for your reviewer:
WorkspaceVolume.Sourceuses the Kubernetes-nativecorev1.VolumeSourcetype directly, so no custom volume abstraction is needed. Restricting volume source types (e.g. disallowinghostPath) is left to cluster admission policy, consistent with how most operators handle this.Does this PR introduce a user-facing change?
Summary by cubic
Adds an optional
spec.volumesto theWorkspaceCRD so users can mount extra volumes (PVC, ConfigMap, Secret,EmptyDir) into the agent container. The default workspaceEmptyDirand fresh clone remain unchanged; part of kelos-dev#774.New Features
WorkspaceVolumeandspec.volumesusingcorev1.VolumeSource; enforce unique names and reserve "workspace" and "kelos-plugin".examples/12-workspace-with-volumes/andexamples/15-workspace-with-setup/.Bug Fixes
:latestimage refs using a regex to avoid false positives from CRD descriptions.Written for commit 9021205. Summary will update on new commits.