@@ -172,27 +172,46 @@ type PersistentVolumeClaimSpec struct {
172172  ... 
173173} 
174174
175+ // Add the PersistentVolumeClaimModifyVolume condition to existing PersistentVolumeClaimConditionType 
176+ // Condition is used to document the last error controller sees 
177+ const ( 
178+   ... 
179+   // PersistentVolumeClaimModifyVolume - a user trigger modify volume of pvc has been started 
180+   PersistentVolumeClaimModifyVolume PersistentVolumeClaimConditionType = "ModifyVolume" 
181+   ... 
182+ ) 
183+ 
184+ 
175185// PersistentVolumeClaimStatus represents the status of PV claim 
176186type PersistentVolumeClaimStatus struct { 
177187  ... 
178-   // The VolumeAttributesClassName string cannot be empty 
179-   VolumeAttributesClassName string 
180-   ModifyVolumeStatus *PersistentVolumeClaimModifyVolumeStatus 
188+   ModifyVolumeStatus ModifyVolumeStatus 
181189  ... 
182190} 
183191
192+ // ModifyVolumeStatus represents the status of ControllerModifyVolume operation 
193+ type ModifyVolumeStatus struct { 
194+   ActualVolumeAttributesClassName string 
195+   TargetVolumeAttributesClassName string 
196+   Status *PersistentVolumeClaimModifyVolumeStatus 
197+ } 
198+ 
184199// +enum 
200+ // When a controller receives persistentvolume claim update with PersistentVolumeClaimModifyVolumeStatus for a resource 
201+ // that it does not recognizes, then it should ignore that update and let other controllers 
202+ // handle it. 
185203type PersistentVolumeClaimModifyVolumeStatus string 
186204
187205const ( 
188-   // When modify volume is complete, the empty string is set by modify volume controller. 
189-   PersistentVolumeClaimNoModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = "" 
206+   // State set when modify volume controller wants to modify the volume in control-plane 
207+   // but the VolumeAttributesClass does not exist. 
208+   PersistentVolumeClaimControllerModifyVolumePending PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumePending" 
190209  // State set when modify volume controller starts modifying the volume in control-plane 
210+   // When the request has been rejected as invalid by the CSI driver. To resolve this error, 
211+   // the PersistentVolumeClaim needs to specify a valid VolumeAttributesClass. 
191212  PersistentVolumeClaimControllerModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInProgress" 
192213  // State set when modify volume has failed in modify volume controller with a terminal error. 
193-   // Transient errors such as timeout should not set this status and should leave ModifyVolumeStatus 
194-   // unmodified, so as modify volume controller can resume the volume modification. 
195-   PersistentVolumeClaimControllerModifyVolumeFailed PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeFailed" 
214+   PersistentVolumeClaimControllerModifyVolumeInfeasible PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInfeasible" 
196215) 
197216
198217``` 
@@ -208,30 +227,44 @@ The CSI create request will be extended to add mutable parameters. A new Control
208227// ControllerServer is the server API for Controller service. 
209228type ControllerServer interface { 
210229    ... 
211-     rpc ControllerModifyVolume (ModifyVolumeRequest ) 
212-         returns (ModifyVolumeResponse ) { 
230+     rpc ControllerModifyVolume (ControllerModifyVolumeRequest ) 
231+         returns (ControllerModifyVolumeResponse ) { 
213232            option (alpha_method) = true; 
214233        } 
215234    ... 
216235} 
217236
218- message ModifyVolumeRequest  { 
237+ message ControllerModifyVolumeRequest  { 
219238  // Contains identity information for the existing volume. 
220239  // This field is REQUIRED. 
221-   string volume_id = 1 
222-   // This field is OPTIONAL.This allows the CO to specify the 
223-   // mutable parameters to apply.  
224-   map<string, string> mutable_parameters = 2; 
240+   string volume_id = 1; 
241+ 
242+   // Secrets required by plugin to complete modify volume request. 
243+   // This field is OPTIONAL. Refer to the `Secrets Requirements` 
244+   // section on how to use this field. 
245+   map<string, string> secrets = 2 [(csi_secret) = true]; 
246+ 
247+   // Plugin specific volume attributes to mutate, passed in as  
248+   // opaque key-value pairs.  
249+   // This field is REQUIRED. The Plugin is responsible for 
250+   // parsing and validating these parameters. COs will treat these 
251+   // as opaque. The CO SHOULD specify the intended values of all mutable 
252+   // parameters it intends to modify. SPs MUST NOT modify volumes based 
253+   // on the absence of keys, only keys that are specified should result 
254+   // in modifications to the volume. 
255+   map<string, string> mutable_parameters = 3; 
225256} 
226- message ModifyVolumeResponse  {} 
257+ message ControllerModifyVolumeResponse  {} 
227258
228259message CreateVolumeRequest { 
229260  ... 
230261  // See CreateVolumeRequest.parameters. 
231262  // This field is OPTIONAL. 
232263  map<string, string> parameters = 4; 
233-   // This field is OPTIONAL. This allows the CO to specify the 
234-   // volume attributes class parameters to apply.  
264+   // Plugins MUST treat these  
265+   // as if they take precedence over the parameters field. 
266+   // This field SHALL NOT be specified unless the SP has the 
267+   // MODIFY_VOLUME plugin capability. 
235268  map<string, string> mutable_parameters = 8; 
236269} 
237270``` 
@@ -275,6 +308,7 @@ apiVersion: storage.k8s.io/v1alpha1
275308kind: VolumeAttributesClass 
276309metadata: 
277310  name: silver 
311+ driverName: pd.csi.storage.gke.io 
278312parameters: 
279313  iops: "500" 
280314  throughput: "50MiB/s" 
@@ -318,6 +352,7 @@ apiVersion: storage.k8s.io/v1alpha1
318352kind: VolumeAttributesClass 
319353metadata: 
320354  name: silver 
355+ driverName: pd.csi.storage.gke.io 
321356parameters: 
322357  iops: "500" 
323358  throughput: "50MiB/s" 
@@ -345,6 +380,7 @@ apiVersion: storage.k8s.io/v1alpha1
345380kind: VolumeAttributesClass 
346381metadata: 
347382  name: gold 
383+ driverName: pd.csi.storage.gke.io 
348384parameters: 
349385  iops: "1000" 
350386  throughput: "100MiB/s" 
@@ -409,12 +445,25 @@ The resource quota controller is the only component capable of monitoring and re
409445### 3. Add new statuses in PVC API to indicate changes of VolumeAttributesClass and the status of the ModifyVolume operation.  
410446
411447``` 
412- type VolumeAttributesClassStatus string 
448+ type ModifyVolumeStatus struct { 
449+   ActualClassName string 
450+   TargetClassName string 
451+   Status *PersistentVolumeClaimModifyVolumeStatus 
452+ } 
453+ 
454+ // +enum 
455+ type PersistentVolumeClaimModifyVolumeStatus string 
413456
414457const ( 
415-     PersistentVolumeClaimControllerModifyVolumeProgress VolumeAttributesClassStatus = "ControllerModifyVolumeInProgress" 
416-     PersistentVolumeClaimControllerModifyVolumePending VolumeAttributesClassStatus = "ControllerModifyVolumePending" 
417-     PersistentVolumeClaimControllerModifyVolumeFailed VolumeAttributesClassStatus = "ControllerModifyVolumeFailed" 
458+   // State set when modify volume controller wants to modify the volume in control-plane 
459+   // but the VolumeAttributesClass does not exist. 
460+   PersistentVolumeClaimControllerModifyVolumePending PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumePending" 
461+   // State set when modify volume controller starts modifying the volume in control-plane 
462+   // When the request has been rejected as invalid by the CSI driver. To resolve this error, 
463+   // the PersistentVolumeClaim needs to specify a valid VolumeAttributesClass. 
464+   PersistentVolumeClaimControllerModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInProgress" 
465+   // State set when modify volume has failed in modify volume controller with a terminal error. 
466+   PersistentVolumeClaimControllerModifyVolumeInfeasible PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInfeasible" 
418467) 
419468``` 
420469### 4. Add new CSI API ControllerModifyVolume, when there is a change of VolumeAttributesClass in PVC, external-resizer triggers a ControllerModifyVolume operation against a CSI endpoint. A Controller Plugin MUST implement this RPC call if it has MODIFY_VOLUME capability.   
@@ -454,7 +503,7 @@ There are a few conditions that will trigger add/remove pvc finalizers in the Vo
4545031 .  PVC created with a VolumeAttributesClass
455504
456505    The ** VACObjectInUseProtection admission controller** :
457-     *  Check if the VolumeAttributesClass exists. If not, the PVC will enter the PENDING  state because we do not want to impose ordering on object creation
506+     *  Check if the VolumeAttributesClass exists. If not, the PVC will enter the INPROGRESS  state because we do not want to impose ordering on object creation
458507    *  Check if this VolumeAttributesClass already has a protection finalizer
459508    *  Add the finalizer to the VolumeAttributesClass if there is none 
4605092 .  PVC created with a VolumeAttributesClass being deleted
@@ -480,7 +529,7 @@ For unbound PVs referencing a VAC:
480529
4815301 .  Unbound PV created with a VolumeAttributesClass
482531    The ** VACObjectInUseProtection admission controller** :
483-     *  Check if the VolumeAttributesClass exists. If not, the PV will enter the PENDING  state because we do not want to impose ordering on object creation
532+     *  Check if the VolumeAttributesClass exists. If not, the PV will enter the INPROGRESS  state because we do not want to impose ordering on object creation
484533    *  Check if this VolumeAttributesClass already has a protection finalizer
485534    *  Add the finalizer to the VolumeAttributesClass if there is none
4865352 .  PV has a VolumeAttributesClass and this PV is deleted
@@ -496,6 +545,7 @@ apiVersion: storage.k8s.io/v1alpha1
496545kind: VolumeAttributesClass 
497546metadata: 
498547  name: silver 
548+ driverName: pd.csi.storage.gke.io 
499549parameters: 
500550  iops: "500" 
501551  throughput: "50MiB/s" 
@@ -569,6 +619,7 @@ apiVersion: storage.k8s.io/v1alpha1
569619kind: VolumeAttributesClass 
570620metadata: 
571621  name: gold 
622+ driverName: pd.csi.storage.gke.io 
572623parameters: 
573624  iops: "1000" 
574625  throughput: "100MiB/s" 
@@ -593,7 +644,7 @@ spec:
593644
594645ModifyVolume is only allowed on bound PVCs. Under the ModifyVolume call, it will pass in the mutable parameters and do the update operation based on the ` VolumeAttributesClass `  parameters.
595646
596- ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow.png ) 
647+ ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow-v2 .png ) 
597648
598649### Implementation & Handling Failure  
599650
0 commit comments