4 ms·
Agreed on all counts, especially the central issue with nix and the properties that I'd want out of a replacement. I think CUE ( https://cuelang.org/ https://cu
by infogulch 2y ago
Agreed on all counts, especially the central issue with nix and the properties that I'd want out of a replacement. I think CUE ( https://cuelang.org/ https://cuelang.org/ ) is a perfect language for this.
- nine_k 2y agoCue is fun, but already the unification example (https://cuelang.org/docs/tour/basics/duplicate-fields/ https://cuelang.org/docs/tour/basics/duplicate-fields/) shouts "footguns" to me :( TS is certainly excessively powerful though.
- infogulch 2y agoI don't think this would be a problem in practice. By default structs are "open" in cue, i.e. as long as matching fields unify, disparate fields just merge. There are also "closed" structs that allow creating a definition that fails to unify with fields not explicitly listed. https://cuelang.org/docs/tour/types/closed/ https://cuelang.org/docs/tour/types/closed/
- from-nibly 2y agoWhat foot guns are you seeing specifically?
- nine_k 2y agoGo find a place where the struct value is clearly defined. It may seem that any definition is final, but none is. Since the last definition of a struct field overwrites a previous one, the order in which e.g. files are interpreted matters. It's like writing a config by using Python dicts, with the added complication that creation of a new one and updating of an existing one are indistinguishable. This may be okay in practice, given some discipline.
- from-nibly 2y agoNo it cant overwrite values. It has to agree or it will throw an error. You can have wider types being overridden by more closed types. e.g. string => "this literal". But you cant have two disagreeing values. I use this to create kubernetes manifests at work, at a reasonably large scale. The inability to join multiple files without fear of collision is specifically one of the best features.
- nine_k 2y agoHmm, looks better this way!
- Sadzeih 2y agoAs someone who works with Kubernetes every day and has been curious about CUE for some time, can you describe a bit how you're using it to create manifests? Did it replace helm for you? Or is it to create CRDs? Edit: I'm struggling to see where it fits in the whole k8s ecosystem.
- from-nibly 2y agoIt creates all the stuff that isnt in helm charts already for me. Im probably abusing it at the moment but ill see if I can make a gist and post the link. Bascally though I have a single massive package with a monolithic object. That goes env -> namespace -> resourceName -> resourceType -> resourceManifest. Then I have a tool file that loops through that and renders it into fall files. Then argocd picks that up in chunks with application files. Its awesome cause it lets me set project wide defaults and restrictions. It also lets me do stuff like. "If there is at least one manifest called x create an argocd application for it automatically" or " loop through these repos and create an app for each one with the following properties"