1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! Declarative manifest rendering seam (plan §6 step 10).
//!
//! [`ManifestRenderer`] is the deployer-side contract behind
//! `gtc op env render`: it turns an [`Environment`] (plus optional wizard
//! answers) into the ordered list of declarative manifest documents the
//! deployer would apply, without applying anything. This is what lets an
//! operator choose direct apply, GitOps repository handoff, or rendered-
//! manifest handoff — the rendered artifact and the applied resources come
//! from the same functions.
//!
//! The trait deliberately sits NEXT TO [`Deployer`](super::deployer::Deployer)
//! rather than on it: rendering only makes sense for deployers whose
//! desired state is expressible as declarative documents (K8s). Imperative
//! deployers (local-process, AWS-ECS) simply don't implement it — their
//! handlers return `None` from
//! [`EnvPackHandler::as_manifest_renderer`](super::slot::EnvPackHandler::as_manifest_renderer)
//! and `op env render` reports the kind as non-renderable.
use Environment;
use Value;
/// Renders an environment's full declarative desired state.
///
/// Contract:
/// - **Pure and deterministic** — same `(env, answers)` pair, same
/// documents, same order. No I/O, no provider calls, no clock.
/// - **Apply order** — consumers may feed the list to `kubectl apply -f`
/// (or commit it to a GitOps repo) as-is; dependencies come before
/// dependents (e.g. Namespace before namespaced objects).
/// - Each [`Value`] is one manifest document following the K8s object
/// convention (`apiVersion` / `kind` / `metadata.name`).
/// - The set covers environment-level objects AND per-revision workload
/// objects for revisions whose persisted lifecycle implies presence in
/// the desired state — the exact lifecycle policy is the impl's to
/// define and document.
/// Errors from [`ManifestRenderer::render_environment`].