Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/tools/genpolicy/src/mount_and_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ fn get_host_path_mount(
}
}

let access = match yaml_mount.readOnly {
Some(true) => {
debug!("setting read only access for host path mount");
"ro"
}
_ => "rw",
};
// TODO:
//
// - When volume.hostPath.path: /dev/ttyS0
Expand All @@ -208,15 +215,15 @@ fn get_host_path_mount(
if !path.starts_with("/dev/") && !path.starts_with("/sys/") {
debug!("get_host_path_mount: calling get_shared_bind_mount");
let propagation = if biderectional { "rshared" } else { "rprivate" };
get_shared_bind_mount(yaml_mount, p_mounts, propagation, "rw");
get_shared_bind_mount(yaml_mount, p_mounts, propagation, access);
} else {
let dest = yaml_mount.mountPath.clone();
let type_ = "bind".to_string();
let mount_option = if biderectional { "rshared" } else { "rprivate" };
let options = vec![
"rbind".to_string(),
mount_option.to_string(),
"rw".to_string(),
access.to_string(),
];

if let Some(policy_mount) = p_mounts.iter_mut().find(|m| m.destination.eq(&dest)) {
Expand Down
Loading