Admission Controller PVC Finalizer Plugin

This admission plugin puts finalizer to every created PVC. The finalizer is
removed by PVCProtectionController when the PVC is not referenced by any
pods and thus the PVC can be deleted.
This commit is contained in:
pospispa
2017-11-09 13:56:41 +01:00
parent 4d6d9817b0
commit a06901a868
11 changed files with 281 additions and 5 deletions

View File

@@ -20,6 +20,11 @@ import (
"k8s.io/api/core/v1"
)
const (
// Name of finalizer on PVCs that have a running pod.
PVCProtectionFinalizer = "kubernetes.io/pvc-protection"
)
// IsPVCBeingDeleted returns:
// true: in case PVC is being deleted, i.e. ObjectMeta.DeletionTimestamp is set
// false: in case PVC is not being deleted, i.e. ObjectMeta.DeletionTimestamp is nil