Hacker News new | ask | show | jobs
by ithkuil 3316 days ago
can you point to some examples of this matsuri? I failed to figure out what it is from the link you pasted.

A nice thing about jsonnet is that is it's a native data templating language, you don't have to compose a structured data format with a textual template language and deal with things as trailing commas in json or indentation (!!!) in yaml.

It offers a sound model for extending and overriding values.

Another thing: it's a fully featured programming language, but it's purely functional so you are guaranteed that your templates won't have surprising side effects.

In this respect, the most similar alternative is the Nix functional language.

1 comments

Sorry, I don't have much in the way of examples. I am not using a textual template language. Instead, you define Ruby hashes which is then converted into either json (for loading into Kubernetes) or yaml (for debugging). It takes advantage of method overrides and class/module inheritance to achieve that. Specifications themselves are written as untyped, lazy-evaluated functional style. (Ruby being Ruby, it is not really immutable)

I just created a small example with redis: https://gist.github.com/hosh/89099f6f14ca5101e22c55f8d7f9e65...

That doesn't show off all of the features in there. There is a Rails-like convention so that resource definitions are loaded and can be referenced within each other. There are additional hooks that lets you generate `kubectl` commands, so for example, on our team, I defined hooks that lets me shell into a running container, or go directly to the console. (Redis, MongoDB, PostgreSQL, Rails, Rabbitmq, etc. consoles)

So yeah, Matsuri is very heavy-weight compared to Ksonnet. It isn't just that it is Ruby (already heavy-weight). Feature-wise, it does a lot more. I'm not sure that is a good or a bad thing.