diff --git a/docs/sections/instructionsFileSpec.md b/docs/sections/instructionsFileSpec.md index 0ce2553..9e92816 100644 --- a/docs/sections/instructionsFileSpec.md +++ b/docs/sections/instructionsFileSpec.md @@ -27,7 +27,7 @@ Each list item in the `yamlFiles` key is treated as a dictionary/map with the fo | path | yes | A fully qualified path to the YAML file to modify, or a path relative to the location of the instructions file. Can be a path to a YAML file or a directory containing YAML files. | None | string | | overlays | no | List/array of overlay operations to apply. If your YAML file contains multiple documents separated by `---`, then this would apply to every YAML document first, unless a qualifier or combination of qualifiers `documentQuery` and `documentIndex` are provided. If you need to apply overlays only to a specific YAML document in a multi-document YAML file, then see the `documents` key. See [overlays keys](#overlays-keys) for available dictionary/map keys. | None | list/array of dictionaries | | documents | no | List/array of overlay operations to apply to a multi-document YAML file. When each document from a multi-document YAML file is loaded, an overlay can be applied by addressing the document by its index. See [documents keys](#documents-keys) for available dictionary/map keys. | None | list/array of dictionaries/maps | -| outputPath | no | Alters the output path for a YAML file or directory of YAML files. Absolute paths are not currently supported, and all paths are relative to the output directory specified by the `-o` or `--output-directory` flag.
1. If a filename is specified (must have a file extension), and the value of `path` is a single file (not a directory of files), this will alter the filename of the YAML file on output within the output directory specified by the `-o` or `--output-directory` flag. Example: `outputPath: newfilename.yaml`
2. If a new filename is proceded with a directory/directory structure in `outputPath` and the value of `path` is a single file, the directory structure will be created within the output directory specified by the `-o` or `--output-directory` flag. Example: `outputPath: newDir/anotherNewDir/newfilename.yaml`
3. If a directory/directory structure is specified in `outputPath`, the directory structure will be created within the output directory specified by the `-o` or `--output-directory` flag, and the original filename will be retained within the new `outputPath`. Example `outputPath: newDir/anotherNewDir` or `outputPath: newDir/anotherNewDir/`
4. If a directory is given with the `path` key, the value of `outputPath` will be treated as a new directory/directory structure within the output directory specified with by the `-o` or `--output-directory` flag. Example: `outputPath: newDir/anotherNewDir` or `outputPath: newDir/anotherNewDir`.
5. If you wish to change the output location for a single file that was within a `path` which was a directory, add an additional item to the `yamlFiles` array with the `path` to the file and desired `outputPath`. Yot uses the last listed `outputPath` for a given file for final output to the filesystem. | None | string | +| outputPath | no | Alters the output path for a YAML file or directory of YAML files. all paths are relative to the output directory specified by the `-o` or `--output-directory` flag or you can give an absolute path.
1. If a filename is specified (must have a file extension), and the value of `path` is a single file (not a directory of files), this will alter the filename of the YAML file on output within the output directory specified by the `-o` or `--output-directory` flag. Example: `outputPath: newfilename.yaml`
2. If a new filename is proceded with a directory/directory structure in `outputPath` and the value of `path` is a single file, the directory structure will be created within the output directory specified by the `-o` or `--output-directory` flag. Example: `outputPath: newDir/anotherNewDir/newfilename.yaml`
3. If a directory/directory structure is specified in `outputPath`, the directory structure will be created within the output directory specified by the `-o` or `--output-directory` flag, and the original filename will be retained within the new `outputPath`. Example `outputPath: newDir/anotherNewDir` or `outputPath: newDir/anotherNewDir/`
4. If a directory is given with the `path` key, the value of `outputPath` will be treated as a new directory/directory structure within the output directory specified with by the `-o` or `--output-directory` flag. Example: `outputPath: newDir/anotherNewDir` or `outputPath: newDir/anotherNewDir`.
5. If you wish to change the output location for a single file that was within a `path` which was a directory, add an additional item to the `yamlFiles` array with the `path` to the file and desired `outputPath`. Yot uses the last listed `outputPath` for a given file for final output to the filesystem. | None | string | ### `overlays` keys diff --git a/docs/sections/overlayQualifiers.md b/docs/sections/overlayQualifiers.md index befe070..f72d80c 100644 --- a/docs/sections/overlayQualifiers.md +++ b/docs/sections/overlayQualifiers.md @@ -28,9 +28,10 @@ The `documentQuery` key is a list/array which contains a list of the following t | Key | Description | Type | | --- | --- | --- | -| query | The key to search for within a YAML document expressed as a JSONPath query or dot-notation. | string | -| value | The value that the JSONPath query must return from one of the results of the `query` before an overlay action is applied to a document. | string | +| query | The key to search for within a YAML document expressed as a JSONPath query or dot-notation. (can accept multiple queries)| string | +| value | (optional) The value that the JSONPath query must return from one of the results of the `query` before an overlay action is applied to a document. | string | +***if value is not provided then the condition will return true if any results are found from the query*** #### documentQuery examples @@ -59,8 +60,19 @@ commonOverlays: - conditions: - query: kind value: Deployment - - query: metadata.labels.`app.kubernetes.io/name` + - query: metadata.labels.["app.kubernetes.io/name"] value: cool-app + + # With no Value, same conditions as above + commonOverlays: +- name: Change the namespace for all k8s Deployments with name label of cool-app + query: metadata.namespace + value: my-namespace + action: replace + documentQuery: + - conditions: + - query: $[?($.kind == "Deployment")] + - query: metadata.labels.[?(@.name == "cool-app")]` ``` The following example demonstrates use of multiple `documentQuery` groups. Any single one of these query/value conditions groups have to match within the YAML document prior to the overlay's application. Think of each group of conditions as "match this" or "match this" (implicit "or").