3 ms·
Glad someone put in the effort for this. I wrote something that fills this econiche sometime last year in Ruby (https://github.com/matsuri-rb/matsuri https://g
by hosh 9y ago
Glad someone put in the effort for this.
I wrote something that fills this econiche sometime last year in Ruby (https://github.com/matsuri-rb/matsuri https://github.com/matsuri-rb/matsuri). Same ideas: mixins, generation of Kubernetes resources, etc. For better or worse, it also adds the idea of combining all the deployment environments into a single workflow and command line interface.
The big difference? Ksonnet is better documented and promoted, lighter-weight, and now better supported within the community.
- ithkuil 9y agocan 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.
- hosh 9y agoSorry, 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/89099f6f14ca5101e22c55f8d7f9e65d 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.
- jbeda 9y ago[OP here] Another goal here is to have something that is easy to embed/repurpose. ruby is pretty heavyweight from that point of view. While jsonnet is a C program right now (https://github.com/google/jsonnet https://github.com/google/jsonnet) we are looking at picking up work on a go port so it is easier to integrate with the kubernetes universe.
- hosh 9y agoLooking forward to seeing the go port!