Skip to content

Commit 30ad385

Browse files
mjamivdrew
authored andcommitted
fix(kubernetes): address PVC config review follow-up
Signed-off-by: mjamiv <michael.commack@gmail.com>
1 parent e37cd63 commit 30ad385

6 files changed

Lines changed: 142 additions & 109 deletions

File tree

crates/openshell-core/src/driver_mounts.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ const RESERVED_MOUNT_TARGETS: &[&str] = &[
3333
"/run/netns",
3434
];
3535

36-
/// Serde default helper for mount options that default to read-only.
37-
pub fn default_true() -> bool {
38-
true
39-
}
40-
4136
/// Validate a non-empty driver mount source.
4237
pub fn validate_mount_source(source: &str, field: &str) -> Result<(), String> {
4338
if source.is_empty() {

crates/openshell-driver-docker/src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ enum DockerDriverMountConfig {
262262
Bind {
263263
source: String,
264264
target: String,
265-
#[serde(default = "driver_mounts::default_true")]
265+
#[serde(default = "default_true")]
266266
read_only: bool,
267267
#[serde(default)]
268268
selinux_label: Option<SelinuxLabel>,
269269
},
270270
Volume {
271271
source: String,
272272
target: String,
273-
#[serde(default = "driver_mounts::default_true")]
273+
#[serde(default = "default_true")]
274274
read_only: bool,
275275
#[serde(default)]
276276
subpath: Option<String>,
@@ -287,13 +287,17 @@ enum DockerDriverMountConfig {
287287
Image {
288288
source: String,
289289
target: String,
290-
#[serde(default = "driver_mounts::default_true")]
290+
#[serde(default = "default_true")]
291291
read_only: bool,
292292
#[serde(default)]
293293
subpath: Option<String>,
294294
},
295295
}
296296

297+
fn default_true() -> bool {
298+
true
299+
}
300+
297301
type WatchStream =
298302
Pin<Box<dyn Stream<Item = Result<WatchSandboxesEvent, Status>> + Send + 'static>>;
299303

crates/openshell-driver-kubernetes/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ nested schema and currently accepts:
117117
- `pod.priority_class_name`
118118
- `containers.agent.resources.requests`
119119
- `containers.agent.resources.limits`
120-
- `volumes[].name`
121-
- `volumes[].persistent_volume_claim.claim_name`
122-
- `volumes[].persistent_volume_claim.read_only`
123120
- `containers.agent.volume_mounts[].name`
124121
- `containers.agent.volume_mounts[].mount_path`
125122
- `containers.agent.volume_mounts[].sub_path`
126123
- `containers.agent.volume_mounts[].read_only`
124+
- `volumes[].name`
125+
- `volumes[].persistent_volume_claim.claim_name`
126+
- `volumes[].persistent_volume_claim.read_only`
127127

128128
Nested keys inside the `kubernetes` block use snake_case. The top-level
129129
`driver_config` envelope is keyed by driver names, so `kubernetes` is not part
@@ -151,9 +151,9 @@ Use PVC volumes to mount existing Kubernetes PersistentVolumeClaims into the
151151
agent container. PVC volumes and mounts default to read-only unless
152152
`read_only: false` is set explicitly. Read-write access requires
153153
`read_only: false` on both the PVC volume and each writable mount. The driver
154-
rejects duplicate volume names, invalid DNS-1123 volume or PVC claim names,
155-
mounts that reference unknown volumes, non-normalized or protected mount paths,
156-
and absolute or parent-traversing `sub_path` values.
154+
rejects duplicate volume names, invalid DNS-1123 volume labels or PVC claim
155+
subdomain names, mounts that reference unknown volumes, non-normalized or
156+
protected mount paths, and absolute or parent-traversing `sub_path` values.
157157

158158
Any explicit driver-config mount under `/sandbox` disables the driver's
159159
default `/sandbox` workspace PVC injection for that sandbox. Only the explicit

0 commit comments

Comments
 (0)