k8s_openapi_ext/ext/
volume_mount.rs

1use super::*;
2
3/// Builders for `corev1::VolumeMount` objects
4pub trait VolumeMountExt: Sized {
5    fn new(mount_path: impl ToString, volume: &corev1::Volume) -> Self;
6
7    fn read_only(self) -> Self;
8}
9
10impl VolumeMountExt for corev1::VolumeMount {
11    fn new(mount_path: impl ToString, volume: &corev1::Volume) -> Self {
12        let mount_path = mount_path.to_string();
13        let name = volume.name.clone();
14        Self {
15            mount_path,
16            name,
17            // mount_propagation: todo!(),
18            // read_only: todo!(),
19            // sub_path: todo!(),
20            // sub_path_expr: todo!(),
21            ..default()
22        }
23    }
24
25    fn read_only(mut self) -> Self {
26        self.read_only = Some(true);
27        self
28    }
29}