ytt
templates are plain YAML documents made from nodes - for example, maps and arrays. ytt
allows you to set values and use programming logic (such as if statements and for loops) on those nodes. This eliminates text insertion concerns like manual escaping and allows for easy structure reuse.
To get a feel for how ytt
works, you can play with it in the interactive playground. There are examples there (organized by topic) so that you can familiarize yourself with ytt
's key features.
Finally, ytt
guarantees that templates produce identical output with the same inputs. This works because the ytt
execution environment is airtight and protected from outside influences, with no access to the filesystem, network, time, randomness, or operating system interfaces.
chmod +x manuscript/define-deploy-dev/carvel-ytt.sh
./manuscript/define-deploy-dev/carvel-ytt.sh
ls -1 ytt/resources
cat ytt/resources/deployment.yaml
cat ytt/resources/service.yaml
cat ytt/resources/ingress.yaml
cat ytt/schema.yaml
cat ytt/values-dev.yaml
yq --inplace ".image.tag = \"$TAG\"" ytt/values-dev.yaml
cat ytt/values-dev.yaml
ytt --file ytt/schema.yaml --file ytt/resources \
--data-values-file ytt/values-dev.yaml \
| tee yaml/dev/app.yaml
kubectl --namespace dev apply --filename yaml/dev
echo "http://cncf-demo-dev.$DOMAIN"
# Open it in a browser
- If you chose
kbld
to build images, then with one command you can usekbld
to build the images, push them to a registry, and modify the manifests with image SHAs. Next usekubectl
to apply the manifests generated bykbld
.