Skip to content

Commit d41665c

Browse files
Update ControllerModifyVolume Status API
1 parent 8ec8fa2 commit d41665c

File tree

3 files changed

+79
-26
lines changed

3 files changed

+79
-26
lines changed

keps/sig-storage/3751-volume-attributes-class/README.md

Lines changed: 79 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,48 @@ 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+
// PersistentVolumeClaimVolumeAttriburesModifyError - a user trigger modify volume of pvc has error
180+
PersistentVolumeClaimVolumeAttriburesModifyError PersistentVolumeClaimConditionType = "VolumeAttriburesModifyError"
181+
...
182+
)
183+
184+
175185
// PersistentVolumeClaimStatus represents the status of PV claim
176186
type PersistentVolumeClaimStatus struct {
177187
...
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
181190
...
182191
}
183192
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+
184203
// +enum
204+
// New statuses can be added in the future. Consumers should check for unknown statuses and fail appropriately
185205
type PersistentVolumeClaimModifyVolumeStatus string
186206
187207
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
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+
// 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"
196217
)
197218
198219
```
@@ -208,30 +229,44 @@ The CSI create request will be extended to add mutable parameters. A new Control
208229
// ControllerServer is the server API for Controller service.
209230
type ControllerServer interface {
210231
...
211-
rpc ControllerModifyVolume (ModifyVolumeRequest)
212-
returns (ModifyVolumeResponse) {
232+
rpc ControllerModifyVolume (ControllerModifyVolumeRequest)
233+
returns (ControllerModifyVolumeResponse) {
213234
option (alpha_method) = true;
214235
}
215236
...
216237
}
217238
218-
message ModifyVolumeRequest {
239+
message ControllerModifyVolumeRequest {
219240
// Contains identity information for the existing volume.
220241
// 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;
225258
}
226-
message ModifyVolumeResponse {}
259+
message ControllerModifyVolumeResponse {}
227260
228261
message CreateVolumeRequest {
229262
...
230263
// See CreateVolumeRequest.parameters.
231264
// This field is OPTIONAL.
232265
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.
235270
map<string, string> mutable_parameters = 8;
236271
}
237272
```
@@ -275,6 +310,7 @@ apiVersion: storage.k8s.io/v1alpha1
275310
kind: VolumeAttributesClass
276311
metadata:
277312
name: silver
313+
driverName: pd.csi.storage.gke.io
278314
parameters:
279315
iops: "500"
280316
throughput: "50MiB/s"
@@ -318,6 +354,7 @@ apiVersion: storage.k8s.io/v1alpha1
318354
kind: VolumeAttributesClass
319355
metadata:
320356
name: silver
357+
driverName: pd.csi.storage.gke.io
321358
parameters:
322359
iops: "500"
323360
throughput: "50MiB/s"
@@ -345,6 +382,7 @@ apiVersion: storage.k8s.io/v1alpha1
345382
kind: VolumeAttributesClass
346383
metadata:
347384
name: gold
385+
driverName: pd.csi.storage.gke.io
348386
parameters:
349387
iops: "1000"
350388
throughput: "100MiB/s"
@@ -409,12 +447,25 @@ The resource quota controller is the only component capable of monitoring and re
409447
### 3. Add new statuses in PVC API to indicate changes of VolumeAttributesClass and the status of the ModifyVolume operation.
410448

411449
```
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
413458
414459
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"
418469
)
419470
```
420471
### 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
454505
1. PVC created with a VolumeAttributesClass
455506

456507
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
458509
* Check if this VolumeAttributesClass already has a protection finalizer
459510
* Add the finalizer to the VolumeAttributesClass if there is none
460511
2. PVC created with a VolumeAttributesClass being deleted
@@ -480,7 +531,7 @@ For unbound PVs referencing a VAC:
480531

481532
1. Unbound PV created with a VolumeAttributesClass
482533
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
484535
* Check if this VolumeAttributesClass already has a protection finalizer
485536
* Add the finalizer to the VolumeAttributesClass if there is none
486537
2. PV has a VolumeAttributesClass and this PV is deleted
@@ -496,6 +547,7 @@ apiVersion: storage.k8s.io/v1alpha1
496547
kind: VolumeAttributesClass
497548
metadata:
498549
name: silver
550+
driverName: pd.csi.storage.gke.io
499551
parameters:
500552
iops: "500"
501553
throughput: "50MiB/s"
@@ -569,6 +621,7 @@ apiVersion: storage.k8s.io/v1alpha1
569621
kind: VolumeAttributesClass
570622
metadata:
571623
name: gold
624+
driverName: pd.csi.storage.gke.io
572625
parameters:
573626
iops: "1000"
574627
throughput: "100MiB/s"
@@ -593,7 +646,7 @@ spec:
593646

594647
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.
595648

596-
![ModifyVolume Flow Diagram](./VolumeAttributesClass-ModifyVolume-Flow.png)
649+
![ModifyVolume Flow Diagram](./VolumeAttributesClass-ModifyVolume-Flow-v2.png)
597650

598651
### Implementation & Handling Failure
599652

250 KB
Loading

0 commit comments

Comments
 (0)