Skip to content

gracesmith6504/Agenix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agenix — Automated Agent Identity Operator

A Kubernetes operator that automates cryptographic identity provisioning for AI agents.

Built at Red Hat | AI Agent Ops Team | Summer 2026

Grace Smith | GitHub | Blog Post

Watch the Demo Presentation: architecture walkthrough, live demo, and team presentation


What is Agenix?

In AI agent-to-agent systems, every workload needs a verifiable identity, but managing certificates manually doesn't scale. Agenix is a Kubernetes operator that handles this: you create one custom resource pointing at a Deployment, and the operator issues X.509 certificates, generates SPIFFE IDs, injects credentials into pods via a webhook, rotates certs, and cleans up on deletion.

The design uses composition over inheritance. The CRD references a target Deployment by name rather than embedding its spec, so the identity layer stays separate from workload config. Agenix is a simplified, educational take on production patterns from the Kagenti Operator, an IBM Research project with Red Hat contributors.

This is my fork. The upstream repo is Bobbins228/Agenix. All PRs linked below were merged into upstream. I'm using this fork to showcase my contributions.


My Contributions

I built the CRD, controller, and certificate provisioning pipeline: the core reconciliation path from "user creates a resource" to "agent pod has a verified cryptographic identity."

PR What I Built Lines Key Concepts
#1 CRD Design & Project Scaffolding +3,990 Kubebuilder, OpenAPI v3 schema, metav1.Time, printcolumn markers, composition over inheritance
#2 CI Pipeline Fix +16 GitHub Actions workflow path + go-version-file fix
#5 Controller Scaffolding — CA init, RBAC, watches +221 Reconciliation loop, For()/Owns() watches, RBAC markers, status subresource
#6 Certificate Provisioning in reconcile loop +426 X.509/ECDSA P-256, SPIFFE IDs, CreateOrUpdate, owner references, RequeueAfter at 2/3 TTL
#13 OpenShift Security Context fix +11 restricted-v2 SCC compliance, runAsNonRoot, seccompProfile, ubi9-minimal
OpenShift Deployment & Validation Cross-arch build (ARM→AMD64), quay.io registry, ROSA HCP cluster, wrote deployment guide

Also: Reviewed all 8 teammate PRs (#3, #4, #7, #8, #9, #10, #11, #12). Found a SPIFFE ID validation gap on #3 and a path injection risk in SPIFFE ID generation on #4.

Total: ~4,660 lines of Go across 5 merged PRs, plus OpenShift deployment work and code review.


Architecture

Architecture Diagram

The operator follows the standard Kubernetes controller pattern:

  1. Developer creates an AgentIdentity CR referencing a target Deployment
  2. The Controller detects it via For() watch and enters the reconcile loop
  3. Reads the target Deployment and its ServiceAccount
  4. Generates a SPIFFE ID (spiffe://<trustDomain>/ns/<namespace>/sa/<serviceAccount>)
  5. Issues an X.509 certificate (ECDSA P-256, signed by the in-process CA)
  6. Stores cert material in a Kubernetes Secret with owner references
  7. Verifies the certificate chain and SPIFFE ID → sets status to Verified
  8. The Mutating Webhook intercepts pod creation and injects the TLS secret as a volume mount + environment variables
  9. On deletion, a Finalizer cleans up the Secret, labels, and Deployment patches

How the Reconcile Loop Works

Reconcile Loop

Each step sets a status condition on failure. Certificate rotation requeues at 2/3 of the TTL, so a 24-hour cert requeues after 16 hours. The controller uses controllerutil.CreateOrUpdate for idempotent Secret management, so it converges correctly even if restarted mid-reconcile.


Demos, Walkthroughs & Deep Dives

Resource What It Covers
Demo Presentation Slides Architecture, design decisions, reconcile loop flowchart, team reflections
Kind Cluster Demo End-to-end operator demo on local Kind cluster
OpenShift (ROSA) Demo Operator running on production-like ROSA HCP cluster
Full Demo Recording Complete team presentation with live demo
Task 1: CRD Design Walkthrough Kubebuilder scaffolding, OpenAPI schema, composition vs inheritance, deep copy generation
Task 4a: Controller Scaffolding Walkthrough Reconciliation loop, CA initialization, RBAC markers, For()/Owns() watches
Task 4b: Certificate Provisioning Walkthrough X.509 generation, SPIFFE IDs, CreateOrUpdate, owner refs, integration testing with envtest
OpenShift Deployment Guide Cross-arch builds, SCC compliance, ROSA HCP deployment, validation steps
Learning Exercises 15 pages of intentional breakage experiments across all tasks: CRDs, certs, webhooks, finalizers

What I Learned

I intentionally broke things to understand how they work. From 15 pages of learning exercises:

  • Deleting a CRD cascades to ALL custom resources of that type. They cannot be recovered. The CRD is the definition; without it, Kubernetes can't keep any instances.
  • Chain validation fails when a leaf cert is self-signed. The CA proves the identity is legitimate. Without chain validation, any agent could forge its own identity.
  • Owner references vs finalizers serve different purposes. Owner refs handle same-namespace garbage collection automatically; finalizers are needed when cleanup spans namespaces or involves external resources. You need both.
  • Manually removing a finalizer is dangerous. It tells Kubernetes "cleanup is done" when the cleanup logic hasn't actually run, leaving orphaned resources behind.
  • For() vs Owns() watches. For() triggers reconcile when the primary resource changes; Owns() triggers reconcile of the owner when a child resource (like a Secret) changes. Getting this wrong means the controller misses updates.

Technologies

Go, Kubernetes, Kubebuilder, controller-runtime, X.509 / SPIFFE, ECDSA P-256, Ginkgo / Gomega, envtest, GitHub Actions, OpenShift / ROSA HCP, Kustomize, Podman, cert-manager


How I Worked

All contributions followed the Kagenti project's contributing guidelines and development guide:

  • Fork-and-branch workflow. Worked from a personal fork, merged from upstream before each PR
  • DCO sign-off on every commit (Developer Certificate of Origin)
  • Conventional commits prefixed with feat:, fix:, docs:, test:
  • Pre-commit linting. Ran make lint before every push
  • PR descriptions included problem context, solution explanation, and testing steps
  • Code review. Reviewed teammates' PRs and responded to review feedback on my own

About the Project

Agenix was built by three interns on Red Hat's AI Agent Ops team. The upstream repo is Bobbins228/Agenix. I built the CRD, controller, and certificate provisioning (Tasks 1, 4a, 4b), plus OpenShift deployment. Other team members built the CA, webhook, verification, SPIFFE utilities, and finalizer/lifecycle management.

For the full project README (setup instructions, API reference, architecture details), see the upstream repo.

About

Intern Operator Project focusing on Agent Identity

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 86.6%
  • Makefile 7.2%
  • Shell 5.5%
  • Dockerfile 0.7%