This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Kubernetes operator for the Inference Gateway project, built using Go 1.24+ and the Operator SDK. The operator manages Gateway, A2A (Agent-to-Agent), and MCP (Model Context Protocol) custom resources in Kubernetes clusters.
All commands use the Task runner. Common development tasks:
task build- Build the manager binary (includes manifests, generate, fmt, vet)task test- Run unit tests with coveragetask test:e2e- Run end-to-end tests (requires k3d cluster)task test:e2e:focus FOCUS="test name"- Run specific e2e testtask lint- Run golangci-lint lintertask lint-fix- Run linter with automatic fixestask fmt- Format Go codetask vet- Run go vettask generate- Generate DeepCopy methods for API typestask manifests- Generate CRDs, RBAC, and installation manifeststask tidy- Run go mod tidy
task lintandtask lint-fix- Ensure code qualitytask generate- Generate types (after schema changes)task manifests- Update Kubernetes manifeststask fmt- Format codetask build- Verify compilationtask test- Run unit teststask test:e2e- Run e2e tests if applicable
- Gateway (
api/v1alpha1/gateway_types.go) - Core inference gateway deployment with AI provider integration, authentication, observability, and networking - Agent (
api/v1alpha1/agent_types.go) - Agent-to-Agent communication servers - MCP (
api/v1alpha1/mcp_types.go) - Model Context Protocol servers
- Gateway Controller (
internal/controller/gateway_controller.go) - Manages Gateway deployments, services, configmaps, and HPA - Agent Controller (
internal/controller/agent_controller.go) - Manages Agent server deployments - MCP Controller (
internal/controller/mcp_controller.go) - Manages MCP server deployments
api/v1alpha1/- API type definitions and generated codeinternal/controller/- Controller implementations and testsconfig/- Kubernetes manifests (CRDs, RBAC, deployments)examples/- Sample resource configurationsmanifests/- Generated installation manifests
- Use table-driven testing pattern
- Each test case should have isolated mock dependencies
- Run with
task test(requires envtest setup)
- Located in
test/e2e/ - Requires k3d cluster managed by ctlptl
- Uses Ginkgo testing framework
- Run with
task test:e2eor focused tests withtask test:e2e:focus
- Use early returns to avoid deep nesting
- Prefer switch statements over if-else chains
- Use table-driven testing
- Code to interfaces for easier mocking
- Use lowercase log messages
- Maintain type safety with strong typing
task install- Install CRDs to clustertask deploy- Build and deploy operator to k3d clustertask undeploy- Remove operator from clustertask uninstall- Remove CRDs from cluster
task cluster:create- Create local k3d cluster with cert-manager and nginx-ingresstask cluster:delete- Delete local cluster
The following files are auto-generated and should not be edited manually:
api/v1alpha1/zz_generated.deepcopy.go- Generated bytask generateconfig/crd/bases/*.yaml- Generated bytask manifestsmanifests/*.yaml- Generated bytask manifests
Always run task generate and task manifests after modifying API types or controller RBAC annotations.