1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use super::Result;
use std::collections::BTreeMap;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct VolumeSecretItem {
#[serde(default = "volume_key")]
pub key: String,
pub path: String,
#[serde(default = "volume_default_mode")]
pub mode: u32,
}
fn volume_key() -> String {
"value".into()
}
fn volume_default_mode() -> u32 {
420
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct VolumeSecretDetail {
pub secretName: String,
pub items: Vec<VolumeSecretItem>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct ProjectedVolumeSecretSourceDetail {
pub name: String,
pub items: Vec<VolumeSecretItem>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct ProjectedVolumeSecretSource {
pub secret: ProjectedVolumeSecretSourceDetail,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct ProjectedVolumeSecret {
pub sources: Vec<ProjectedVolumeSecretSource>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct DownwardApiWrapper {
pub items: Vec<DownwardApiItem>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DownwardApiItem {
pub path: String,
pub resourceFieldRef: DownWardApiResource,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DownWardApiResource {
pub containerName: String,
pub resource: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub divisor: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct Volume {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub projected: Option<ProjectedVolumeSecret>,
#[serde(skip_serializing_if = "Option::is_none")]
pub secret: Option<VolumeSecretDetail>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub emptyDir: Option<BTreeMap<String, String>>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub persistentVolumeClaim: BTreeMap<String, String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub downwardAPI: Option<DownwardApiWrapper>,
}
impl Volume {
pub fn verify(&self) -> Result<()> {
Ok(())
}
}
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct VolumeMount {
pub name: String,
pub mountPath: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subPath: Option<String>,
#[serde(default)]
pub readOnly: bool,
}