Documentation for version v0.38.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.
The way to describe patch-like edits in
ytt is via “Overlays”.
(For a high-level overview of
ytt, see How it works.)
What are they? ¶
Sometimes it makes more sense to patch some YAML rather than template it.
For example, when:
- the file should not be edited directly (e.g. from a third party);
- the edit will apply to most or all documents; or
- the specific variable is less commonly configured.
Given a sample target YAML file:
--- id: 1 contents: - apple --- id: 2 contents: - pineapple
… this overlay …
#@ load("@ytt:overlay", "overlay") #@overlay/match by=overlay.all, expects="1+" --- contents: - pen
Prior to v0.32.0 append array items with
- “match all YAML documents, expecting to match at least one;"
- “within each document, merge the key named
- “append an array item with the content
… when processed by
$ ytt -f config.yml -f add-content.yml
… produces …
id: 1 contents: - apple - pen --- id: 2 contents: - pineapple - pen
Next Steps ¶
- Overlay example in the ytt Playground to try it out, yourself.
- ytt Library: Overlay module for reference of all overlay annotations and functions.
- Data Values vs Overlays for when to use one mechanism over the other.
(Help improve our docs: edit this page on GitHub)