View on GitHub

yaml-overlay-tool

Use JSONPath to query & patch YAML files with ease.

Back to Table of contents

Installation and setup

Manual install

Download the latest binary

wget

Use wget to download the pre-compiled binaries:

wget https://github.com/vmware-tanzu-labs/yaml-overlay-tool/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
  tar xz && mv ${BINARY} /usr/bin/yot

For instance, VERSION=v0.3.1 and BINARY=yot_${VERSION}_linux_amd64

MacOS / Linux via Homebrew install

Using Homebrew

brew tap vmware-tanzu-labs/tap
brew install yot

Linux snap install

snap install yaml-overlay-tool

NOTE: yot installs with strict confinement in snap, this means it doesn’t have direct access to root files. To read root files you can:

sudo cat /etc/myfile.yaml | yot -i -

And to write to a root file you can either use sponge:

sudo cat /etc/myfile.yaml | yot -s -i - | sudo sponge /etc/myfile.yaml

or write to a temporary file:

sudo cat /etc/myfile.yaml | yot -s -i  | sudo tee /etc/myfiletmp.yaml
sudo mv /etc/myfiletmp.yaml /etc/myfile.yaml

Docker image pull

docker pull ghcr.io/vmawre-tanzu-labs/yot

One-shot container use

docker run --rm -v "${PWD}":/workdir ghcr.io/vmware-tanzu-labs/yot [flags]

Run container commands interactively

docker run --rm -it -v "${PWD}":/workdir --entrypoint sh ghcr.io/vmawre-tanzu-labs/yot

It can be useful to have a bash function to avoid typing the whole docker command:

yot() {
  docker run --rm -i -v "${PWD}":/workdir ghcr.io/vmware-tanzu-labs/yot "$@"
}

Go install

GO111MODULE=on go get github.com/vmware-tanzu-labs/yaml-overlay-tool/cmd/yot

Back to Table of contents
Next Up: Configuration file