Documentation ¶
Index ¶
- Constants
- Variables
- func GetVolumeDir() (string, string)
- func RegisterWorker(name string, fun func([]byte, *exectorManager) (TaskWorker, error))
- type AppSnapshot
- type BackupAPPNew
- type BackupAPPRestore
- type Commit
- type Error
- type ExportApp
- type GarbageCollectionItem
- type ImageBuildItem
- type ImageShareItem
- type ImportApp
- type Info
- type Manager
- type MarketSlugItem
- type PluginShareItem
- type RegionServiceSnapshot
- type RestoreResult
- type ServiceCheckInput
- type ServiceCheckResult
- type ShareStatus
- type SlugShareItem
- type SourceCodeBuildItem
- func (i *SourceCodeBuildItem) IsDockerfile() bool
- func (i *SourceCodeBuildItem) Run(timeout time.Duration) error
- func (i *SourceCodeBuildItem) UpdateBuildVersionInfo(res *build.Response) error
- func (i *SourceCodeBuildItem) UpdateCheckResult(result *dbmodel.CodeCheckResult) error
- func (i *SourceCodeBuildItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
- type TaskWorker
- func BackupAPPNewCreater(in []byte, m *exectorManager) (TaskWorker, error)
- func BackupAPPRestoreCreater(in []byte, m *exectorManager) (TaskWorker, error)
- func NewExportApp(in []byte, m *exectorManager) (TaskWorker, error)
- func NewImportApp(in []byte, m *exectorManager) (TaskWorker, error)
- func SharePluginItemCreater(in []byte, m *exectorManager) (TaskWorker, error)
- type Worker
Constants ¶
const ( // OldMetadata identify older versions of metadata OldMetadata = "OldMetadata" // NewMetadata identify new version of metadata NewMetadata = "NewMetadata" )
Variables ¶
var ErrCallback = fmt.Errorf("callback task to mq")
ErrCallback do not handle this task
var MetricBackTaskNum float64
MetricBackTaskNum back task number
var MetricErrorTaskNum float64
MetricErrorTaskNum error run task number
var MetricTaskNum float64
MetricTaskNum task number
Functions ¶
func RegisterWorker ¶
func RegisterWorker(name string, fun func([]byte, *exectorManager) (TaskWorker, error))
RegisterWorker register worker creator
Types ¶
type AppSnapshot ¶
type AppSnapshot struct { Services []*RegionServiceSnapshot Plugins []*dbmodel.TenantEnvPlugin PluginBuildVersions []*dbmodel.TenantEnvPluginBuildVersion }
AppSnapshot holds a snapshot of your app
type BackupAPPNew ¶
type BackupAPPNew struct { WithImageData bool `json:"with_image_data"` GroupID string `json:"group_id" ` ServiceIDs []string `json:"service_ids" ` Version string `json:"version"` EventID string SourceDir string `json:"source_dir"` SourceType string `json:"source_type"` BackupID string `json:"backup_id"` BackupSize int64 Logger event.Logger ImageClient sources.ImageClient //full-online,full-offline Mode string `json:"mode"` S3Config struct { Provider string `json:"provider"` Endpoint string `json:"endpoint"` AccessKey string `json:"access_key"` SecretKey string `json:"secret_key"` BucketName string `json:"bucket_name"` } `json:"s3_config"` }
BackupAPPNew backup group app new version
func (*BackupAPPNew) ErrorCallBack ¶
func (b *BackupAPPNew) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*BackupAPPNew) GetLogger ¶
func (b *BackupAPPNew) GetLogger() event.Logger
GetLogger GetLogger
type BackupAPPRestore ¶
type BackupAPPRestore struct { //full-online,full-offline EventID string BackupID string `json:"backup_id"` TenantEnvID string `json:"tenant_env_id"` Logger event.Logger //RestoreMode(cdct) current datacenter and current tenantEnv //RestoreMode(cdot) current datacenter and other tenantEnv //RestoreMode(od) other datacenter RestoreMode string `json:"restore_mode"` RestoreID string `json:"restore_id"` ImageClient sources.ImageClient S3Config struct { Provider string `json:"provider"` Endpoint string `json:"endpoint"` AccessKey string `json:"access_key"` SecretKey string `json:"secret_key"` BucketName string `json:"bucket_name"` } `json:"s3_config"` // contains filtered or unexported fields }
BackupAPPRestore restrore the group app backup
func (*BackupAPPRestore) ErrorCallBack ¶
func (b *BackupAPPRestore) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*BackupAPPRestore) GetLogger ¶
func (b *BackupAPPRestore) GetLogger() event.Logger
GetLogger GetLogger
type Error ¶
type Error struct { Code uint `json:"code"` Msg string `json:"msg"` Details string `json:"details,omitempty"` }
Error Error
type ExportApp ¶
type ExportApp struct { EventID string `json:"event_id"` Format string `json:"format"` SourceDir string `json:"source_dir"` WithImageData bool `json:"with_image_data"` Logger event.Logger ImageClient sources.ImageClient }
ExportApp Export app to specified format(wutong-app or dockercompose)
func (*ExportApp) CleanSourceDir ¶
CleanSourceDir clean export dir
func (*ExportApp) ErrorCallBack ¶
ErrorCallBack if run error will callback
type GarbageCollectionItem ¶
type GarbageCollectionItem struct { TenantEnvID string `json:"tenant_env_id"` ServiceID string `json:"service_id"` EventIDs []string `json:"event_ids"` Cfg option.Config `json:"-"` }
GarbageCollectionItem -
func NewGarbageCollectionItem ¶
func NewGarbageCollectionItem(cfg option.Config, in []byte) (*GarbageCollectionItem, error)
NewGarbageCollectionItem creates a new GarbageCollectionItem
type ImageBuildItem ¶
type ImageBuildItem struct { Namespace string `json:"namespace"` TenantEnvName string `json:"tenant_env_name"` ServiceAlias string `json:"service_alias"` Image string `json:"image"` DestImage string `json:"dest_image"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` ImageClient sources.ImageClient TenantEnvID string ServiceID string DeployVersion string HubUser string HubPassword string Action string Configs map[string]gjson.Result `json:"configs"` Operator string `json:"operator"` }
ImageBuildItem ImageBuildItem
func (*ImageBuildItem) StorageVersionInfo ¶
func (i *ImageBuildItem) StorageVersionInfo(image string) error
StorageVersionInfo 存储version信息
func (*ImageBuildItem) UpdateVersionInfo ¶
func (i *ImageBuildItem) UpdateVersionInfo(status string) error
UpdateVersionInfo 更新任务执行结果
type ImageShareItem ¶
type ImageShareItem struct { string `json:"service_key" ` AppVersion string `json:"app_version" ` EventID string `json:"event_id"` ShareUser string `json:"share_user"` ShareScope string `json:"share_scope"` ImageInfo struct { HubURL string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` } `json:"share_info"` }ServiceKey
ImageShareItem ImageShareItem
func NewImageShareItem ¶
func NewImageShareItem(in []byte, imageClient sources.ImageClient, EtcdCli *clientv3.Client) (*ImageShareItem, error)
NewImageShareItem 创建实体
func (*ImageShareItem) ShareService ¶
func (i *ImageShareItem) ShareService() error
ShareService ShareService
func (*ImageShareItem) UpdateShareStatus ¶
func (i *ImageShareItem) UpdateShareStatus(status string) error
UpdateShareStatus 更新任务执行结果
type ImportApp ¶
type ImportApp struct { EventID string `json:"event_id"` Format string `json:"format"` SourceDir string `json:"source_dir"` Apps []string `json:"apps"` ServiceImage model.ServiceImage `json:"service_image"` Logger event.Logger // ContainerdCli export.ContainerdAPI ImageClient sources.ImageClient // contains filtered or unexported fields }
ImportApp Export app to specified format(wutong-app or dockercompose)
func (*ImportApp) ErrorCallBack ¶
ErrorCallBack if run error will callback
type Manager ¶
type Manager interface { GetMaxConcurrentTask() float64 GetCurrentConcurrentTask() float64 AddTask(*pb.TaskMessage) error SetReturnTaskChan(func(*pb.TaskMessage)) Start() error Stop() error GetImageClient() sources.ImageClient }
Manager 任务执行管理器
type MarketSlugItem ¶
type MarketSlugItem struct { TenantEnvName string `json:"tenant_env_name"` ServiceAlias string `json:"service_alias"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` Operator string `json:"operator"` DeployVersion string `json:"deploy_version"` TenantEnvID string `json:"tenant_env_id"` ServiceID string `json:"service_id"` Action string `json:"action"` TGZPath string Configs map[string]string `json:"configs"` SlugInfo struct { SlugPath string `json:"slug_path"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info"` }
MarketSlugItem MarketSlugItem
func NewMarketSlugItem ¶
func NewMarketSlugItem(in []byte) (*MarketSlugItem, error)
NewMarketSlugItem 创建实体
func (*MarketSlugItem) UpdateVersionInfo ¶
func (i *MarketSlugItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
UpdateVersionInfo 更新任务执行结果
type PluginShareItem ¶
type PluginShareItem struct { string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` }HubURL
PluginShareItem PluginShareItem
func (*PluginShareItem) ErrorCallBack ¶
func (i *PluginShareItem) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*PluginShareItem) GetLogger ¶
func (i *PluginShareItem) GetLogger() event.Logger
GetLogger GetLogger
type RegionServiceSnapshot ¶
type RegionServiceSnapshot struct { ServiceID string Service *dbmodel.TenantEnvServices ServiceProbe []*dbmodel.TenantEnvServiceProbe LBMappingPort []*dbmodel.TenantEnvServiceLBMappingPort ServiceEnv []*dbmodel.TenantEnvServiceEnvVar ServiceLabel []*dbmodel.TenantEnvServiceLabel ServiceSchedulingLabels []*dbmodel.TenantEnvServiceSchedulingLabel ServiceSchedulingTolerations []*dbmodel.TenantEnvServiceSchedulingToleration ServiceMntRelation []*dbmodel.TenantEnvServiceMountRelation ServiceRelation []*dbmodel.TenantEnvServiceRelation ServiceStatus string ServiceVolume []*dbmodel.TenantEnvServiceVolume ServiceConfigFile []*dbmodel.TenantEnvServiceConfigFile ServicePort []*dbmodel.TenantEnvServicesPort Versions []*dbmodel.VersionInfo PluginRelation []*dbmodel.TenantEnvServicePluginRelation PluginConfigs []*dbmodel.TenantEnvPluginVersionDiscoverConfig PluginEnvs []*dbmodel.TenantEnvPluginVersionEnv PluginStreamPorts []*dbmodel.TenantEnvServicesStreamPluginPort }
RegionServiceSnapshot RegionServiceSnapshot
type RestoreResult ¶
type RestoreResult struct { Status string `json:"status"` Message string `json:"message"` CreateTime time.Time `json:"create_time"` ServiceChange map[string]*Info `json:"service_change"` BackupID string `json:"backup_id"` RestoreMode string `json:"restore_mode"` EventID string `json:"event_id"` RestoreID string `json:"restore_id"` CacheDir string `json:"cache_dir"` }
RestoreResult RestoreResult
type ServiceCheckInput ¶
type ServiceCheckInput struct { CheckUUID string `json:"uuid"` //检测来源类型 SourceType string `json:"source_type"` // 检测来源定义, // 代码: https://github.com/shurcooL/githubql.git master // docker-run: docker run --name xxx nginx:latest nginx // docker-compose: compose全文 SourceBody string `json:"source_body"` Username string `json:"username"` Password string `json:"password"` TenantEnvID string EventID string `json:"event_id"` }
ServiceCheckInput 任务输入数据
type ServiceCheckResult ¶
type ServiceCheckResult struct { //检测状态 Success Failure CheckStatus string `json:"check_status"` ErrorInfos parser.ParseErrorList `json:"error_infos"` ServiceInfo []parser.ServiceInfo `json:"service_info"` }
ServiceCheckResult 应用检测结果
func CreateResult ¶
func CreateResult(ErrorInfos parser.ParseErrorList, ServiceInfo []parser.ServiceInfo) (ServiceCheckResult, error)
CreateResult 创建检测结果
type ShareStatus ¶
type ShareStatus struct {}
ShareStatus share status result ShareStatus share status result
func (ShareStatus) String ¶
func (s ShareStatus) String() string
type SlugShareItem ¶
type SlugShareItem struct { string `json:"service_key" ` AppVersion string `json:"app_version" ` EventID string `json:"event_id"` ShareUser string `json:"share_user"` ShareScope string `json:"share_scope"` SlugInfo struct { Namespace string `json:"namespace"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info,omitempty"` } `json:"share_info"` }ServiceKey
SlugShareItem SlugShareItem
func NewSlugShareItem ¶
func NewSlugShareItem(in []byte, etcdCli *clientv3.Client) (*SlugShareItem, error)
NewSlugShareItem 创建实体
func (*SlugShareItem) CheckMD5FileExist ¶
func (i *SlugShareItem) CheckMD5FileExist(md5path, packageName string) bool
CheckMD5FileExist CheckMD5FileExist
func (*SlugShareItem) ShareToLocal ¶
func (i *SlugShareItem) ShareToLocal() error
ShareToLocal ShareToLocal
func (*SlugShareItem) UpdateShareStatus ¶
func (i *SlugShareItem) UpdateShareStatus(status string) error
UpdateShareStatus 更新任务执行结果
type SourceCodeBuildItem ¶
type SourceCodeBuildItem struct { Namespace string `json:"namespace"` TenantEnvName string `json:"tenant_env_name"` WTDataPVCName string `json:"gr_data_pvc_name"` CachePVCName string `json:"cache_pvc_name"` CacheMode string `json:"cache_mode"` CachePath string `json:"cache_path"` ServiceAlias string `json:"service_alias"` Action string `json:"action"` DestImage string `json:"dest_image"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` CacheDir string `json:"cache_dir"` TGZDir string `json:"tgz_dir"` ImageClient sources.ImageClient KanikoImage string KubeClient kubernetes.Interface WtNamespace string WtRepoName string TenantEnvID string ServiceID string DeployVersion string Lang string Runtime string BuildEnvs map[string]string CodeSouceInfo sources.CodeSourceInfo RepoInfo *sources.RepostoryBuildInfo Configs map[string]gjson.Result `json:"configs"` Ctx context.Context Operator string `json:"operator"` // contains filtered or unexported fields }
SourceCodeBuildItem SouceCodeBuildItem
func NewSouceCodeBuildItem ¶
func NewSouceCodeBuildItem(in []byte) *SourceCodeBuildItem
NewSouceCodeBuildItem create
func (*SourceCodeBuildItem) IsDockerfile ¶
func (i *SourceCodeBuildItem) IsDockerfile() bool
IsDockerfile CheckDockerfile
func (*SourceCodeBuildItem) Run ¶
func (i *SourceCodeBuildItem) Run(timeout time.Duration) error
Run Run
func (*SourceCodeBuildItem) UpdateBuildVersionInfo ¶
func (i *SourceCodeBuildItem) UpdateBuildVersionInfo(res *build.Response) error
UpdateBuildVersionInfo update service build version info to db
func (*SourceCodeBuildItem) UpdateCheckResult ¶
func (i *SourceCodeBuildItem) UpdateCheckResult(result *dbmodel.CodeCheckResult) error
UpdateCheckResult UpdateCheckResult
func (*SourceCodeBuildItem) UpdateVersionInfo ¶
func (i *SourceCodeBuildItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
UpdateVersionInfo Update build application service version info
type TaskWorker ¶
type TaskWorker interface { Run(timeout time.Duration) error GetLogger() event.Logger Name() string Stop() error //ErrorCallBack if run error will callback ErrorCallBack(err error) }
TaskWorker worker interface
func BackupAPPNewCreater ¶
func BackupAPPNewCreater(in []byte, m *exectorManager) (TaskWorker, error)
BackupAPPNewCreater create
func BackupAPPRestoreCreater ¶
func BackupAPPRestoreCreater(in []byte, m *exectorManager) (TaskWorker, error)
BackupAPPRestoreCreater create
func NewExportApp ¶
func NewExportApp(in []byte, m *exectorManager) (TaskWorker, error)
NewExportApp create
func NewImportApp ¶
func NewImportApp(in []byte, m *exectorManager) (TaskWorker, error)
NewImportApp create
func SharePluginItemCreater ¶
func SharePluginItemCreater(in []byte, m *exectorManager) (TaskWorker, error)
SharePluginItemCreater create