Skip to content

Serialization

The Kubernetes lexicon serializes resources into multi-document YAML with --- separators between resources. Each resource gets the standard K8s structure: apiVersion, kind, metadata, and spec.

Run chant build to produce Kubernetes manifests from your declarations:

Terminal window
chant build src/ --output dist/manifests.yaml
# Writes dist/manifests.yaml

The generated file includes:

  • Multi-document YAML with --- separators
  • Correct apiVersion and kind for each resource
  • metadata.name auto-generated from export names (camelCase → kebab-case)
  • Default labels and annotations injected from defaultLabels()/defaultAnnotations()
Chant (TypeScript)YAML outputRule
export const myApp = new Deployment({...})metadata.name: my-appExport name → kebab-case
new Container({...})Inline container specProperty types expanded inline
defaultLabels({...})Merged into all resourcesProject-wide label injection

The output is standard Kubernetes YAML. Apply with kubectl:

Terminal window
# Dry run first
kubectl apply -f dist/manifests.yaml --dry-run=server
# Apply
kubectl apply -f dist/manifests.yaml
# Diff before applying
kubectl diff -f dist/manifests.yaml

The output is compatible with:

  • kubectl apply/diff
  • Helm (as raw manifests)
  • ArgoCD / Flux GitOps controllers
  • Kustomize (as a base)
  • Any tool that processes Kubernetes YAML