Type: Explanation · Audience: Anyone seeking understanding
RezusCloud is a tenant orchestrator that lives one layer above talosctl
and kubectl. It declares Kubernetes clusters (called tenants), realises
them on top of lower-layer tools, and surfaces their state read-only. It never
duplicates lower-layer features.
Binaries
One repository, two binaries (the kubectl-in-kubernetes model):
| Binary | Runs on | Purpose |
|---|---|---|
rezuscloud |
Management host / Docker / Home Assistant | REST API, WebUI, TF execution engine, TF HTTP backend, reconciliation |
rezusctl |
Operator's laptop / CI | boot (standalone) + thin client commands against the REST API |
rezusctl boot creates the management cluster and deploys rezuscloud. After
that, rezuscloud runs autonomously. The CLI is only needed for boot and
convenience.
rezusctl builds clusters. kubectl manages them. rezuscloud runs them.
Layering
C4Context
title RezusCloud — layering and context
Person(op, "Operator", "rezusctl boot · declare · watch")
Person(cons, "Consumer", "kubectl + kubeconfig")
System_Boundary(rc, "RezusCloud management plane") {
System(plane, "rezuscloud", "tenant orchestration — renders .tf.json · reconciles via tofu apply")
SystemDb(db, "SQLite", "spec · status · TF-state blobs · users · audit — one file")
SystemQueue(nats, "NATS (embedded)", "spec mutations → watch/SSE fan-out")
}
System_Ext(low, "talosctl / kubectl", "node OS · in-cluster objects — driven, never reimplemented")
System_Ext(cloud, "cloud provider APIs", "OCI · OpenStack — called by tofu providers")
System_Ext(tenants, "Talos nodes + Kubernetes clusters", "the tenants — own etcd · no shared control plane")
Rel(op, plane, "declares tenants · triggers reconciliation", "REST · WebUI · rezusctl")
Rel(plane, op, "watch / SSE — state surfaced read-only", "HTTP")
Rel(plane, db, "persists spec + status · serves /tfstate", "SQLite — shared DB")
Rel(plane, nats, "publishes spec mutations", "in-process")
Rel(plane, cloud, "creates · maintains machines", "tofu apply")
Rel(plane, low, "renders Talos config via provider data source", "generation")
Rel(low, tenants, "manages")
Rel(plane, tenants, "health probe · rolling upgrade", "Talos API — read-mostly")
Rel(cons, tenants, "day-2 workload work", "kubeconfig")
Once a tenant is deployed, day-to-day work happens at the lower layers
(kubectl against the tenant, via a kubeconfig obtained from
rezusctl kubeconfig). RezusCloud stays responsible for the cluster-as-a-unit:
existence, configuration, upgrades, teardown.
State — two planes, never mixed
| Plane | What it holds | Source | Authority |
|---|---|---|---|
| Spec | Declared infrastructure (tenant, node group, machine identity) | TF state | Authoritative |
| Status | Observed runtime state (node health, machine stage) | Best-effort on-demand probe (15 s TTL) | Never authoritative, never written to TF state |
The management plane's own data (users, API tokens, audit, status fields) lives in SQLite initially.
How RezusCloud talks to infrastructure
RezusCloud drives infrastructure through OpenTofu providers. A Provider
is the RezusCloud module (internal/provider/<name>/) that wraps a real
registry TF provider (oci, openstack, talos, …) — it generates the standard
.tf.json that tofu apply runs against, and declares how the resulting TF
state projects back into RezusCloud resources.
RezusCloud exec's the tofu binary as a subprocess; it does not embed TF
libraries and does not use custom provider-plugin binaries.
Events
NATS is the event primitive, embedded in-process for the single-replica management plane. Spec mutations are published to per-resource-type subjects and consumed by the watch surface (REST watch/SSE and the WebUI live view). Reconciliation triggers do not ride NATS — they flow over a parallel EnqueueBus wire straight from the store to the apply queue, so the two consumers (human watchers and the reconciler) can never stall each other.
REST API
Kubernetes resource model: per-type endpoints, metadata/spec/status,
labels, finalizers, structured errors, optimistic concurrency, watch/SSE. JWT
- API-token auth.
WebUI
Server-rendered HTML (templ + HTMX + Tailwind + Alpine.js). Surfaces tenant orchestration state read-only and triggers orchestration actions. It is not a Kubernetes console.
Project layout
cmd/
rezusctl/ CLI entry point (boot + API client)
internal/
api/ REST API router + handlers (per resource type)
auth/ JWT, bcrypt, RBAC, users, API tokens
audit/ HTTP-middleware audit log
backup/ Backup manager
cli/ CLI-only packages (boot, platform, helm, apiclient, …)
controller/ Reconciliation controllers
credentials/ Kubeconfig / talosconfig generation
ingress/ HA-ingress compatibility middleware
state/ SQLite state store
talosconfig/ Talos config generation
upgrade/ Rolling upgrade engine
watch/ Event bus (NATS-backed)
web/ WebUI handler + templ views
tfbackend/ OpenTofu HTTP state backend
tfexec/ OpenTofu subprocess driver
tfencryption/ OpenTofu state encryption config
applyqueue/ Debounced per-tenant apply queue
provider/ RezusCloud TF-Provider wrappers (oci, openstack, metal, …)
projection/ TF-state → API-resource projection (under construction)
main.go Server entry point
Marketplace evolution
The layering above is unchanged by the platform's next phase: the sovereign cloud marketplace (see The Cloud Contract — the definition of a cloud and the blueprint model the marketplace lists).
RezusCloud becomes the reference implementation — Profile #1 — of an
open marketplace of sovereign cloud blueprints. Marketplace units
(Component / Solution / Profile) are pipeline-resident: they render at
composition time into the same layers RezusCloud already orchestrates
(OpenTofu below, Flux+Helm and OAM above), so the marketplace adds no layer
below or beside talosctl/kubectl. Products are swappable digest-pinned
properties bound to capability contracts (CSI, CNI, Gateway API, OIDC,
OTLP, Flux sources, SCS shapes); substitution is render-time and reconciles
through the declared-state pipeline.