Documentation for version v0.40.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.
Configure patch-like edits in
ytt via “Overlays”.
(For a high-level overview of
ytt, see How it works.)
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
- “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.
- Primer on
yttOverlays for a screencast-formatted in-depth introduction to writing and using overlays.
(Help improve our docs: edit this page on GitHub)