This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
🌱 Update AgentCardSyncReconciler - #175
Merged
Merged
Conversation
Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the AgentCardSync controller to create/migrate AgentCards using spec.targetRef and to reconcile agent workloads (Deployments/StatefulSets) in addition to the legacy Agent CRD, gated by a new --enable-legacy-agent-crd flag.
Changes:
- Added separate reconcile paths/controllers for Deployments, StatefulSets, and (optionally) legacy Agent CRDs.
- Switched AgentCard creation to
spec.targetRefand added selector→targetRef migration behavior. - Wired a new
--enable-legacy-agent-crdflag throughcmd/main.goand expanded controller test coverage for the new reconcile paths.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| kagenti-operator/internal/controller/agentcardsync_controller.go | Adds workload reconcilers, targetRef-based AgentCard ensure/create, and optional legacy Agent CRD watching. |
| kagenti-operator/internal/controller/agentcardsync_controller_test.go | Adds tests for Deployment/StatefulSet reconciliation and selector→targetRef migration. |
| kagenti-operator/internal/controller/agentcard_controller.go | Adds optional legacy Agent watches and deprecation warnings for selector/legacy labels. |
| kagenti-operator/internal/controller/agentcard_controller_test.go | Formatting-only adjustments in selector matching tests and label protocol test. |
| kagenti-operator/cmd/main.go | Introduces --enable-legacy-agent-crd and passes it to both AgentCard and AgentCardSync controllers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… generated AgentCard name 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]>
…V(1) level Signed-off-by: Paolo Dettori <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
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.
Summary
Update AgentCardSyncReconciler
Changes to agentcardsync_controller.go:
- ReconcileDeployment() - handles Deployment events
- ReconcileStatefulSet() - handles StatefulSet events
- ReconcileAgent() - handles legacy Agent CRD events (renamed from Reconcile)
- shouldSyncWorkload() - checks if a workload has required labels
- ensureAgentCard() - creates or updates AgentCard with targetRef
- createAgentCardForWorkload() - creates new AgentCard with targetRef
- hasOwnerReferenceForObject() - generic owner reference check
- Create separate controllers for Deployments, StatefulSets, and Agent CRDs
- Use adapter types to route reconcile requests to the appropriate method
- Filter resources using agentLabelPredicate() (kagenti.io/type=agent)
Changes to cmd/main.go:
Changes to agentcardsync_controller_test.go:
Added comprehensive tests for:
Key Features:
- Existing AgentCards with selector are automatically migrated to targetRef
- Legacy Agent CRD support can be disabled via --enable-legacy-agent-crd=false
Related issue(s)
Fixes #166
🤖 Assisted by Claude Code