@@ -172,27 +172,46 @@ type PersistentVolumeClaimSpec struct {
172
172
...
173
173
}
174
174
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
+
175
185
// PersistentVolumeClaimStatus represents the status of PV claim
176
186
type PersistentVolumeClaimStatus struct {
177
187
...
178
- // The VolumeAttributesClassName string cannot be empty
179
- VolumeAttributesClassName string
180
- ModifyVolumeStatus *PersistentVolumeClaimModifyVolumeStatus
188
+ ModifyVolumeStatus ModifyVolumeStatus
181
189
...
182
190
}
183
191
192
+ // ModifyVolumeStatus represents the status of ControllerModifyVolume operation
193
+ type ModifyVolumeStatus struct {
194
+ ActualVolumeAttributesClassName string
195
+ TargetVolumeAttributesClassName string
196
+ Status *PersistentVolumeClaimModifyVolumeStatus
197
+ }
198
+
184
199
// +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.
185
203
type PersistentVolumeClaimModifyVolumeStatus string
186
204
187
205
const (
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"
190
209
// 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.
191
212
PersistentVolumeClaimControllerModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInProgress"
192
213
// 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"
196
215
)
197
216
198
217
```
@@ -208,30 +227,44 @@ The CSI create request will be extended to add mutable parameters. A new Control
208
227
// ControllerServer is the server API for Controller service.
209
228
type ControllerServer interface {
210
229
...
211
- rpc ControllerModifyVolume (ModifyVolumeRequest )
212
- returns (ModifyVolumeResponse ) {
230
+ rpc ControllerModifyVolume (ControllerModifyVolumeRequest )
231
+ returns (ControllerModifyVolumeResponse ) {
213
232
option (alpha_method) = true;
214
233
}
215
234
...
216
235
}
217
236
218
- message ModifyVolumeRequest {
237
+ message ControllerModifyVolumeRequest {
219
238
// Contains identity information for the existing volume.
220
239
// 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;
225
256
}
226
- message ModifyVolumeResponse {}
257
+ message ControllerModifyVolumeResponse {}
227
258
228
259
message CreateVolumeRequest {
229
260
...
230
261
// See CreateVolumeRequest.parameters.
231
262
// This field is OPTIONAL.
232
263
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.
235
268
map<string, string> mutable_parameters = 8;
236
269
}
237
270
```
@@ -275,6 +308,7 @@ apiVersion: storage.k8s.io/v1alpha1
275
308
kind: VolumeAttributesClass
276
309
metadata:
277
310
name: silver
311
+ driverName: pd.csi.storage.gke.io
278
312
parameters:
279
313
iops: "500"
280
314
throughput: "50MiB/s"
@@ -318,6 +352,7 @@ apiVersion: storage.k8s.io/v1alpha1
318
352
kind: VolumeAttributesClass
319
353
metadata:
320
354
name: silver
355
+ driverName: pd.csi.storage.gke.io
321
356
parameters:
322
357
iops: "500"
323
358
throughput: "50MiB/s"
@@ -345,6 +380,7 @@ apiVersion: storage.k8s.io/v1alpha1
345
380
kind: VolumeAttributesClass
346
381
metadata:
347
382
name: gold
383
+ driverName: pd.csi.storage.gke.io
348
384
parameters:
349
385
iops: "1000"
350
386
throughput: "100MiB/s"
@@ -409,12 +445,25 @@ The resource quota controller is the only component capable of monitoring and re
409
445
### 3. Add new statuses in PVC API to indicate changes of VolumeAttributesClass and the status of the ModifyVolume operation.
410
446
411
447
```
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
413
456
414
457
const (
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"
418
467
)
419
468
```
420
469
### 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
454
503
1 . PVC created with a VolumeAttributesClass
455
504
456
505
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
458
507
* Check if this VolumeAttributesClass already has a protection finalizer
459
508
* Add the finalizer to the VolumeAttributesClass if there is none
460
509
2 . PVC created with a VolumeAttributesClass being deleted
@@ -480,7 +529,7 @@ For unbound PVs referencing a VAC:
480
529
481
530
1 . Unbound PV created with a VolumeAttributesClass
482
531
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
484
533
* Check if this VolumeAttributesClass already has a protection finalizer
485
534
* Add the finalizer to the VolumeAttributesClass if there is none
486
535
2 . PV has a VolumeAttributesClass and this PV is deleted
@@ -496,6 +545,7 @@ apiVersion: storage.k8s.io/v1alpha1
496
545
kind: VolumeAttributesClass
497
546
metadata:
498
547
name: silver
548
+ driverName: pd.csi.storage.gke.io
499
549
parameters:
500
550
iops: "500"
501
551
throughput: "50MiB/s"
@@ -569,6 +619,7 @@ apiVersion: storage.k8s.io/v1alpha1
569
619
kind: VolumeAttributesClass
570
620
metadata:
571
621
name: gold
622
+ driverName: pd.csi.storage.gke.io
572
623
parameters:
573
624
iops: "1000"
574
625
throughput: "100MiB/s"
@@ -593,7 +644,7 @@ spec:
593
644
594
645
ModifyVolume 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.
595
646
596
- ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow.png )
647
+ ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow-v2 .png )
597
648
598
649
### Implementation & Handling Failure
599
650
0 commit comments