This repository was archived by the owner on Nov 12, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 12, 2026. It is now read-only.
epic: Refactor AgentCard controller to work with Deployments and StatefulSets #161
Copy link
Copy link
Closed
Labels
Description
As part of the epic rossoctl/rossoctl#523 we need to refactor AgentCard controller to work with Deployments and StatefulSets.
This is also tracked in rossoctl/rossoctl#555
Description
Overview
Migrate the AgentCard controller from watching the custom Agent CRD to watching standard Kubernetes workloads (Deployments and StatefulSets). This aligns with the Kagenti UI migration
where agents are now deployed directly as Deployments/StatefulSets rather than through the Agent CRD.
Motivation
- Remove dependency on Agent CRD for agent card indexing
- Support agents deployed as standard Kubernetes workloads
- Enable extensibility to any workload type (Job, CronJob, etc.) without code changes
- Follow Kubernetes conventions (Gateway API pattern)
Approach: targetRef with Duck Typing
Instead of using label selectors, the AgentCard will use an explicit targetRef field:
apiVersion: agent.kagenti.dev/v1alpha1
kind: AgentCard
metadata:
name: my-agent-card
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment # or StatefulSet, Job, etc.
name: my-agent
Benefits:
- Explicit reference to exactly one workload (no ambiguity)
- Extensible to any workload type without code changes
- Uses unstructured.Unstructured for duck typing
- Follows Gateway API's PolicyTargetReference pattern
Design Document
See kagenti/docs/plans/migrate-agent-crd-to-workloads.md for the full migration plan.
Phases
- Design plan to refactor AgentCard controller to work with Deployments and StatefulSets #163
- Update AgentCard CRD #164
- Add targetRef field with apiVersion, kind, and name
- Deprecate label-based selector field (keep for backward compatibility)
- Update validation to require either targetRef or selector
- Add print columns for workload type and name
- Update CRD documentation
- Update AgentCardReconciler #165
- Add getWorkloadByTargetRef() method using unstructured.Unstructured
- Implement readiness detection for Deployments and StatefulSets
- Update protocol label lookup to support both kagenti.io/protocol and legacy kagenti.io/agent-protocol
- Fall back to selector if targetRef is not specified
- Add watches for Deployments and StatefulSets
- Update RBAC permissions
- Update AgentCardSyncReconciler #166
- Add watches for Deployments and StatefulSets with kagenti.io/type=agent label
- Create AgentCards with targetRef instead of selector
- Update owner reference handling for garbage collection
- Migrate existing selector-based AgentCards to use targetRef
- Handle both Agent CRD and workload sources
- Backward Compatibility & Testing #167
- Add --enable-legacy-agent-crd feature flag (default: true)
- Add unit tests for duck typing and readiness detection
- Add integration tests for Deployment/StatefulSet flows
- Add E2E tests for full agent card sync workflow
- Document migration path for users
- Add deprecation warnings for selector field
- Deprecate Agent CRD Support #168
- Remove Agent CRD watches (when flag is disabled)
- Clean up legacy selector-based code
- Update documentation to reflect new approach
- Release notes for migration
Acceptance Criteria
- AgentCards can reference Deployments via targetRef
- AgentCards can reference StatefulSets via targetRef
- AgentCards are automatically created for labeled Deployments/StatefulSets
- Existing AgentCards with selector continue to work
- Legacy Agent CRD support works when flag is enabled
- Owner references ensure AgentCard cleanup on workload deletion
- Agent card data is correctly fetched from workload services
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]feature: Refactor AgentCard controller to work with Deployments and StatefulSets[/-][+]epic: Refactor AgentCard controller to work with Deployments and StatefulSets[/+]rubambiza commentedon Feb 9, 2026
Will be removed once all other components have been migrated.
mrsabath commentedon Feb 16, 2026
wait until we are convinced to be in the stable state
pdettori commentedon Feb 23, 2026
this is complete