🐛 fix annotations on pvc migration - #754
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesPVC annotation preservation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
Tested on OCP successfully. All existing tests pass. |
|
[review-docs] |
📚 Documentation ReviewAnalyzed PR: #754 Found 1 file(s) that may need updates: 📋 Select files to updateUncheck any files you do not want updated:
💡 Next Steps:
Powered by code-to-docs AI ✨ |
|
[update-docs] |
📚 Documentation UpdateUpdated 1 file(s) based on your review selections:
📄 Changes
|
Summary
Copy user-defined annotations from source PVC to destination PVC during
transfer-pvc, stripping server-managed annotations that are cluster-specific.Problem
buildDestinationPVC()copies labels and spec from the source PVC but skips annotations entirely. User-defined annotations (e.g.backup.company.com/schedule: daily) are silently lost on the destination PVC.Fix
Added
stripServerManagedPVCAnnotations()which copies all annotations except those with known server-managed prefixes:pv.kubernetes.io/volume.kubernetes.io/volume.beta.kubernetes.io/kubectl.kubernetes.io/These prefixes cover all K8s distributions (EKS, GKE, AKS, OCP). CSI-specific annotations use these same prefixes on PVCs — the CSI driver name appears in the annotation value (e.g.
volume.kubernetes.io/storage-provisioner: ebs.csi.aws.com), not as a separate key prefix.User annotations use company/org domain prefixes (
backup.company.com/,app.kubernetes.io/) which are never stripped.Tests
5 test cases for
TestStripServerManagedPVCAnnotations:Fixes #672
Summary by CodeRabbit
Bug Fixes
Tests