1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct CSIDriverSpec {
6 pub attach_required: Option<bool>,
10
11 pub fs_group_policy: Option<std::string::String>,
17
18 pub node_allocatable_update_period_seconds: Option<i64>,
24
25 pub pod_info_on_mount: Option<bool>,
36
37 pub prevent_pod_scheduling_if_missing: Option<bool>,
45
46 pub requires_republish: Option<bool>,
50
51 pub se_linux_mount: Option<bool>,
59
60 pub service_account_token_in_secrets: Option<bool>,
70
71 pub storage_capacity: Option<bool>,
79
80 pub token_requests: Option<std::vec::Vec<crate::api::storage::v1::TokenRequest>>,
90
91 pub volume_lifecycle_modes: Option<std::vec::Vec<std::string::String>>,
99}
100
101impl crate::DeepMerge for CSIDriverSpec {
102 fn merge_from(&mut self, other: Self) {
103 crate::DeepMerge::merge_from(&mut self.attach_required, other.attach_required);
104 crate::DeepMerge::merge_from(&mut self.fs_group_policy, other.fs_group_policy);
105 crate::DeepMerge::merge_from(&mut self.node_allocatable_update_period_seconds, other.node_allocatable_update_period_seconds);
106 crate::DeepMerge::merge_from(&mut self.pod_info_on_mount, other.pod_info_on_mount);
107 crate::DeepMerge::merge_from(&mut self.prevent_pod_scheduling_if_missing, other.prevent_pod_scheduling_if_missing);
108 crate::DeepMerge::merge_from(&mut self.requires_republish, other.requires_republish);
109 crate::DeepMerge::merge_from(&mut self.se_linux_mount, other.se_linux_mount);
110 crate::DeepMerge::merge_from(&mut self.service_account_token_in_secrets, other.service_account_token_in_secrets);
111 crate::DeepMerge::merge_from(&mut self.storage_capacity, other.storage_capacity);
112 crate::merge_strategies::list::atomic(&mut self.token_requests, other.token_requests);
113 crate::merge_strategies::list::set(&mut self.volume_lifecycle_modes, other.volume_lifecycle_modes);
114 }
115}
116
117impl<'de> crate::serde::Deserialize<'de> for CSIDriverSpec {
118 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
119 #[allow(non_camel_case_types)]
120 enum Field {
121 Key_attach_required,
122 Key_fs_group_policy,
123 Key_node_allocatable_update_period_seconds,
124 Key_pod_info_on_mount,
125 Key_prevent_pod_scheduling_if_missing,
126 Key_requires_republish,
127 Key_se_linux_mount,
128 Key_service_account_token_in_secrets,
129 Key_storage_capacity,
130 Key_token_requests,
131 Key_volume_lifecycle_modes,
132 Other,
133 }
134
135 impl<'de> crate::serde::Deserialize<'de> for Field {
136 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
137 struct Visitor;
138
139 impl crate::serde::de::Visitor<'_> for Visitor {
140 type Value = Field;
141
142 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
143 f.write_str("field identifier")
144 }
145
146 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
147 Ok(match v {
148 "attachRequired" => Field::Key_attach_required,
149 "fsGroupPolicy" => Field::Key_fs_group_policy,
150 "nodeAllocatableUpdatePeriodSeconds" => Field::Key_node_allocatable_update_period_seconds,
151 "podInfoOnMount" => Field::Key_pod_info_on_mount,
152 "preventPodSchedulingIfMissing" => Field::Key_prevent_pod_scheduling_if_missing,
153 "requiresRepublish" => Field::Key_requires_republish,
154 "seLinuxMount" => Field::Key_se_linux_mount,
155 "serviceAccountTokenInSecrets" => Field::Key_service_account_token_in_secrets,
156 "storageCapacity" => Field::Key_storage_capacity,
157 "tokenRequests" => Field::Key_token_requests,
158 "volumeLifecycleModes" => Field::Key_volume_lifecycle_modes,
159 _ => Field::Other,
160 })
161 }
162 }
163
164 deserializer.deserialize_identifier(Visitor)
165 }
166 }
167
168 struct Visitor;
169
170 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
171 type Value = CSIDriverSpec;
172
173 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
174 f.write_str("CSIDriverSpec")
175 }
176
177 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
178 let mut value_attach_required: Option<bool> = None;
179 let mut value_fs_group_policy: Option<std::string::String> = None;
180 let mut value_node_allocatable_update_period_seconds: Option<i64> = None;
181 let mut value_pod_info_on_mount: Option<bool> = None;
182 let mut value_prevent_pod_scheduling_if_missing: Option<bool> = None;
183 let mut value_requires_republish: Option<bool> = None;
184 let mut value_se_linux_mount: Option<bool> = None;
185 let mut value_service_account_token_in_secrets: Option<bool> = None;
186 let mut value_storage_capacity: Option<bool> = None;
187 let mut value_token_requests: Option<std::vec::Vec<crate::api::storage::v1::TokenRequest>> = None;
188 let mut value_volume_lifecycle_modes: Option<std::vec::Vec<std::string::String>> = None;
189
190 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
191 match key {
192 Field::Key_attach_required => value_attach_required = crate::serde::de::MapAccess::next_value(&mut map)?,
193 Field::Key_fs_group_policy => value_fs_group_policy = crate::serde::de::MapAccess::next_value(&mut map)?,
194 Field::Key_node_allocatable_update_period_seconds => value_node_allocatable_update_period_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
195 Field::Key_pod_info_on_mount => value_pod_info_on_mount = crate::serde::de::MapAccess::next_value(&mut map)?,
196 Field::Key_prevent_pod_scheduling_if_missing => value_prevent_pod_scheduling_if_missing = crate::serde::de::MapAccess::next_value(&mut map)?,
197 Field::Key_requires_republish => value_requires_republish = crate::serde::de::MapAccess::next_value(&mut map)?,
198 Field::Key_se_linux_mount => value_se_linux_mount = crate::serde::de::MapAccess::next_value(&mut map)?,
199 Field::Key_service_account_token_in_secrets => value_service_account_token_in_secrets = crate::serde::de::MapAccess::next_value(&mut map)?,
200 Field::Key_storage_capacity => value_storage_capacity = crate::serde::de::MapAccess::next_value(&mut map)?,
201 Field::Key_token_requests => value_token_requests = crate::serde::de::MapAccess::next_value(&mut map)?,
202 Field::Key_volume_lifecycle_modes => value_volume_lifecycle_modes = crate::serde::de::MapAccess::next_value(&mut map)?,
203 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
204 }
205 }
206
207 Ok(CSIDriverSpec {
208 attach_required: value_attach_required,
209 fs_group_policy: value_fs_group_policy,
210 node_allocatable_update_period_seconds: value_node_allocatable_update_period_seconds,
211 pod_info_on_mount: value_pod_info_on_mount,
212 prevent_pod_scheduling_if_missing: value_prevent_pod_scheduling_if_missing,
213 requires_republish: value_requires_republish,
214 se_linux_mount: value_se_linux_mount,
215 service_account_token_in_secrets: value_service_account_token_in_secrets,
216 storage_capacity: value_storage_capacity,
217 token_requests: value_token_requests,
218 volume_lifecycle_modes: value_volume_lifecycle_modes,
219 })
220 }
221 }
222
223 deserializer.deserialize_struct(
224 "CSIDriverSpec",
225 &[
226 "attachRequired",
227 "fsGroupPolicy",
228 "nodeAllocatableUpdatePeriodSeconds",
229 "podInfoOnMount",
230 "preventPodSchedulingIfMissing",
231 "requiresRepublish",
232 "seLinuxMount",
233 "serviceAccountTokenInSecrets",
234 "storageCapacity",
235 "tokenRequests",
236 "volumeLifecycleModes",
237 ],
238 Visitor,
239 )
240 }
241}
242
243impl crate::serde::Serialize for CSIDriverSpec {
244 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
245 let mut state = serializer.serialize_struct(
246 "CSIDriverSpec",
247 self.attach_required.as_ref().map_or(0, |_| 1) +
248 self.fs_group_policy.as_ref().map_or(0, |_| 1) +
249 self.node_allocatable_update_period_seconds.as_ref().map_or(0, |_| 1) +
250 self.pod_info_on_mount.as_ref().map_or(0, |_| 1) +
251 self.prevent_pod_scheduling_if_missing.as_ref().map_or(0, |_| 1) +
252 self.requires_republish.as_ref().map_or(0, |_| 1) +
253 self.se_linux_mount.as_ref().map_or(0, |_| 1) +
254 self.service_account_token_in_secrets.as_ref().map_or(0, |_| 1) +
255 self.storage_capacity.as_ref().map_or(0, |_| 1) +
256 self.token_requests.as_ref().map_or(0, |_| 1) +
257 self.volume_lifecycle_modes.as_ref().map_or(0, |_| 1),
258 )?;
259 if let Some(value) = &self.attach_required {
260 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "attachRequired", value)?;
261 }
262 if let Some(value) = &self.fs_group_policy {
263 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fsGroupPolicy", value)?;
264 }
265 if let Some(value) = &self.node_allocatable_update_period_seconds {
266 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nodeAllocatableUpdatePeriodSeconds", value)?;
267 }
268 if let Some(value) = &self.pod_info_on_mount {
269 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "podInfoOnMount", value)?;
270 }
271 if let Some(value) = &self.prevent_pod_scheduling_if_missing {
272 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "preventPodSchedulingIfMissing", value)?;
273 }
274 if let Some(value) = &self.requires_republish {
275 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "requiresRepublish", value)?;
276 }
277 if let Some(value) = &self.se_linux_mount {
278 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "seLinuxMount", value)?;
279 }
280 if let Some(value) = &self.service_account_token_in_secrets {
281 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "serviceAccountTokenInSecrets", value)?;
282 }
283 if let Some(value) = &self.storage_capacity {
284 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageCapacity", value)?;
285 }
286 if let Some(value) = &self.token_requests {
287 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "tokenRequests", value)?;
288 }
289 if let Some(value) = &self.volume_lifecycle_modes {
290 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "volumeLifecycleModes", value)?;
291 }
292 crate::serde::ser::SerializeStruct::end(state)
293 }
294}
295
296#[cfg(feature = "schemars")]
297impl crate::schemars::JsonSchema for CSIDriverSpec {
298 fn schema_name() -> std::borrow::Cow<'static, str> {
299 "io.k8s.api.storage.v1.CSIDriverSpec".into()
300 }
301
302 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
303 crate::schemars::json_schema!({
304 "description": "CSIDriverSpec is the specification of a CSIDriver.",
305 "type": "object",
306 "properties": {
307 "attachRequired": {
308 "description": "attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.\n\nThis field is immutable.",
309 "type": "boolean",
310 },
311 "fsGroupPolicy": {
312 "description": "fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.",
313 "type": "string",
314 },
315 "nodeAllocatableUpdatePeriodSeconds": {
316 "description": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis feature requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.",
317 "type": "integer",
318 "format": "int64",
319 },
320 "podInfoOnMount": {
321 "description": "podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false.\n\nThe CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext.\n\nThe following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume\n defined by a CSIVolumeSource, otherwise \"false\"\n\n\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.",
322 "type": "boolean",
323 },
324 "preventPodSchedulingIfMissing": {
325 "description": "PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".",
326 "type": "boolean",
327 },
328 "requiresRepublish": {
329 "description": "requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.",
330 "type": "boolean",
331 },
332 "seLinuxMount": {
333 "description": "seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".",
334 "type": "boolean",
335 },
336 "serviceAccountTokenInSecrets": {
337 "description": "serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.",
338 "type": "boolean",
339 },
340 "storageCapacity": {
341 "description": "storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field was immutable in Kubernetes <= 1.22 and now is mutable.",
342 "type": "boolean",
343 },
344 "tokenRequests": {
345 "description": "tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.",
346 "type": "array",
347 "items": (__gen.subschema_for::<crate::api::storage::v1::TokenRequest>()),
348 },
349 "volumeLifecycleModes": {
350 "description": "volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism.\n\nThe other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume.\n\nFor more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.\n\nThis field is beta. This field is immutable.",
351 "type": "array",
352 "items": {
353 "type": "string",
354 },
355 },
356 },
357 })
358 }
359}
360
361#[cfg(feature = "schemars08")]
362impl crate::schemars08::JsonSchema for CSIDriverSpec {
363 fn schema_name() -> std::string::String {
364 "io.k8s.api.storage.v1.CSIDriverSpec".into()
365 }
366
367 fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
368 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
369 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
370 description: Some("CSIDriverSpec is the specification of a CSIDriver.".into()),
371 ..Default::default()
372 })),
373 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
374 object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
375 properties: [
376 (
377 "attachRequired".into(),
378 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
379 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
380 description: Some("attachRequired indicates this CSI volume driver requires an attach operation (because it implements the CSI ControllerPublishVolume() method), and that the Kubernetes attach detach controller should call the attach volume interface which checks the volumeattachment status and waits until the volume is attached before proceeding to mounting. The CSI external-attacher coordinates with CSI volume driver and updates the volumeattachment status when the attach operation is complete. If the value is specified to false, the attach operation will be skipped. Otherwise the attach operation will be called.\n\nThis field is immutable.".into()),
381 ..Default::default()
382 })),
383 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
384 ..Default::default()
385 }),
386 ),
387 (
388 "fsGroupPolicy".into(),
389 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
390 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
391 description: Some("fsGroupPolicy defines if the underlying volume supports changing ownership and permission of the volume before being mounted. Refer to the specific FSGroupPolicy values for additional details.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.\n\nDefaults to ReadWriteOnceWithFSType, which will examine each volume to determine if Kubernetes should modify ownership and permissions of the volume. With the default policy the defined fsGroup will only be applied if a fstype is defined and the volume's access mode contains ReadWriteOnce.".into()),
392 ..Default::default()
393 })),
394 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
395 ..Default::default()
396 }),
397 ),
398 (
399 "nodeAllocatableUpdatePeriodSeconds".into(),
400 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
401 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
402 description: Some("nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis feature requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.".into()),
403 ..Default::default()
404 })),
405 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Integer))),
406 format: Some("int64".into()),
407 ..Default::default()
408 }),
409 ),
410 (
411 "podInfoOnMount".into(),
412 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
413 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
414 description: Some("podInfoOnMount indicates this CSI volume driver requires additional pod information (like podName, podUID, etc.) during mount operations, if set to true. If set to false, pod information will not be passed on mount. Default is false.\n\nThe CSI driver specifies podInfoOnMount as part of driver deployment. If true, Kubelet will pass pod information as VolumeContext in the CSI NodePublishVolume() calls. The CSI driver is responsible for parsing and validating the information passed in as VolumeContext.\n\nThe following VolumeContext will be passed if podInfoOnMount is set to true. This list might grow, but the prefix will be used. \"csi.storage.k8s.io/pod.name\": pod.Name \"csi.storage.k8s.io/pod.namespace\": pod.Namespace \"csi.storage.k8s.io/pod.uid\": string(pod.UID) \"csi.storage.k8s.io/ephemeral\": \"true\" if the volume is an ephemeral inline volume\n defined by a CSIVolumeSource, otherwise \"false\"\n\n\"csi.storage.k8s.io/ephemeral\" is a new feature in Kubernetes 1.16. It is only required for drivers which support both the \"Persistent\" and \"Ephemeral\" VolumeLifecycleMode. Other drivers can leave pod info disabled and/or ignore this field. As Kubernetes 1.15 doesn't support this field, drivers can only support one mode when deployed on such a cluster and the deployment determines which mode that is, for example via a command line parameter of the driver.\n\nThis field was immutable in Kubernetes < 1.29 and now is mutable.".into()),
415 ..Default::default()
416 })),
417 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
418 ..Default::default()
419 }),
420 ),
421 (
422 "preventPodSchedulingIfMissing".into(),
423 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
424 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
425 description: Some("PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".".into()),
426 ..Default::default()
427 })),
428 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
429 ..Default::default()
430 }),
431 ),
432 (
433 "requiresRepublish".into(),
434 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
435 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
436 description: Some("requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.".into()),
437 ..Default::default()
438 })),
439 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
440 ..Default::default()
441 }),
442 ),
443 (
444 "seLinuxMount".into(),
445 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
446 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
447 description: Some("seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".".into()),
448 ..Default::default()
449 })),
450 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
451 ..Default::default()
452 }),
453 ),
454 (
455 "serviceAccountTokenInSecrets".into(),
456 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
457 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
458 description: Some("serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.".into()),
459 ..Default::default()
460 })),
461 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
462 ..Default::default()
463 }),
464 ),
465 (
466 "storageCapacity".into(),
467 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
468 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
469 description: Some("storageCapacity indicates that the CSI volume driver wants pod scheduling to consider the storage capacity that the driver deployment will report by creating CSIStorageCapacity objects with capacity information, if set to true.\n\nThe check can be enabled immediately when deploying a driver. In that case, provisioning new volumes with late binding will pause until the driver deployment has published some suitable CSIStorageCapacity object.\n\nAlternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.\n\nThis field was immutable in Kubernetes <= 1.22 and now is mutable.".into()),
470 ..Default::default()
471 })),
472 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Boolean))),
473 ..Default::default()
474 }),
475 ),
476 (
477 "tokenRequests".into(),
478 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
479 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
480 description: Some("tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"<audience>\": {\n \"token\": <token>,\n \"expirationTimestamp\": <expiration timestamp in RFC3339>,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.".into()),
481 ..Default::default()
482 })),
483 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
484 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
485 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::api::storage::v1::TokenRequest>()))),
486 ..Default::default()
487 })),
488 ..Default::default()
489 }),
490 ),
491 (
492 "volumeLifecycleModes".into(),
493 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
494 metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
495 description: Some("volumeLifecycleModes defines what kind of volumes this CSI volume driver supports. The default if the list is empty is \"Persistent\", which is the usage defined by the CSI specification and implemented in Kubernetes via the usual PV/PVC mechanism.\n\nThe other mode is \"Ephemeral\". In this mode, volumes are defined inline inside the pod spec with CSIVolumeSource and their lifecycle is tied to the lifecycle of that pod. A driver has to be aware of this because it is only going to get a NodePublishVolume call for such a volume.\n\nFor more information about implementing this mode, see https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html A driver can support one or more of these modes and more modes may be added in the future.\n\nThis field is beta. This field is immutable.".into()),
496 ..Default::default()
497 })),
498 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
499 array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
500 items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(
501 crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
502 instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
503 ..Default::default()
504 })
505 ))),
506 ..Default::default()
507 })),
508 ..Default::default()
509 }),
510 ),
511 ].into(),
512 ..Default::default()
513 })),
514 ..Default::default()
515 })
516 }
517}