k8s_openapi_ext/ext/
volume_mount.rs1use super::*;
2
3pub 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 ..default()
22 }
23 }
24
25 fn read_only(mut self) -> Self {
26 self.read_only = Some(true);
27 self
28 }
29}