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

✨ AgentCard → Workload Identity Binding via CRD Extension - #160

Merged
usize merged 3 commits into
rossoctl:mainfrom
kevincogan:feature/agentcard-identity-binding
Feb 4, 2026
Merged

usize merged 3 commits into
rossoctl:mainfrom
kevincogan:feature/agentcard-identity-binding

Conversation

@kevincogan

@kevincogan kevincogan commented Jan 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements AgentCard → Workload Identity Binding via CRD Extension (Step 1): policy-based binding between an AgentCard and a workload identity derived from Kubernetes metadata.

RFC: AgentCard → Workload Identity Binding via CRD Extension (Step 1)

Related issue(s)

Fixes #429 - feature: A Registry Binding A2A Agent Cards and Workload Identity

Motivation

Without binding, any workload can claim any AgentCard. This change adds a Kubernetes-native mechanism to declare and enforce which workload identity is allowed to serve a card.

Example

spec:
  identityBinding:
    allowedSpiffeIDs:
      - "spiffe://cluster.local/ns/prod/sa/weather-sa"
    strict: true # Scale to 0 on mismatch

Design

  • Identity model: a workload identity represented as a SPIFFE ID derived from Kubernetes metadata
    spiffe://<trust-domain>/ns/<namespace>/sa/<serviceAccount>

  • Policy location: the allowlist lives on the AgentCard AgentCard.spec.identityBinding.allowedSpiffeIDs

  • Evaluation: the AgentCard controller computes expectedSpiffeID from the Agent resource it targets (Agent namespace + the ServiceAccount on the Agent’s pod template). This does not require pods to be running.

  • Enforcement (strict mode): if strict=true and the binding check fails, the Agent controller disables the Agent by scaling its Deployment to 0. When the binding is fixed (all strict bindings pass), it restores the Deployment back to the previous replica count.

  • Observability: results are written to status fields and emitted as Kubernetes Events; ambiguous selectors (where an AgentCard matches multiple Agents) are detected and reported.

Key Changes

  • API / CRDs

    • AgentCard: adds identityBinding policy + publishes binding results in status
    • Agent: adds enforcement status to record when/why an Agent was disabled and what replicas to restore
  • Controller behavior

    • AgentCard controller: evaluates binding and reports status + Events
    • Agent controller: enforces strict mode (scale to 0) and restores automatically + Events
  • Docs

    • Quickstart guide + sample manifests

Events

Event Meaning
BindingEvaluated Binding passed
BindingFailed Binding failed
BindingEnforced Strict mode enforced (deployment scaled to 0)
BindingRestored Restored after binding passes
MultipleAgentsMatched Selector matched more than one Agent

How to Test

  • Unit Test: go test ./internal/controller/... -run Identity -v
  • Integration Test: go test ./test/integration/... -run IdentityBinding -v
  • Manual Test: follow docs/identity-binding-quickstart.md (match, mismatch, strict enforce, restore, ambiguous selector)

Notes

  • Backwards compatible: identityBinding is optional.
  • Step 2 (future): runtime cryptographic enforcement via mTLS/mesh or gateway.

@kevincogan kevincogan changed the title feat: AgentCard → Workload Identity Binding via CRD Extension (Step 1) ✨ AgentCard → Workload Identity Binding via CRD Extension (Step 1) Jan 28, 2026
@kevincogan
kevincogan force-pushed the feature/agentcard-identity-binding branch from cafa166 to 9df2411 Compare January 28, 2026 15:24
@kevincogan kevincogan changed the title ✨ AgentCard → Workload Identity Binding via CRD Extension (Step 1) ✨ AgentCard → Workload Identity Binding via CRD Extension Jan 28, 2026
@usize
usize self-requested a review January 28, 2026 18:01
@kevincogan
kevincogan force-pushed the feature/agentcard-identity-binding branch from 9df2411 to 3eccc2e Compare January 30, 2026 13:13
@usize

usize commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

@kevincogan I fixed some merge issues that popped up because of a recent change. Importantly AgentSelector was deprecated and made into a pointer.

Selector *AgentSelector json:"selector,omitempty"``

I left your uses of Selector intact despite the deprecation to try to keep things as smooth as possible for implementation. We can port AgentSelector to TargetRef as a follow up. For now, I want to keep our momentum. 🚀

@pdettori

pdettori commented Feb 3, 2026

Copy link
Copy Markdown
Member

@kevincogan pls. see instructions from failing CI DCO check to fix it

@kevincogan
kevincogan force-pushed the feature/agentcard-identity-binding branch 2 times, most recently from 54c013a to bbb3341 Compare February 3, 2026 12:33
@kevincogan

Copy link
Copy Markdown
Contributor Author

@kevincogan pls. see instructions from failing CI DCO check to fix it

Thanks @pdettori, all my commits are DCO signed.

@usize I believe the Trigger CI re-run needs your signature whenever you get a chance, thanks! 😄

@maia-iyer maia-iyer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Couple questions on this PR!

class E,H failClass
```

### SPIFFE ID Format

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm concerned that we are making assumptions about how SPIRE is configured. Currently it is default behavior by SPIRE's Helm operator to create SPIFFEIDs with namespace and service account, but identities can actually be much richer (See here: https://github.com/spiffe/spire/blob/main/doc/plugin_agent_workloadattestor_k8s.md#k8s-selectors). I see in the proposal there is some "SPIFFEID Derivation" - that may be brittle depending on implementation details I haven't dug into yet

@kevincogan kevincogan Feb 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great catch, @maia-iyer! You're absolutely right that SPIRE supports much richer identity patterns beyond the default ns/<namespace>/sa/<serviceAccount> format.

I've addressed this by adding an optional expectedSpiffeID field to the IdentityBinding spec to this PR. This allows users with custom SPIRE configurations to explicitly specify their expected SPIFFE ID rather than relying on auto-derivation:

spec:
  identityBinding:
    # Override auto-derivation for custom SPIRE configurations
    expectedSpiffeID: "spiffe://mycompany.local/cluster/prod/workload/weather-agent"
    allowedSpiffeIDs:
      - "spiffe://mycompany.local/cluster/prod/workload/weather-agent"

The behavior is now:

  • If expectedSpiffeID is provided: We use it directly (supports any SPIRE configuration).
  • If not provided: We fall back to deriving from K8s metadata (works with standard SPIRE Helm operator defaults).

This keeps the simple case easy (auto-derivation works out of the box for standard setups) while supporting the full range of SPIRE identity patterns for advanced configurations.

I've also added documentation linking to the SPIRE workload attestor selectors so users understand when they need to use the explicit field.

Looking ahead: Step 2 (planned for the next PR) will add runtime mTLS enforcement, which extracts the SPIFFE ID directly from the workload's certificate making it work automatically with any SPIRE configuration. The allowedSpiffeIDs policy defined here will be reused for that cryptographic verification.

@usize
usize force-pushed the feature/agentcard-identity-binding branch from bbb3341 to a9c7146 Compare February 3, 2026 15:43
kevincogan and others added 3 commits February 3, 2026 21:41
…ations

Adds optional ExpectedSpiffeID field to IdentityBinding spec to support
non-standard SPIRE identity formats beyond the default ns/sa derivation.

Changes:
- Add ExpectedSpiffeID field to override auto-derived SPIFFE ID
- Prioritize explicit ID when provided, fallback to K8s metadata derivation
- Fix ambiguous selector behavior to return error (not silently pick one)
- Update tests for new API and behavior
- Add documentation for custom SPIRE configuration use cases

Resolves merge conflicts from main branch rebase.

Signed-off-by: Kevin Cogan <[email protected]>
@kevincogan
kevincogan force-pushed the feature/agentcard-identity-binding branch from a9c7146 to cb38146 Compare February 3, 2026 22:48
@usize
usize merged commit 616d2e8 into rossoctl:main Feb 4, 2026
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: A Registry Binding A2A Agent Cards and Workload Identity

4 participants