Added witheout for operator related resources#134
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds six OLM (operators.coreos.com) GroupKind constants and includes them in the whiteout list; expands tests to cover these resources and fixes minor test literal issues. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@transform/kubernetes/kubernetes_test.go`:
- Around line 211-212: Replace the misspelled owner reference key "ame" with the
correct "name" in the test data for the ownerReferences entries used by the
GetOwnerReferences() checks; update each occurrence (the ownerReferences
literals shown in kubernetes_test.go where "ame": "PodOwner") to "name":
"PodOwner" so the test fixtures accurately reflect real Kubernetes
ownerReference fields while leaving the GetOwnerReferences() logic unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 273ca3c0-0a0b-469d-840c-f69f5baf75f5
📒 Files selected for processing (2)
transform/kubernetes/kubernetes.gotransform/kubernetes/kubernetes_test.go
|
Transform: same export, old vs new crane Old binary — only these OLM-related whiteouts (from ownerReferences, not from explicit OLM kinds in gksToWhiteout): level=info msg="resource file: InstallPlan_operators.coreos.com_v1alpha1_olm-whiteout-test_install-jx94r.yaml creating whiteout file: /tmp/olm-w-tf-old2/resources/olm-whiteout-test/.wh.InstallPlan_operators.coreos.com_v1alpha1_olm-whiteout-test_install-jx94r.yaml" New binary (crane-lib with OLM entries in gksToWhiteout), after go build -a: level=info msg="resource file: ClusterServiceVersion_operators.coreos.com_v1alpha1_olm-whiteout-test_prometheusoperator.0.56.3.yaml creating whiteout file: /tmp/olm-w-tf-new2/resources/olm-whiteout-test/.wh.ClusterServiceVersion_operators.coreos.com_v1alpha1_olm-whiteout-test_prometheusoperator.0.56.3.yaml" New export brings in more OLM YAML; new transform + crane-lib adds explicit whiteouts for Subscription, OperatorGroup, and ClusterServiceVersion (InstallPlan / OperatorCondition were already whited out on the old path when they had owner references). |
|
Fix for migtools/crane#201 |
aufi
left a comment
There was a problem hiding this comment.
LGTM
Operator-related use-cases might come later, so we'll focus on handling those when needed.
Summary
Default Kubernetes transform whiteouts now include OLM (Operator Lifecycle Manager) resources under
operators.coreos.com. After Crane export started usingServerPreferredResources(), these types are discovered and exported reliably; they are still not safe to apply on a generic target cluster (catalogs, install state, and generated objects differ). Whiteouting them during transform keeps exports as a full snapshot while apply skips them unless the user opts in via plugin flags.What is whiteouted
operators.coreos.comoperators.coreos.comoperators.coreos.comoperators.coreos.comoperators.coreos.comoperators.coreos.comImplementation
transform/kubernetes/kubernetes.go: addGroupKindconstants and append them togksToWhiteout.transform/kubernetes/kubernetes_test.go: table tests assertingIsWhiteOut: truefor each kind (representativeapiVersionper resource).Behavior notes
.wh.*files for these resources so apply does not push them.include-only/extra-whiteouts).Testing
go test ./transform/kubernetes/...Summary by CodeRabbit
New Features
Tests