Skip to content

Commit 4235d93

Browse files
committed
Add details about secrets for ControllerModifyVolume
The secret references for ControllerModifyVolume have been added to the documentation of the StorageClass. There is also an explanation that the external-provisioner adds annotations on the PV so that the external-resizer can use them.
1 parent 29a171c commit 4235d93

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

book/src/secrets-and-credentials-storage-class.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The CSI [external-provisioner](external-provisioner.md) sidecar container facili
88
* `ControllerExpandVolumeRequest`
99
* `NodeStageVolumeRequest`
1010
* `NodePublishVolumeRequest`
11+
* `ControllerModifyVolumeRequest`
1112

1213
CSI `external-provisioner` v1.0.1+ supports the following keys in `StorageClass.parameters`:
1314

@@ -24,6 +25,10 @@ CSI `external-provisioner` v1.2.0+ adds support for the following keys in `Stora
2425
* `csi.storage.k8s.io/controller-expand-secret-name`
2526
* `csi.storage.k8s.io/controller-expand-secret-namespace`
2627

28+
CSI `external-provisioner` v6.1.0+ adds support for the following keys in `StorageClass.parameters`:
29+
* `csi.storage.k8s.io/controller-modify-secret-name`
30+
* `csi.storage.k8s.io/controller-modify-secret-namespace`
31+
2732
Cluster admins can populate the secret fields for the operations listed above with data from Kubernetes `Secret` objects by specifying these keys in the `StorageClass` object.
2833

2934
## Examples
@@ -254,3 +259,40 @@ The values of these parameters may be "templates". The `external-provisioner` wi
254259
* Replaced with name of the `PersistentVolume` object being provisioned.
255260
* `${pvc.namespace}`
256261
* Replaced with namespace of the `PersistentVolumeClaim` object that triggered provisioning.
262+
263+
### Controller Modify (VolumeAttributeClass) Secret
264+
265+
The CSI `external-provisioner` (v6.1.0+) looks for the following keys in `StorageClass.parameters`:
266+
267+
* `csi.storage.k8s.io/controller-modify-secret-name`
268+
* `csi.storage.k8s.io/controller-modify-secret-namespace`
269+
270+
The value of both parameters, together, refer to the name and namespace of the `Secret` object in the Kubernetes API.
271+
272+
If specified, the CSI `external-provisioner` adds the following annotations to the `PersistentVolume` object to refer to this secret once provisioning is successful:
273+
274+
* `volume.kubernetes.io/controller-modify-secret-name`
275+
* `volume.kubernetes.io/controller-modify-secret-namespace`
276+
277+
The `external-resizer` (v2.1.0+), attempts to fetch the secret referenced by the annotations on the `PersistentVolume`, if specified, before starting a volume resize (expand) operation. In case the `PersistentVolume` does not have the annotations, the secret referenced by the `CSIPersistentVolumeSource.ControllerExpandSecretRef` field is used.
278+
279+
If no such secret exists in the Kubernetes API, or the `external-resizer` is unable to fetch it, the volume modification operation fails.
280+
281+
If the secret is retrieved successfully, the `external-resizer` passes it to the CSI driver in the `ControllerModifyVolumeRequest.secrets` field.
282+
283+
The values of these parameters may be "templates". The `external-provisioner` will automatically resolve templates at volume provision time, as detailed below:
284+
285+
* `csi.storage.k8s.io/controller-modify-secret-name`
286+
* `${pv.name}`
287+
* Replaced with name of the `PersistentVolume` object being provisioned.
288+
* `${pvc.namespace}`
289+
* Replaced with namespace of the `PersistentVolumeClaim` object that triggered provisioning.
290+
* `${pvc.name}`
291+
* Replaced with the name of the `PersistentVolumeClaim` object that triggered provisioning.
292+
* `${pvc.annotations['<ANNOTATION_KEY>']}` (e.g. `${pvc.annotations['example.com/key']}`)
293+
* Replaced with the value of the specified annotation from the `PersistentVolumeClaim` object that triggered provisioning
294+
* `csi.storage.k8s.io/controller-modify-secret-namespace`
295+
* `${pv.name}`
296+
* Replaced with name of the `PersistentVolume` object being provisioned.
297+
* `${pvc.namespace}`
298+
* Replaced with namespace of the `PersistentVolumeClaim` object that triggered provisioning.

book/src/volume-attributes-class.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Status | Min K8s Version | Max K8s Version | external-provisioner | external-re
66
-------|-----------------|-----------------|-----------------------|-------------------------
77
Alpha | 1.29 | - | v4.0.0 | v1.10.0
88
Beta | 1.31 | - | v5.1.0 | v1.12.0
9+
GA | 1.34 | - | v6.0.0 | v2.0.0
910

1011
## Overview
1112
A `VolumeAttributesClass` is a cluster-scoped resource that can be used to control and change the settings of a `PersistentVolume`.
@@ -22,4 +23,4 @@ To take advantage of `VolumeAttibutesClass` feature:
2223
* The Kubernetes administrator must create the `VolumeAttributesClass` with the relevant `parameters` for the `driverName`
2324
* The user can then patch the `PersistentVolumeClaim` under `spec.volumeAttributesClassName` to select or update the settings he needs for the volume.
2425

25-
> For more information about how to use the feature, visit the [Kubernetes blog](https://kubernetes.io/blog/2024/08/15/kubernetes-1-31-volume-attributes-class/) page.
26+
> For more information about how to use the feature, visit the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/volume-attributes-classes/) page.

0 commit comments

Comments
 (0)