Skip to content

Commit

Permalink
refactor: workload, port and secret according to the new appConfig model
Browse files Browse the repository at this point in the history
the way of using namespace isn't changed and marked it as a todo
  • Loading branch information
SparkYuan committed Feb 26, 2024
1 parent d6e4ce4 commit c60d53c
Show file tree
Hide file tree
Showing 80 changed files with 555 additions and 11,459 deletions.
81 changes: 81 additions & 0 deletions pkg/apis/core/v1/appconfiguration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package v1

import (
"kusionstack.io/kusion/pkg/apis/core/v1/workload"
)

type Accessory map[string]interface{}

// AppConfiguration is a developer-centric definition that describes how to run an App. The application model is built on a decade
// of experience from AntGroup in operating a large-scale internal developer platform and combines the best ideas and practices from the
// community.
//
// Note: AppConfiguration per se is not a Kusion Module
//
// Example:
// import models.schema.v1 as ac
// import models.schema.v1.workload as wl
// import models.schema.v1.workload.container as c
// import models.schema.v1.workload.container.probe as p
// 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"
// }
// }
// }
// }
// }
//
// # extend accessories module base
// 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 {
// ...
// }
// }
//
// # extend pipeline module base
// pipeline: {
// # Step is a module
// "step" : Step {
// use: "exec"
// args: ["--test-all"]
// }
// }
//
// # 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"`
// 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"`
}
80 changes: 0 additions & 80 deletions pkg/apis/core/v1/appconfiguration/appconfiguration.go

This file was deleted.

Loading

0 comments on commit c60d53c

Please sign in to comment.