-
Notifications
You must be signed in to change notification settings - Fork 72
/
intent.go
47 lines (37 loc) · 1.77 KB
/
intent.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package v1
type Type string
const (
Kubernetes Type = "Kubernetes"
Terraform Type = "Terraform"
)
const (
// ResourceExtensionGVK is the key for resource extension, which is used to
// store the GVK of the resource.
ResourceExtensionGVK = "GVK"
// ResourceExtensionKubeConfig is the key for resource extension, which is used
// to indicate the path of kubeConfig for Kubernetes type resource.
ResourceExtensionKubeConfig = "kubeConfig"
)
// Intent describes the desired state how the infrastructure should look like: which workload to run,
// the load-balancer setup, the location of the database schema, and so on. Based on that information,
// the Kusion engine takes care of updating the production state to match the Intent.
type Intent struct {
// Resources is the list of Resource this Intent contains.
Resources Resources `json:"resources" yaml:"resources"`
}
type Resources []Resource
// Resource is the representation of a resource in the state.
type Resource struct {
// ID is the unique key of this resource in the whole State.
// ApiVersion:Kind:Namespace:Name is an idiomatic way for Kubernetes resources.
// providerNamespace:providerName:resourceType:resourceName for Terraform resources
ID string `json:"id" yaml:"id"`
// Type represents all Runtimes we supported like Kubernetes and Terraform
Type Type `json:"type" yaml:"type"`
// Attributes represents all specified attributes of this resource
Attributes map[string]interface{} `json:"attributes" yaml:"attributes"`
// DependsOn contains all resources this resource depends on
DependsOn []string `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"`
// Extensions specifies arbitrary metadata of this resource
Extensions map[string]interface{} `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}