Carvel Logo

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:

  • 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…

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…

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
    how ytt differs from similar tools.

Articles

Presentations and Interviews