Skip to content
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

feat: update module grpc interface #887

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 45 additions & 45 deletions pkg/apis/core/v1/appconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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"`
Expand Down
26 changes: 17 additions & 9 deletions pkg/modules/proto/module.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions pkg/modules/proto/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading