PV controller changes to support PV Deletion protection finalizer

Signed-off-by: Deepak Kinni <dkinni@vmware.com>
This commit is contained in:
Deepak Kinni
2021-10-19 14:26:28 -07:00
parent bafa87c553
commit bfd5f23a0b
6 changed files with 222 additions and 18 deletions

View File

@@ -537,10 +537,9 @@ func (ctrl *PersistentVolumeController) syncBoundClaim(claim *v1.PersistentVolum
// these events.
func (ctrl *PersistentVolumeController) syncVolume(ctx context.Context, volume *v1.PersistentVolume) error {
klog.V(4).Infof("synchronizing PersistentVolume[%s]: %s", volume.Name, getVolumeStatusForLogging(volume))
// Set correct "migrated-to" annotations on PV and update in API server if
// Set correct "migrated-to" annotations and modify finalizers on PV and update in API server if
// necessary
newVolume, err := ctrl.updateVolumeMigrationAnnotations(ctx, volume)
newVolume, err := ctrl.updateVolumeMigrationAnnotationsAndFinalizers(ctx, volume)
if err != nil {
// Nothing was saved; we will fall back into the same
// condition in the next call to this method