You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that this has been talked about for a while, but I would like to formally make my proposal to use Dhall as our kubernetes yaml-templating solution. I have a working implementation to demonstrate as well, which can be found on the branch s-zeng/dhall_config. See below for more
Problem
Python, as a general purpose language, can often be not the most ergonomic language to write configurations in.
Our current process with mkchain.py involves quite a number of steps - we have a variety of existing yaml templates, which we consume as python data structures to edit a handful of them in place, and then spit everything back out as yaml again.
In particular, we have a main loop which involves looking through every yaml template, wherein we check each template for the appropriate name to apply a particular patch on. Essentially:
This style, in my opinion, obfuscates the relationship between the original templates and the logic that goes into adjusting them, and can make it hard to follow how the inputs become the final outputted yaml file.
Why Dhall
Unlike Python, Dhall is purpose-built as a configuration language, with a number of features designed specifically to this end. A few for summary:
Essentially JSON or YAML, but with functions
Strong types: Has a type system in the vein of ML/Haskell. Even has dependent types (!) if one is so inclined to go that far. Allows for much stronger guarantees about the structure of data
Pure and non-turing complete: unlike general-purpose languages, guarantees lack of IO, and guarantees termination. Dhall is a strongly-normalizing language, so every expression is guaranteed to normalize into a most-reduced form
Can output to always-correct JSON or YAML
Below are snippets from my prototype dhall implementation, along with comparisons to the original python if applicable.
main mkchain function (only have mkchain create implemented right now but should be trivial to implement invite:
With the introduction of optional zerotier containers and init containers present across the bootstrap nodes and the statefulset nodes from #42 , I feel that we've hit the limit of what Dhall is capable of. Until dhall-lang/dhall-haskell#2040 is merged, there simply is no ergonomic way to create generic helm charts with Dhall. While it is a nice and idealistic configuration paradigm, it is in a too immature state for our purposes right now. As such, closing until further notice.
I know that this has been talked about for a while, but I would like to formally make my proposal to use Dhall as our kubernetes yaml-templating solution. I have a working implementation to demonstrate as well, which can be found on the branch
s-zeng/dhall_config
. See below for moreProblem
Python, as a general purpose language, can often be not the most ergonomic language to write configurations in.
Our current process with
mkchain.py
involves quite a number of steps - we have a variety of existing yaml templates, which we consume as python data structures to edit a handful of them in place, and then spit everything back out as yaml again.In particular, we have a main loop which involves looking through every yaml template, wherein we check each template for the appropriate name to apply a particular patch on. Essentially:
This style, in my opinion, obfuscates the relationship between the original templates and the logic that goes into adjusting them, and can make it hard to follow how the inputs become the final outputted yaml file.
Why Dhall
Unlike Python, Dhall is purpose-built as a configuration language, with a number of features designed specifically to this end. A few for summary:
Below are snippets from my prototype dhall implementation, along with comparisons to the original python if applicable.
mkchain create
implemented right now but should be trivial to implementinvite
:The above can be used to output yaml with the following command:
Compared to python yaml template + if statement:
The text was updated successfully, but these errors were encountered: