k8s_openapi/v1_34/api/core/v1/
volume.rs

1// Generated from definition io.k8s.api.core.v1.Volume
2
3/// Volume represents a named volume in a pod that may be accessed by any container in the pod.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct Volume {
6    /// awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
7    pub aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>,
8
9    /// azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type are redirected to the disk.csi.azure.com CSI driver.
10    pub azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource>,
11
12    /// azureFile represents an Azure File Service mount on the host and bind mount to the pod. Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type are redirected to the file.csi.azure.com CSI driver.
13    pub azure_file: Option<crate::api::core::v1::AzureFileVolumeSource>,
14
15    /// cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported.
16    pub cephfs: Option<crate::api::core::v1::CephFSVolumeSource>,
17
18    /// cinder represents a cinder volume attached and mounted on kubelets host machine. Deprecated: Cinder is deprecated. All operations for the in-tree cinder type are redirected to the cinder.csi.openstack.org CSI driver. More info: https://examples.k8s.io/mysql-cinder-pd/README.md
19    pub cinder: Option<crate::api::core::v1::CinderVolumeSource>,
20
21    /// configMap represents a configMap that should populate this volume
22    pub config_map: Option<crate::api::core::v1::ConfigMapVolumeSource>,
23
24    /// csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers.
25    pub csi: Option<crate::api::core::v1::CSIVolumeSource>,
26
27    /// downwardAPI represents downward API about the pod that should populate this volume
28    pub downward_api: Option<crate::api::core::v1::DownwardAPIVolumeSource>,
29
30    /// emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
31    pub empty_dir: Option<crate::api::core::v1::EmptyDirVolumeSource>,
32
33    /// ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.
34    ///
35    /// Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity
36    ///    tracking are needed,
37    /// c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through
38    ///    a PersistentVolumeClaim (see EphemeralVolumeSource for more
39    ///    information on the connection between this volume type
40    ///    and PersistentVolumeClaim).
41    ///
42    /// Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.
43    ///
44    /// Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.
45    ///
46    /// A pod can use both types of ephemeral volumes and persistent volumes at the same time.
47    pub ephemeral: Option<crate::api::core::v1::EphemeralVolumeSource>,
48
49    /// fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
50    pub fc: Option<crate::api::core::v1::FCVolumeSource>,
51
52    /// flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead.
53    pub flex_volume: Option<crate::api::core::v1::FlexVolumeSource>,
54
55    /// flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported.
56    pub flocker: Option<crate::api::core::v1::FlockerVolumeSource>,
57
58    /// gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
59    pub gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource>,
60
61    /// gitRepo represents a git repository at a particular revision. Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.
62    pub git_repo: Option<crate::api::core::v1::GitRepoVolumeSource>,
63
64    /// glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported.
65    pub glusterfs: Option<crate::api::core::v1::GlusterfsVolumeSource>,
66
67    /// hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
68    pub host_path: Option<crate::api::core::v1::HostPathVolumeSource>,
69
70    /// image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:
71    ///
72    /// - Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.
73    ///
74    /// The volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers\[*\].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers\[*\].volumeMounts.subpath) before 1.33. The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.
75    pub image: Option<crate::api::core::v1::ImageVolumeSource>,
76
77    /// iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi
78    pub iscsi: Option<crate::api::core::v1::ISCSIVolumeSource>,
79
80    /// name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
81    pub name: std::string::String,
82
83    /// nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs
84    pub nfs: Option<crate::api::core::v1::NFSVolumeSource>,
85
86    /// persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
87    pub persistent_volume_claim: Option<crate::api::core::v1::PersistentVolumeClaimVolumeSource>,
88
89    /// photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported.
90    pub photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource>,
91
92    /// portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate is on.
93    pub portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource>,
94
95    /// projected items for all in one resources secrets, configmaps, and downward API
96    pub projected: Option<crate::api::core::v1::ProjectedVolumeSource>,
97
98    /// quobyte represents a Quobyte mount on the host that shares a pod's lifetime. Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported.
99    pub quobyte: Option<crate::api::core::v1::QuobyteVolumeSource>,
100
101    /// rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported.
102    pub rbd: Option<crate::api::core::v1::RBDVolumeSource>,
103
104    /// scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported.
105    pub scale_io: Option<crate::api::core::v1::ScaleIOVolumeSource>,
106
107    /// secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
108    pub secret: Option<crate::api::core::v1::SecretVolumeSource>,
109
110    /// storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported.
111    pub storageos: Option<crate::api::core::v1::StorageOSVolumeSource>,
112
113    /// vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type are redirected to the csi.vsphere.vmware.com CSI driver.
114    pub vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource>,
115}
116
117impl crate::DeepMerge for Volume {
118    fn merge_from(&mut self, other: Self) {
119        crate::DeepMerge::merge_from(&mut self.aws_elastic_block_store, other.aws_elastic_block_store);
120        crate::DeepMerge::merge_from(&mut self.azure_disk, other.azure_disk);
121        crate::DeepMerge::merge_from(&mut self.azure_file, other.azure_file);
122        crate::DeepMerge::merge_from(&mut self.cephfs, other.cephfs);
123        crate::DeepMerge::merge_from(&mut self.cinder, other.cinder);
124        crate::DeepMerge::merge_from(&mut self.config_map, other.config_map);
125        crate::DeepMerge::merge_from(&mut self.csi, other.csi);
126        crate::DeepMerge::merge_from(&mut self.downward_api, other.downward_api);
127        crate::DeepMerge::merge_from(&mut self.empty_dir, other.empty_dir);
128        crate::DeepMerge::merge_from(&mut self.ephemeral, other.ephemeral);
129        crate::DeepMerge::merge_from(&mut self.fc, other.fc);
130        crate::DeepMerge::merge_from(&mut self.flex_volume, other.flex_volume);
131        crate::DeepMerge::merge_from(&mut self.flocker, other.flocker);
132        crate::DeepMerge::merge_from(&mut self.gce_persistent_disk, other.gce_persistent_disk);
133        crate::DeepMerge::merge_from(&mut self.git_repo, other.git_repo);
134        crate::DeepMerge::merge_from(&mut self.glusterfs, other.glusterfs);
135        crate::DeepMerge::merge_from(&mut self.host_path, other.host_path);
136        crate::DeepMerge::merge_from(&mut self.image, other.image);
137        crate::DeepMerge::merge_from(&mut self.iscsi, other.iscsi);
138        crate::DeepMerge::merge_from(&mut self.name, other.name);
139        crate::DeepMerge::merge_from(&mut self.nfs, other.nfs);
140        crate::DeepMerge::merge_from(&mut self.persistent_volume_claim, other.persistent_volume_claim);
141        crate::DeepMerge::merge_from(&mut self.photon_persistent_disk, other.photon_persistent_disk);
142        crate::DeepMerge::merge_from(&mut self.portworx_volume, other.portworx_volume);
143        crate::DeepMerge::merge_from(&mut self.projected, other.projected);
144        crate::DeepMerge::merge_from(&mut self.quobyte, other.quobyte);
145        crate::DeepMerge::merge_from(&mut self.rbd, other.rbd);
146        crate::DeepMerge::merge_from(&mut self.scale_io, other.scale_io);
147        crate::DeepMerge::merge_from(&mut self.secret, other.secret);
148        crate::DeepMerge::merge_from(&mut self.storageos, other.storageos);
149        crate::DeepMerge::merge_from(&mut self.vsphere_volume, other.vsphere_volume);
150    }
151}
152
153impl<'de> crate::serde::Deserialize<'de> for Volume {
154    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
155        #[allow(non_camel_case_types)]
156        enum Field {
157            Key_aws_elastic_block_store,
158            Key_azure_disk,
159            Key_azure_file,
160            Key_cephfs,
161            Key_cinder,
162            Key_config_map,
163            Key_csi,
164            Key_downward_api,
165            Key_empty_dir,
166            Key_ephemeral,
167            Key_fc,
168            Key_flex_volume,
169            Key_flocker,
170            Key_gce_persistent_disk,
171            Key_git_repo,
172            Key_glusterfs,
173            Key_host_path,
174            Key_image,
175            Key_iscsi,
176            Key_name,
177            Key_nfs,
178            Key_persistent_volume_claim,
179            Key_photon_persistent_disk,
180            Key_portworx_volume,
181            Key_projected,
182            Key_quobyte,
183            Key_rbd,
184            Key_scale_io,
185            Key_secret,
186            Key_storageos,
187            Key_vsphere_volume,
188            Other,
189        }
190
191        impl<'de> crate::serde::Deserialize<'de> for Field {
192            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
193                struct Visitor;
194
195                impl crate::serde::de::Visitor<'_> for Visitor {
196                    type Value = Field;
197
198                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
199                        f.write_str("field identifier")
200                    }
201
202                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
203                        Ok(match v {
204                            "awsElasticBlockStore" => Field::Key_aws_elastic_block_store,
205                            "azureDisk" => Field::Key_azure_disk,
206                            "azureFile" => Field::Key_azure_file,
207                            "cephfs" => Field::Key_cephfs,
208                            "cinder" => Field::Key_cinder,
209                            "configMap" => Field::Key_config_map,
210                            "csi" => Field::Key_csi,
211                            "downwardAPI" => Field::Key_downward_api,
212                            "emptyDir" => Field::Key_empty_dir,
213                            "ephemeral" => Field::Key_ephemeral,
214                            "fc" => Field::Key_fc,
215                            "flexVolume" => Field::Key_flex_volume,
216                            "flocker" => Field::Key_flocker,
217                            "gcePersistentDisk" => Field::Key_gce_persistent_disk,
218                            "gitRepo" => Field::Key_git_repo,
219                            "glusterfs" => Field::Key_glusterfs,
220                            "hostPath" => Field::Key_host_path,
221                            "image" => Field::Key_image,
222                            "iscsi" => Field::Key_iscsi,
223                            "name" => Field::Key_name,
224                            "nfs" => Field::Key_nfs,
225                            "persistentVolumeClaim" => Field::Key_persistent_volume_claim,
226                            "photonPersistentDisk" => Field::Key_photon_persistent_disk,
227                            "portworxVolume" => Field::Key_portworx_volume,
228                            "projected" => Field::Key_projected,
229                            "quobyte" => Field::Key_quobyte,
230                            "rbd" => Field::Key_rbd,
231                            "scaleIO" => Field::Key_scale_io,
232                            "secret" => Field::Key_secret,
233                            "storageos" => Field::Key_storageos,
234                            "vsphereVolume" => Field::Key_vsphere_volume,
235                            _ => Field::Other,
236                        })
237                    }
238                }
239
240                deserializer.deserialize_identifier(Visitor)
241            }
242        }
243
244        struct Visitor;
245
246        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
247            type Value = Volume;
248
249            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
250                f.write_str("Volume")
251            }
252
253            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
254                let mut value_aws_elastic_block_store: Option<crate::api::core::v1::AWSElasticBlockStoreVolumeSource> = None;
255                let mut value_azure_disk: Option<crate::api::core::v1::AzureDiskVolumeSource> = None;
256                let mut value_azure_file: Option<crate::api::core::v1::AzureFileVolumeSource> = None;
257                let mut value_cephfs: Option<crate::api::core::v1::CephFSVolumeSource> = None;
258                let mut value_cinder: Option<crate::api::core::v1::CinderVolumeSource> = None;
259                let mut value_config_map: Option<crate::api::core::v1::ConfigMapVolumeSource> = None;
260                let mut value_csi: Option<crate::api::core::v1::CSIVolumeSource> = None;
261                let mut value_downward_api: Option<crate::api::core::v1::DownwardAPIVolumeSource> = None;
262                let mut value_empty_dir: Option<crate::api::core::v1::EmptyDirVolumeSource> = None;
263                let mut value_ephemeral: Option<crate::api::core::v1::EphemeralVolumeSource> = None;
264                let mut value_fc: Option<crate::api::core::v1::FCVolumeSource> = None;
265                let mut value_flex_volume: Option<crate::api::core::v1::FlexVolumeSource> = None;
266                let mut value_flocker: Option<crate::api::core::v1::FlockerVolumeSource> = None;
267                let mut value_gce_persistent_disk: Option<crate::api::core::v1::GCEPersistentDiskVolumeSource> = None;
268                let mut value_git_repo: Option<crate::api::core::v1::GitRepoVolumeSource> = None;
269                let mut value_glusterfs: Option<crate::api::core::v1::GlusterfsVolumeSource> = None;
270                let mut value_host_path: Option<crate::api::core::v1::HostPathVolumeSource> = None;
271                let mut value_image: Option<crate::api::core::v1::ImageVolumeSource> = None;
272                let mut value_iscsi: Option<crate::api::core::v1::ISCSIVolumeSource> = None;
273                let mut value_name: Option<std::string::String> = None;
274                let mut value_nfs: Option<crate::api::core::v1::NFSVolumeSource> = None;
275                let mut value_persistent_volume_claim: Option<crate::api::core::v1::PersistentVolumeClaimVolumeSource> = None;
276                let mut value_photon_persistent_disk: Option<crate::api::core::v1::PhotonPersistentDiskVolumeSource> = None;
277                let mut value_portworx_volume: Option<crate::api::core::v1::PortworxVolumeSource> = None;
278                let mut value_projected: Option<crate::api::core::v1::ProjectedVolumeSource> = None;
279                let mut value_quobyte: Option<crate::api::core::v1::QuobyteVolumeSource> = None;
280                let mut value_rbd: Option<crate::api::core::v1::RBDVolumeSource> = None;
281                let mut value_scale_io: Option<crate::api::core::v1::ScaleIOVolumeSource> = None;
282                let mut value_secret: Option<crate::api::core::v1::SecretVolumeSource> = None;
283                let mut value_storageos: Option<crate::api::core::v1::StorageOSVolumeSource> = None;
284                let mut value_vsphere_volume: Option<crate::api::core::v1::VsphereVirtualDiskVolumeSource> = None;
285
286                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
287                    match key {
288                        Field::Key_aws_elastic_block_store => value_aws_elastic_block_store = crate::serde::de::MapAccess::next_value(&mut map)?,
289                        Field::Key_azure_disk => value_azure_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
290                        Field::Key_azure_file => value_azure_file = crate::serde::de::MapAccess::next_value(&mut map)?,
291                        Field::Key_cephfs => value_cephfs = crate::serde::de::MapAccess::next_value(&mut map)?,
292                        Field::Key_cinder => value_cinder = crate::serde::de::MapAccess::next_value(&mut map)?,
293                        Field::Key_config_map => value_config_map = crate::serde::de::MapAccess::next_value(&mut map)?,
294                        Field::Key_csi => value_csi = crate::serde::de::MapAccess::next_value(&mut map)?,
295                        Field::Key_downward_api => value_downward_api = crate::serde::de::MapAccess::next_value(&mut map)?,
296                        Field::Key_empty_dir => value_empty_dir = crate::serde::de::MapAccess::next_value(&mut map)?,
297                        Field::Key_ephemeral => value_ephemeral = crate::serde::de::MapAccess::next_value(&mut map)?,
298                        Field::Key_fc => value_fc = crate::serde::de::MapAccess::next_value(&mut map)?,
299                        Field::Key_flex_volume => value_flex_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
300                        Field::Key_flocker => value_flocker = crate::serde::de::MapAccess::next_value(&mut map)?,
301                        Field::Key_gce_persistent_disk => value_gce_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
302                        Field::Key_git_repo => value_git_repo = crate::serde::de::MapAccess::next_value(&mut map)?,
303                        Field::Key_glusterfs => value_glusterfs = crate::serde::de::MapAccess::next_value(&mut map)?,
304                        Field::Key_host_path => value_host_path = crate::serde::de::MapAccess::next_value(&mut map)?,
305                        Field::Key_image => value_image = crate::serde::de::MapAccess::next_value(&mut map)?,
306                        Field::Key_iscsi => value_iscsi = crate::serde::de::MapAccess::next_value(&mut map)?,
307                        Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?,
308                        Field::Key_nfs => value_nfs = crate::serde::de::MapAccess::next_value(&mut map)?,
309                        Field::Key_persistent_volume_claim => value_persistent_volume_claim = crate::serde::de::MapAccess::next_value(&mut map)?,
310                        Field::Key_photon_persistent_disk => value_photon_persistent_disk = crate::serde::de::MapAccess::next_value(&mut map)?,
311                        Field::Key_portworx_volume => value_portworx_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
312                        Field::Key_projected => value_projected = crate::serde::de::MapAccess::next_value(&mut map)?,
313                        Field::Key_quobyte => value_quobyte = crate::serde::de::MapAccess::next_value(&mut map)?,
314                        Field::Key_rbd => value_rbd = crate::serde::de::MapAccess::next_value(&mut map)?,
315                        Field::Key_scale_io => value_scale_io = crate::serde::de::MapAccess::next_value(&mut map)?,
316                        Field::Key_secret => value_secret = crate::serde::de::MapAccess::next_value(&mut map)?,
317                        Field::Key_storageos => value_storageos = crate::serde::de::MapAccess::next_value(&mut map)?,
318                        Field::Key_vsphere_volume => value_vsphere_volume = crate::serde::de::MapAccess::next_value(&mut map)?,
319                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
320                    }
321                }
322
323                Ok(Volume {
324                    aws_elastic_block_store: value_aws_elastic_block_store,
325                    azure_disk: value_azure_disk,
326                    azure_file: value_azure_file,
327                    cephfs: value_cephfs,
328                    cinder: value_cinder,
329                    config_map: value_config_map,
330                    csi: value_csi,
331                    downward_api: value_downward_api,
332                    empty_dir: value_empty_dir,
333                    ephemeral: value_ephemeral,
334                    fc: value_fc,
335                    flex_volume: value_flex_volume,
336                    flocker: value_flocker,
337                    gce_persistent_disk: value_gce_persistent_disk,
338                    git_repo: value_git_repo,
339                    glusterfs: value_glusterfs,
340                    host_path: value_host_path,
341                    image: value_image,
342                    iscsi: value_iscsi,
343                    name: value_name.unwrap_or_default(),
344                    nfs: value_nfs,
345                    persistent_volume_claim: value_persistent_volume_claim,
346                    photon_persistent_disk: value_photon_persistent_disk,
347                    portworx_volume: value_portworx_volume,
348                    projected: value_projected,
349                    quobyte: value_quobyte,
350                    rbd: value_rbd,
351                    scale_io: value_scale_io,
352                    secret: value_secret,
353                    storageos: value_storageos,
354                    vsphere_volume: value_vsphere_volume,
355                })
356            }
357        }
358
359        deserializer.deserialize_struct(
360            "Volume",
361            &[
362                "awsElasticBlockStore",
363                "azureDisk",
364                "azureFile",
365                "cephfs",
366                "cinder",
367                "configMap",
368                "csi",
369                "downwardAPI",
370                "emptyDir",
371                "ephemeral",
372                "fc",
373                "flexVolume",
374                "flocker",
375                "gcePersistentDisk",
376                "gitRepo",
377                "glusterfs",
378                "hostPath",
379                "image",
380                "iscsi",
381                "name",
382                "nfs",
383                "persistentVolumeClaim",
384                "photonPersistentDisk",
385                "portworxVolume",
386                "projected",
387                "quobyte",
388                "rbd",
389                "scaleIO",
390                "secret",
391                "storageos",
392                "vsphereVolume",
393            ],
394            Visitor,
395        )
396    }
397}
398
399impl crate::serde::Serialize for Volume {
400    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
401        let mut state = serializer.serialize_struct(
402            "Volume",
403            1 +
404            self.aws_elastic_block_store.as_ref().map_or(0, |_| 1) +
405            self.azure_disk.as_ref().map_or(0, |_| 1) +
406            self.azure_file.as_ref().map_or(0, |_| 1) +
407            self.cephfs.as_ref().map_or(0, |_| 1) +
408            self.cinder.as_ref().map_or(0, |_| 1) +
409            self.config_map.as_ref().map_or(0, |_| 1) +
410            self.csi.as_ref().map_or(0, |_| 1) +
411            self.downward_api.as_ref().map_or(0, |_| 1) +
412            self.empty_dir.as_ref().map_or(0, |_| 1) +
413            self.ephemeral.as_ref().map_or(0, |_| 1) +
414            self.fc.as_ref().map_or(0, |_| 1) +
415            self.flex_volume.as_ref().map_or(0, |_| 1) +
416            self.flocker.as_ref().map_or(0, |_| 1) +
417            self.gce_persistent_disk.as_ref().map_or(0, |_| 1) +
418            self.git_repo.as_ref().map_or(0, |_| 1) +
419            self.glusterfs.as_ref().map_or(0, |_| 1) +
420            self.host_path.as_ref().map_or(0, |_| 1) +
421            self.image.as_ref().map_or(0, |_| 1) +
422            self.iscsi.as_ref().map_or(0, |_| 1) +
423            self.nfs.as_ref().map_or(0, |_| 1) +
424            self.persistent_volume_claim.as_ref().map_or(0, |_| 1) +
425            self.photon_persistent_disk.as_ref().map_or(0, |_| 1) +
426            self.portworx_volume.as_ref().map_or(0, |_| 1) +
427            self.projected.as_ref().map_or(0, |_| 1) +
428            self.quobyte.as_ref().map_or(0, |_| 1) +
429            self.rbd.as_ref().map_or(0, |_| 1) +
430            self.scale_io.as_ref().map_or(0, |_| 1) +
431            self.secret.as_ref().map_or(0, |_| 1) +
432            self.storageos.as_ref().map_or(0, |_| 1) +
433            self.vsphere_volume.as_ref().map_or(0, |_| 1),
434        )?;
435        if let Some(value) = &self.aws_elastic_block_store {
436            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "awsElasticBlockStore", value)?;
437        }
438        if let Some(value) = &self.azure_disk {
439            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureDisk", value)?;
440        }
441        if let Some(value) = &self.azure_file {
442            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "azureFile", value)?;
443        }
444        if let Some(value) = &self.cephfs {
445            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cephfs", value)?;
446        }
447        if let Some(value) = &self.cinder {
448            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "cinder", value)?;
449        }
450        if let Some(value) = &self.config_map {
451            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "configMap", value)?;
452        }
453        if let Some(value) = &self.csi {
454            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "csi", value)?;
455        }
456        if let Some(value) = &self.downward_api {
457            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "downwardAPI", value)?;
458        }
459        if let Some(value) = &self.empty_dir {
460            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "emptyDir", value)?;
461        }
462        if let Some(value) = &self.ephemeral {
463            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "ephemeral", value)?;
464        }
465        if let Some(value) = &self.fc {
466            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "fc", value)?;
467        }
468        if let Some(value) = &self.flex_volume {
469            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flexVolume", value)?;
470        }
471        if let Some(value) = &self.flocker {
472            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "flocker", value)?;
473        }
474        if let Some(value) = &self.gce_persistent_disk {
475            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gcePersistentDisk", value)?;
476        }
477        if let Some(value) = &self.git_repo {
478            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "gitRepo", value)?;
479        }
480        if let Some(value) = &self.glusterfs {
481            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "glusterfs", value)?;
482        }
483        if let Some(value) = &self.host_path {
484            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "hostPath", value)?;
485        }
486        if let Some(value) = &self.image {
487            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "image", value)?;
488        }
489        if let Some(value) = &self.iscsi {
490            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "iscsi", value)?;
491        }
492        crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", &self.name)?;
493        if let Some(value) = &self.nfs {
494            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "nfs", value)?;
495        }
496        if let Some(value) = &self.persistent_volume_claim {
497            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "persistentVolumeClaim", value)?;
498        }
499        if let Some(value) = &self.photon_persistent_disk {
500            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "photonPersistentDisk", value)?;
501        }
502        if let Some(value) = &self.portworx_volume {
503            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "portworxVolume", value)?;
504        }
505        if let Some(value) = &self.projected {
506            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "projected", value)?;
507        }
508        if let Some(value) = &self.quobyte {
509            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "quobyte", value)?;
510        }
511        if let Some(value) = &self.rbd {
512            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "rbd", value)?;
513        }
514        if let Some(value) = &self.scale_io {
515            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "scaleIO", value)?;
516        }
517        if let Some(value) = &self.secret {
518            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "secret", value)?;
519        }
520        if let Some(value) = &self.storageos {
521            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "storageos", value)?;
522        }
523        if let Some(value) = &self.vsphere_volume {
524            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "vsphereVolume", value)?;
525        }
526        crate::serde::ser::SerializeStruct::end(state)
527    }
528}
529
530#[cfg(feature = "schemars")]
531impl crate::schemars::JsonSchema for Volume {
532    fn schema_name() -> std::borrow::Cow<'static, str> {
533        "io.k8s.api.core.v1.Volume".into()
534    }
535
536    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
537        crate::schemars::json_schema!({
538            "description": "Volume represents a named volume in a pod that may be accessed by any container in the pod.",
539            "type": "object",
540            "properties": {
541                "awsElasticBlockStore": ({
542                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AWSElasticBlockStoreVolumeSource>();
543                    schema_obj.ensure_object().insert("description".into(), "awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: AWSElasticBlockStore is deprecated. All operations for the in-tree awsElasticBlockStore type are redirected to the ebs.csi.aws.com CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore".into());
544                    schema_obj
545                }),
546                "azureDisk": ({
547                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureDiskVolumeSource>();
548                    schema_obj.ensure_object().insert("description".into(), "azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type are redirected to the disk.csi.azure.com CSI driver.".into());
549                    schema_obj
550                }),
551                "azureFile": ({
552                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::AzureFileVolumeSource>();
553                    schema_obj.ensure_object().insert("description".into(), "azureFile represents an Azure File Service mount on the host and bind mount to the pod. Deprecated: AzureFile is deprecated. All operations for the in-tree azureFile type are redirected to the file.csi.azure.com CSI driver.".into());
554                    schema_obj
555                }),
556                "cephfs": ({
557                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CephFSVolumeSource>();
558                    schema_obj.ensure_object().insert("description".into(), "cephFS represents a Ceph FS mount on the host that shares a pod's lifetime. Deprecated: CephFS is deprecated and the in-tree cephfs type is no longer supported.".into());
559                    schema_obj
560                }),
561                "cinder": ({
562                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CinderVolumeSource>();
563                    schema_obj.ensure_object().insert("description".into(), "cinder represents a cinder volume attached and mounted on kubelets host machine. Deprecated: Cinder is deprecated. All operations for the in-tree cinder type are redirected to the cinder.csi.openstack.org CSI driver. More info: https://examples.k8s.io/mysql-cinder-pd/README.md".into());
564                    schema_obj
565                }),
566                "configMap": ({
567                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ConfigMapVolumeSource>();
568                    schema_obj.ensure_object().insert("description".into(), "configMap represents a configMap that should populate this volume".into());
569                    schema_obj
570                }),
571                "csi": ({
572                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::CSIVolumeSource>();
573                    schema_obj.ensure_object().insert("description".into(), "csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers.".into());
574                    schema_obj
575                }),
576                "downwardAPI": ({
577                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::DownwardAPIVolumeSource>();
578                    schema_obj.ensure_object().insert("description".into(), "downwardAPI represents downward API about the pod that should populate this volume".into());
579                    schema_obj
580                }),
581                "emptyDir": ({
582                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::EmptyDirVolumeSource>();
583                    schema_obj.ensure_object().insert("description".into(), "emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir".into());
584                    schema_obj
585                }),
586                "ephemeral": ({
587                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::EphemeralVolumeSource>();
588                    schema_obj.ensure_object().insert("description".into(), "ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.\n\nUse this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity\n   tracking are needed,\nc) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through\n   a PersistentVolumeClaim (see EphemeralVolumeSource for more\n   information on the connection between this volume type\n   and PersistentVolumeClaim).\n\nUse PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.\n\nUse CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.\n\nA pod can use both types of ephemeral volumes and persistent volumes at the same time.".into());
589                    schema_obj
590                }),
591                "fc": ({
592                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FCVolumeSource>();
593                    schema_obj.ensure_object().insert("description".into(), "fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.".into());
594                    schema_obj
595                }),
596                "flexVolume": ({
597                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlexVolumeSource>();
598                    schema_obj.ensure_object().insert("description".into(), "flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead.".into());
599                    schema_obj
600                }),
601                "flocker": ({
602                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::FlockerVolumeSource>();
603                    schema_obj.ensure_object().insert("description".into(), "flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running. Deprecated: Flocker is deprecated and the in-tree flocker type is no longer supported.".into());
604                    schema_obj
605                }),
606                "gcePersistentDisk": ({
607                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GCEPersistentDiskVolumeSource>();
608                    schema_obj.ensure_object().insert("description".into(), "gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Deprecated: GCEPersistentDisk is deprecated. All operations for the in-tree gcePersistentDisk type are redirected to the pd.csi.storage.gke.io CSI driver. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk".into());
609                    schema_obj
610                }),
611                "gitRepo": ({
612                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GitRepoVolumeSource>();
613                    schema_obj.ensure_object().insert("description".into(), "gitRepo represents a git repository at a particular revision. Deprecated: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.".into());
614                    schema_obj
615                }),
616                "glusterfs": ({
617                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::GlusterfsVolumeSource>();
618                    schema_obj.ensure_object().insert("description".into(), "glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. Deprecated: Glusterfs is deprecated and the in-tree glusterfs type is no longer supported.".into());
619                    schema_obj
620                }),
621                "hostPath": ({
622                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::HostPathVolumeSource>();
623                    schema_obj.ensure_object().insert("description".into(), "hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath".into());
624                    schema_obj
625                }),
626                "image": ({
627                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ImageVolumeSource>();
628                    schema_obj.ensure_object().insert("description".into(), "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.".into());
629                    schema_obj
630                }),
631                "iscsi": ({
632                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ISCSIVolumeSource>();
633                    schema_obj.ensure_object().insert("description".into(), "iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes/#iscsi".into());
634                    schema_obj
635                }),
636                "name": {
637                    "description": "name of the volume. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
638                    "type": "string",
639                },
640                "nfs": ({
641                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::NFSVolumeSource>();
642                    schema_obj.ensure_object().insert("description".into(), "nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs".into());
643                    schema_obj
644                }),
645                "persistentVolumeClaim": ({
646                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PersistentVolumeClaimVolumeSource>();
647                    schema_obj.ensure_object().insert("description".into(), "persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims".into());
648                    schema_obj
649                }),
650                "photonPersistentDisk": ({
651                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PhotonPersistentDiskVolumeSource>();
652                    schema_obj.ensure_object().insert("description".into(), "photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported.".into());
653                    schema_obj
654                }),
655                "portworxVolume": ({
656                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::PortworxVolumeSource>();
657                    schema_obj.ensure_object().insert("description".into(), "portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate is on.".into());
658                    schema_obj
659                }),
660                "projected": ({
661                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ProjectedVolumeSource>();
662                    schema_obj.ensure_object().insert("description".into(), "projected items for all in one resources secrets, configmaps, and downward API".into());
663                    schema_obj
664                }),
665                "quobyte": ({
666                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::QuobyteVolumeSource>();
667                    schema_obj.ensure_object().insert("description".into(), "quobyte represents a Quobyte mount on the host that shares a pod's lifetime. Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported.".into());
668                    schema_obj
669                }),
670                "rbd": ({
671                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::RBDVolumeSource>();
672                    schema_obj.ensure_object().insert("description".into(), "rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. Deprecated: RBD is deprecated and the in-tree rbd type is no longer supported.".into());
673                    schema_obj
674                }),
675                "scaleIO": ({
676                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::ScaleIOVolumeSource>();
677                    schema_obj.ensure_object().insert("description".into(), "scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported.".into());
678                    schema_obj
679                }),
680                "secret": ({
681                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::SecretVolumeSource>();
682                    schema_obj.ensure_object().insert("description".into(), "secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret".into());
683                    schema_obj
684                }),
685                "storageos": ({
686                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::StorageOSVolumeSource>();
687                    schema_obj.ensure_object().insert("description".into(), "storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported.".into());
688                    schema_obj
689                }),
690                "vsphereVolume": ({
691                    let mut schema_obj = __gen.subschema_for::<crate::api::core::v1::VsphereVirtualDiskVolumeSource>();
692                    schema_obj.ensure_object().insert("description".into(), "vsphereVolume represents a vSphere volume attached and mounted on kubelets host machine. Deprecated: VsphereVolume is deprecated. All operations for the in-tree vsphereVolume type are redirected to the csi.vsphere.vmware.com CSI driver.".into());
693                    schema_obj
694                }),
695            },
696            "required": [
697                "name",
698            ],
699        })
700    }
701}