const PluginName … // Register registers a plugin func Register(plugins *admission.Plugins) { … } type storageProtectionPlugin … var _ … // newPlugin creates a new admission plugin. func newPlugin() *storageProtectionPlugin { … } var pvResource … var pvcResource … // Admit sets finalizer on all PVCs(PVs). The finalizer is removed by // PVCProtectionController(PVProtectionController) when it's not referenced. // // This prevents users from deleting a PVC that's used by a running pod. // This also prevents admin from deleting a PV that's bound by a PVC func (c *storageProtectionPlugin) Admit(ctx context.Context, a admission.Attributes, o admission.ObjectInterfaces) error { … } func (c *storageProtectionPlugin) admitPV(a admission.Attributes) error { … } func (c *storageProtectionPlugin) admitPVC(a admission.Attributes) error { … }