Go templating is a powerful feature provided by the Go programming language that allows you to generate text output by replacing placeholders (variables) in a template with their corresponding values. It's a convenient way to generate dynamic content, including YAML files.
Helm, a package manager for Kubernetes, utilizes Go templating to generate Kubernetes manifest files from templates.
In this tutorial we'll see how we can use Go templating to replace values in a YAML file with values from another YAML file, similar to what Helm does.
$ make run
It will generate parsed/parsed.yaml
file as a result of replacing placeholders in template/template.yaml
with values coming from template/values.yaml
.
$ make test
$ make coverage