VolumeSource

Struct VolumeSource 

Source
pub struct VolumeSource {
Show 30 fields pub host_path: Option<HostPathVolumeSource>, pub empty_dir: Option<EmptyDirVolumeSource>, pub gce_persistent_disk: Option<GcePersistentDiskVolumeSource>, pub aws_elastic_block_store: Option<AwsElasticBlockStoreVolumeSource>, pub git_repo: Option<GitRepoVolumeSource>, pub secret: Option<SecretVolumeSource>, pub nfs: Option<NfsVolumeSource>, pub iscsi: Option<IscsiVolumeSource>, pub glusterfs: Option<GlusterfsVolumeSource>, pub persistent_volume_claim: Option<PersistentVolumeClaimVolumeSource>, pub rbd: Option<RbdVolumeSource>, pub flex_volume: Option<FlexVolumeSource>, pub cinder: Option<CinderVolumeSource>, pub cephfs: Option<CephFsVolumeSource>, pub flocker: Option<FlockerVolumeSource>, pub downward_api: Option<DownwardAPIVolumeSource>, pub fc: Option<FcVolumeSource>, pub azure_file: Option<AzureFileVolumeSource>, pub config_map: Option<ConfigMapVolumeSource>, pub vsphere_volume: Option<VsphereVirtualDiskVolumeSource>, pub quobyte: Option<QuobyteVolumeSource>, pub azure_disk: Option<AzureDiskVolumeSource>, pub photon_persistent_disk: Option<PhotonPersistentDiskVolumeSource>, pub projected: Option<ProjectedVolumeSource>, pub portworx_volume: Option<PortworxVolumeSource>, pub scale_io: Option<ScaleIoVolumeSource>, pub storageos: Option<StorageOsVolumeSource>, pub csi: Option<CSIVolumeSource>, pub ephemeral: Option<EphemeralVolumeSource>, pub image: Option<ImageVolumeSource>,
}
Expand description

Represents the source of a volume to mount. Only one of its members may be specified.

Fields§

§host_path: Option<HostPathVolumeSource>

§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

TODO(jonesdl) We need to restrict who can use host directory mounts and who can/can not mount host directories as read/write. +optional

§empty_dir: Option<EmptyDirVolumeSource>

emptyDir represents a temporary directory that shares a pod’s lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir +optional

§gce_persistent_disk: Option<GcePersistentDiskVolumeSource>

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 +optional

§aws_elastic_block_store: Option<AwsElasticBlockStoreVolumeSource>

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 +optional

§git_repo: Option<GitRepoVolumeSource>

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. +optional

§secret: Option<SecretVolumeSource>

secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret +optional

§nfs: Option<NfsVolumeSource>

nfs represents an NFS mount on the host that shares a pod’s lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs +optional

§iscsi: Option<IscsiVolumeSource>

iscsi represents an ISCSI Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md +optional

§glusterfs: Option<GlusterfsVolumeSource>

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. More info: https://examples.k8s.io/volumes/glusterfs/README.md +optional

§persistent_volume_claim: Option<PersistentVolumeClaimVolumeSource>

persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims +optional

§rbd: Option<RbdVolumeSource>

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. More info: https://examples.k8s.io/volumes/rbd/README.md +optional

§flex_volume: Option<FlexVolumeSource>

flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin. Deprecated: FlexVolume is deprecated. Consider using a CSIDriver instead. +optional

§cinder: Option<CinderVolumeSource>

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 +optional

§cephfs: Option<CephFsVolumeSource>

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. +optional

§flocker: Option<FlockerVolumeSource>

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. +optional

§downward_api: Option<DownwardAPIVolumeSource>

downwardAPI represents downward API about the pod that should populate this volume +optional

§fc: Option<FcVolumeSource>

fc represents a Fibre Channel resource that is attached to a kubelet’s host machine and then exposed to the pod. +optional

§azure_file: Option<AzureFileVolumeSource>

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. +optional

§config_map: Option<ConfigMapVolumeSource>

configMap represents a configMap that should populate this volume +optional

§vsphere_volume: Option<VsphereVirtualDiskVolumeSource>

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. +optional

§quobyte: Option<QuobyteVolumeSource>

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. +optional

§azure_disk: Option<AzureDiskVolumeSource>

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. +optional

§photon_persistent_disk: Option<PhotonPersistentDiskVolumeSource>

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.

§projected: Option<ProjectedVolumeSource>

projected items for all in one resources secrets, configmaps, and downward API

§portworx_volume: Option<PortworxVolumeSource>

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. +optional

§scale_io: Option<ScaleIoVolumeSource>

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. +optional

§storageos: Option<StorageOsVolumeSource>

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. +optional

§csi: Option<CSIVolumeSource>

csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers. +optional

§ephemeral: Option<EphemeralVolumeSource>

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.

Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity tracking are needed, c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through a PersistentVolumeClaim (see EphemeralVolumeSource for more information on the connection between this volume type and PersistentVolumeClaim).

Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.

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.

A pod can use both types of ephemeral volumes and persistent volumes at the same time.

+optional

§image: Option<ImageVolumeSource>

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:

  • 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.

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. +featureGate=ImageVolume +optional

Trait Implementations§

Source§

impl Clone for VolumeSource

Source§

fn clone(&self) -> VolumeSource

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VolumeSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VolumeSource

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for VolumeSource

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for VolumeSource

Source§

fn eq(&self, other: &VolumeSource) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VolumeSource

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.