Align primary VolRep PVC processing with secondary flow - #2592
Conversation
📝 WalkthroughWalkthroughRefactors primary-side PVC processing: extracts per-PVC logic into ChangesPrimary-side PVC Processing Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if v.pvcUnprotectVolRepIfDeleted(*pvc, log) { | ||
| continue | ||
| } | ||
| v.processPVCAsPrimary(pvc, pvcNamespacedName, log, groupPVCs) |
There was a problem hiding this comment.
Using in-out paramters is not recommended, instead functions should return appropriate values.
There was a problem hiding this comment.
I agree that returning values would be cleaner than using in-out parameters.
The main purpose of this PR was to synchronize the primary and secondary PVC processing flows, and that goal has been achieved. To avoid increasing the scope of this PR, I suggest we handle this improvement in a follow-up PR.
3310ab0 to
a352612
Compare
| pvcNamespacedName := types.NamespacedName{Name: pvc.Name, Namespace: pvc.Namespace} | ||
| log := v.log.WithValues("pvc", pvcNamespacedName.String()) | ||
| log := logWithPvcName(v.log, pvc) |
There was a problem hiding this comment.
This looks like a refactor that is out of scope for this PR. Maybe could be in a separate commit.
There was a problem hiding this comment.
Not exactly. My goal was to align the Primary and Secondary flows as closely as possible. In the Secondary flow, we initialize the logger using the logWithPvcName function.
4d67a24 to
88c7064
Compare
Primary reconciliation used processPVCsAsPrimary to handle all PVCs in one function, while secondary already processed each PVC via processPVCAsSecondary. Refactor primary to follow the same pattern: reconcileVolRepsAsPrimary loops per PVC, delegates to processPVCAsPrimary, and uses reconcilePVCVRAsPrimary for VR-specific work (mirroring reconcilePVCVRAsSecondary). Signed-off-by: Elena Gershkovich <elenage@il.ibm.com>
88c7064 to
3bbe3a9
Compare
Primary reconciliation used processPVCsAsPrimary to handle all PVCs in one function, while secondary already processed each PVC via processPVCAsSecondary. Refactor primary to follow the same pattern: reconcileVolRepsAsPrimary loops per PVC, delegates to processPVCAsPrimary, and uses reconcilePVCVRAsPrimary for VR-specific work (mirroring reconcilePVCVRAsSecondary).
Summary by CodeRabbit