Codebase Map

3 min read

Orkestra compiles into three binaries. Every package in pkg/ and every command in cmd/ belongs to one of them — or is shared.


Binaries

Runtime (cmd/orkestra)

The reconciliation engine. Watches Kubernetes resources, runs operatorBox logic, dispatches webhooks, manages CRD lifecycle. Built with -tags runtime.

Core packages:

PackageWhat it does
pkg/katalogLoads, merges, and validates the Katalog. The link between YAML config and every runtime decision.
pkg/reconcilerGenericReconciler — the reconcile loop, rollback gate, snapshot logic, notification dispatch.
pkg/kordinatorOrchestrates reconcilers per CRD; manages CRD health, degradation, and dependency ordering.
pkg/childrenFetches and enriches child resources (_pods, _replicaSets, _owner, etc.) and builds the .children map available in status templates.
pkg/informerShared index informers and factory lifecycle.
pkg/kubeclientCore, dynamic, and apiextensions clients; REST mapper.
pkg/orkestra-registryBuilt-in resource handlers: deployments, services, configMaps, jobs, etc.
pkg/mergerKomposer — multi-source Katalog merging.
pkg/motifMotif expansion — assembles reusable resource building blocks at load time.
pkg/webhookAdmission and conversion webhook server.
pkg/certmanagerTLS certificate provisioning for webhook servers.
pkg/reconcilerGeneric reconciler including typed and dynamic modes.
pkg/generateCode generation for ork generate registry and related commands.
pkg/typeregistryGenerated stub — blank-imported by user main.go to wire typed extensions.

Gateway (cmd/gateway)

An HTTPS sidecar that owns all webhook endpoints (admission, conversion, deletion-protection) and receives notification dispatch from the runtime. Runs as a separate pod.

Key packages:

PackageWhat it does
pkg/kordinatorBuildNotifyHandler, BuildGatewayKatalogHandler — HTTP handlers served by the gateway.
pkg/webhookShared webhook parsing and dispatch logic.
pkg/notificationDirectNotifier — SMTP and Slack dispatch, used by the gateway’s /notify handler.

Control Center (cmd/controlcenter)

A read-only web UI that aggregates status from one or more running runtimes. Written in Go with embedded HTML templates. No Kubernetes access of its own — pulls everything via the runtime’s /katalog HTTP API.


Shared packages

These are imported by more than one binary.

PackageNotes
pkg/typesAll Katalog YAML structs, registries, and generated type interfaces.
pkg/konfigEnvironment variable parsing and startup configuration.
pkg/loggerStructured zerolog wrapper.
pkg/utilsSmall helpers (cluster detection, env expansion, exit).
pkg/labelsOrkestra label keys and helpers.
pkg/healthHealth and degradation tracking for CRDs.
pkg/queuePer-CRD work queue with backoff and rate limiting.
pkg/eventKubernetes event recorder.
pkg/metricsPrometheus metrics stubs.
pkg/providerCloud and database provider interface and implementations.
pkg/planPlan/diff logic for operatorBox reconciliation.
pkg/registryRuntime-level type and hook registries.
pkg/simulateTest harness for reconciler unit tests.
pkg/noteTemplate note functions — Go helpers exposed as template variables so operators can surface replica counts, pod health, scaling state, and more in status fields without writing code. Every new note makes Orkestra more declarative.
pkg/notificationNotification stack, throttle state, DirectNotifier, GatewayNotifier.

Reading the code

Every package with a README.md explains what it does, what it owns, and what it does not own. Start there. Packages without a README are small enough to read directly.

The pkg/katalog package is the connective tissue of the entire project. If you are unsure how a feature works end-to-end, start from the Katalog accessor for that feature and follow callers inward.


CLI commands (cmd/cli)

The ork CLI is built with a !runtime build tag so it is excluded from the runtime binary. Commands live in cmd/cli/:

  • ork run — start the runtime
  • ork generate registry — emit pkg/typeregistry/zz_generated_typeregistry.go
  • ork generate bundle — emit Kubernetes manifests for the runtime or gateway
  • ork init — scaffold a new operator project from an example pack
  • ork validate — validate a Katalog offline
  • ork simulate — dry-run a reconcile loop without a cluster
  • ork control — manage a running runtime (start, stop, reload)