YART - Yet Another Random Templater

Hi all,
in my current role as platform engineer for the Hamburg Port Authority we need to keep the velocity high to provide a good service for our internal clients. As result most of our infrastructure is created through templates in any way.

To get things up and running we developed a simple templater written in python with all required bindings towards jinja and kept expanding it. Naturally we expanded it without a direct scope and focus on reusability. Things needed to be done and it should work.
With growing struggle the need of a new templater arose. The idea of a new clean approach came up.



Let me present you: YART - yet another random templater

A simple but extensive templating tool for multiple needs.
YART provides you a useful schema validation for your input data to keep it free of issues and also an option to create a dynamic template structure based on your input.

Most specific for this tool may be the dynamic generation of folders based on your template.
It allows you to duplicate a specific structure multiple times.
Lets assume the following usecase.
You need to configure multiple clusters at once within an repository.
Each cluster contains multiple services which require a value configuration.
To ease up the installation you split all dedicated values within a folder named after the service.
The resulting folder structure may look like the following listing.

1
2
3
4
clusters
└── $name
├── externaldns
└── mailhog

As configuration we are going to assume you want to template the following values onto your manifests.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
clusters:
- name: happy-path-cluster
defaults:
storageClass: "storageclass-happy-path-cluster"
serviceUri: "happy-path-cluster.corp.local"
serviceCatalog:
externalDns:
powerdnsApiKey: "myAwesomeKey"
domainFilter:
- uri: "*.subdomain.corp.local"
- uri: "*.sub.corp.local"
mailhog:
uri: "mailhog"
- name: happier-path-cluster
defaults:
storageClass: "storageclass-cluster"
serviceUri: "happier-path-cluster.corp.local"
serviceCatalog:
externalDns:
powerdnsApiKey: "myAwesomeKey"
domainFilter:
- uri: "*.subdomain.corp.local"
- uri: "*.sub.corp.local"
mailhog:
uri: "mailhog-awesomesauce"

Based on this configuration the result looks like the following listing

1
2
3
4
5
6
7
clusters
├── happier-path-cluster
│ ├── externaldns
│ └── mailhog
└── happy-path-cluster
├── externaldns
└── mailhog

The templated files could now easily picked up by your gitops tools and applied to the individual clusters.
This example is also available as code block wihtin the YART Repository.

A wider exaplaination of all features is also available within the README.MD within the repository.

Through the implementation of YART we were able to solve multiple issues with our current template approach and installed a flexable and dynamic way to create our clusters and deployment configuration with ease.