Skip to content

Wire AllowedAudiences from AgentRuntime CRD to AuthProxy sidecar#370

Merged
huang195 merged 1 commit into
rossoctl:mainfrom
akram:fix/wire-allowed-audiences-368
May 21, 2026
Merged

Wire AllowedAudiences from AgentRuntime CRD to AuthProxy sidecar#370
huang195 merged 1 commit into
rossoctl:mainfrom
akram:fix/wire-allowed-audiences-368

Conversation

@akram

@akram akram commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds spec.identity.allowedAudiences field to the AgentRuntime CRD, allowing per-agent JWT audience overrides
  • Wires the field through AgentRuntimeOverridesResolvedConfig → per-agent ConfigMap generation
  • Injects allowed_audiences into the pipeline.inbound.plugins[jwt-validation].config section of the per-agent ConfigMap
  • Transitional mechanism to support application-to-agent flows (e.g. playground → agent) until the auth model is finalized

Example usage

apiVersion: agent.kagenti.dev/v1alpha1
kind: AgentRuntime
metadata:
  name: my-agent-runtime
spec:
  type: agent
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-agent
  identity:
    allowedAudiences:
      - playground
      - kagenti-agents

Changed files

File Change
api/v1alpha1/agentruntime_types.go Add AllowedAudiences []string to IdentitySpec
internal/webhook/injector/agentruntime_config.go Extract from CR, add to AgentRuntimeOverrides
internal/webhook/injector/resolved_config.go Add to ResolvedConfig, merge with AR precedence
internal/webhook/injector/pod_mutator.go injectAllowedAudiences() helper, pass through both call sites
internal/webhook/injector/pod_mutator_test.go Tests for injection and nil cases
api/v1alpha1/zz_generated.deepcopy.go Regenerated
config/crd/bases/agent.kagenti.dev_agentruntimes.yaml Regenerated CRD manifest

Closes #368

Test plan

  • Unit tests pass (go test ./internal/webhook/injector/...)
  • Verified on OpenShift (ROSA) with redbank-demo-test-envoy namespace:
    • Patched AgentRuntime CRs with allowedAudiences: ["redbank-demo-test-envoy", "account"]
    • Confirmed allowed_audiences appears in per-agent ConfigMaps under pipeline.inbound.plugins[jwt-validation].config
    • Confirmed authbridge sidecar starts and accepts user tokens with matching audiences (inbound authorized)
    • Full E2E: playground → orchestrator → banking/knowledge agents working with envoy-sidecar mode
  • Negative test: agents without allowedAudiences in CR have no allowed_audiences in ConfigMap

🤖 Generated with Claude Code

@akram
akram requested review from a team as code owners May 21, 2026 00:43
@akram
akram force-pushed the fix/wire-allowed-audiences-368 branch 2 times, most recently from eaf4cbd to 574e4a6 Compare May 21, 2026 00:54

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adds spec.identity.allowedAudiences []string to the AgentRuntime CRD and wires it through to the per-agent authbridge ConfigMap's pipeline.inbound.plugins[jwt-validation].config.allowed_audiences. Closes #368. Both proxy-sidecar and envoy-sidecar code paths thread an allowedAudiences parameter through ensurePerAgentConfigMap. Two new tests cover AR-set-injects and nil-doesn't-inject.

Areas reviewed: Go (CRD type, deepcopy, override extraction, ResolvedConfig, pod mutator, tests), kubebuilder annotations, kagenti commit/PR conventions
Commits: 1, signed-off (DCO passing)
CI status: 14/15 passing; E2E pending

Three meta-level items, easy to apply before merge:

  1. Commit-message attribution: trailer uses Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>. Kagenti convention (root CLAUDE.md "Commit Attribution Policy" + the ai-assisted-by-trailer pre-commit hook) is Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>. The pre-commit hook should have rewritten this — worth checking whether it ran. git rebase --signoff + manual edit fixes it.

  2. PR body footer: reads 🤖 Generated with [Claude Code](https://claude.com/claude-code). Same kagenti convention applies (root CLAUDE.md "PR Bodies" section): footer should be Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>, not "Generated with". One-line edit to the PR description.

  3. PR title: no emoji prefix. Kagenti repo:pr convention is <emoji> <Short descriptive title>feat: would be replaced by ✨ (or add ✨ as a prefix to the existing title). Not blocking.

Four inline comments below — one suggestion (dead code in ResolvedConfig), three nits / suggestions for hardening.

Verdict: APPROVE — feature works as advertised, dead-code finding (the inline #1 below) doesn't block merge but is worth cleaning up in a follow-up so future engineers don't reasonably assume ResolvedConfig.AllowedAudiences is the canonical source of truth.

Comment thread kagenti-operator/internal/webhook/injector/resolved_config.go
Comment thread kagenti-operator/internal/webhook/injector/agentruntime_config.go
Comment thread kagenti-operator/internal/webhook/injector/pod_mutator.go
Comment thread kagenti-operator/internal/webhook/injector/pod_mutator_test.go
@huang195

Copy link
Copy Markdown
Member

@akram please rebase and resolve conflict?

Add spec.identity.allowedAudiences to the AgentRuntime CRD so per-agent
JWT audience overrides flow through the operator into the authbridge
sidecar's jwt-validation plugin config. This is a transitional mechanism
to support application-to-agent flows until the auth model is finalized.

Closes rossoctl#368

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Akram <akram.benaissi@gmail.com>
@akram
akram force-pushed the fix/wire-allowed-audiences-368 branch from 574e4a6 to 456808c Compare May 21, 2026 07:10
@akram

akram commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

@akram please rebase and resolve conflict?

done (rebased and solved conflicts), and review's comments have been addressed

@huang195
huang195 merged commit 3a38c30 into rossoctl:main May 21, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from New /:ToDo to Done in Kagenti Issue Prioritization May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Wire AllowedAudiences from AgentRuntime CRD to AuthProxy sidecar

3 participants