You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-storage/3751-volume-attributes-class/README.md
+17-25
Original file line number
Diff line number
Diff line change
@@ -437,46 +437,38 @@ Operation metrics from [csiOperationsLatencyMetric](https://github.com/kubernete
437
437
438
438
#### VolumeAttributesClass Deletion Protection
439
439
440
-
While a VolumeAttributesClass is referenced by any PVC, we will prevent the object from being deleted by adding a finalizer([reference](https://github.com/kubernetes/kubernetes/blob/master/plugin/pkg/admission/storage/storageobjectinuseprotection/admission.go)).
440
+
While a VolumeAttributesClass is referenced by any PVC, we will prevent the object from being deleted by adding a finalizer`kubernetes.io/vac-protection`. It's a best effort to prevent users from making mistakes. It may not be accurate in all cases.
441
441
442
-
The **vac_finalizer_controller** sets/removes the finalizer on all VolumeAttributesClasses. This prevents users from deleting a VolumeAttributesClass that's used by a PVC. The vac_finalizer_controller will maintain a cache of a map of VolumeAttributesClass to the list of PVCs that are using the VolumeAttributesClass.
442
+
The **vac_finalizer_controller** sets/removes the finalizer on all VolumeAttributesClasses. It has PVC/PV informers with a custom indexer which is used to list all PVCs/PVs for a given VolumeAttributesClass name.
443
443
444
-
There are a few conditions that will trigger add/remove pvc finalizers in the VolumeAttributesClass:
444
+
There are a few conditions that will trigger add/remove the finalizer in the VolumeAttributesClass:
445
445
446
446
1. PVC created with a VolumeAttributesClass
447
447
The **vac_finalizer_controller**:
448
-
* If the VolumeAttributesClassName is nil or empty, the VolumeAttributesClass will not be added to the vac_finalizer_controller cache
449
-
* Check if the VolumeAttributesClass exists. If not, the VolumeAttributesClass will not be added to the vac_finalizer_controller cache
448
+
* If the VolumeAttributesClassName is nil or empty, do nothing.
449
+
* Check if the VolumeAttributesClass exists. If not, do nothing.
450
450
* Check if this VolumeAttributesClass already has a protection finalizer
451
451
* Add the finalizer to the VolumeAttributesClass if there is none
452
-
2. PVC created with a VolumeAttributesClass being deleted
453
-
The **vac_finalizer_controller**:
454
-
* Check VolumeAttributesClass is being deleted and PVC creation failed
455
-
3. PVC updated to a different VolumeAttributesClass
456
-
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the vac_finalizer_controller cache
452
+
2. PVC updated to a different VolumeAttributesClass
453
+
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs from informers via a custom indexer and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the vac_finalizer_controller cache
457
454
* Check if the new VolumeAttributesClass already has a protection finalizer
458
-
* Add the finalizer to the new VolumeAttributesClass if there is none
459
-
4. PVC updated to a different VolumeAttributesClass that is being deleted
460
-
The **vac_finalizer_controller**:
461
-
* Check VolumeAttributesClass is being deleted and PVC update failed
462
-
5. PVC has a VolumeAttributesClass and this PVC is deleted
463
-
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the informer(a cache of VolumeAttributesClass) **only**
464
-
6. Delete a VolumeAttributesClass while there is **kubernetes.io/vac-protection** finalizer associated with this VolumeAttributesClass
465
-
* Deletion will not return an error but it will add a deletionTimestamp and wait for the finalizer being removed, then remove the VolumeAttributesClass
466
-
7. Delete a VolumeAttributesClass without any finalizers
467
-
* Deletion succeed
455
+
* Add the finalizer to the new VolumeAttributesClass if there is nones
456
+
3. PVC has a VolumeAttributesClass and this PVC is deleted
457
+
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs from informers via a custom indexer and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the informer(a cache of VolumeAttributesClass) **only**
458
+
4. Delete a VolumeAttributesClass while there is **kubernetes.io/vac-protection** finalizer associated with this VolumeAttributesClass
459
+
* Remove the finalizer only if there is no PVC/PV using this VolumeAttributesClass anymore. The check logic is the same as above.
468
460
469
-
For unbound PVs referencing a VAC:
461
+
For PVs referencing a VAC:
470
462
471
463
1. Unbound PV created with a VolumeAttributesClass
472
464
The **vac_finalizer_controller**:
473
-
* If the VolumeAttributesClassName is nil or empty, the VolumeAttributesClass will not be added to the vac_finalizer_controller cache
465
+
* If the VolumeAttributesClassName is nil or empty, do nothing
474
466
* Check if this VolumeAttributesClass already has a protection finalizer
475
467
* Add the finalizer to the VolumeAttributesClass if there is none
476
468
2. PV has a VolumeAttributesClass and this PV is deleted
477
-
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the informer(a cache of VolumeAttributesClass) **only**
469
+
* The **vac_finalizer_controller** will remove finalizer in the VolumeAttributesClass only if after listing all the PVCs/PVs from informers via a custom indexer and confirm that this PVC/PV is the last one that is consuming the VolumeAttributesClass in the informer(a cache of VolumeAttributesClass) **only**
478
470
479
-
Only the **vac_finalizer_controller** will remove finalizers on VolumeAttributesClass. If the **vac_finalizer_controller** fails at the step of removing finalizer even there is no PVC/PV using the VolumeAttributesClass anymore, the **vac_finalizer_controller** should retry the deletion as a separate go routine.
471
+
Only the **vac_finalizer_controller** will remove finalizers on VolumeAttributesClass. If the **vac_finalizer_controller** fails at the step of removing finalizer even there is no PVC/PV using the VolumeAttributesClass anymore, the **vac_finalizer_controller** should retry it in next reconcile loop.
480
472
481
473
The vac_finalizer_controller will use only informers and therefore it may remove the finalizer too early. One scenario is:
482
474
@@ -888,7 +880,7 @@ For each of them, fill in the following information by copying the below templat
888
880
levels that could help debug the issue?
889
881
Not required until feature graduated to beta.
890
882
- Testing: Are there any tests for failure mode? If not, describe why.
891
-
-->
883
+
-->
892
884
893
885
###### What steps should be taken if SLOs are not being met to determine the problem?
0 commit comments