4 ms·
KCL, a constraint-based functional language for configuration
- hosh 2y agoThere was that other long thread about using a general purpose language to generate Kubernetes manifests. However, just looking at this briefly, this may have all the features I care about from general-purpose languages. Although it looks like it is a better replacement for HCL (Terraform), I'm thinking this may end up working better than Helm.
- hbogert 2y agoHave you seen timoni? it ticks all my boxes. It uses cuelang which admittedly is a steeper learning curve, but o boi, its conceptual model is so nice once it 'clicks' https://timoni.sh/ https://timoni.sh/
- aliasxneo 2y agoWe've been using Timoni in production for six months now. What a breath of fresh air (and sanity) coming from Helm. It's not perfect, but I'll take immature imperfections (that are improving by the month) over the YAML/Go templating nightmare that is Helm.
- hosh 2y agoI have not. However, looking at it now, it falls into the same problems all template generators have. Those are things solved by using general purpose languages generate rather than templating manifests. KCL is in the middle ground. The Ruby mixins I can use for manifest generation can has an equivalence with KCL's union. I can see Timoni's appeal as it looks like an improvement over Helm and integrates building artifacts.
- hbogert 2y agoOh, now I'm eager to now why you think KCL is middle ground, but cuelang and timoni are not. What is inherent to KCL that is so powerful that you can not due in CUE?
- evanjrowley 2y agoHow does this compare with Nickel?
- kirmerzlikin 2y agoHere's what KCL authors say about it themselves https://www.kcl-lang.io/docs/user_docs/getting-started/intro#vs-nickel https://www.kcl-lang.io/docs/user_docs/getting-started/intro...
- jeffrallen 2y agohttps://xkcd.com/927/ https://xkcd.com/927/
- from-nibly 2y ago> KCL's automatic merge mechanism for isolated configuration blocks promotes high scalability. This part scares me a bit. How does it merge? In cuelang, everything has to agree otherwise it's an error. If KCL has a situation where one file can override another, I'm out. That gets way too hairy way too fast. Edit: data0 = {id: 1} | {id: 2} # Error:conflicting values between {'id': 2} and {'id': 1} data1 = {id: 1} | {id = 2} # Ok, the value of `data` is {"id": 2} There are the foot guns
- drdaeman 2y agonixpkgs.lib has mkDefault/mkForce/mkOverride system (which I'm not a fond of because of the poor type system, but at least it works) that feels like a better approach than this weirdness.
- soraminazuki 2y agoThe Nixpkgs module system that you're describing does have types though. The whole purpose of that system is to attach types and documentation to data.
- drdaeman 2y agoUnless I'm misunderstanding how it all works, it's just attrsets underneath. Like JSON objects with some semantics given to them - and those (and their YAML counterparts) are not exactly great. In particular, I believe (I could be wrong here) this results in sometimes hard-to-understand error traces if something gets messed up.
- soraminazuki 2y agoThe module system type checks each attribute in a attrset. It merges all modules, ensures there are no conflicts, type checks and returns the resulting attrset. Error messages indicate the offending option definition along with its location in the case of conflicts or type errors, which should be enough for enough for debugging.
- jiggawatts 2y agoComparison with YAML, Jsonnet, HCL, CUE, Dhall, Nickel, Helm, etc... here: https://www.kcl-lang.io/docs/user_docs/getting-started/intro#how-to-choose https://www.kcl-lang.io/docs/user_docs/getting-started/intro...