exector

package
v3.6.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 41 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var REGISTRYDOMAIN = "goodrain.me"

REGISTRYDOMAIN REGISTRY_DOMAIN

Functions

func RegisterWorker

func RegisterWorker(name string, fun func([]byte, *exectorManager) (TaskWorker, error))

RegisterWorker register worker creater

func ShowExec

func ShowExec(command string, params []string, logger event.Logger) error

ShowExec ShowExec

Types

type BackupAPPNew

type BackupAPPNew struct {
	GroupID    string   `json:"group_id" `
	ServiceIDs []string `json:"service_ids" `
	//full-online,full-offline
	Mode     string `json:"mode"`
	Version  string `json:"version"`
	EventID  string
	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"`
	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"`
	SourceDir    string `json:"source_dir"`
	SourceType   string `json:"source_type"`
	BackupID     string `json:"backup_id"`
	BackupSize   int64
	Logger       event.Logger
	DockerClient *client.Client
}

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

func (*BackupAPPNew) Name

func (b *BackupAPPNew) Name() string

Name return worker name

func (*BackupAPPNew) Run

func (b *BackupAPPNew) Run(timeout time.Duration) error

Run Run

func (*BackupAPPNew) Stop

func (b *BackupAPPNew) Stop() error

Stop stop

type BackupAPPRestore

type BackupAPPRestore struct {
	//full-online,full-offline
	EventID  string
	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"`
	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"`
	BackupID string `json:"backup_id"`
	TenantID string `json:"tenant_id"`
	Logger   event.Logger
	//RestoreMode(cdct) current datacenter and current tenant
	//RestoreMode(cdot) current datacenter and other tenant
	//RestoreMode(od)     other datacenter
	RestoreMode  string `json:"restore_mode"`
	RestoreID    string `json:"restore_id"`
	DockerClient *client.Client
	// 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

func (*BackupAPPRestore) Name

func (b *BackupAPPRestore) Name() string

Name return worker name

func (*BackupAPPRestore) Run

func (b *BackupAPPRestore) Run(timeout time.Duration) error

Run Run

func (*BackupAPPRestore) Stop

func (b *BackupAPPRestore) Stop() error

Stop stop

type DockerComposeYaml

type DockerComposeYaml struct {
	Version  string              `yaml:"version"`
	Volumes  map[string]string   `yaml:"volumes,omitempty"`
	Services map[string]*Service `yaml:"services,omitempty"`
}

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"`
	Logger       event.Logger
	DockerClient *client.Client
}

ExportApp Export app to specified format(rainbond-app or dockercompose)

func (*ExportApp) CleanSourceDir

func (i *ExportApp) CleanSourceDir() error

func (*ExportApp) ErrorCallBack

func (i *ExportApp) ErrorCallBack(err error)

ErrorCallBack if run error will callback

func (*ExportApp) GetLogger

func (i *ExportApp) GetLogger() event.Logger

GetLogger GetLogger

func (*ExportApp) Name

func (i *ExportApp) Name() string

Name return worker name

func (*ExportApp) Run

func (i *ExportApp) Run(timeout time.Duration) error

Run Run

func (*ExportApp) Stop

func (i *ExportApp) Stop() error

Stop stop

type ImageBuildItem

type ImageBuildItem struct {
	Namespace     string       `json:"namespace"`
	TenantName    string       `json:"tenant_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"`
	DockerClient  *client.Client
	TenantID      string
	ServiceID     string
	DeployVersion string
	HubUser       string
	HubPassword   string
}

ImageBuildItem ImageBuildItem

func NewImageBuildItem

func NewImageBuildItem(in []byte) *ImageBuildItem

NewImageBuildItem 创建实体

func (*ImageBuildItem) CreateUpgradeTaskBody

func (i *ImageBuildItem) CreateUpgradeTaskBody() *model.RollingUpgradeTaskBody

CreateUpgradeTaskBody 构造消息体

func (*ImageBuildItem) ImageNameHandler

func (i *ImageBuildItem) ImageNameHandler(source string) string

ImageNameHandler 根据平台配置处理镜像名称

func (*ImageBuildItem) Run

func (i *ImageBuildItem) Run(timeout time.Duration) error

Run Run

func (*ImageBuildItem) StorageLocalImageURL

func (i *ImageBuildItem) StorageLocalImageURL(imageURL string) error

StorageLocalImageURL 修改的镜像名称存库

func (*ImageBuildItem) StorageVersionInfo

func (i *ImageBuildItem) StorageVersionInfo(imageURL string) error

StorageVersionInfo 存储version信息

func (*ImageBuildItem) UpdateVersionInfo

func (i *ImageBuildItem) UpdateVersionInfo(status string) error

UpdateVersionInfo 更新任务执行结果

type ImageShareItem

type ImageShareItem struct {
	Namespace      string `json:"namespace"`
	TenantName     string `json:"tenant_name"`
	ServiceID      string `json:"service_id"`
	ServiceAlias   string `json:"service_alias"`
	ImageName      string `json:"image_name"`
	LocalImageName string `json:"local_image_name"`
	ShareID        string `json:"share_id"`
	Logger         event.Logger
	ShareInfo      struct {
		ServiceKey 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"`
	DockerClient *client.Client
	EtcdCli      *clientv3.Client
}

ImageShareItem ImageShareItem

func NewImageShareItem

func NewImageShareItem(in []byte, DockerClient *client.Client, 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
	ServiceSlug  model.ServiceSlug
	Logger       event.Logger
	DockerClient *client.Client
}

ImportApp Export app to specified format(rainbond-app or dockercompose)

func (*ImportApp) ErrorCallBack

func (i *ImportApp) ErrorCallBack(err error)

ErrorCallBack if run error will callback

func (*ImportApp) GetLogger

func (i *ImportApp) GetLogger() event.Logger

GetLogger GetLogger

func (*ImportApp) Name

func (i *ImportApp) Name() string

Name return worker name

func (*ImportApp) Run

func (i *ImportApp) Run(timeout time.Duration) error

Run Run

func (*ImportApp) Stop

func (i *ImportApp) Stop() error

Stop stop

type Info

type Info struct {
	ServiceID    string
	ServiceAlias string
	Status       string
	LBPorts      map[int]int
}

Info service cache info

type Manager

type Manager interface {
	AddTask(*pb.TaskMessage) error
	Start() error
	Stop() error
}

Manager 任务执行管理器

func NewManager

func NewManager(conf config.Config) (Manager, error)

NewManager new manager

type MarketSlugItem

type MarketSlugItem struct {
	TenantName    string       `json:"tenant_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"`
	TenantID      string       `json:"tenant_id"`
	ServiceID     string       `json:"service_id"`
	TGZPath       string
	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) CreateUpgradeTaskBody

func (i *MarketSlugItem) CreateUpgradeTaskBody() *model.RollingUpgradeTaskBody

CreateUpgradeTaskBody 构造消息体

func (*MarketSlugItem) Run

func (i *MarketSlugItem) Run() error

Run Run

func (*MarketSlugItem) UpdateVersionInfo

func (i *MarketSlugItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error

UpdateVersionInfo 更新任务执行结果

type PluginShareItem

type PluginShareItem struct {
	EventID        string `json:"event_id"`
	ImageName      string `json:"image_name"`
	LocalImageName string `json:"local_image_name"`
	ShareID        string `json:"share_id"`
	Logger         event.Logger
	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"`
	DockerClient *client.Client
	EtcdCli      *clientv3.Client
}

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

func (*PluginShareItem) Name

func (i *PluginShareItem) Name() string

Name return worker name

func (*PluginShareItem) Run

func (i *PluginShareItem) Run(timeout time.Duration) error

Run Run

func (*PluginShareItem) Stop

func (i *PluginShareItem) Stop() error

Stop stop

type RegionServiceSnapshot

type RegionServiceSnapshot struct {
	ServiceID          string
	Service            *dbmodel.TenantServices
	ServiceProbe       []*dbmodel.ServiceProbe
	LBMappingPort      []*dbmodel.TenantServiceLBMappingPort
	ServiceEnv         []*dbmodel.TenantServiceEnvVar
	ServiceLabel       []*dbmodel.TenantServiceLable
	ServiceMntRelation []*dbmodel.TenantServiceMountRelation
	PluginRelation     []*dbmodel.TenantServicePluginRelation
	ServiceRelation    []*dbmodel.TenantServiceRelation
	ServiceStatus      string
	ServiceVolume      []*dbmodel.TenantServiceVolume
	ServicePort        []*dbmodel.TenantServicesPort
	Versions           []*dbmodel.VersionInfo
}

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 Service

type Service struct {
	Image         string            `yaml:"image"`
	ContainerName string            `yaml:"container_name,omitempty"`
	Restart       string            `yaml:"restart,omitempty"`
	NetworkMode   string            `yaml:"network_mode,omitempty"`
	Volumes       []string          `yaml:"volumes,omitempty"`
	Command       string            `yaml:"command,omitempty"`
	Environment   map[string]string `yaml:"environment,omitempty"`
	Loggin        struct {
		Driver  string `yaml:"driver,omitempty"`
		Options struct {
			MaxSize string `yaml:"max-size,omitempty"`
			MaxFile string `yaml:"max-file,omitempty"`
		}
	} `yaml:"logging,omitempty"`
}

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"`
	TenantID   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 {
	ShareID string `json:"share_id,omitempty"`
	Status  string `json:"status,omitempty"`
}

ShareStatus share status result ShareStatus share status result

func (ShareStatus) String

func (s ShareStatus) String() string

type SlugShareItem

type SlugShareItem struct {
	Namespace     string `json:"namespace"`
	TenantName    string `json:"tenant_name"`
	ServiceID     string `json:"service_id"`
	ServiceAlias  string `json:"service_alias"`
	SlugPath      string `json:"slug_path"`
	LocalSlugPath string `json:"local_slug_path"`
	ShareID       string `json:"share_id"`
	Logger        event.Logger
	ShareInfo     struct {
		ServiceKey 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"`
	EtcdCli     *clientv3.Client
	PackageName string
}

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) ShareService

func (i *SlugShareItem) ShareService() error

ShareService Run

func (*SlugShareItem) ShareToFTP

func (i *SlugShareItem) ShareToFTP() error

ShareToFTP ShareToFTP

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"`
	TenantName   string       `json:"tenant_name"`
	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"`
	//SourceDir     string       `json:"source_dir"`
	TGZDir        string `json:"tgz_dir"`
	DockerClient  *client.Client
	TenantID      string
	ServiceID     string
	DeployVersion string
	Lang          string
	Runtime       string
	BuildEnvs     map[string]string
	CodeSouceInfo sources.CodeSourceInfo
	RepoInfo      *sources.RepostoryBuildInfo
	// contains filtered or unexported fields
}

SourceCodeBuildItem SouceCodeBuildItem

func NewSouceCodeBuildItem

func NewSouceCodeBuildItem(in []byte) *SourceCodeBuildItem

NewSouceCodeBuildItem create

func (*SourceCodeBuildItem) CreateUpgradeTaskBody

func (i *SourceCodeBuildItem) CreateUpgradeTaskBody() *model.RollingUpgradeTaskBody

CreateUpgradeTaskBody 构造消息体

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) UpdateCheckResult

func (i *SourceCodeBuildItem) UpdateCheckResult(result *dbmodel.CodeCheckResult) error

UpdateCheckResult UpdateCheckResult

func (*SourceCodeBuildItem) UpdateVersionInfo

func (i *SourceCodeBuildItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error

UpdateVersionInfo 更新任务执行结果

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

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker 工作器

func NewWorker

func NewWorker(cmdpath, user string, envs []string, in []byte) *Worker

NewWorker 创建一个worker

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL