News for hackers. Stuff that matters.
Re:Validating Kubernetes YAML for best practice and policies by Znafon on Sunday August 09, 2020 @10:58AM (#24100015)
> Why are so few configuration languages not backed by a real language?

In many cases, not having a full featured language is helpful as you have some additional guarantees that comes with a non Turing complete language like guaranteed completion.

In some cases though, you do need a full pledged programming language. For those cases, HashiCorp recently announced CDK support for Terraform: https://www.hashicorp.com/blog/cdk-for-terraform-enabling-py...

Re:Validating Kubernetes YAML for best practice and policies by zelphirkalt on Sunday August 09, 2020 @11:32AM (#24100228)
You can bring that argument, but only until you decide to use YAML, instead of something declarative and simple like JSON.

Once you switch to something as powerful as YAML, you might as well reach for a real programming language.

Re:Validating Kubernetes YAML for best practice and policies by tyfon on Sunday August 09, 2020 @11:51AM (#24100369)
Also, YAML is kind of a hack.

Living in Norway I've had quite a few of these situations where no is parsed to False [1].

[1] https://hitchdev.com/strictyaml/why/implicit-typing-removed/

Re:Validating Kubernetes YAML for best practice and policies by ithkuil on Sunday August 09, 2020 @01:58PM (#24101477)
It has been fixed since yaml 1.2

That said, yeah :facepalm:

Re:Validating Kubernetes YAML for best practice and policies by ithkuil on Sunday August 09, 2020 @01:57PM (#24101464)
> powerful as yaml

Can you make an example of the power of yaml that makes it more like a programming language (in particular vs JSON)?

Re:Validating Kubernetes YAML for best practice and policies by riffraff on Sunday August 09, 2020 @02:04PM (#24101537)
not OP but: tags (custom data types), more builtin data types (dates etc), more syntax variations (heredocuments, multiple ways to write a string,a boolean, etc), comments, references+aliases.

The language is vast, and most people use it without knowing it.

I love YAML, but I wish there was a "strict&sane yaml subset".

Re:Validating Kubernetes YAML for best practice and policies by ithkuil on Sunday August 09, 2020 @03:37PM (#24102230)
All those are good examples of yaml complexity but none of that is anywhere near what even a simple programming language can unleash (variables, loops, functions, recursion etc)
Re:Validating Kubernetes YAML for best practice and policies by Znafon on Sunday August 09, 2020 @06:53PM (#24103641)
You can do recursion in YAML, and it ends badly: https://en.wikipedia.org/wiki/Billion_laughs_attack#Variatio...
Re:Validating Kubernetes YAML for best practice and policies by ithkuil on Monday August 10, 2020 @03:59AM (#24106706)
Recursion without termination doesn't produce a useful computation
Re:Validating Kubernetes YAML for best practice and policies by default-kramer on Sunday August 09, 2020 @11:08AM (#24100059)
Cool, I hadn't seen CDK for Terraform before. But doesn't this support my point? If they had just used Typescript from the start, they wouldn't have to add Typescript support later.

I suppose guaranteed completion matters if you are running untrusted code, but wouldn't sandboxing solve that? Are there any other guarantees that sandboxing wouldn't solve?

Re:Validating Kubernetes YAML for best practice and policies by Znafon on Sunday August 09, 2020 @11:19AM (#24100122)
> I suppose guaranteed completion matters if you are running untrusted code, but wouldn't sandboxing solve that? Are there any other guarantees that sandboxing wouldn't solve?

There is more benefits than just that, by restricting the possibilities you know there won't be unbounded loops, analysis and code review is easier (and infrastructure teams are often seriously lagging in this regard), it can be easier to maintain, update and test.

In some cases, you can have a project where this is seriously limiting though because you have some very complex and specific thing you need to express. For this you can use CDK. I would say both approach are complementary, not exclusive.

In my experience I would say nearly all infrastructure projects can be expressed as Terraform rather easily, but YMMV.

Re:Validating Kubernetes YAML for best practice and policies by rectang on Sunday August 09, 2020 @01:46PM (#24101356)
Can a config mechanism where shell commands are embedded as strings still be considered as offering these additional guarantees?

Perhaps certain things are easier: it's easier to parse, to isolate the code portions, and to read data portions. But then validating what's inside those code portions is a challenge.

It seems like there's an opportunity for a programming language purpose built for the task of configuration. Its chief feature would be the ability to provide a lot of information when read in "inert data" mode, yet also provide full programming language power when read in "run" mode.

ETA: Perhaps embed Python inside something similar to YAML, and support active code via a "lambda" type. Use indentation for delimiting.

   project: "Foo"
   version: "1.0.1"
   email: "[email protected]"
   load:
     lambda file_path:
       pass