Skip to content

Commit 2653c26

Browse files
authored
Merge pull request #4713 from carlory/kep-3751
update VolumeAttributesClass Deletion Protection
2 parents c00c35d + 5a22c0f commit 2653c26

File tree

1 file changed

+17
-25
lines changed
  • keps/sig-storage/3751-volume-attributes-class

1 file changed

+17
-25
lines changed

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

+17-25
Original file line numberDiff line numberDiff line change
@@ -437,46 +437,38 @@ Operation metrics from [csiOperationsLatencyMetric](https://github.com/kubernete
437437

438438
#### VolumeAttributesClass Deletion Protection
439439

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.
441441

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.
443443

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:
445445

446446
1. PVC created with a VolumeAttributesClass
447447
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.
450450
* Check if this VolumeAttributesClass already has a protection finalizer
451451
* 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
457454
* 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.
468460

469-
For unbound PVs referencing a VAC:
461+
For PVs referencing a VAC:
470462

471463
1. Unbound PV created with a VolumeAttributesClass
472464
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
474466
* Check if this VolumeAttributesClass already has a protection finalizer
475467
* Add the finalizer to the VolumeAttributesClass if there is none
476468
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**
478470

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.
480472

481473
The vac_finalizer_controller will use only informers and therefore it may remove the finalizer too early. One scenario is:
482474

@@ -888,7 +880,7 @@ For each of them, fill in the following information by copying the below templat
888880
levels that could help debug the issue?
889881
Not required until feature graduated to beta.
890882
- Testing: Are there any tests for failure mode? If not, describe why.
891-
-->
883+
-->
892884

893885
###### What steps should be taken if SLOs are not being met to determine the problem?
894886

0 commit comments

Comments
 (0)