Skip to main content

tatara_render/
lib.rs

1//! tatara-render — the RENDER phase morphism.
2//!
3//! ## Where it sits
4//!
5//! Phase 5 of the eight-phase convergence loop (THEORY §IV.3):
6//!
7//! ```text
8//! 1. DECLARE    → tatara_env::compile_into_env  (Vec<Sexp> → Env)
9//! 2. SIMULATE   → tatara_env::validate
10//! 3. PROVE      → property tests on lattice laws
11//! 4. REMEDIATE  → declared ⊔ remediations  (right-bias)
12//! 5. RENDER     → tatara_render::Backend     ← THIS CRATE
13//! 6. DEPLOY     → tatara_rollout::diff_envs + apply
14//! 7. VERIFY     → observed ⊑ declared
15//! 8. RECONVERGE → drifts_from → GOTO DECLARE
16//! ```
17//!
18//! ## What it produces
19//!
20//! Each `Backend` impl turns a typed `Env` into a target-shaped
21//! manifest set. The target ranges from "raw Kubernetes CR YAML
22//! ready to apply" through "FluxCD Kustomization tree" to
23//! "Pangea Ruby DSL" to "Terraform JSON" — every place the
24//! existing pleme-io stack already accepts deployment input.
25//!
26//! Today this crate ships the simplest member of the family:
27//! `KubernetesYaml`. It takes a typed env and produces, for each
28//! resource, a YAML document in the target's expected shape:
29//!
30//!   - `defgateway` → `Gateway` CR (gateway.networking.k8s.io/v1)
31//!   - `defciliumnetworkpolicy` → `CiliumNetworkPolicy` CR
32//!   - `defpodmonitor` → `PodMonitor` CR
33//!   - `defbpf-program` / `defbpf-map` / `defbpf-policy` →
34//!     ConfigMaps describing the BPF spec, plus a sibling
35//!     reference to the substrate-built `.bpf.o` (the actual
36//!     loader is a separate Job/DaemonSet outside this crate).
37//!
38//! Every other backend (helm-chart-forge, pangea-forge, the
39//! existing `iac-forge` family) is one trait impl away.
40//!
41//! ## Why a trait, not a function
42//!
43//! Adding a new target inherits all existing proofs. The
44//! typescape types (`Env`, `Resource`) are where the
45//! invariants live — `Backend` impls are pure projections. The
46//! `Synthesizer` trait in `arch-synthesizer` is the same
47//! shape; this crate's `Backend` is a narrower, env-specific
48//! variant that lands faster than wiring through the full
49//! typescape layer (which it can grow into).
50
51pub mod backend;
52pub mod kubernetes_yaml;
53
54pub use backend::{Backend, Manifest, RenderError};
55pub use kubernetes_yaml::KubernetesYaml;