This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
🌱 Update AgentCardReconciler as part of AgentCard refactoring - #171
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates the AgentCardReconciler to support duck typing for standard Kubernetes workloads (Deployments and StatefulSets) while maintaining backward compatibility with the selector-based lookup and legacy Agent CRD.
Changes:
- Added duck typing support via targetRef to reference any workload type (Deployment, StatefulSet, or Agent CRD)
- Implemented readiness detection for different workload types using both structured and unstructured approaches
- Added support for new protocol label (kagenti.io/protocol) with fallback to legacy label (kagenti.io/agent-protocol)
- Added watches for Deployments and StatefulSets with agent label predicates
- Updated RBAC permissions to include get/list/watch for Deployments and StatefulSets
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| kagenti-operator/internal/controller/agentcard_controller.go | Core implementation of targetRef-based workload lookup, readiness detection for multiple workload types, dual protocol label support, and watches for Deployments/StatefulSets |
| kagenti-operator/config/rbac/role.yaml | Added RBAC permissions for StatefulSets (get/list/watch) and updated events permissions to match kubebuilder markers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]> Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]> Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]> Co-authored-by: Copilot <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
…chestration Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Contributor
|
I'll wait for this to land before we try to land #160 There are issues with CI I've been investigating. It runs fine locally for me, I'll investigate further after a few more retries and merge this PR once it completes. |
usize
pushed a commit
to kevincogan/kagenti-operator
that referenced
this pull request
Feb 3, 2026
🌱 Update AgentCardReconciler as part of AgentCard refactoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
This is a stacked PR and it is based and depends on #170, which must be reviewed and merged before this PR is reviewed and merged.
Summary
Update AgentCardReconciler as part of AgentCard refactoring.
- getWorkloadByTargetRef() - fetches any workload by apiVersion/kind/name using unstructured.Unstructured
- getWorkload() - orchestrates workload lookup (targetRef first, then selector fallback)
- findMatchingWorkloadBySelector() - backward compatible selector-based lookup
- isWorkloadReady() - checks readiness based on workload kind
- Supports Deployments (replicas), StatefulSets (replicas), and Agent CRD (phase)
- getWorkloadProtocol() - supports both old (kagenti.io/agent-protocol) and new (kagenti.io/protocol) labels
- Added watches for Deployments and StatefulSets with agentLabelPredicate
- Added mapWorkloadToAgentCard() handler for triggering reconciliation
- Added get/list/watch for apps/v1 Deployments and StatefulSets
- Populates status.targetRef with resolved workload reference
The implementation maintains full backward compatibility with the existing selector field while enabling the new targetRef duck typing approach.
Related issue(s)
Fixes #165
🤖 Assisted by Claude Code