News for hackers. Stuff that matters.
Re:Why did Prolog lose steam? (2010) by nightowl_games on Wednesday April 19, 2023 @10:03AM (#35628267)
Can you elaborate on the flaws of Kubernetes YAML templating? Can you include a description of a better system?
Re:Why did Prolog lose steam? (2010) by infogulch on Wednesday April 19, 2023 @11:36AM (#35629517)
Re:Why did Prolog lose steam? (2010) by yuretz on Wednesday April 19, 2023 @11:51AM (#35629709)
Sure. Using things like loops and conditionals to stitch parts of the specification together is not a very declarative way to do things, imo. Regarding a better system I don't know, they all have their quirks, I guess. My point was that purely declarative approach has its limits and often times breaks when facing real world complexity.
Re:Why did Prolog lose steam? (2010) by ekimekim on Wednesday April 19, 2023 @12:19PM (#35630051)
Using a template to render out text that is then interpreted as something else (YAML in this case) is always fraught with quoting issues, complex workarounds, and for YAML specifically indentation issues.

You see the same thing with the C preprocessor - there's a very good reason that basically no language since has copied that design, and it's infamous for being full of footguns.

A far simpler and more manageable solution is to generate the same data structure (the final manifest) in a language which can actually represent those data structures directly. That might be a dedicated language like Cue or Jsonnet, or it could just be a general purpose programming language. You can generate the data structure using whatever tools you like, and then render it to JSON or YAML to be consumed by whatever tool is uploading it to kubernetes (kubectl apply, helm, etc).

Re:Why did Prolog lose steam? (2010) by mst on Wednesday April 19, 2023 @01:39PM (#35631013)
Using textual templating to generate a whitespace sensitive language is a massive footgun - I wouldn't want to try and generate python that way either.

It looks like you can plugin in your own templating script to the helm stuff though, I was thinking that something like https://yglu.io could retain the essential YAML-ness for comprehensibility to others while not being completely ridiculous like using a text templating system is.

Re:Why did Prolog lose steam? (2010) by rad_gruchalski on Wednesday April 19, 2023 @08:07PM (#35634848)
You take something with a structure (yaml) and covert into something without a structure.

Jsonnet is one of the alternatives.