Add adapter to create Lightspeed Proposal after must-gather completion#365
Add adapter to create Lightspeed Proposal after must-gather completion#365sakshiep1 wants to merge 2 commits into
Conversation
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds an optional ChangesAgentic Debugging Integration
Sequence Diagram(s)sequenceDiagram
participant Job as Kubernetes Job
participant Controller as MustGatherReconciler
participant ProposalLogic as proposal.go
participant Discovery as DiscoveryClient
participant K8s as Kubernetes API
Job-->>Controller: Job status = Completed
Controller->>ProposalLogic: createIntelliAideProposal(ctx, mustGather)
ProposalLogic->>ProposalLogic: agenticDebuggingEnabled && spec.storage set?
ProposalLogic->>K8s: Get Proposal by name/namespace
alt Already exists
K8s-->>ProposalLogic: Proposal found
ProposalLogic-->>Controller: nil
else Not found
ProposalLogic->>Discovery: ServerResourcesForGroupVersion(agentic.openshift.io)
Discovery-->>ProposalLogic: resources or error
ProposalLogic->>K8s: Create unstructured Proposal CR (PVC, image, namespaces)
K8s-->>ProposalLogic: OK or CRD missing
ProposalLogic-->>Controller: nil
end
Controller->>Controller: continue completion/cleanup flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sakshiep1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@controllers/mustgather/proposal.go`:
- Around line 99-101: The Proposal is always created in the openshift-lightspeed
namespace, but the pvcName is retrieved from the MustGather spec which may be in
a different namespace. Since PVCs are namespace-scoped, this causes invalid
Proposal data when the MustGather instance is outside openshift-lightspeed. Add
a guard condition before creating the Proposal (before the pvcName and
proposalName variable assignments) that checks if the instance namespace equals
openshift-lightspeed, and skip or reject Proposal creation if the namespaces do
not match.
In `@deploy/crds/operator.openshift.io_mustgathers.yaml`:
- Around line 103-110: The agenticDebuggingEnabled field currently accepts true
values even when spec.storage is not configured, resulting in non-functional
accepted configurations. Add a validation rule to the agenticDebuggingEnabled
field definition in the mustgathers CRD schema that enforces the prerequisite:
reject configurations where agenticDebuggingEnabled is set to true unless
spec.storage is also specified. This can be accomplished by adding a CEL
validation rule that checks if agenticDebuggingEnabled is true, then requires
spec.storage to be non-empty, preventing invalid configurations from being
accepted by the API server.
🪄 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: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ef390d95-a11a-4f2f-a4a6-a44867458290
⛔ Files ignored due to path filters (1)
api/v1alpha1/zz_generated.deepcopy.gois excluded by!**/zz_generated*
📒 Files selected for processing (5)
api/v1alpha1/mustgather_types.gocontrollers/mustgather/mustgather_controller.gocontrollers/mustgather/proposal.godeploy/02_must-gather-operator.ClusterRole.yamldeploy/crds/operator.openshift.io_mustgathers.yaml
…osal spec. Use an IntelliAide-specific request prompt, add targetNamespaces, and increase analysis timeout so the agent follows the skills pipeline.
Summary
Adds an adapter in the must-gather operator that automatically creates a Lightspeed
ProposalCR for agentic root-cause analysis when aMustGatherjob completessuccessfully with
spec.agenticDebuggingEnabled: true.This enables the end-to-end flow:
MustGather (with storage)→ must-gather collection → Job success →Proposalcreated→ Lightspeed agentic operator runs IntelliAide analysis on the must-gather PVC.
Changes
spec.agenticDebuggingEnabledfield to theMustGatherCRDcontrollers/mustgather/proposal.gowith adapter logic:spec.storageset, Lightspeed installed (Proposal CRD discovery), idempotencyProposalinopenshift-lightspeedusing unstructured objects (no hard dependency on lightspeed-agentic-operator Go types)paths: [/skills/intelliaide], PVC dataSource, and IntelliAide-specific request texthandleJobCompletion()on successful Job completion (best-effort; failures do not block MustGather completion)proposals.agentic.openshift.io(get,create)Design notes
MustGatherCR should be created inopenshift-lightspeedso the analysis pod can mount the same PVC (PVCs are namespace-scoped).Test plan
MustGatherCR inopenshift-lightspeedwithagenticDebuggingEnabled: trueandstorageconfiguredProposal(intelliaide-<mustgather-name>) inopenshift-lightspeed/data/inputmake go-test,make lintSummary by CodeRabbit