Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

🌱 Update AgentCard CRD - #170

Merged
pdettori merged 3 commits into
rossoctl:mainfrom
pdettori:issue-164
Feb 2, 2026
Merged

pdettori merged 3 commits into
rossoctl:mainfrom
pdettori:issue-164

Conversation

@pdettori

@pdettori pdettori commented Feb 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Update AgentCard CRD to support standard k8s workload types for agents.

Warning

This is a stacked PR and it is based and depends on #169, which must be reviewed and merged before this PR is reviewed and merged.

Changes Made

  1. Updated api/v1alpha1/agentcard_types.go:
  • Added TargetRef struct with apiVersion, kind, and name fields
  • Added TargetRef field to AgentCardSpec (preferred way to reference workloads)
  • Changed Selector in AgentCardSpec from value to pointer type (now optional)
  • Added deprecation comments to AgentSelector
  • Added TargetRef field to AgentCardStatus (resolved reference)
  • Added new print columns for Kind and Target
  1. Created internal/webhook/v1alpha1/agentcard_webhook.go:
  • Validation webhook that ensures either targetRef or selector is specified
  • Validates targetRef fields are non-empty when specified
  • Emits deprecation warning when only selector is used
  1. Updated cmd/main.go:
  • Registered the AgentCard webhook with the manager
  1. Updated internal/controller/agentcard_controller.go:
  • Added nil checks for Selector (now a pointer)
  1. Updated internal/controller/agentcardsync_controller.go:
  • Changed Selector initialization to use pointer
  1. Updated internal/controller/agentcard_controller_test.go:
  • Changed Selector initialization to use pointer
  1. Regenerated manifests:
  • config/crd/bases/agent.kagenti.dev_agentcards.yaml - Updated CRD with new fields
  • config/webhook/manifests.yaml - Added AgentCard validating webhook
  • api/v1alpha1/zz_generated.deepcopy.go - Regenerated deepcopy functions

Example AgentCard with targetRef

  apiVersion: agent.kagenti.dev/v1alpha1
  kind: AgentCard
  metadata:
    name: my-agent-card
    namespace: default
  spec:
    syncPeriod: "30s"
    targetRef:
      apiVersion: apps/v1
      kind: Deployment
      name: my-agent

New kubectl Output Columns

  NAME            PROTOCOL   KIND         TARGET     AGENT       SYNCED   LASTSYNC   AGE
  my-agent-card   a2a        Deployment   my-agent   My Agent    True     2m         5m

Related issue(s)

Fixes #164

🤖 Assisted by Claude Code

Signed-off-by: Paolo Dettori <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a targetRef field to the AgentCard CRD to enable referencing standard Kubernetes workloads (Deployments, StatefulSets, etc.) using duck typing, while deprecating the label-based selector field for backward compatibility.

Changes:

  • Added TargetRef struct and field to AgentCard spec and status for explicit workload references
  • Created validation webhook to ensure either targetRef or selector is specified
  • Updated Selector field from value to pointer type to make it optional
  • Added new print columns to display workload kind and target name in kubectl output

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
api/v1alpha1/agentcard_types.go Added TargetRef struct and fields; made Selector optional with deprecation
internal/webhook/v1alpha1/agentcard_webhook.go New validation webhook enforcing targetRef/selector requirements
internal/controller/agentcard_controller.go Added nil checks for optional Selector field
internal/controller/agentcardsync_controller.go Updated Selector initialization to use pointer syntax
internal/controller/agentcard_controller_test.go Updated test to use pointer for Selector
cmd/main.go Registered AgentCard webhook with manager
config/crd/bases/agent.kagenti.dev_agentcards.yaml Updated CRD with new targetRef fields and print columns
config/webhook/manifests.yaml Added AgentCard validating webhook configuration
config/rbac/role.yaml Removed 'update' verb for events resource
api/v1alpha1/zz_generated.deepcopy.go Regenerated deepcopy functions for new pointer types
docs/plans/migrate-agentcard-controller-to-workloads.md Comprehensive migration plan for multi-phase workload support implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kagenti-operator/config/rbac/role.yaml Resolved
pdettori and others added 2 commits February 1, 2026 16:29
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori changed the base branch from main to issue-163 February 1, 2026 22:15
@cwiklik
cwiklik self-requested a review February 2, 2026 14:59

@cwiklik cwiklik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@pdettori
pdettori changed the base branch from issue-163 to main February 2, 2026 18:47
@pdettori
pdettori merged commit bcd246e into rossoctl:main Feb 2, 2026
2 checks passed
@pdettori
pdettori deleted the issue-164 branch February 2, 2026 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Update AgentCard CRD

3 participants