Resources
Kusion uses Spec to manage resource specifications. A Kusion resource is a logical concept that encapsulates physical resources on different resource planes, including but not limited to Kubernetes, AWS, AliCloud, Azure and Google Cloud.
Kusion Resources are produced by Kusion Module Generators and usually map to a physical resource that can be applied via a Kusion Runtime.
Runtimesโ
Runtimes is the consumer of the resources in a Spec by turning them into actual physical resources in infrastructure providers.
Currently there are two in-tree runtimes defined in the Kusion source code but we are planning to make them out-of-tree in the future:
- Kubernetes, used to manage resources inside a Kubernetes cluster. This can be any native Kubernetes resources or CRDs (if you wish to manage infrastructures via CrossPlane or Kubevela, for example, this is completely doable by creating a Kusion Module with a generator that produces the resource YAML for the relevant CRDs)
- Terraform, used to manage infrastructure resources outside a Kubernetes cluster. Kusion uses Terraform as an executor that can manage basically any infrastructure given there is a terraform provider tailored for the infrastructure API. This is generally used to manage the lifecycle of infrastructure resources on clouds, no matter public or on-prem.
Resource Planesโ
Resource Plane is a property of a Kusion resource. It represents the actual plane on which the resource exists. Current resource planes include kubernetes
,aws
,azure
,google
,alicloud
,ant
and custom
.
Resource ID, Resource URN and Cloud Resource IDโ
Kusion Resource ID is a unique identifier for a Kusion Resource within a Spec. It must be unique across a Spec. The resource ID is technically generated by module generators so there are no definite rules for producing a Kusion Resource ID. The best practice is to use the KubernetesResourceID()
and TerraformResourceID()
method from kusion-module-framework to manage Kusion Resource IDs. You can use the official module generators as a reference.
'''tip
Resource ID validations do exist.
For Kubernetes resources, the resource ID must include API version, kind, namespace (if applicable) and name.
For Terraform resources, the resource ID must include provider namespace, provider name, resource type and resource name.
It's always recommended to use the KubernetesResourceID()
and TerraformResourceID()
method from kusion-module-framework to produce the Resource IDs.
'''
Kusion Resource URN is used to uniquely identify a Kusion Resource across a Kusion server instance. It consists of ${project-name}:${stack-name}:${workspace-name}:${kusion-resource-id}
to ensure global uniqueness.
Cloud Resource ID is used to map to an actual resource on the cloud. For AWS and Alicloud, this is usually known as the resource ARN
on the cloud. For Azure and Google Cloud, this is known as the Resource ID. It can be empty in some cases, for example, a Kubernetes resource does not have cloud resource ID.
Resource Graphsโ
A Resource Graph visualizes the relationship between all resources for a given stack. In the Kusion developer portal, you can inspect the resource graph by clicking on the Resource Graph
tab on the stack page:
You can closely inspect the resource details by hovering over the resource node on the graph.