Hopr ytt Template Guide
A guide on how to use ytt Templates when configuring and deploying Hopr sidecars
Not sure what ytt is? Not sure how to use ytt templates? You've come to the right place!
- What is ytt?
- Installation of ytt
- Leveraging HOPR's ytt Template
ytt is an open source tool that is a part of the Carvel suite. It is a tool that understands YAML structure and can be used for templating, combining, and patching YAML content. ytt gives the ability to set values that you can use across configs, and also gives us (Hopr) the ability to make a standard configuration YAML available for our customers to utilize. While not necessary for installation of XTRA, it is a fast and convenient way of configuring the YAML files needed to run XTRA sidecar in your environment while eliminating the woes of text-based templating.
Side note: The artifacts in this guide show considerations for Kubernetes environments, but any container runtime or container orchestration environment can be used to deploy XTRA.
XTRA & ytt
In order to successfully deploy XTRA in your Kubernetes environment, there are Kubernetes manifest that has to be setup in your Kubernetes cluster. Those manifest include: namespace configuration, envoy configmap configuration, docker configuration file secret, hopr license secret, persistent maid volume, XTRA deployment manifest, as well as, services and communication endpoints configurations.
This can be overwhelming for even the most seasoned configuration veterans.
In comes ytt templating
ytt templates allows you to use our premade configuration files with values you set that are specific to your environment.
Example: Creating a namespace for your Kubernetes cluster
HOPR will provide you with a ytt template that looks like:
You will be able to set the name of the namespace by replacing the value for namespace in the vars file, that looks like:
In order to use ytt templates, ytt has to be installed in your environment.
Installation of ytt is straightforward:
You can access install scripts provided by Carvel available for all Carvel Tools.Note: The following command will install Carvel's suite of tools.
You can also access specific downloads on their GitHub page:
Note: For our purposes, you will only need to install ytt.
For more information on ytt installation, visit Carvel's ytt page [here].(https://carvel.dev/ytt/docs/v0.44.0/install/)
Once you have installed ytt, you can start leveraging HOPR's ytt template.
Leveraging Hopr's ytt Template
HOPR's ytt template can be found here:
Verify you have a templ.yaml file and a vars file:
Example: hopr-p2p.templ.yaml and vars.yaml
The templ.yaml file is created by HOPR and can be leveraged by setting values specific to your environment in the vars.yaml file
A vars.yaml file
Once the vars.yaml file is set, run the following command to output the YAML files for your XTRA deployment:
This can be paired with the kubectl apply command to apply the YAML files directly to your Kubernetes cluster: