@@ -222,13 +222,20 @@ func (rc *volumeHealthReconciler) tkgUpdatePV(oldObj, newObj interface{}) {
222
222
if newPv .Spec .CSI != nil && newPv .Spec .CSI .Driver == csitypes .Name &&
223
223
oldPv .Status .Phase != v1 .VolumeBound && newPv .Status .Phase == v1 .VolumeBound {
224
224
// Add to volumeHandleToPVs.
225
+ log .Infof ("tkgUpdatePV: Add PV %s from TKGPVList to update" , newPv .Name )
225
226
rc .volumeHandleToPVs .add (newPv .Spec .CSI .VolumeHandle , newPv .Name )
226
227
227
228
// Add SVC PVC to work queue to add volume health annotation to statically
228
229
// provisioned volumes.
229
230
objKey := rc .supervisorNamespace + "/" + newPv .Spec .CSI .VolumeHandle
230
231
log .Infof ("tkgUpdatePV: add %s to claim queue" , objKey )
231
232
rc .svcClaimQueue .Add (objKey )
233
+ } else if (newPv .Spec .CSI != nil ) && (newPv .Spec .CSI .Driver == csitypes .Name ) &&
234
+ (newPv .Spec .PersistentVolumeReclaimPolicy == v1 .PersistentVolumeReclaimRetain ) &&
235
+ (oldPv .Status .Phase == v1 .VolumeBound ) && (newPv .Status .Phase == v1 .VolumeReleased ) {
236
+ // Remove from volumeHandleToPVs.
237
+ log .Infof ("tkgUpdatePV: Remove PV %s from TKGPVList to update" , newPv .Name )
238
+ rc .volumeHandleToPVs .remove (newPv .Spec .CSI .VolumeHandle , newPv .Name )
232
239
}
233
240
}
234
241
@@ -355,7 +362,7 @@ func (rc *volumeHealthReconciler) syncPVC(key string) error {
355
362
if tkgPVList == nil {
356
363
// If no PV is found, the SV PVC may not be referenced within
357
364
// this TKG. Do not requeue this request.
358
- log .Debugf ("Tanzu Kubernetes Grid PV not found for Supervisor PVC %s/%s. Igonoring ..." , namespace , name )
365
+ log .Debugf ("Tanzu Kubernetes Grid PV not found for Supervisor PVC %s/%s. Ignoring ..." , namespace , name )
359
366
return nil
360
367
}
361
368
0 commit comments