fix(plugins): Validate selector during k8s reconciliation#3137
fix(plugins): Validate selector during k8s reconciliation#3137adityathebe wants to merge 1 commit into
Conversation
WalkthroughThis PR adds selector validation to the plugin reconciliation process. A new helper function ChangesPlugin Selector Validation
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugin/registry/reconciler.go`:
- Around line 48-50: validatePluginSelector currently returns raw fmt.Errorf for
invalid spec.selector and is called from PersistPluginFromCRD without a context;
update validatePluginSelector to accept the existing ctx parameter used in
PersistPluginFromCRD (thread ctx into the call in
PersistPluginFromCRD/PersistPluginFromCRD callers) and replace any
fmt.Errorf(...) error returns with ctx.Oops().Code(dutyAPI.EINVALID).Wrapf(...)
to produce a typed validation error; also add the import for
github.com/flanksource/duty/api as dutyAPI so the constant dutyAPI.EINVALID is
available and ensure all call sites of validatePluginSelector pass the ctx.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a09d0b81-7837-4dd2-beb2-cc8ea961f9df
📒 Files selected for processing (1)
plugin/registry/reconciler.go
Summary by CodeRabbit