handlers

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TmcInstanceStatusInit        = "INIT"
	TmcInstanceStatusRunning     = "RUNNING"
	TmcInstanceStatusError       = "ERROR"
	TmcInstanceStatusDeleted     = "DELETED"
	TmcInstanceStatusDeleteError = "DELETE_ERROR"
)
View Source
const (
	ResourceConfigCenter     = "config-center"
	ResourceNacos            = "nacos"
	ResourceMysql            = "mysql"
	ResourceTerminusZKProxy  = "terminus-zkproxy"
	ResourceRegisterCenter   = "registercenter"
	ResourceZookeeper        = "zookeeper"
	ResourceZKProxy          = "zkproxy"
	ResourceEtcd             = "etcd"
	ResourceApiGateway       = "api-gateway"
	ResourcePostgresql       = "postgresql"
	ResourceMonitor          = "monitor"
	ResourceJvmProfiler      = "jvm-profiler"
	ResourceLogAnalytics     = "log-analytics"
	ResourceLogEs            = "log-es"
	ResourceLogExporter      = "log-exporter"
	ResourceMonitorCollector = "monitor-collector"
	ResourceMonitorKafka     = "monitor-kafka"
	ResourceMonitorZk        = "monitor-zk"
	ResourceServiceMesh      = "service-mesh"
	ResourceLogService       = "log-service"
)
View Source
const (
	DeployModeSAAS = "SAAS"
	DeployModePAAS = "PAAS"
)
View Source
const RuntimeMaxUpTimeoutSeconds = 15 * 60

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultDeployHandler

type DefaultDeployHandler struct {
	TenantDb             *db.InstanceTenantDB
	InstanceDb           *db.InstanceDB
	TmcRequestRelationDb *db.TmcRequestRelationDB
	TmcDb                *db.TmcDB
	TmcVersionDb         *db.TmcVersionDB
	TmcIniDb             *db.TmcIniDB
	Bdl                  *bundle.Bundle
	Log                  logs.Logger
}

func NewDefaultHandler

func NewDefaultHandler(dbClient *gorm.DB, logger logs.Logger) *DefaultDeployHandler

func (*DefaultDeployHandler) BuildDeployResult

func (h *DefaultDeployHandler) BuildDeployResult(tmcInstance *db.Instance, tenant *db.InstanceTenant) ResourceDeployResult

func (*DefaultDeployHandler) BuildRequestRelation

func (h *DefaultDeployHandler) BuildRequestRelation(parentRequest string, childRequest string) error

func (*DefaultDeployHandler) BuildServiceGroupRequest

func (h *DefaultDeployHandler) BuildServiceGroupRequest(resourceInfo *ResourceInfo, tmcInstance *db.Instance, clusterConfig map[string]string) interface{}

func (*DefaultDeployHandler) BuildSubResourceDeployRequest

func (h *DefaultDeployHandler) BuildSubResourceDeployRequest(name string, addon *diceyml.AddOn, req *ResourceDeployRequest) *ResourceDeployRequest

func (*DefaultDeployHandler) BuildTmcInstanceConfig

func (h *DefaultDeployHandler) BuildTmcInstanceConfig(tmcInstance *db.Instance, serviceGroupDeployResult interface{}, clusterConfig map[string]string, additionalConfig map[string]string) map[string]string

func (*DefaultDeployHandler) Callback

func (h *DefaultDeployHandler) Callback(url string, id string, success bool, config map[string]string, options map[string]string) error

func (*DefaultDeployHandler) CheckIfHasCustomConfig

func (h *DefaultDeployHandler) CheckIfHasCustomConfig(clusterConfig map[string]string) (map[string]string, bool)

func (*DefaultDeployHandler) CheckIfNeedTmcInstance

func (h *DefaultDeployHandler) CheckIfNeedTmcInstance(req *ResourceDeployRequest, resourceInfo *ResourceInfo) (*db.Instance, bool, error)

func (*DefaultDeployHandler) CheckIfNeedTmcInstanceTenant

func (h *DefaultDeployHandler) CheckIfNeedTmcInstanceTenant(req *ResourceDeployRequest, resourceInfo *ResourceInfo) (*db.InstanceTenant, bool, error)

func (*DefaultDeployHandler) DeleteRequestRelation

func (h *DefaultDeployHandler) DeleteRequestRelation(parentId string, childId string) error

func (*DefaultDeployHandler) DeleteTenant

func (h *DefaultDeployHandler) DeleteTenant(tenant *db.InstanceTenant, tmcInstance *db.Instance, clusterConfig map[string]string) error

func (*DefaultDeployHandler) DeleteTmcInstance

func (h *DefaultDeployHandler) DeleteTmcInstance(tmcInstance *db.Instance, status string) error

func (*DefaultDeployHandler) DoApplyTmcInstanceTenant

func (h *DefaultDeployHandler) DoApplyTmcInstanceTenant(req *ResourceDeployRequest, resourceInfo *ResourceInfo,
	tmcInstance *db.Instance, tenant *db.InstanceTenant, clusterConfig map[string]string) (map[string]string, error)

func (*DefaultDeployHandler) DoDeploy

func (h *DefaultDeployHandler) DoDeploy(serviceGroupDeployRequest interface{}, resourceInfo *ResourceInfo, tmcInstance *db.Instance, clusterConfig map[string]string) (
	interface{}, error)

DoDeploy submit to scheduler and wait status ready

func (*DefaultDeployHandler) DoPostDeployJob

func (h *DefaultDeployHandler) DoPostDeployJob(tmcInstance *db.Instance, serviceGroupDeployResult interface{}, clusterConfig map[string]string) (map[string]string, error)

func (*DefaultDeployHandler) DoPreDeployJob

func (h *DefaultDeployHandler) DoPreDeployJob(resourceInfo *ResourceInfo, tmcInstance *db.Instance) error

func (*DefaultDeployHandler) GetClusterConfig

func (h *DefaultDeployHandler) GetClusterConfig(az string) (map[string]string, error)

func (*DefaultDeployHandler) GetDiceOperatorId

func (h *DefaultDeployHandler) GetDiceOperatorId() string

func (*DefaultDeployHandler) GetInstanceById

func (h *DefaultDeployHandler) GetInstanceById(id string) (instance *db.Instance, tenant *db.InstanceTenant, tmc *db.Tmc, dice *diceyml.Object, err error)

func (*DefaultDeployHandler) GetRelationResourceIds

func (h *DefaultDeployHandler) GetRelationResourceIds(parentId string) []string

func (*DefaultDeployHandler) GetResourceInfo

func (h *DefaultDeployHandler) GetResourceInfo(req *ResourceDeployRequest) (*ResourceInfo, error)

func (*DefaultDeployHandler) InitializeTmcInstance

func (h *DefaultDeployHandler) InitializeTmcInstance(req *ResourceDeployRequest, resourceInfo *ResourceInfo,
	subResults []*ResourceDeployResult) (*db.Instance, error)

func (*DefaultDeployHandler) InitializeTmcInstanceTenant

func (h *DefaultDeployHandler) InitializeTmcInstanceTenant(req *ResourceDeployRequest,
	tmcInstance *db.Instance, subResults []*ResourceDeployResult) (*db.InstanceTenant, error)

func (*DefaultDeployHandler) IsMatch

func (h *DefaultDeployHandler) IsMatch(tmc *db.Tmc) bool

func (*DefaultDeployHandler) IsNotDCOSCluster

func (h *DefaultDeployHandler) IsNotDCOSCluster(clusterType string) bool

func (*DefaultDeployHandler) UnDeploy

func (h *DefaultDeployHandler) UnDeploy(tmcInstance *db.Instance) error

func (*DefaultDeployHandler) UpdateTmcInstanceOnCustom

func (h *DefaultDeployHandler) UpdateTmcInstanceOnCustom(tmcInstance *db.Instance, sgConfig map[string]string) error

func (*DefaultDeployHandler) UpdateTmcInstanceOnFinish

func (h *DefaultDeployHandler) UpdateTmcInstanceOnFinish(tmcInstance *db.Instance, sgConfig map[string]string, sgStatus string) error

func (*DefaultDeployHandler) UpdateTmcInstanceTenantOnFinish

func (h *DefaultDeployHandler) UpdateTmcInstanceTenantOnFinish(tenant *db.InstanceTenant, config map[string]string) (*db.InstanceTenant, error)

type ResourceDeployHandler

type ResourceDeployHandler interface {
	IsMatch(tmc *db.Tmc) bool
	GetResourceInfo(req *ResourceDeployRequest) (*ResourceInfo, error)
	GetClusterConfig(az string) (map[string]string, error)
	CheckIfHasCustomConfig(clusterConfig map[string]string) (map[string]string, bool)
	UpdateTmcInstanceOnCustom(tmcInstance *db.Instance, sgConfig map[string]string) error
	CheckIfNeedTmcInstance(req *ResourceDeployRequest, resourceInfo *ResourceInfo) (*db.Instance, bool, error)
	DoPreDeployJob(resourceInfo *ResourceInfo, tmcInstance *db.Instance) error
	BuildServiceGroupRequest(resourceInfo *ResourceInfo, tmcInstance *db.Instance, clusterConfig map[string]string) interface{}
	DoDeploy(serviceGroupDeployRequest interface{}, resourceInfo *ResourceInfo, tmcInstance *db.Instance, clusterConfig map[string]string) (interface{}, error)
	BuildTmcInstanceConfig(tmcInstance *db.Instance, serviceGroupDeployResult interface{}, clusterConfig map[string]string, additionalConfig map[string]string) map[string]string
	UpdateTmcInstanceOnFinish(tmcInstance *db.Instance, sgConfig map[string]string, sgStatus string) error
	DoPostDeployJob(tmcInstance *db.Instance, serviceGroupDeployResult interface{}, clusterConfig map[string]string) (map[string]string, error)
	CheckIfNeedTmcInstanceTenant(req *ResourceDeployRequest, resourceInfo *ResourceInfo) (*db.InstanceTenant, bool, error)
	DoApplyTmcInstanceTenant(req *ResourceDeployRequest, resourceInfo *ResourceInfo, tmcInstance *db.Instance, tenant *db.InstanceTenant, clusterConfig map[string]string) (map[string]string, error)
	InitializeTmcInstance(req *ResourceDeployRequest, resourceInfo *ResourceInfo, subResults []*ResourceDeployResult) (*db.Instance, error)
	InitializeTmcInstanceTenant(req *ResourceDeployRequest, tmcInstance *db.Instance, subResults []*ResourceDeployResult) (*db.InstanceTenant, error)
	UpdateTmcInstanceTenantOnFinish(tenant *db.InstanceTenant, config map[string]string) (*db.InstanceTenant, error)
	BuildSubResourceDeployRequest(name string, addon *diceyml.AddOn, req *ResourceDeployRequest) *ResourceDeployRequest
	BuildRequestRelation(parentRequest string, childRequest string) error
	BuildDeployResult(tmcInstance *db.Instance, tenant *db.InstanceTenant) ResourceDeployResult
	DeleteTmcInstance(tmcInstance *db.Instance, status string) error
	DeleteTenant(tenant *db.InstanceTenant, tmcInstance *db.Instance, clusterConfig map[string]string) error
	UnDeploy(tmcInstance *db.Instance) error
	GetRelationResourceIds(parentId string) []string
	DeleteRequestRelation(parentId string, childId string) error
}

type ResourceDeployRequest

type ResourceDeployRequest struct {
	Engine      string
	Uuid        string
	Plan        string
	Az          string
	Options     map[string]string
	TenantGroup string
	Callback    string
}

type ResourceDeployResult

type ResourceDeployResult struct {
	ID          string
	Config      map[string]string
	Options     map[string]string
	Status      string
	CreatedTime time.Time
	UpdatedTime time.Time
}

type ResourceInfo

type ResourceInfo struct {
	Tmc        *db.Tmc
	TmcVersion *db.TmcVersion
	Spec       *apistructs.AddonExtension
	Dice       *diceyml.Object
}

Jump to

Keyboard shortcuts

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