## CSIDriverSpec

# Struct CSIDriverSpec

Source

    pub struct CSIDriverSpec {
        pub attach_required: Option<bool>,
        pub fs_group_policy: Option<String>,
        pub node_allocatable_update_period_seconds: Option<i64>,
        pub pod_info_on_mount: Option<bool>,
        pub requires_republish: Option<bool>,
        pub se_linux_mount: Option<bool>,
        pub service_account_token_in_secrets: Option<bool>,
        pub storage_capacity: Option<bool>,
        pub token_requests: Option<Vec<TokenRequest>>,
        pub volume_lifecycle_modes: Option<Vec<String>>,
    }

Expand description

CSIDriverSpec is the specification of a CSIDriver.

## Fields§

§`attach_required: Option<bool>`

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.

This field is immutable.

§`fs_group_policy: Option<String>`

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.

This field was immutable in Kubernetes < 1.29 and now is mutable.

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

§`node_allocatable_update_period_seconds: Option<i64>`

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.

This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.

This field is mutable.

§`pod_info_on_mount: Option<bool>`

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.

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

The 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 defined by a CSIVolumeSource, otherwise “false”

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

This field was immutable in Kubernetes < 1.29 and now is mutable.

§`requires_republish: Option<bool>`

requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.

Note: 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.

§`se_linux_mount: Option<bool>`

seLinuxMount specifies if the CSI driver supports “-o context” mount option.

When “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.

When “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.

Default is “false”.

§`service_account_token_in_secrets: Option<bool>`

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.

When “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.

When “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.

This field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.

Default behavior if unset is to pass tokens in the VolumeContext field.

§`storage_capacity: Option<bool>`

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.

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

Alternatively, the driver can be deployed with the field unset or false and it can be flipped later when storage capacity information has been published.

This field was immutable in Kubernetes <= 1.22 and now is mutable.

§`token_requests: Option<Vec<TokenRequest>>`

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”: { “<audience>”: { “token”: <token>, “expirationTimestamp”: <expiration timestamp in RFC3339>, }, … }

Note: 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.

§`volume_lifecycle_modes: Option<Vec<String>>`

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.

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

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

This field is beta. This field is immutable.

## Trait Implementations§

Source§

### impl Clone for CSIDriverSpec

Source§

#### fn clone(&self) -> CSIDriverSpec

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 CSIDriverSpec

Source§

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

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

### impl DeepMerge for CSIDriverSpec

Source§

#### fn merge_from(&mut self, other: Self)

Merge `other` into `self`.
Source§

### impl Default for CSIDriverSpec

Source§

#### fn default() -> CSIDriverSpec

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

### impl<'de> Deserialize<'de> for CSIDriverSpec

Source§

#### fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

### impl PartialEq for CSIDriverSpec

Source§

#### fn eq(&self, other: &CSIDriverSpec) -> 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 Serialize for CSIDriverSpec

Source§

#### fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

### impl StructuralPartialEq for CSIDriverSpec

## Auto Trait Implementations§

§

### impl Freeze for CSIDriverSpec

§

### impl RefUnwindSafe for CSIDriverSpec

§

### impl Send for CSIDriverSpec

§

### impl Sync for CSIDriverSpec

§

### impl Unpin for CSIDriverSpec

§

### impl UnwindSafe for CSIDriverSpec

## 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.
Source§

### impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,