-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CUE to describe a Definition #1697
Comments
Everyone is familiar with the yaml section.
This is a ComponentDefinition of Terraform OSS, currently it has nothing to do with CUE. apiVersion: core.oam.dev/v1alpha2
kind: ComponentDefinition
metadata:
name: alibaba-oss
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud OSS object
type: terraform
spec:
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
schematic:
terraform:
configuration: |
resource "alicloud_oss_bucket" "bucket-acl" {
bucket = var.bucket
acl = var.acl
}
output "BUCKET_NAME" {
value = "${alicloud_oss_bucket.bucket-acl.bucket}.${alicloud_oss_bucket.bucket-acl.extranet_endpoint}"
}
variable "bucket" {
description = "OSS bucket name"
default = "vela-website"
type = string
}
variable "acl" {
description = "OSS bucket ACL, supported 'private', 'public-read', 'public-read-write'"
default = "private"
type = string
} |
It is good idea that Use cue to manage the definition through the command line Solution 1:
Solution 2:
|
@wonderflow , @zzxwill follow up comments regarding to your thoughts on Terraform components:
Yes, exactly. All components, traits, workflow steps should be CUE modules, and I don't even think a K8s entity wrapper is needed for X-Definitions (could be fixed later of course). Also, I don't think embedding HCL in I noticed this issue is still focusing on |
There have been some offline discussion I had with @Somefive . Let me sum it up here:
|
Background
Currently, the Definition object is a pure YAML file but blended with CUE raw string:
https://github.com/oam-dev/kubevela/blob/b124873fd73b8c1ca02a351fc8d4dbb2ee00fca1/charts/vela-core/templates/defwithtemplate/webservice.yaml#L2-L19
This is not very user-friendly. We shouldn't let user write such YAML.
Proposal
We should use CUE to describe a Definition, and then provide CLI tool to parse them into k8s object.
Here's an example. In user's IDE, a definition would be a folder:
kube.cue
would look like:schema.cue
would look like:Then provide CLI or script to blend them together to generate definition object.
The text was updated successfully, but these errors were encountered: