YTT transform invokes the YTT templating engine as an external process.
type: YTT extraArgs: # optional - <SpEL-expression-1> - <SpEL-expression-2> - ...
YTT transform's yaml notation does not require any parameters. If invoked without parameters (the typical use case), then YTT transform's input is determined entirely by two things only:
YTT is invoked as an external process with the following commandline:
ytt -f <input-folder> \ --data-values-file <symbols.json> \ --output-files <output-folder> \ <extra-args>
<input-folder> is a temporary folder into which the input files are 'materialized' (i.e. the set of files that is passed to the YTT transform as input, is written out into this folder so as to allow the YTT process to read them).
<symbols.json> file is a temporary json file into which the current option values and derived symbols are materialized in the form of a json map. This allows YTT templates in the
<input-folder> to make use of these symbols during processing.
<output-folder> is a fresh temporary folder which is empty at the time of invocation. In a typical scenario, upon completion, the output folder will contain files generated by YTT.
<extra-args> are additional command line arguments obtained by evaluating the SpEL expressions from the
ytt process completes with a 0 exit code, then this is considered as a 'succesful' execution and the contents of the output folder is then taken to be the result of the YTT transform.
If on the other hand the
ytt process completes with a non 0 exit code; the execution of the
YTT transform is considered to have failed and an exception is raised.
If all you want to do in your accelerator is excute
ytt on the contents of the entire accelerator repo you can just use the 'YTT' transform as your only transform in the engine declaration.
accelerator: ... engine: type: YTT
Note however that if you want to do anything extra beyond simply calling YTT then you will need to compose YTT into your accelerator flow using merge and/or chain combinators. This is exactly the same as composing any other type of transform.
For example, if you wanted to define some derived symbols as well as merge the results from YTT with results from other parts of your accelerator transform, you could do as follows:
engine: let: # Define derived symbols visible to all transforms (including YTT) - name: theAnswer expression: "41 + 1" merge: - include: ["deploy/**.yml"] # select some yaml files to process with YTT chain: # Chain selected yaml files to YTT type: YTT - ... include/generate other stuff to be merged alongside yaml generated by YTT...
The above example uses a combination of Chain and Merge. But you can use either
Chain or both to compose YTT into your accelerator flow. Which one you choose depends on how you want to use YTT as part of your larger accelerator.
extraArgs field can be used to pass additional commandline arguments to YTT. This can, amongst other things, be used to add file marks.
For example, the following runs YTT and renames
foo/demo.yml file in its output to
engine: type: YTT extraArgs: ["'--file-mark'", "'foo/demo.yml:path=bar/demo.yml'"]
Note that the
extraArgs attribute expects SpEL expressions so you must take care to use proper escaping of literal strings using double and single quotes (i.e. `"'literal-string'").