Skip to content

Commit

Permalink
refactor: use project&stack types in core v1 pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
adohe committed Dec 21, 2023
1 parent 0413e0c commit 076297b
Show file tree
Hide file tree
Showing 87 changed files with 941 additions and 2,447 deletions.
25 changes: 25 additions & 0 deletions pkg/apis/core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ type (
MonitorType string
)

const (
KCLBuilder BuilderType = "KCL"
AppConfigurationBuilder BuilderType = "AppConfiguration"
PodMonitorType MonitorType = "Pod"
ServiceMonitorType MonitorType = "Service"
)

// Project is a definition of Kusion Project resource.
//
// A project is composed of one or more applications and is linked to a Git repository,
Expand All @@ -18,8 +25,17 @@ type Project struct {
// Labels is the list of labels that are assigned to this project.
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

// Path is a directory path within the Git repository.
Path string `json:"path,omitempty" yaml:"path,omitempty"`

// Generator controls how to generate the Intent.
Generator *GeneratorConfig `json:"generator,omitempty" yaml:"generator,omitempty"`

// Prometheus configs
Prometheus *PrometheusConfig `json:"prometheus,omitempty" yaml:"prometheus,omitempty"`

// The set of stacks that are known about this project.
Stacks []*Stack `json:"stacks,omitempty" yaml:"stacks,omitempty"`
}

// GeneratorConfig holds the intent generation configurations defined in Project resource.
Expand All @@ -30,6 +46,12 @@ type GeneratorConfig struct {
Configs map[string]interface{} `json:"configs,omitempty" yaml:"configs,omitempty"`
}

// PrometheusConfig represent Prometheus configs saved in project.yaml
type PrometheusConfig struct {
OperatorMode bool `yaml:"operatorMode,omitempty" json:"operatorMode,omitempty"`
MonitorType MonitorType `yaml:"monitorType,omitempty" json:"monitorType,omitempty"`
}

// Stack is a definition of Kusion Stack resource.
//
// Stack provides a mechanism to isolate multiple deploys of same application,
Expand All @@ -43,4 +65,7 @@ type Stack struct {
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
// Labels is the list of labels that are assigned to this stack.
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`

// Path is a directory path within the Git repository.
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}
185 changes: 0 additions & 185 deletions pkg/apis/project/project.go

This file was deleted.

0 comments on commit 076297b

Please sign in to comment.