@@ -106,8 +106,9 @@ func (r *RecoverStaleVolumeReconciler) Reconcile(ctx context.Context, req ctrl.R
106
106
reqLogger .Info ("Data Requested" , "namespace" , namespace , "deployments" , deployments )
107
107
108
108
k8sOps := & crutils.K8sResourceOps {
109
- Client : r .Client ,
110
- Ctx : ctx ,
109
+ Client : r .Client ,
110
+ Ctx : ctx ,
111
+ Namespace : namespace ,
111
112
}
112
113
113
114
// If applications are not set, then fetch all deployments from given ns
@@ -288,32 +289,23 @@ func fetchCSIPVCAndPVNames(k8sOps *crutils.K8sResourceOps, log logr.Logger) (map
288
289
289
290
reqData := map [string ]string {}
290
291
291
- for _ , pvcData := range pvcList .Items {
292
- pvcName := pvcData .Name
293
- pvc , err := k8sOps .GetPVC (pvcName )
294
- if err != nil {
295
- if k8serr .IsNotFound (err ) {
296
- log .Info ("PVC not found." )
297
- continue
298
- }
299
- log .Error (err , "failed to get pvc" )
300
- return nil , err
301
- }
292
+ for _ , pvc := range pvcList .Items {
293
+ log .Info ("PVC Found" , "pvc-name" , pvc .Name , "namespace" , pvc .Namespace )
302
294
303
295
storageClassName := pvc .Spec .StorageClassName
304
296
if storageClassName == nil {
305
- log .Info ("PVC does not have any storageClass" , "pvc-name" , pvcName )
297
+ log .Info ("PVC does not have any storageClass" , "pvc-name" , pvc . Name )
306
298
continue
307
299
}
308
300
309
301
scName := * storageClassName
310
302
if scName == "" {
311
- log .Info ("PVC does not have any storageClass" , "pvc-name" , pvcName )
303
+ log .Info ("PVC does not have any storageClass" , "pvc-name" , pvc . Name )
312
304
continue
313
305
}
314
306
315
307
if strings .HasPrefix (scName , constants .StorageClassPrefix ) && strings .HasSuffix (scName , constants .StorageClassSuffix ) {
316
- reqData [pvcName ] = pvc .Spec .VolumeName
308
+ reqData [pvc . Name ] = pvc .Spec .VolumeName
317
309
}
318
310
}
319
311
0 commit comments