Documentation for version v0.44.0 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
About ytt
Overview ¶
ytt
is a command-line tool used to template and patch YAML files. It also provides the means to collect fragments and piles of YAML into modular chunks for easy re-use.
In practice, these YAML files are Kubernetes configuration, Concourse Pipeline, Docker Compose, GitHub Action workflow files…, really anything that is in YAML format.
ytt
is most useful when manually maintaining these files has or will become too much work.
Templating ¶
A plain YAML file is turned into a ytt
template by adding specially formatted comments, that is: annotating. Through these annotations, one can inject input values, logic like conditionals and looping, and perform transformations on the content.
Those “input values” are called “Data Values” in ytt
. Such inputs are included in a separate file.
For more:
- see it in action in the load data files example on the playground
- check out the Using Data Values guide
- look up reference details of the programming language used in templates in Language.
Patching (aka Overlaying) ¶
ytt
can also be used to patch YAML files. These edits are called “Overlays” and are themselves written in YAML.
For more around overlaying…
- see overlaying in action through a progressive set of examples in the
ytt
Playground; - learn more about Overlays in ytt Overlays overview;
- for a reference of all Overlay functionality, see Overlay module;
- for a screencast-formatted in-depth introduction to writing and using overlays, watch Primer on
ytt
Overlays.
Modularizing ¶
ytt
provides powerful techniques for extracting and reusing chunks of YAML and logic.
Functions in ytt
capture either a calculation or fragment of YAML. Functions can be used in the same templates that define them, or — if defined in a module file — loaded into any template. Entire sets of templates, overlays, and library code can be encapsulated in a ytt
library.
For more about modular code…
- see live examples in the
ytt
Playground around functions andytt
libraries; - read further about functions, YAML Fragments, and loading reusable modules and libraries;
- catch-up on a particularly relevant discussion about using modules and libraries in
ytt
.
Further Reading ¶
Hopefully, the pointers above helped get you started. If you’re looking to go either deeper or broader, here are some resources we can recommend.
Documentation ¶
How it Works
a more detailed look of how all these parts fit together.ytt vs. X
howytt
differs from similar tools.
Articles ¶
ytt: The YAML Templating Tool that simplifies complex configuration management
a complete introduction ofytt
including motivations and contrasts with other tools.Deploying Kubernetes Applications with ytt, kbld, and kapp
howytt
works well with other Carvel tools.
Presentations and Interviews ¶
IBM Developer podcast: Introducing the YAML Templating Tool (ytt)
a thorough introduction toytt
especially contrasted with Helm.TGI Kubernetes: #079: YTT and Kapp
Joe Beda puts bothytt
and sister toolkapp
through their paces.Helm Summit 2019: ytt: An Alternative to Text Templating of YAML Configuration in Helm (slides)
in-depth review of the philosophy behindytt
and how it differs from other YAML templating approaches.Kubecon 2020: Managing Applications in Production: Helm vs ytt & kapp @ Kubecon 2020
howytt
andkapp
can provide an alternative way to manage the lifecycle of application on Kubernetes.Rawkode Live: Introduction to Carvel
Dmitriy joins David McKay to talk through many tools in the Carvel suite, includingytt
.
(Help improve our docs: edit this page on GitHub)