diff --git a/pkg/apis/core/v1/appconfiguration.go b/pkg/apis/core/v1/appconfiguration.go index a34220c53..84c4000f5 100644 --- a/pkg/apis/core/v1/appconfiguration.go +++ b/pkg/apis/core/v1/appconfiguration.go @@ -20,61 +20,61 @@ type Accessory map[string]interface{} // import models.schema.v1.monitoring as m // import models.schema.v1.database as d // -// helloWorld: ac.AppConfiguration { -// # Built-in module -// workload: wl.Service { -// containers: { -// "main": c.Container { -// image: "ghcr.io/kusion-stack/samples/helloworld:latest" -// # Configure a HTTP readiness probe -// readinessProbe: p.Probe { -// probeHandler: p.Http { -// url: "http://localhost:80" -// } -// } -// } -// } -// } +// helloWorld: ac.AppConfiguration { +// # Built-in module +// workload: wl.Service { +// containers: { +// "main": c.Container { +// image: "ghcr.io/kusion-stack/samples/helloworld:latest" +// # Configure a HTTP readiness probe +// readinessProbe: p.Probe { +// probeHandler: p.Http { +// url: "http:localhost:80" +// } +// } +// } +// } +// } // -// # extend accessories module base +// # a collection of accessories that will be attached to the workload // accessories: { -// # Built-in module, key represents the module source -// "kusionstack/mysql@v0.1" : d.MySQL { -// type: "cloud" -// version: "8.0" -// } -// # Built-in module, key represents the module source -// "kusionstack/prometheus@v0.1" : m.Prometheus { -// path: "/metrics" -// } -// # Customized module, key represents the module source -// "foo/customize": customizedModule { -// ... -// } -// } +// # Built-in module, key represents the module source +// "kusionstack/mysql@v0.1.0" : d.MySQL { +// type: "cloud" +// version: "8.0" +// } +// # Built-in module, key represents the module source +// "kusionstack/prometheus@v0.1.0" : m.Prometheus { +// path: "/metrics" +// } +// # Customized module, key represents the module source +// "foo/customize@v0.1.0": customizedModule { +// ... +// } +// } // -// # extend pipeline module base -// pipeline: { -// # Step is a module -// "step" : Step { -// use: "exec" -// args: ["--test-all"] -// } -// } +// # pipeline modules +// pipeline: { +// # Step is a module +// "step" : Step { +// use: "exec" +// args: ["--test-all"] +// } +// } // -// # Dependent app list -// dependency: { -// dependentApps: ["init-kusion"] -// } -// } +// # dependent app list +// dependency: { +// dependentApps: ["init-kusion"] +// } +// } type AppConfiguration struct { // Name of the target App. Name string `json:"name,omitempty" yaml:"name,omitempty"` // Workload defines how to run your application code. Workload *workload.Workload `json:"workload" yaml:"workload"` // Accessories defines a collection of accessories that will be attached to the workload. - // The key in this map represents the module source. e.g. kusionstack/mysql@v0.1 - Accessories map[string]*Accessory `json:"accessories,omitempty" yaml:"accessories,omitempty"` + // The key in this map represents the module source. e.g. kusionstack/mysql@v0.1.0.0 + Accessories map[string]Accessory `json:"accessories,omitempty" yaml:"accessories,omitempty"` // Labels and Annotations can be used to attach arbitrary metadata as key-value pairs to resources. Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations,omitempty"` diff --git a/pkg/modules/proto/module.pb.go b/pkg/modules/proto/module.pb.go index 249f4932f..298179818 100644 --- a/pkg/modules/proto/module.pb.go +++ b/pkg/modules/proto/module.pb.go @@ -26,13 +26,20 @@ type GeneratorRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"` // Project represents the project name - Stack string `protobuf:"bytes,2,opt,name=stack,proto3" json:"stack,omitempty"` // Stack represents the stack name - App string `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` // App represents the application name, which is typically the same as the namespace of Kubernetes resources - Workload []byte `protobuf:"bytes,4,opt,name=workload,proto3" json:"workload,omitempty"` // Workload represents the workload configuration - DevModuleConfig []byte `protobuf:"bytes,5,opt,name=dev_module_config,json=devModuleConfig,proto3" json:"dev_module_config,omitempty"` // DevModuleConfig is the developer's inputs of this module - PlatformModuleConfig []byte `protobuf:"bytes,6,opt,name=platform_module_config,json=platformModuleConfig,proto3" json:"platform_module_config,omitempty"` // PlatformModuleConfig is the platform engineer's inputs of this module - RuntimeConfig []byte `protobuf:"bytes,7,opt,name=runtime_config,json=runtimeConfig,proto3" json:"runtime_config,omitempty"` // RuntimeConfig is the runtime configurations defined in the workspace config + // Project represents the project name + Project string `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"` + // Stack represents the stack name + Stack string `protobuf:"bytes,2,opt,name=stack,proto3" json:"stack,omitempty"` + // App represents the application name, which is typically the same as the namespace of Kubernetes resources + App string `protobuf:"bytes,3,opt,name=app,proto3" json:"app,omitempty"` + // Workload represents the v1.Workload defined in the AppConfiguration + Workload []byte `protobuf:"bytes,4,opt,name=workload,proto3" json:"workload,omitempty"` + // DevModuleConfig is the developer's inputs of this module + DevModuleConfig []byte `protobuf:"bytes,5,opt,name=dev_module_config,json=devModuleConfig,proto3" json:"dev_module_config,omitempty"` + // PlatformModuleConfig is the platform engineer's inputs of this module + PlatformModuleConfig []byte `protobuf:"bytes,6,opt,name=platform_module_config,json=platformModuleConfig,proto3" json:"platform_module_config,omitempty"` + // RuntimeConfig is the runtime configurations defined in the workspace + RuntimeConfig []byte `protobuf:"bytes,7,opt,name=runtime_config,json=runtimeConfig,proto3" json:"runtime_config,omitempty"` } func (x *GeneratorRequest) Reset() { @@ -116,13 +123,14 @@ func (x *GeneratorRequest) GetRuntimeConfig() []byte { return nil } -// GeneratorResponse represents the generate result of the generator +// GeneratorResponse represents the generate result of the generator. type GeneratorResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Resources [][]byte `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` // Project represents the project name + // Resources is a v1.Resource array, which represents the generated resources by this module. + Resources [][]byte `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` } func (x *GeneratorResponse) Reset() { diff --git a/pkg/modules/proto/module.proto b/pkg/modules/proto/module.proto index 328dd78ad..01b4ba97d 100644 --- a/pkg/modules/proto/module.proto +++ b/pkg/modules/proto/module.proto @@ -3,18 +3,26 @@ option go_package = "../proto"; // GeneratorRequest represents a request to generate something based on the project details message GeneratorRequest { - string project = 1; // Project represents the project name - string stack = 2; // Stack represents the stack name - string app = 3; // App represents the application name, which is typically the same as the namespace of Kubernetes resources - bytes workload = 4; // Workload represents the workload configuration - bytes dev_module_config = 5; // DevModuleConfig is the developer's inputs of this module - bytes platform_module_config = 6; // PlatformModuleConfig is the platform engineer's inputs of this module - bytes runtime_config = 7; // RuntimeConfig is the runtime configurations defined in the workspace config + // Project represents the project name + string project = 1; + // Stack represents the stack name + string stack = 2; + // App represents the application name, which is typically the same as the namespace of Kubernetes resources + string app = 3; + // Workload represents the v1.Workload defined in the AppConfiguration + bytes workload = 4; + // DevModuleConfig is the developer's inputs of this module + bytes dev_module_config = 5; + // PlatformModuleConfig is the platform engineer's inputs of this module + bytes platform_module_config = 6; + // RuntimeConfig is the runtime configurations defined in the workspace + bytes runtime_config = 7; } -// GeneratorResponse represents the generate result of the generator +// GeneratorResponse represents the generate result of the generator. message GeneratorResponse { - repeated bytes resources = 1; // Project represents the project name + // Resources is a v1.Resource array, which represents the generated resources by this module. + repeated bytes resources = 1; } service Module {