-
Notifications
You must be signed in to change notification settings - Fork 132
v2: add legacy and modern tracker interfaces for providerconfig usages #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
v2: add legacy and modern tracker interfaces for providerconfig usages #862
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds two new tracker interfaces, Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Thank you for the clear PR — would you like me to scan for call sites that could adopt these adapters or generate small usage examples? Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/!(*_test).go📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)
Files:
**/*.go⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (1)pkg/resource/providerconfig.go (2)
🔍 Remote MCPI'm encountering authentication issues with the Context7 tools that prevent me from retrieving documentation about the crossplane-runtime library. However, let me search for publicly available information about this PR and the patterns being implemented:Let me search for more specific information about the existing Tracker pattern and the relationship between LegacyManaged and ModernManaged types:## Summary of Relevant Context for PR #862 Review Based on my research, here is the additional context relevant to reviewing this PR: Existing Tracker PatternThe crossplane-runtime already defines a Legacy vs. Modern Managed Resources ContextCrossplane v2 supports two styles of managed resources: Modern v2 style (recommended) using ProviderConfigUsage Tracking RelationshipCrossplane providers generate a ProviderConfigUsage for each managed resource (MR) they handle, which enables representing the relationship between MR and a ProviderConfig so that the controller can use it as a finalizer when you delete a ProviderConfig. The new tracker interfaces would support tracking different managed resource types through this usage mechanism. Scope: This addition provides type-safe abstractions for tracking both legacy cluster-scoped and modern namespaced managed resources, following the established functional options pattern in crossplane-runtime for providerconfig usages.[::web_search::] 🔇 Additional comments (3)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
pkg/resource/providerconfig.go (2)
135-136: Refine the documentation for specificity.The comment says "tracks managed resources" but should say "tracks legacy managed resources" for consistency with the Track method comment on line 138 and to clearly distinguish this from the generic
TrackerFn.Apply this diff:
-// A LegacyTrackerFn is a function that tracks managed resources. +// A LegacyTrackerFn is a function that tracks legacy managed resources. type LegacyTrackerFn func(ctx context.Context, mg LegacyManaged) error
149-152: Refine the documentation for specificity.The comments should be more specific:
- Line 149 says "tracks managed resources" but should say "tracks modern managed resources"
- Line 152 says "Track the supplied managed resource" but should say "Track the supplied modern managed resource"
This improves consistency with the LegacyTrackerFn documentation and clearly distinguishes this from the generic
TrackerFn.Apply this diff:
-// A ModernTrackerFn is a function that tracks managed resources. +// A ModernTrackerFn is a function that tracks modern managed resources. type ModernTrackerFn func(ctx context.Context, mg ModernManaged) error -// Track the supplied managed resource. +// Track the supplied modern managed resource. func (fn ModernTrackerFn) Track(ctx context.Context, mg ModernManaged) error {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pkg/resource/providerconfig.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/!(*_test).go
📄 CodeRabbit inference engine (coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt)
**/!(*_test).go: Do not remove exported Go APIs (functions, types, methods, or fields) without the 'breaking-change' label
Do not rename exported Go APIs without the 'breaking-change' label
Do not change function/method signatures of exported Go APIs without the 'breaking-change' label
Avoid behavior changes to exported Go APIs that could break existing users unless labeled 'breaking-change'
Files:
pkg/resource/providerconfig.go
🧬 Code graph analysis (1)
pkg/resource/providerconfig.go (2)
pkg/resource/interfaces.go (2)
LegacyManaged(219-224)ModernManaged(209-213)pkg/resource/fake/mocks.go (2)
LegacyManaged(398-405)ModernManaged(370-376)
Signed-off-by: Erhan Cagirici <[email protected]>
bf01e9c to
cc51946
Compare
Description of your changes
Adds
LegacyTrackerandModernTrackerinterfaces for capturing new provider config usage pattern.These would help also in testing.
I have:
earthly +reviewableto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.