Repository navigation
✨ AgentCard → Workload Identity Binding via CRD Extension - #160
Conversation
cafa166 to
9df2411
Compare
9df2411 to
3eccc2e
Compare
|
@kevincogan I fixed some merge issues that popped up because of a recent change. Importantly
I left your uses of |
|
@kevincogan pls. see instructions from failing CI DCO check to fix it |
54c013a to
bbb3341
Compare
Thanks @pdettori, all my commits are DCO signed. @usize I believe the |
| class E,H failClass | ||
| ``` | ||
|
|
||
| ### SPIFFE ID Format |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
expectedSpiffeIDis 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.
bbb3341 to
a9c7146
Compare
Signed-off-by: Kevin Cogan <[email protected]>
Signed-off-by: usize <[email protected]>
…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]>
a9c7146 to
cb38146
Compare
Summary
Implements AgentCard → Workload Identity Binding via CRD Extension (Step 1): policy-based binding between an
AgentCardand 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
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.allowedSpiffeIDsEvaluation: the AgentCard controller computes
expectedSpiffeIDfrom 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=trueand the binding check fails, the Agent controller disables the Agent by scaling its Deployment to0. 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
identityBindingpolicy + publishes binding results in statusController behavior
Docs
Events
BindingEvaluatedBindingFailedBindingEnforcedBindingRestoredMultipleAgentsMatchedHow to Test
go test ./internal/controller/... -run Identity -vgo test ./test/integration/... -run IdentityBinding -vdocs/identity-binding-quickstart.md(match, mismatch, strict enforce, restore, ambiguous selector)Notes
identityBindingis optional.