service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpandStepTmplInfo   = "tmpl_info"
	ExpandStepBaseEnv    = "base_env"
	ExpandStepServiceEnv = "service_env"
	ExpandStepMount      = "mount"
)

Variables

This section is empty.

Functions

func IsAlibabaCloudAccountValid added in v0.1.1

func IsAlibabaCloudAccountValid(account config.AlibabaCloudAccount) bool

func RemoteCmdExec

func RemoteCmdExec(ctx context.Context, localCmd string, remoteScript string, ip, uname, pwd string) ([]byte, error)

RemoteCmdExec 复制 inScript 到 远端 OutScript 并执行 | todo 参数结构化

Types

type ActionSvc

type ActionSvc interface {
	ExecAct(ctx context.Context, args interface{}, act types.Action) (interface{}, error)
	// contains filtered or unexported methods
}

type BaseEnvInitAsyncSvcReq

type BaseEnvInitAsyncSvcReq struct {
	ServiceClusterId int64                 `json:"service_cluster_id"`
	TaskId           int64                 `json:"task_id"`
	InstanceList     []*types.InstanceInfo `json:"instance_list"`
	Auth             *types.InstanceAuth   `json:"auth"`
}

type BridgXSvc

type BridgXSvc struct {
	Expand          types.Action
	PoolQueryExpand types.Action
	Shrink          types.Action
	PoolQueryShrink types.Action
	GetCluster      types.Action
}

func GetBridgXSvcInst

func GetBridgXSvcInst() *BridgXSvc

func (*BridgXSvc) ExecAct

func (s *BridgXSvc) ExecAct(ctx context.Context, args interface{}, act types.Action) (resp interface{}, err error)

func (*BridgXSvc) RatePass

func (s *BridgXSvc) RatePass(rate string) bool

type BridgXSvcReq

type BridgXSvcReq struct {
	Count       int64
	ClusterName string
	TaskId      int64
	InstGroup   *nodeact.InstanceGroup
}

type BridgXSvcResp

type BridgXSvcResp struct {
	TaskId    int64
	InstGroup *nodeact.InstanceGroup
	Auth      *types.InstanceAuth
}

type CallBackNodeInitSvcReq

type CallBackNodeInitSvcReq struct {
	Instance *types.InstanceMeta `json:"instance"`
	Msg      string              `json:"msg"`
}

type ClusterInstanceCount added in v0.2.0

type ClusterInstanceCount struct {
	ServiceClusterName string `json:"service_cluster_name"`
	ServiceClusterId   int64  `json:"service_cluster_id"`
	InstanceCount      int    `json:"instance_count"`
}

type ClusterListResp added in v0.2.0

type ClusterListResp struct {
	ClusterList []ServiceClusterInfo `json:"cluster_list"`
}

type EnvService

type EnvService struct {
}

func GetEnvOpsSvcInst

func GetEnvOpsSvcInst() *EnvService

func (*EnvService) BaseEnvInitAsync

func (s *EnvService) BaseEnvInitAsync(ctx context.Context, svcReq *BaseEnvInitAsyncSvcReq) error

func (*EnvService) BaseEnvInitSingle

func (s *EnvService) BaseEnvInitSingle(ctx context.Context, taskId int64, inst *types.InstanceInfo, auth *types.InstanceAuth) error

func (*EnvService) CallBackSvc

func (s *EnvService) CallBackSvc(ctx context.Context, taskId int64, instId string, instStatus types.InstanceStatus, msg string) error

func (*EnvService) IsNotHttpOk

func (s *EnvService) IsNotHttpOk(res []byte) bool

func (*EnvService) IsNotRemoteCmdOk

func (s *EnvService) IsNotRemoteCmdOk(res []byte) bool

func (*EnvService) NodeUpdateStore

func (s *EnvService) NodeUpdateStore(ctx context.Context, instanceList []*types.InstanceInfo, taskId, serviceClusterId int64) error

func (*EnvService) ServiceEnvInitAsync

func (s *EnvService) ServiceEnvInitAsync(ctx context.Context, svcReq *SvcEnvInitAsyncSvcReq) error

func (*EnvService) ServiceEnvInitSingle

func (s *EnvService) ServiceEnvInitSingle(ctx context.Context, taskId int64, inst *types.InstanceInfo, auth *types.InstanceAuth, params *types.ParamsServiceEnv, cmd string) error

type ExposeMountSvcReq

type ExposeMountSvcReq struct {
	TaskId       int64                 `json:"task_id"`
	InstanceList []*types.InstanceInfo `json:"instance_list"`
	MountType    string                `json:"mount_type"`
	MountValue   string                `json:"mount_value"`
}

type ExposeMountSvcResp

type ExposeMountSvcResp struct {
	TaskId       int64                 `json:"task_id"`
	InstanceList []*types.InstanceInfo `json:"instance_list"`
}

type ExposeUmountSvcReq

type ExposeUmountSvcReq struct {
	TaskId           int64  `json:"task_id"`
	ServiceClusterId int64  `json:"service_cluster_id"`
	Count            int64  `json:"count"`
	MountType        string `json:"mount_type"`
	MountValue       string `json:"mount_value"`
}

type ExposeUmountSvcResp

type ExposeUmountSvcResp struct {
	TaskId       int64                 `json:"task_id"`
	InstanceList []*types.InstanceInfo `json:"instance_list"`
}

type InitServicSvcReq

type InitServicSvcReq struct {
	Cmd    string
	Params *types.ParamsServiceEnv
}

type InstanceCountResp added in v0.2.0

type InstanceCountResp struct {
	ServiceClusterList []ClusterInstanceCount `json:"service_cluster_list"`
}

type InstanceService added in v0.2.0

type InstanceService struct {
}

func GetInstanceService added in v0.2.0

func GetInstanceService() *InstanceService

func (*InstanceService) InstanceCountByCluster added in v0.2.0

func (s *InstanceService) InstanceCountByCluster(ctx context.Context, serviceName, serviceClusterName string, clusterId int64) (*InstanceCountResp, error)

type InstrSvc

type InstrSvc struct {
	BridgXExpand    types.Action
	BridgXShrink    types.Action
	NodeActInitBase types.Action
	NodeActInitSvc  types.Action
	MountSLB        types.Action
	UmountSLB       types.Action
	MountNginx      types.Action
	UmountNginx     types.Action
}

func GetInstrSvcInst

func GetInstrSvcInst() *InstrSvc

func (*InstrSvc) CreateBaseEnvInstr

func (s *InstrSvc) CreateBaseEnvInstr(ctx context.Context, args *types.BaseEnv, tmpId int64, needReverse bool, dbo *gorm.DB) (int64, int64, error)

func (*InstrSvc) CreateBridgxExpandInstr

func (s *InstrSvc) CreateBridgxExpandInstr(ctx context.Context, tmplId int64, revTmplId int64, needReverse bool, dbo *gorm.DB) (int64, int64, error)

func (*InstrSvc) CreateBridgxShrinkInstr

func (s *InstrSvc) CreateBridgxShrinkInstr(ctx context.Context, tmplId int64, dbo *gorm.DB) (int64, error)

func (*InstrSvc) CreateMountSlbInstr

func (s *InstrSvc) CreateMountSlbInstr(ctx context.Context, args *types.ParamsMount, tmplId, revTmplId int64, needReverse bool, dbo *gorm.DB) (int64, int64, error)

func (*InstrSvc) CreateServiceEnvInstr

func (s *InstrSvc) CreateServiceEnvInstr(ctx context.Context, args *types.ServiceEnv, tmplId int64, needReverse bool, dbo *gorm.DB) (int64, int64, error)

func (*InstrSvc) CreateUMountSlbInstr

func (s *InstrSvc) CreateUMountSlbInstr(ctx context.Context, args *types.ParamsMount, tmplId int64, dbo *gorm.DB) (int64, error)

func (*InstrSvc) ExecAct

func (s *InstrSvc) ExecAct(ctx context.Context, args interface{}, act types.Action) (svcResp interface{}, err error)

type InstrSvcReq

type InstrSvcReq struct {
	ServiceName      string
	ServiceClusterId int64
	ScheduleTaskId   int64
	InstrId          int64
	Instruction      *db.Instruction
	BridgXSvcReq     *BridgXSvcReq
	NodeActSvcReq    *NodeActSvcReq
}

type InstrSvcResp

type InstrSvcResp struct {
	BridgXSvcResp  *BridgXSvcResp
	NodeActSvcResp *NodeActSvcResp
}

type MountService

type MountService struct {
}

func GetMountSvcInst

func GetMountSvcInst() *MountService

func (*MountService) Mount

func (*MountService) Umount

type NodeActSvc

type NodeActSvc struct {
	InitBase             types.Action
	InitService          types.Action
	MountSlb             types.Action
	UmountSlb            types.Action
	PollQueryInitBase    types.Action
	PollQueryInitService types.Action
}

func GetNodeActSvcInst

func GetNodeActSvcInst() *NodeActSvc

func (*NodeActSvc) ExecAct

func (s *NodeActSvc) ExecAct(ctx context.Context, args interface{}, act types.Action) (svcResp interface{}, err error)

func (*NodeActSvc) InitBaseAction

func (s *NodeActSvc) InitBaseAction(ctx context.Context, instGroup *nodeact.InstanceGroup, auth *types.InstanceAuth, serviceClusterId int64) (*NodeActSvcResp, error)

func (*NodeActSvc) InitServiceAction

func (s *NodeActSvc) InitServiceAction(ctx context.Context, instGroup *nodeact.InstanceGroup, auth *types.InstanceAuth, svcReq *InitServicSvcReq, serviceClusterId int64) (*NodeActSvcResp, error)

func (*NodeActSvc) MountInstAction

func (s *NodeActSvc) MountInstAction(ctx context.Context, instGroup *nodeact.InstanceGroup, slbMountInfo *nodeact.ParamsMountInfo) (*ExposeMountSvcResp, error)

func (*NodeActSvc) PollQueryBaseNode

func (s *NodeActSvc) PollQueryBaseNode(ctx context.Context, taskId int64) (*NodeActSvcResp, error)

func (*NodeActSvc) PoolQueryServiceNode

func (s *NodeActSvc) PoolQueryServiceNode(ctx context.Context, taskId int64) (*NodeActSvcResp, error)

func (*NodeActSvc) RatePass

func (s *NodeActSvc) RatePass(rate string) bool

func (*NodeActSvc) UmountInstAction

func (s *NodeActSvc) UmountInstAction(ctx context.Context, taskId, serviceClusterId int64, umountSlbSvcReq *UmountSlbSvcReq) (*ExposeUmountSvcResp, error)

type NodeActSvcReq

type NodeActSvcReq struct {
	InstGroup        *nodeact.InstanceGroup
	TaskId           int64
	ServiceClusterId int64
	Auth             *types.InstanceAuth
	//HarborRegisterUrl string // harbor 镜像服务地址,用于加入 docker 的配置允许 http 链接
	InitServicSvcReq *InitServicSvcReq
	//Params          *nodeact.ParamsServiceEnv
	SlbMountInfo    *nodeact.ParamsMountInfo // 用于挂载 slb 的服务器组 id
	UmountSlbSvcReq *UmountSlbSvcReq
}

type NodeActSvcResp

type NodeActSvcResp struct {
	InstGroup *nodeact.InstanceGroup
}

type NodeService

type NodeService struct {
}

func GetNodeSvcInst

func GetNodeSvcInst() *NodeService

func (*NodeService) UpdateNode

func (s *NodeService) UpdateNode(ctx context.Context, svcReq *CallBackNodeInitSvcReq) error

type ScheduleSvc

type ScheduleSvc struct {
	Expand types.Action
	Shrink types.Action
}

func GetScheduleSvcInst

func GetScheduleSvcInst() *ScheduleSvc

func (*ScheduleSvc) ExecAct

func (s *ScheduleSvc) ExecAct(ctx context.Context, args interface{}, act types.Action) (svcResp interface{}, err error)

type ScheduleSvcReq

type ScheduleSvcReq struct {
	ServiceExpandSvcReq *ServiceExpandSvcReq
	ServiceShrinkSvcReq *ServiceShrinkSvcReq
	InstrId             int64
}

type ScheduleSvcResp

type ScheduleSvcResp struct {
	ServiceExpandSvcResp *ServiceExpandSvcResp
	ServiceShrinkSvcResp *ServiceShrinkSvcResp
}

type ServiceClusterInfo added in v0.2.0

type ServiceClusterInfo struct {
	ServiceClusterId   int64  `json:"service_cluster_id"`
	ServiceCluster     string `json:"service_cluster"`
	BridgxCluster      string `json:"bridgx_cluster"`
	InstanceCount      int64  `json:"instance_count"`
	InstanceTypeDesc   string `json:"instance_type_desc"`
	Provider           string `json:"provider"`
	ComputingPowerType string `json:"computing_power_type"`
	ChargeType         string `json:"charge_type"`
}

type ServiceCreateSvcRequest

type ServiceCreateSvcRequest struct {
	ServiceInfo *types.ServiceInfo `json:"service_info"`
}

type ServiceCreateSvcResponse

type ServiceCreateSvcResponse struct {
	ServiceClusterId int64 `json:"service_cluster_id"`
}

type ServiceExpandSvcReq

type ServiceExpandSvcReq struct {
	ServiceClusterId int64  `json:"service_cluster_id'"`
	Count            int64  `json:"count"`
	ExecType         string `json:"exec_type"`
}

type ServiceExpandSvcResp added in v0.1.1

type ServiceExpandSvcResp struct {
	TaskId int64 `json:"task_id"`
}

type ServiceShrinkSvcReq

type ServiceShrinkSvcReq struct {
	ServiceClusterId int64  `json:"service_cluster_id'"`
	Count            int64  `json:"count"`
	ExecType         string `json:"exec_type"` // manual | auto
}

type ServiceShrinkSvcResp added in v0.1.1

type ServiceShrinkSvcResp struct {
	TaskId int64 `json:"task_id"`
}

type ServiceSvc

type ServiceSvc struct {
}

func GetServiceIns

func GetServiceIns() *ServiceSvc

func (*ServiceSvc) CreateService

func (*ServiceSvc) Detail

func (s *ServiceSvc) Detail(ctx context.Context, serviceName string) (map[string]interface{}, error)

func (*ServiceSvc) GetExpandHistory

func (s *ServiceSvc) GetExpandHistory(ctx context.Context, page, pageSize, serviceClusterId int) (map[string]interface{}, error)

func (*ServiceSvc) GetServiceClusterList added in v0.2.0

func (s *ServiceSvc) GetServiceClusterList(ctx context.Context, serviceName string) (*ClusterListResp, error)

func (*ServiceSvc) GetServiceList

func (s *ServiceSvc) GetServiceList(ctx context.Context, page, pageSize int, serviceName, lang string) (map[string]interface{}, error)

func (*ServiceSvc) UpdateDesc

func (s *ServiceSvc) UpdateDesc(ctx context.Context, serviceName, description string) (map[string]interface{}, error)

type SvcEnvInitAsyncSvcReq

type SvcEnvInitAsyncSvcReq struct {
	ServiceClusterId int64                   `json:"service_cluster_id"`
	TaskId           int64                   `json:"task_id"`
	InstanceList     []*types.InstanceInfo   `json:"instance_list"`
	Auth             *types.InstanceAuth     `json:"auth"`
	Params           *types.ParamsServiceEnv `json:"params"`
	Cmd              string                  `json:"string"`
}

type TaskDescribeSvcReq

type TaskDescribeSvcReq struct {
	TaskId         int64                `json:"task_id"`
	InstanceStatus types.InstanceStatus `json:"instance_status"`
}

type TaskDescribeSvcResp

type TaskDescribeSvcResp struct {
	TaskDescribe *types.TaskDescribe `json:"task_describe"`
}

type TaskInfoSvcReq added in v0.1.1

type TaskInfoSvcReq struct {
	TaskId int64 `json:"task_id"`
}

type TaskInfoSvcResp added in v0.1.1

type TaskInfoSvcResp struct {
	TaskInfo *types.TaskInfo `json:"task_info"`
}

type TaskInstancesSvcReq

type TaskInstancesSvcReq struct {
	TaskId         int64                `json:"task_id"`
	InstanceStatus types.InstanceStatus `json:"instance_status"`
	PageNumber     int                  `json:"page_number"`
	PageSize       int                  `json:"page_size"`
}

type TaskInstancesSvcResp

type TaskInstancesSvcResp struct {
	InstancesList []*types.Instance `json:"instances_list"`
	Pager         *types.Pager      `json:"pager"`
}

type TaskService

type TaskService struct {
}

func GetTaskSvcInst

func GetTaskSvcInst() *TaskService

func (*TaskService) Describe

func (*TaskService) HasRunningTask added in v0.2.0

func (s *TaskService) HasRunningTask(ctx context.Context, serviceName, clusterName string) (bool, error)

func (*TaskService) Info added in v0.1.1

func (s *TaskService) Info(ctx context.Context, svcReq *TaskInfoSvcReq) (*TaskInfoSvcResp, error)

func (*TaskService) InstanceList added in v0.1.1

func (s *TaskService) InstanceList(ctx context.Context, page, pageSize int, taskId int64, taskStatus types.InstanceStatus) (int64, []types.InstInfoResp, error)

func (*TaskService) Instances

type TemplateSvc

type TemplateSvc struct {
	Create types.Action
	Info   types.Action
	Update types.Action
}

func GetTemplateSvcInst

func GetTemplateSvcInst() *TemplateSvc

func (*TemplateSvc) Delete

func (s *TemplateSvc) Delete(ctx context.Context, tmpExpandIds []int64) (int64, error)

func (*TemplateSvc) ExecAct

func (s *TemplateSvc) ExecAct(ctx context.Context, args interface{}, act types.Action) (svcResp interface{}, err error)

func (*TemplateSvc) InfoAction

func (s *TemplateSvc) InfoAction(ctx context.Context, svcReq *TmplInfoSvcReq) (*TemplateSvcResp, error)

func (*TemplateSvc) List

func (s *TemplateSvc) List(ctx context.Context, serviceName string, page, pageSize, serviceClusterId int) (map[string]interface{}, error)

func (*TemplateSvc) UpdateAction

func (s *TemplateSvc) UpdateAction(ctx context.Context, svcReq *TmplUpdateSvcReq) (*TemplateSvcResp, error)

type TemplateSvcReq

type TemplateSvcReq struct {
	TmplExpandSvcReq *TmplExpandSvcReq
	TmplInfoSvcReq   *TmplInfoSvcReq
	TmplUpdateSvcReq *TmplUpdateSvcReq
}

type TemplateSvcResp

type TemplateSvcResp struct {
	TmplExpandSvcResp *TmplExpandSvcResp
	TmplInfoSvcResp   *TmplInfoSvcResp
	TmplUpdateSvcResp *TmplUpdateSvcResp
}

type TmplExpandSvcReq

type TmplExpandSvcReq struct {
	EndStep    string             `json:"end_step"`
	TmplInfo   *types.TmpInfo     `json:"tmpl_info"`
	BaseEnv    *types.BaseEnv     `json:"base_env"`
	ServiceEnv *types.ServiceEnv  `json:"service_env"`
	Mount      *types.ParamsMount `json:"mount"`
}

type TmplExpandSvcResp

type TmplExpandSvcResp struct {
	TmplId string `json:"tmpl_id"`
}

type TmplInfoSvcReq

type TmplInfoSvcReq struct {
	TmplExpandId int64 `json:"tmpl_expand_id"`
}

type TmplInfoSvcResp

type TmplInfoSvcResp struct {
	TmplInfo   *types.TmpInfo     `json:"tmpl_info"`
	BaseEnv    *types.BaseEnv     `json:"base_env"`
	ServiceEnv *types.ServiceEnv  `json:"service_env"`
	Mount      *types.ParamsMount `json:"mount"`
}

type TmplUpdateSvcReq

type TmplUpdateSvcReq struct {
	TmplExpandId int64              `json:"tmpl_expand_id"`
	EndStep      string             `json:"end_step"`
	TmplInfo     *types.TmpInfo     `json:"tmpl_info"`
	BaseEnv      *types.BaseEnv     `json:"base_env"`
	ServiceEnv   *types.ServiceEnv  `json:"service_env"`
	Mount        *types.ParamsMount `json:"mount"`
}

type TmplUpdateSvcResp

type TmplUpdateSvcResp struct {
	TmplExpandId int64 `json:"tmpl_expand_id"`
}

type UmountSlbSvcReq

type UmountSlbSvcReq struct {
	UmountInstCnt int64                    `json:"umount_inst_cnt"`
	SlbInfo       *nodeact.ParamsMountInfo `json:"slb_info"`
}

Jump to

Keyboard shortcuts

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