Skip to content

Commit

Permalink
deploy job support update vars and service config (koderover#2340)
Browse files Browse the repository at this point in the history
* add basic production service logic

Signed-off-by: allenshen <[email protected]>

* fix error

Signed-off-by: allenshen <[email protected]>

* fix error

Signed-off-by: allenshen <[email protected]>

* fix error

Signed-off-by: allenshen <[email protected]>

* remove log

Signed-off-by: allenshen <[email protected]>

* add basic workflow api

Signed-off-by: allenshen <[email protected]>

* add basic logic for workload settings

Signed-off-by: allenshen <[email protected]>

* deploy job support update vars and service config

Signed-off-by: guoyu <[email protected]>

* add logic to support undeployed services

Signed-off-by: allenshen <[email protected]>

* fix error

Signed-off-by: allenshen <[email protected]>

* add service api

Signed-off-by: allenshen <[email protected]>

* add func definition

Signed-off-by: allenshen <[email protected]>

* add render service yaml logic

Signed-off-by: allenshen <[email protected]>

* update render yaml logic

Signed-off-by: allenshen <[email protected]>

* fix

Signed-off-by: guoyu <[email protected]>

* add update deploy logic

Signed-off-by: allenshen <[email protected]>

* add update product deploy api

Signed-off-by: allenshen <[email protected]>

* remove useless code

Signed-off-by: allenshen <[email protected]>

* add service defination

Signed-off-by: allenshen <[email protected]>

* add deploy logic

Signed-off-by: allenshen <[email protected]>

* add authority config

Signed-off-by: allenshen <[email protected]>

* fix router config

Signed-off-by: allenshen <[email protected]>

* add debug log

Signed-off-by: allenshen <[email protected]>

* add log

Signed-off-by: allenshen <[email protected]>

* fix renderset find bug

Signed-off-by: allenshen <[email protected]>

* add production logic

Signed-off-by: allenshen <[email protected]>

* add policy defination

Signed-off-by: allenshen <[email protected]>

* add api logic

Signed-off-by: allenshen <[email protected]>

* add production evn logic

Signed-off-by: allenshen <[email protected]>

* add function defination

Signed-off-by: allenshen <[email protected]>

* add get service variable api

Signed-off-by: allenshen <[email protected]>

* fix service find bug

Signed-off-by: allenshen <[email protected]>

* fix service find bug

Signed-off-by: allenshen <[email protected]>

* fix create prod env bug

Signed-off-by: allenshen <[email protected]>

* fix data

Signed-off-by: allenshen <[email protected]>

* fix ingress not found bug

Signed-off-by: allenshen <[email protected]>

* add log

Signed-off-by: allenshen <[email protected]>

* update logs

Signed-off-by: allenshen <[email protected]>

* update logs

Signed-off-by: allenshen <[email protected]>

* remove logs

Signed-off-by: allenshen <[email protected]>

* fix get svc detail error

Signed-off-by: allenshen <[email protected]>

* fix get svc detail error

Signed-off-by: allenshen <[email protected]>

* fix test env create fail bug

Signed-off-by: allenshen <[email protected]>

* fix panic error

Signed-off-by: allenshen <[email protected]>

* fix panic error

Signed-off-by: allenshen <[email protected]>

* pre run job

Signed-off-by: guoyu <[email protected]>

* add filter

Signed-off-by: allenshen <[email protected]>

* add logs

Signed-off-by: allenshen <[email protected]>

* add logs

Signed-off-by: allenshen <[email protected]>

* fix get user variable error

Signed-off-by: allenshen <[email protected]>

* add deploy

Signed-off-by: guoyu <[email protected]>

* fix get current variable missing bug

Signed-off-by: allenshen <[email protected]>

* add logic to fetch service build modules

Signed-off-by: allenshen <[email protected]>

* add logic to fetch service build modules

Signed-off-by: allenshen <[email protected]>

* add logic to fetch service build modules

Signed-off-by: allenshen <[email protected]>

* fix envname query error bug

Signed-off-by: allenshen <[email protected]>

* fix envname query error bug

Signed-off-by: allenshen <[email protected]>

* fix envname query error bug

Signed-off-by: allenshen <[email protected]>

* fix namespace filter error

Signed-off-by: allenshen <[email protected]>

* add contianers param for workflows

Signed-off-by: allenshen <[email protected]>

* add kv to yaml api

Signed-off-by: allenshen <[email protected]>

* fix import issue

Signed-off-by: allenshen <[email protected]>

* fix fetch build

Signed-off-by: allenshen <[email protected]>

* run job

Signed-off-by: guoyu <[email protected]>

* fix transfer service fail bug

Signed-off-by: allenshen <[email protected]>

* support external env

Signed-off-by: guoyu <[email protected]>

* fix project transfer error bug

Signed-off-by: allenshen <[email protected]>

* job task preview

Signed-off-by: guoyu <[email protected]>

* add default deploy contents

Signed-off-by: guoyu <[email protected]>

* optimize the content of worloads fetched from env

Signed-off-by: allenshen <[email protected]>

* add default deploy contents

Signed-off-by: guoyu <[email protected]>

* fix bug

Signed-off-by: guoyu <[email protected]>

* add debug log

Signed-off-by: guoyu <[email protected]>

* add debug log

Signed-off-by: allenshen <[email protected]>

* add debug log

Signed-off-by: allenshen <[email protected]>

* update deployment deploy info

Signed-off-by: allenshen <[email protected]>

* fix get deployment yaml error

Signed-off-by: allenshen <[email protected]>

* fix get deployment yaml error

Signed-off-by: allenshen <[email protected]>

* init job when find workflow

Signed-off-by: guoyu <[email protected]>

* fix vars

Signed-off-by: guoyu <[email protected]>

* optimize code

Signed-off-by: allenshen <[email protected]>

* remove debug log

Signed-off-by: guoyu <[email protected]>

---------

Signed-off-by: allenshen <[email protected]>
Signed-off-by: guoyu <[email protected]>
Co-authored-by: allenshen <[email protected]>
Co-authored-by: guoyu <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2023
1 parent d364cff commit a9cf660
Show file tree
Hide file tree
Showing 11 changed files with 1,029 additions and 108 deletions.
8 changes: 8 additions & 0 deletions pkg/microservice/aslan/config/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ const (
SourceFromJob DeploySourceType = "fromjob"
)

type DeployContent string

const (
DeployImage DeployContent = "image"
DeployVars DeployContent = "vars"
DeployConfig DeployContent = "config"
)

type StageType string

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,26 @@ type JobTaskCustomDeploySpec struct {
}

type JobTaskDeploySpec struct {
Env string `bson:"env" json:"env" yaml:"env"`
ServiceName string `bson:"service_name" json:"service_name" yaml:"service_name"`
ServiceType string `bson:"service_type" json:"service_type" yaml:"service_type"`
ServiceModule string `bson:"service_module" json:"service_module" yaml:"service_module"`
SkipCheckRunStatus bool `bson:"skip_check_run_status" json:"skip_check_run_status" yaml:"skip_check_run_status"`
Image string `bson:"image" json:"image" yaml:"image"`
ClusterID string `bson:"cluster_id" json:"cluster_id" yaml:"cluster_id"`
Timeout int `bson:"timeout" json:"timeout" yaml:"timeout"`
ReplaceResources []Resource `bson:"replace_resources" json:"replace_resources" yaml:"replace_resources"`
RelatedPodLabels []map[string]string `bson:"-" json:"-" yaml:"-"`
Env string `bson:"env" json:"env" yaml:"env"`
ServiceName string `bson:"service_name" json:"service_name" yaml:"service_name"`
Production bool `bson:"production" json:"production" yaml:"production"`
DeployContents []config.DeployContent `bson:"deploy_contents" json:"deploy_contents" yaml:"deploy_contents"`
KeyVals []*ServiceKeyVal `bson:"key_vals" json:"key_vals" yaml:"key_vals"`
UpdateConfig bool `bson:"update_config" json:"update_config" yaml:"update_config"`
YamlContent string `bson:"yaml_content" json:"yaml_content" yaml:"yaml_content"`
ServiceAndImages []*DeployServiceModule `bson:"service_and_images" json:"service_and_images" yaml:"service_and_images"`
ServiceType string `bson:"service_type" json:"service_type" yaml:"service_type"`
CreateEnvType string `bson:"env_type" json:"env_type" yaml:"env_type"`
SkipCheckRunStatus bool `bson:"skip_check_run_status" json:"skip_check_run_status" yaml:"skip_check_run_status"`
ClusterID string `bson:"cluster_id" json:"cluster_id" yaml:"cluster_id"`
Timeout int `bson:"timeout" json:"timeout" yaml:"timeout"`
ReplaceResources []Resource `bson:"replace_resources" json:"replace_resources" yaml:"replace_resources"`
RelatedPodLabels []map[string]string `bson:"-" json:"-" yaml:"-"`
}

type DeployServiceModule struct {
ServiceModule string `bson:"service_module" json:"service_module" yaml:"service_module"`
Image string `bson:"image" json:"image" yaml:"image"`
}

type Resource struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,30 @@ type ServiceAndBuild struct {

type ZadigDeployJobSpec struct {
Env string `bson:"env" yaml:"env" json:"env"`
Production bool `bson:"production" yaml:"production" json:"production"`
DeployType string `bson:"deploy_type" yaml:"-" json:"deploy_type"`
SkipCheckRunStatus bool `bson:"skip_check_run_status" yaml:"skip_check_run_status" json:"skip_check_run_status"`
// fromjob/runtime, runtime 表示运行时输入,fromjob 表示从上游构建任务中获取
Source config.DeploySourceType `bson:"source" yaml:"source" json:"source"`
Source config.DeploySourceType `bson:"source" yaml:"source" json:"source"`
DeployContents []config.DeployContent `bson:"deploy_contents" yaml:"deploy_contents" json:"deploy_contents"`
// 当 source 为 fromjob 时需要,指定部署镜像来源是上游哪一个构建任务
JobName string `bson:"job_name" yaml:"job_name" json:"job_name"`
ServiceAndImages []*ServiceAndImage `bson:"service_and_images" yaml:"service_and_images" json:"service_and_images"`
Services []*DeployService `bson:"services" yaml:"services" json:"services"`
}

type DeployService struct {
ServiceName string `bson:"service_name" yaml:"service_name" json:"service_name"`
KeyVals []*ServiceKeyVal `bson:"key_vals" yaml:"key_vals" json:"key_vals"`
UpdateConfig bool `bson:"update_config" yaml:"update_config" json:"update_config"`
}

type ServiceKeyVal struct {
Key string `bson:"key" json:"key" yaml:"key"`
Value interface{} `bson:"value" json:"value" yaml:"value"`
Type ParameterSettingType `bson:"type,omitempty" json:"type,omitempty" yaml:"type"`
ChoiceOption []string `bson:"choice_option,omitempty" json:"choice_option,omitempty" yaml:"choice_option,omitempty"`
IsCredential bool `bson:"is_credential" json:"is_credential" yaml:"is_credential"`
}

type ServiceAndImage struct {
Expand Down
Loading

0 comments on commit a9cf660

Please sign in to comment.