@@ -172,27 +172,48 @@ 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
+ // PersistentVolumeClaimVolumeAttriburesModifyError - a user trigger modify volume of pvc has error
180
+ PersistentVolumeClaimVolumeAttriburesModifyError PersistentVolumeClaimConditionType = "VolumeAttriburesModifyError"
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 represents the status object of ControllerModifyVolume operation
189
+ ModifyVolumeStatus ModifyVolumeStatus
181
190
...
182
191
}
183
192
193
+ // ModifyVolumeStatus represents the status object of ControllerModifyVolume operation
194
+ type ModifyVolumeStatus struct {
195
+ // CurrentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using
196
+ CurrentVolumeAttributesClassName string
197
+ // TargetVolumeAttributesClassName is the name of the VolumeAttributesClass the PVC currently being reconciled
198
+ TargetVolumeAttributesClassName string
199
+ // Status is the status of the ControllerModifyVolume operation
200
+ Status *PersistentVolumeClaimModifyVolumeStatus
201
+ }
202
+
184
203
// +enum
204
+ // New statuses can be added in the future. Consumers should check for unknown statuses and fail appropriately
185
205
type PersistentVolumeClaimModifyVolumeStatus string
186
206
187
207
const (
188
- // When modify volume is complete, the empty string is set by modify volume controller.
189
- PersistentVolumeClaimNoModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = ""
190
- // State set when modify volume controller starts modifying the volume in control-plane
208
+ // Pending indicates that the PersistentVolumeClaim cannot be modified due to requirements not being met, such as
209
+ // the PersistentVolumeClaim being in an invalid state or the specified VolumeAttributesClass is existing
210
+ PersistentVolumeClaimControllerModifyVolumePending PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumePending"
211
+ // State set when modify volume controller starts modifying the volume
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
+ // When the request has been rejected as invalid by the CSI driver. To resolve this error,
215
+ // the PersistentVolumeClaim needs to specify a valid VolumeAttributesClass .
216
+ PersistentVolumeClaimControllerModifyVolumeInfeasible PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInfeasible "
196
217
)
197
218
198
219
```
@@ -208,30 +229,44 @@ The CSI create request will be extended to add mutable parameters. A new Control
208
229
// ControllerServer is the server API for Controller service.
209
230
type ControllerServer interface {
210
231
...
211
- rpc ControllerModifyVolume (ModifyVolumeRequest )
212
- returns (ModifyVolumeResponse ) {
232
+ rpc ControllerModifyVolume (ControllerModifyVolumeRequest )
233
+ returns (ControllerModifyVolumeResponse ) {
213
234
option (alpha_method) = true;
214
235
}
215
236
...
216
237
}
217
238
218
- message ModifyVolumeRequest {
239
+ message ControllerModifyVolumeRequest {
219
240
// Contains identity information for the existing volume.
220
241
// 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;
242
+ string volume_id = 1;
243
+
244
+ // Secrets required by plugin to complete modify volume request.
245
+ // This field is OPTIONAL. Refer to the `Secrets Requirements`
246
+ // section on how to use this field.
247
+ map<string, string> secrets = 2 [(csi_secret) = true];
248
+
249
+ // Plugin specific volume attributes to mutate, passed in as
250
+ // opaque key-value pairs.
251
+ // This field is REQUIRED. The Plugin is responsible for
252
+ // parsing and validating these parameters. COs will treat these
253
+ // as opaque. The CO SHOULD specify the intended values of all mutable
254
+ // parameters it intends to modify. SPs MUST NOT modify volumes based
255
+ // on the absence of keys, only keys that are specified should result
256
+ // in modifications to the volume.
257
+ map<string, string> mutable_parameters = 3;
225
258
}
226
- message ModifyVolumeResponse {}
259
+ message ControllerModifyVolumeResponse {}
227
260
228
261
message CreateVolumeRequest {
229
262
...
230
263
// See CreateVolumeRequest.parameters.
231
264
// This field is OPTIONAL.
232
265
map<string, string> parameters = 4;
233
- // This field is OPTIONAL. This allows the CO to specify the
234
- // volume attributes class parameters to apply.
266
+ // Plugins MUST treat these
267
+ // as if they take precedence over the parameters field.
268
+ // This field SHALL NOT be specified unless the SP has the
269
+ // MODIFY_VOLUME plugin capability.
235
270
map<string, string> mutable_parameters = 8;
236
271
}
237
272
```
@@ -275,6 +310,7 @@ apiVersion: storage.k8s.io/v1alpha1
275
310
kind: VolumeAttributesClass
276
311
metadata:
277
312
name: silver
313
+ driverName: pd.csi.storage.gke.io
278
314
parameters:
279
315
iops: "500"
280
316
throughput: "50MiB/s"
@@ -318,6 +354,7 @@ apiVersion: storage.k8s.io/v1alpha1
318
354
kind: VolumeAttributesClass
319
355
metadata:
320
356
name: silver
357
+ driverName: pd.csi.storage.gke.io
321
358
parameters:
322
359
iops: "500"
323
360
throughput: "50MiB/s"
@@ -345,6 +382,7 @@ apiVersion: storage.k8s.io/v1alpha1
345
382
kind: VolumeAttributesClass
346
383
metadata:
347
384
name: gold
385
+ driverName: pd.csi.storage.gke.io
348
386
parameters:
349
387
iops: "1000"
350
388
throughput: "100MiB/s"
@@ -409,12 +447,25 @@ The resource quota controller is the only component capable of monitoring and re
409
447
### 3. Add new statuses in PVC API to indicate changes of VolumeAttributesClass and the status of the ModifyVolume operation.
410
448
411
449
```
412
- type VolumeAttributesClassStatus string
450
+ type ModifyVolumeStatus struct {
451
+ ActualClassName string
452
+ TargetClassName string
453
+ Status *PersistentVolumeClaimModifyVolumeStatus
454
+ }
455
+
456
+ // +enum
457
+ type PersistentVolumeClaimModifyVolumeStatus string
413
458
414
459
const (
415
- PersistentVolumeClaimControllerModifyVolumeProgress VolumeAttributesClassStatus = "ControllerModifyVolumeInProgress"
416
- PersistentVolumeClaimControllerModifyVolumePending VolumeAttributesClassStatus = "ControllerModifyVolumePending"
417
- PersistentVolumeClaimControllerModifyVolumeFailed VolumeAttributesClassStatus = "ControllerModifyVolumeFailed"
460
+ // Pending indicates that the PersistentVolumeClaim cannot be modified due to requirements not being met, such as
461
+ // the PersistentVolumeClaim being in an invalid state or the specified VolumeAttributesClass is existing
462
+ PersistentVolumeClaimControllerModifyVolumePending PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumePending"
463
+ // State set when modify volume controller starts modifying the volume in control-plane
464
+ // When the request has been rejected as invalid by the CSI driver. To resolve this error,
465
+ // the PersistentVolumeClaim needs to specify a valid VolumeAttributesClass.
466
+ PersistentVolumeClaimControllerModifyVolumeInProgress PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInProgress"
467
+ // State set when modify volume has failed in modify volume controller with a terminal error.
468
+ PersistentVolumeClaimControllerModifyVolumeInfeasible PersistentVolumeClaimModifyVolumeStatus = "ControllerModifyVolumeInfeasible"
418
469
)
419
470
```
420
471
### 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 +505,7 @@ There are a few conditions that will trigger add/remove pvc finalizers in the Vo
454
505
1 . PVC created with a VolumeAttributesClass
455
506
456
507
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
508
+ * 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
509
* Check if this VolumeAttributesClass already has a protection finalizer
459
510
* Add the finalizer to the VolumeAttributesClass if there is none
460
511
2 . PVC created with a VolumeAttributesClass being deleted
@@ -480,7 +531,7 @@ For unbound PVs referencing a VAC:
480
531
481
532
1 . Unbound PV created with a VolumeAttributesClass
482
533
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
534
+ * 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
535
* Check if this VolumeAttributesClass already has a protection finalizer
485
536
* Add the finalizer to the VolumeAttributesClass if there is none
486
537
2 . PV has a VolumeAttributesClass and this PV is deleted
@@ -496,6 +547,7 @@ apiVersion: storage.k8s.io/v1alpha1
496
547
kind: VolumeAttributesClass
497
548
metadata:
498
549
name: silver
550
+ driverName: pd.csi.storage.gke.io
499
551
parameters:
500
552
iops: "500"
501
553
throughput: "50MiB/s"
@@ -569,6 +621,7 @@ apiVersion: storage.k8s.io/v1alpha1
569
621
kind: VolumeAttributesClass
570
622
metadata:
571
623
name: gold
624
+ driverName: pd.csi.storage.gke.io
572
625
parameters:
573
626
iops: "1000"
574
627
throughput: "100MiB/s"
@@ -593,7 +646,7 @@ spec:
593
646
594
647
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
648
596
- ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow.png )
649
+ ![ ModifyVolume Flow Diagram] ( ./VolumeAttributesClass-ModifyVolume-Flow-v2 .png )
597
650
598
651
### Implementation & Handling Failure
599
652
0 commit comments