-
Originally opened by @cedricgc in cuelang/cue#431 CUE as a general data configuration language has potential wherever humans define data. The use case we see the most interest though, is with CUE as the language to define software infrastructure (Infrastructure as Code). With the rise of cloud computing, organizations now have to contend with much of their infrastructure as abstract resources represented as data. Kubernetes extends this idea to the application layer with its own resource model. The end result is that cloud-native software organization has a large scale, complex configuration problem as described in my previous essay. CUE has specific properties that are well suited for solving this new challenge: CUE is designed for large scale configurationCUE deliberately opts for the graph unification model used in computational linguistics instead of the traditional inheritance model. A language definition can be thought of as a massive configuration spanning hundreds of thousands of lines of code. In the future, we will look at software infrastructure in the same way: a complex, tightly interconnected graph of resources that describes an organization's entire computing environment. In that scenario, the ability to understand a configuration worked on by engineers across a whole company and to safely change a value that modifies thousands of objects in a configuration goes from nice-to-have to essential. CUE supports first-class code generation and automationA design goal of CUE is to have code that is straightfoward for humans to write, but is also simple for machines to generate. An important facet of configuration is bridging the gap between data written in many different formats by both humans and machines. This means that CUE can integrate with existing tools and workflows naturally while other tools would have to build complex custom solutions. For example, CUE can generate Kubernetes definitions from Go code and OpenAPI schemas and immediately work with resources directly or build higher level libraries. CUE's scripting layer is also a critical component for integrating with IaC tools. CUE the language can be the best interface for developers to define data, but scripting is the glue that lets us build full automation workflows. For example, with scripting we can create a workflow that exports CUE configurations as JSON/YAML then push to Kuberenetes through CUE integrates well with Go, the language of cloud toolingGo is the language of choice for infrastructure tools such as Kubernetes and Terraform. CUE is also implemented in and exposes a rich client API in Go. This leads to opportunities for tight integration with IaC tools. This ranges from the straightforward, like generating CUE libraries for even third party Terraform plugins (written in Go) to leveraging data constraint features in Kubernetes natively in controllers for policy enforcement, etc. CUE shares many of the same design philosophies as Go and can be natural fit for Go developers who need a good way to handle data constraint problems. Next StepsInfrastructure as Code is not something that is core to the CUE language itself, but has the opportunity to be a killer use case that drives adoption and grows the community. CUE offers a great interface to describing complex data for humans and can be the layer of automation that is missing in developer workflows. For CUE, having such a wide reaching use case (anybody using cloud computing or declarative infrastructure can benefit from this) can drive investment in CUE tooling and libraries that are necessary in the long term for healthy adoption. I want this thread to be a hub point for discussion about we as a community approach this space and techniques we can use, no matter what the particular implementation looks like. There are many ways to tackle this problem and would benefit from early collaboration and knowledge sharing. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Original reply by @cedricgc in cuelang/cue#431 (comment) A more incremental approach would be to double down heavily on existing successful IaC tools, like Terraform and use CUE features to layer value on top. As I described above, CUE is well suited to wrapping existing tools by generating compliant JSON structures and having Terraform handle the rest. I think CUE would be a more powerful option than HCL at scale and we could also build automation to handle code and tool tasks like code linting and state file management. We can add value without having to compete with a tool directly. |
Beta Was this translation helpful? Give feedback.
-
Original reply by @cedricgc in cuelang/cue#431 (comment) I've been working on essay that describes what a next generation IaC tool would look like. Instead of waiting for the completed essay, I thought I would post some initial notes and get some early feedback and thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Original reply by @verdverm in cuelang/cue#431 (comment) @cedricgc just awesome! thank you for spending your time on this |
Beta Was this translation helpful? Give feedback.
-
Original reply by @jlongtine in cuelang/cue#431 (comment) @cedricgc There's some really good stuff in here. I'll try to take some time to digest and respond soon (might be after my vacation next week, though). We've got a pretty slick tool that we've been using at Gloo (gloo.us) for CloudFormation, and it gives And I think we're likely to work on a tool for generating Kubernetes manifests from CUE that will then be utilized by kubectl or ArgoCD, etc. for application to a cluster. This space is pretty exciting, honestly. Lots of good happening here. Talk soon! |
Beta Was this translation helpful? Give feedback.
-
Original reply by @cedricgc in cuelang/cue#431 (comment) I was pointed to the Kubernetesx project which has some good lessons for what we are trying to do. I like the focus on composition of resources: it closely follows how CUE can build types without inheritance. One thing I found interesting is that they can build encapsulated methods on those resources to do scoped transformations. For example: const deployment = new kx.Deployment(...);
const service = deployment.createService(); Here we can define a |
Beta Was this translation helpful? Give feedback.
Original reply by @cedricgc in cuelang/cue#431 (comment)
I've been working on essay that describes what a next generation IaC tool would look like. Instead of waiting for the completed essay, I thought I would post some initial notes and get some early feedback and thoughts: