How kro-run/kro works
Project type and purpose
• This is a Kubernetes Operator project (“kro”) written in Go, with a companion CLI (kro), dynamic controller generation, CRD codegen, and a website.
• Its purpose is to let users define “ResourceGraphDefinition” CRDs that group arbitrary Kubernetes resources and declare their dependencies; kro’s controller machinery then generates the CRDs, spins up dedicated controllers, and reconciles instances by creating/managing the underlying resources in the correct order.
File structure
• Top-level cmd/controller: the static “kro-controller” manager binary
• Top-level cmd/kro: the CLI binary with subcommands (generate, validate, etc.)
• api/v1alpha1: Go types & codegen stubs for the core ResourceGraphDefinition CRD
• pkg/controller: reconciliation logic for the static controller
• pkg/dynamiccontroller: logic to spawn per-ResourceGraphDefinition microcontrollers
• pkg/graph, pkg/runtime, pkg/cel, pkg/simpleschema: the internal engine that parses a RGDef, builds its dependency DAG, evaluates parameters (CEL), and drives reconcile loops
• config/* & helm/: Kubernetes manifests (CRDs, RBAC, kustomize overlays, Helm chart) for installation
• examples/, test/: sample RGDefs and e2e/integration tests
• website/: static site for docs and examples
README for additional insights
• Confirms the key custom resource (“ResourceGraphDefinition”)
• Describes two-phase operation:
a) Apply a RGDef → kro controller registers a new CRD & deploys its microcontroller
b) Create instances of that CRD → the microcontroller reconciles and manages underlying K8s resources
a. Main components
• User & CI/CD: invokes kro CLI or applies manifests
• Kubernetes API Server (backed by etcd)
• Static kro-controller Manager
• Dynamic Microcontrollers (one per ResourceGraphDefinition)
• Dependency Engine (graph builder, CEL evaluator)
• Underlying Kubernetes Resources (Deployments, Services, ConfigMaps, CRDs)
• Codegen & Build pipelines (GitHub Actions)
• Helm/Kustomize overlays (installation artifacts)
b. Relationships & interactions
1. User runs kro generate/validate → local manifests → kubectl apply → API Server
2. Static kro-controller watches RGDef CRs → upon new RGDef:
• Run codegen to emit a new CRD
• Register the new CRD with API Server
• Deploy a dynamic controller deployment (pod) for that CRD
3. Dynamic controller watches Instances of its CRD → on reconcile:
• Parsing via Dependency Engine (pkg/graph + pkg/runtime + CEL)
• Compute ordered list of child resources
• Use client-go to Create/Update/Delete each resource in correct order
4. API Server persists everything to etcd
c. Architectural patterns & principles
• Operator pattern (controller runtime, reconcile loops)
• Microcontroller per custom resource (dynamic controller generation)
• Event-driven architecture (watch + reconcile)
• Dependency graph / DAG pattern for ordering operations
• Kubernetes-native extension (CRDs, RBAC, Kustomize, Helm)
d. Key technologies
• Go + controller-runtime + client-go
• CEL (expression evaluation for parameters)
• Kustomize (& config/ overlays)
• Helm (packaging & distribution)
• GitHub Actions (CI: unit, integration, e2e, image publish)