Kapitan Blog
Published in

Kapitan Blog

Kapitan — Using Ytt as input

tl;dr: https://github.com/ulyssescb/kapitan-ytt

Kapitan

Is a tool to put all the configuration management hell in a box throwing the key away so you always can get the happy path.

Okay, this might be not true and I’m overreacting. There’s no happy path when the matter is managing configuration of hundreds, possible thousands of configuration files in many of the Domain Specific Languages (DLS) and Data Template Language (DTL (?)). But for sure, this is a tool that will help us.

Kapitan is the tool to help you manage the complexity of your configuration using an inventory and a choice of templates.

kapitan.dev

Learn it:

Ytt

Yet (another) Templating Tool ? It’s a template tool although I don’t think it’s only another one.

We’re tired of knowing that computers like JSON but we, only humans, don’t. We just can’t easily read it, doesn’t matter how senior you are, really. To help us, only humans, there is a more human friendly superset of it, theYAML.

ytt (pronounced spelled out) is a templating tool that understands YAML structure. It helps you easily configure complex software via reusable templates and user provided values.

carvel ytt

Learn it:

What?

Right now, ytt isn’t a input_type in Kapitan. Don’t you worry, it’s totally possible to use it and leverage all of its feature.

Why?

Assuming that’s very important to keep only one source of truth for the variables, not having Ytt data valuesand Kapitan inventory as separated entities, make sense to delegate this responsibility to Kapitan.

How?

Kapitan’s external input_type executes a local script or binary, meaning: it’s possible to combine both tools in a ‘transparent’ interface by manipulating and compiling the right files in the right paths.

The ytt/inventory.yml component it’s only a jinja template to create a values file.

A class to actually run the binary:

Another one to handle the inventory generation:

An abstraction of input method:

And finally a class to be included in targets:

Pretty simple, right? Now we’re able to use ytt and kapitan as one!

Want to see it running? https://github.com/ulyssescb/kapitan-ytt

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store