Documentation ¶
Overview ¶
Package dbclient 定义数据库操作的方法, orm 等。
Index ¶
- Constants
- func ConvertRuntimeDTO(runtime *Runtime, app *apistructs.ApplicationDTO) *apistructs.RuntimeDTO
- type AddonAttachment
- type AddonAudit
- type AddonDeploy
- type AddonExtra
- type AddonInstance
- type AddonInstanceExtra
- type AddonInstanceRelation
- type AddonInstanceRouting
- type AddonInstanceTenant
- type AddonManagement
- type AddonMicroAttach
- type AddonNode
- type AddonPrebuild
- type DBClient
- func (db *DBClient) ClearRuntimeServiceErrors(serviceId uint64) error
- func (db *DBClient) CountAddonReferenceByClusterAndOrg(clusterName, orgID string) (int, error)
- func (db *DBClient) CountServiceReferenceByClusterAndOrg(clusterName, orgID string) (int, error)
- func (db *DBClient) CreateAddonAudit(addonAudit AddonAudit) error
- func (db *DBClient) CreateAddonDeploy(addonDeploy *AddonDeploy) error
- func (db *DBClient) CreateAddonExtra(addonExtra *AddonExtra) error
- func (db *DBClient) CreateAddonInstance(instance *AddonInstance) error
- func (db *DBClient) CreateAddonInstanceExtra(addonInstanceExtra *AddonInstanceExtra) error
- func (db *DBClient) CreateAddonInstanceRelation(addonInstanceRelation *AddonInstanceRelation) error
- func (db *DBClient) CreateAddonInstanceRouting(addonRouting *AddonInstanceRouting) error
- func (db *DBClient) CreateAddonInstanceTenant(tenant *AddonInstanceTenant) error
- func (db *DBClient) CreateAddonNode(addonNode *AddonNode) error
- func (db *DBClient) CreateAttachment(addonAttachment *AddonAttachment) error
- func (db *DBClient) CreateDeployment(deployment *Deployment) error
- func (db *DBClient) CreateInstance(instance *RuntimeInstance) error
- func (db *DBClient) CreateMicroAttach(addonMicroAttach *AddonMicroAttach) error
- func (db *DBClient) CreateMigrationLog(migrationLog *MigrationLog) error
- func (db *DBClient) CreateOrUpdateRuntimeService(service *RuntimeService, overrideStatus bool) error
- func (db *DBClient) CreatePrebuild(addonPrebuild *AddonPrebuild) error
- func (db *DBClient) CreateRuntime(runtime *Runtime) error
- func (db *DBClient) DeleteAddonInstance(instanceID string) error
- func (db *DBClient) DeleteAddonInstanceTenant(tenantID string) error
- func (db *DBClient) DeleteAttachmentByRuntimeAndInstanceID(runtimeID, instanceID string) error
- func (db *DBClient) DeleteAttachmentByRuntimeAndRoutingInstanceID(runtimeID, routingInstanceID string) error
- func (db *DBClient) DeleteAttachmentsByRoutingInstanceID(routingInstanceID string) error
- func (db *DBClient) DeleteDomain(domainValue string) error
- func (db *DBClient) DeleteDomainsByRuntimeId(runtimeId uint64) error
- func (db *DBClient) DeleteOldest(serviceId uint64, count int) error
- func (db *DBClient) DeleteRuntime(runtimeId uint64) error
- func (db *DBClient) DestroyById(id uint64) error
- func (db *DBClient) DestroyByInstanceId(instanceID string) error
- func (db *DBClient) DestroyByIntsanceID(instanceID string) error
- func (db *DBClient) DestroyByProjectAndEnvAndRoutingId(instanceID string) error
- func (db *DBClient) DestroyByRoutingID(routingInstanceID string) error
- func (db *DBClient) DestroyPrebuildByRuntimeID(runtimeID string) error
- func (db *DBClient) ExistRoost(projectID uint64, clusterName, workspace string) (bool, error)
- func (db *DBClient) ExistZK(projectID uint64, clusterName, workspace string) (bool, error)
- func (db *DBClient) FindDeletingRuntimes() ([]Runtime, error)
- func (db *DBClient) FindDeployments(runtimeId uint64, filter DeploymentFilter, offset int, limit int) ([]Deployment, int, error)
- func (db *DBClient) FindDomains(domainValues []string) ([]RuntimeDomain, error)
- func (db *DBClient) FindDomainsByRuntimeId(runtimeId uint64) ([]RuntimeDomain, error)
- func (db *DBClient) FindDomainsByRuntimeIdAndServiceName(runtimeId uint64, serviceName string) ([]RuntimeDomain, error)
- func (db *DBClient) FindLastDeployment(runtimeId uint64) (*Deployment, error)
- func (db *DBClient) FindMultiRuntimesDeployments(runtimeids []uint64, filter DeploymentFilter, offset int, limit int) ([]Deployment, int, error)
- func (db *DBClient) FindNotOutdatedOlderThan(runtimeId uint64, maxId uint64) ([]Deployment, error)
- func (db *DBClient) FindPreDeployment(uniqueId spec.RuntimeUniqueId) (*PreDeployment, error)
- func (db *DBClient) FindPreDeploymentOrCreate(uniqueId spec.RuntimeUniqueId, dice *diceyml.DiceYaml) (*PreDeployment, error)
- func (db *DBClient) FindRuntime(uniqueId spec.RuntimeUniqueId) (*Runtime, error)
- func (db *DBClient) FindRuntimeOrCreate(uniqueId spec.RuntimeUniqueId, operator string, ...) (*Runtime, bool, error)
- func (db *DBClient) FindRuntimeServices(runtimeId uint64) ([]RuntimeService, error)
- func (db *DBClient) FindRuntimesByAppId(appId uint64) ([]Runtime, error)
- func (db *DBClient) FindRuntimesByIds(ids []uint64) ([]Runtime, error)
- func (db *DBClient) FindRuntimesNewerThan(minId uint64, limit int) ([]Runtime, error)
- func (db *DBClient) FindSuccessfulDeployments(runtimeId uint64, limit int) ([]Deployment, error)
- func (db *DBClient) FindTopDeployments(runtimeId uint64, limit int) ([]Deployment, error)
- func (db *DBClient) FindUnfinishedDeployments() ([]Deployment, error)
- func (db *DBClient) GetAddonInstance(id string) (*AddonInstance, error)
- func (db *DBClient) GetAddonInstanceRoutingByOrgAndAddonName(OrgID, clusterName, addonName, workspace, shareScope string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAddonInstanceRoutingByProjectAndAddonName(projectID, clusterName, addonName, workspace string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAddonInstanceTenant(id string) (*AddonInstanceTenant, error)
- func (db *DBClient) GetAddonNodesByInstanceID(instanceID string) (*[]AddonNode, error)
- func (db *DBClient) GetAddonNodesByInstanceIDs(instanceIDs []string) (*[]AddonNode, error)
- func (db *DBClient) GetAliveByAddonIDs(addonIDs []string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAliveClusterAddon(addonName, clusterName string, status []apistructs.AddonStatus) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAliveDiceAddon(addonName string, status []apistructs.AddonStatus) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAliveProjectAddons(projectID, clusterName, workspace string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetAttachMentsByRuntimeID(runtimeID uint64) (*[]AddonAttachment, error)
- func (db *DBClient) GetAttachmentCountByInstanceID(instanceID string) (int64, error)
- func (db *DBClient) GetAttachmentCountByRoutingInstanceID(routingInstanceID string) (int64, error)
- func (db *DBClient) GetAttachmentsByInstanceID(instanceID string) (*[]AddonAttachment, error)
- func (db *DBClient) GetAttachmentsByRoutingInstanceID(routingInstanceID string) (*[]AddonAttachment, error)
- func (db *DBClient) GetAttachmentsByTenantInstanceID(tenantInstanceID string) (*[]AddonAttachment, error)
- func (db *DBClient) GetByAddonNameAndField(addonName, field string) (*AddonExtra, error)
- func (db *DBClient) GetByAppIdAndBranchAndEnv(applicationID, gitBranch, env string) (*[]AddonPrebuild, error)
- func (db *DBClient) GetByAppIdAndBranchAndEnvAndInstanceName(applicationID, gitBranch, env, instanceName string) (*[]AddonPrebuild, error)
- func (db *DBClient) GetById(id int64) (*AddonPrebuild, error)
- func (db *DBClient) GetByInSideInstanceID(instanceID string) (*AddonInstanceRelation, error)
- func (db *DBClient) GetByInstanceIDAndField(instanceID, field string) (*AddonInstanceExtra, error)
- func (db *DBClient) GetByOutSideInstanceID(instanceID string) (*[]AddonInstanceRelation, error)
- func (db *DBClient) GetByRealInstance(realInstanceID string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetByRoutingIDs(routingInstanceIDs []string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetByRuntimeIDAndInstanceID(runtimeID, instanceID string) (*[]AddonAttachment, error)
- func (db *DBClient) GetByRuntimeIDAndRoutingInstanceID(runtimeID, routingInstanceID string) (*[]AddonAttachment, error)
- func (db *DBClient) GetClusterAddon(addonName string, clusterName []string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetConfigCenterAddonInstance() (*AddonInstance, error)
- func (db *DBClient) GetDefaultDomainOrCreate(runtimeId uint64, serviceName string, domain string) (string, error)
- func (db *DBClient) GetDeployByAddonName(addonName string) (*[]AddonDeploy, error)
- func (db *DBClient) GetDeployById(id int64) (*AddonDeploy, error)
- func (db *DBClient) GetDeployment(id uint64) (*Deployment, error)
- func (db *DBClient) GetDistinctProjectInfo() (*[]string, error)
- func (db *DBClient) GetExtraByAddonName(addonName string) (*[]AddonExtra, error)
- func (db *DBClient) GetInstanceByTaskId(taskId string) (*RuntimeInstance, error)
- func (db *DBClient) GetInstanceCountByServiceId(serviceId uint64) (int, error)
- func (db *DBClient) GetInstanceExtraByAddonName(addonName string) (*[]AddonExtra, error)
- func (db *DBClient) GetInstanceRouting(id string) (*AddonInstanceRouting, error)
- func (db *DBClient) GetInstanceRoutingByRealInstance(realIns string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetInstanceRoutingsByIDs(ids []string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetInstanceRoutingsByProjectIDs(platformServiceType int, projectIDs []string, az, env string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetInstancesByIDs(ids []string) (*[]AddonInstance, error)
- func (db *DBClient) GetMicroAttachByAddonName(addonName string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMicroAttachByOrgId(orgID string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMicroAttachByProjectAndEnv(projectID, env string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMicroAttachByProjects(projectIDs []string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMicroAttachesByAddonName(addonName, orgID string, projectIDs []string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMicroAttachesByAddonNameAndProjectIDs(addonName string, projectIDs []string, env string) (*[]AddonMicroAttach, error)
- func (db *DBClient) GetMigrationLogByDeploymentID(deploymentID uint64) (*MigrationLog, error)
- func (db *DBClient) GetMigrationLogExpiredThreeDays() (*[]MigrationLog, error)
- func (db *DBClient) GetOrgRoutingInstances(orgID, workspace, cluster string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetPreBuildsByRuntimeID(runtimeID uint64) (*[]AddonPrebuild, error)
- func (db *DBClient) GetProjectAddon(addonName, orgID, env string, projectIds []string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetProjectRoutingInstances(orgID, projectID, workspace, cluster string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstanceByProjectAndName(projectID uint64, workspace, addonName, name, clusterName string) (*AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesByAddonName(orgID uint64, addonName string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesByCategory(orgID uint64, category string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesByOrg(orgID uint64) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesByProject(orgID, projectID uint64, category string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesBySimilar(addonNames []string, params *apistructs.AddonHandlerCreateItem) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRoutingInstancesByWorkbench(orgID uint64, projectIDs []string, category string) (*[]AddonInstanceRouting, error)
- func (db *DBClient) GetRunningInstancesByServiceId(serviceId uint64) ([]RuntimeInstance, error)
- func (db *DBClient) GetRuntime(id uint64) (*Runtime, error)
- func (db *DBClient) GetRuntimeAllowNil(id uint64) (*Runtime, error)
- func (db *DBClient) GetRuntimeByProjectIDs(projectIDs []uint64) (*[]Runtime, error)
- func (db *DBClient) GetRuntimeByScheduleName(scheduleName string) (*Runtime, error)
- func (db *DBClient) ListAddonInstanceByAddonName(projectID, workspace, addonName string) (*[]AddonInstance, error)
- func (db *DBClient) ListAddonInstanceByOrg(orgID uint64) (*[]AddonInstance, error)
- func (db *DBClient) ListAddonInstanceTenant() ([]AddonInstanceTenant, error)
- func (db *DBClient) ListAddonInstanceTenantByAddonInstanceID(addoninstanceId string) ([]AddonInstanceTenant, error)
- func (db *DBClient) ListAddonInstanceTenantByAddonInstanceRoutingID(addoninstanceroutingId string) ([]AddonInstanceTenant, error)
- func (db *DBClient) ListAddonInstanceTenantByProjectIDs(projectIDs []uint64, workspace ...string) ([]AddonInstanceTenant, error)
- func (db *DBClient) ListAddonInstancesByParams(orgID uint64, params *apistructs.MiddlewareListRequest) (int, *[]AddonInstance, error)
- func (db *DBClient) ListAddonInstancesByParamsWithoutPage(orgID uint64, params *apistructs.MiddlewareListRequest) (*[]AddonInstance, error)
- func (db *DBClient) ListAddonInstancesByProjectIDs(projectIDs []uint64, exclude ...string) (*[]AddonInstance, error)
- func (db *DBClient) ListAttachedAddonInstance() ([]AddonInstance, error)
- func (db *DBClient) ListAttachedRoutingInstance() ([]AddonInstanceRouting, error)
- func (db *DBClient) ListAttachingAddonInstance() (*[]AddonInstance, error)
- func (db *DBClient) ListNoAttachAddon() (*[]RemoveAddonID, error)
- func (db *DBClient) ListRoutingInstanceByCluster(clusterName string) ([]AddonInstanceRouting, error)
- func (db *DBClient) ListRuntimeByCluster(clusterName string) ([]Runtime, error)
- func (db *DBClient) ResetPreDice(uniqueId spec.RuntimeUniqueId) error
- func (db *DBClient) SaveDomain(domain *RuntimeDomain) error
- func (db *DBClient) SetRuntimeServiceErrors(serviceId uint64, errs []apistructs.ErrorResponse) error
- func (db *DBClient) UpdateAddonDeploy(addonDeploy *AddonDeploy) error
- func (db *DBClient) UpdateAddonExtra(addonExtra *AddonExtra) error
- func (db *DBClient) UpdateAddonInstance(instance *AddonInstance) error
- func (db *DBClient) UpdateAddonInstanceExtra(addonInstanceExtra *AddonInstanceExtra) error
- func (db *DBClient) UpdateAddonInstanceRelation(addonInstanceRelation *AddonInstanceRelation) error
- func (db *DBClient) UpdateAddonInstanceResource(ID string, cpurequest, cpulimit float64, memrequest, memlimit int) error
- func (db *DBClient) UpdateAddonInstanceRoutingStatus(ID, status string) error
- func (db *DBClient) UpdateAddonInstanceStatus(ID, status string) error
- func (db *DBClient) UpdateAddonInstanceTenant(tenant *AddonInstanceTenant) error
- func (db *DBClient) UpdateAttachment(addonAttachment *AddonAttachment) error
- func (db *DBClient) UpdateCount(id uint64, diff int) error
- func (db *DBClient) UpdateDeleteStatus(id int64, deleteStatus int8) error
- func (db *DBClient) UpdateDeployment(deployment *Deployment) error
- func (db *DBClient) UpdateInstance(instance *RuntimeInstance) error
- func (db *DBClient) UpdateInstanceId(id int64, instanceId, routingInstanceId string) error
- func (db *DBClient) UpdateInstanceRouting(routing *AddonInstanceRouting) error
- func (db *DBClient) UpdateMigrationLog(migrationLog *MigrationLog) error
- func (db *DBClient) UpdatePreDeployment(pre *PreDeployment) error
- func (db *DBClient) UpdatePrebuild(addonPrebuild *AddonPrebuild) error
- func (db *DBClient) UpdateRuntime(runtime *Runtime) error
- func (db *DBClient) UpdateRuntimeId(applicationID, gitBranch, env, runtimeId string) error
- type Deployment
- type DeploymentExtra
- type DeploymentFilter
- type MigrationLog
- type PreDeployment
- type RemoveAddonID
- type Runtime
- type RuntimeDomain
- type RuntimeInstance
- type RuntimeService
- type ScheduleName
Constants ¶
const (
LegacyStatusDeleting = "DELETING"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertRuntimeDTO ¶
func ConvertRuntimeDTO(runtime *Runtime, app *apistructs.ApplicationDTO) *apistructs.RuntimeDTO
TODO: we no need app, just redundant fields into runtime table
Types ¶
type AddonAttachment ¶
type AddonAttachment struct { ID uint64 `gorm:"primary_key"` InstanceID string `gorm:"type:varchar(64)"` // AddonInstance 主键 RoutingInstanceID string `gorm:"type:varchar(64)"` // AddonInstanceRouting 主键 TenantInstanceID string `gorm:"type:varchar(64)"` Options string `gorm:"type:text"` OrgID string ProjectID string ApplicationID string RuntimeID string `gorm:"column:app_id"` InsideAddon string `gorm:"type:varchar(1)"` // N or Y RuntimeName string Deleted string `gorm:"column:is_deleted"` // Y: 已删除 N: 未删除 CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonAttachment addon & runtime 关联关系
type AddonAudit ¶
type AddonAudit struct { ID int64 `gorm:"primary_key"` // 唯一Id OrgID string `gorm:"type:varchar(16)"` // 企业ID ProjectID string `gorm:"type:varchar(16)"` // 项目ID Workspace string `gorm:"type:varchar(16)"` // 环境 Operator string `gorm:"type:varchar(255)"` // 操作人 OpName string `gorm:"type:varchar(64)"` // 操作类型 AddonName string `gorm:"type:varchar(128)"` // 属性值 InsID string `gorm:"type:varchar(64)"` // 属性值 InsName string `gorm:"type:varchar(128)"` // 属性值 Params string `gorm:"type:varchar(4096)"` // 属性值 Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonAudit 第三方addon操作审计信息
type AddonDeploy ¶
type AddonDeploy struct { ID uint64 `gorm:"primary_key"` // 唯一Id AddonName string `gorm:"type:varchar(64)"` // addon名称 Version string `gorm:"type:varchar(32)"` // 版本 DeployStatus string `gorm:"type:varchar(32)"` // 发布状态 DeployMode string `gorm:"type:varchar(32)"` // 发布方式,upgrade或rollback Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonDeploy 平台组件发布信息
type AddonExtra ¶
type AddonExtra struct { ID string `gorm:"type:varchar(64)"` // 唯一Id AddonName string `gorm:"type:varchar(64)"` // addon名称 Field string `gorm:"type:varchar(64)"` // 属性名称 Value string `gorm:"type:text"` // 属性值 Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonExtra 存储addon额外信息
type AddonInstance ¶
type AddonInstance struct { ID string `gorm:"type:varchar(64);primary_key"` // 主键 Name string `gorm:"type:varchar(64)"` // 用户 dice.yml 指定 AddonID string `gorm:"type:varchar(64)"` // addonID // TODO deprecated AddonName string `gorm:"type:varchar(64)"` // 应用市场 addon 名称 Category string Namespace string ScheduleName string Plan string Version string Options string `gorm:"type:text"` Config string `gorm:"type:text"` Label string Status string OrgID string Cluster string `gorm:"column:az"` // 集群名称 ProjectID string ApplicationID string AppID string `gorm:"column:app_id"` Workspace string `gorm:"column:env;type:varchar(20)"` // DEV/TEST/STAGING/PROD Deleted string `gorm:"column:is_deleted"` // Y: 已删除 N: 未删除 PlatformServiceType int `gorm:"type:int(1)"` // 服务类型,0:基础addon,1:微服务,2:通用能力 KmsKey string `gorm:"column:kms_key"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` CpuRequest float64 CpuLimit float64 MemRequest int MemLimit int }
AddonInstance addon 实例
type AddonInstanceExtra ¶
type AddonInstanceExtra struct { ID string `gorm:"type:varchar(64)"` // 唯一Id InstanceID string `gorm:"type:varchar(64)"` // addon名称 Field string `gorm:"type:varchar(32)"` // 属性名称 Value string `gorm:"type:text"` // 属性值 Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonInstanceExtra 存储addon实例额外信息
type AddonInstanceRelation ¶
type AddonInstanceRelation struct { ID string `gorm:"type:varchar(64)"` // 唯一Id OutsideInstanceID string `gorm:"type:varchar(64)"` // addon实例Id InsideInstanceID string `gorm:"type:varchar(32)"` // addon实例依赖Id Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonInstanceRelation 存储addon实例依赖关系
func (AddonInstanceRelation) TableName ¶
func (AddonInstanceRelation) TableName() string
TableName 数据库表名
type AddonInstanceRouting ¶
type AddonInstanceRouting struct { ID string `gorm:"type:varchar(64);primary_key"` // 主键 RealInstance string `gorm:"type:varchar(64)"` // AddonInstance 主键 Name string `gorm:"type:varchar(64)"` // 用户 dice.yml 指定 AddonID string `gorm:"type:varchar(64)"` // addonID AddonName string `gorm:"type:varchar(64)"` // 应用市场 addon 名称 Category string Plan string Version string Options string `gorm:"type:text"` Status string OrgID string Cluster string `gorm:"column:az"` // 集群名称 ProjectID string ApplicationID string AppID string `gorm:"column:app_id"` Workspace string `gorm:"column:env;type:varchar(20)"` // DEV/TEST/STAGING/PROD InsideAddon string `gorm:"type:varchar(1)"` // N or Y Tag string `gorm:"type:varchar(64)"` // 实例标签 Reference int `gorm:"column:attach_count"` // addon 实例引用数 Deleted string `gorm:"column:is_deleted"` // Y: 已删除 N: 未删除 IsPlatform bool // 是否为平台Addon实例 PlatformServiceType int `gorm:"type:int(1)"` // 服务类型,0:基础addon,1:微服务,2:通用能力 CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonInstanceRouting addon 真实实例
func (AddonInstanceRouting) TableName ¶
func (AddonInstanceRouting) TableName() string
TableName 数据库表名
type AddonInstanceTenant ¶
type AddonInstanceTenant struct { ID string `gorm:"type:varchar(64);primary_key"` // 主键 Name string `gorm:"type:varchar(64)"` // project 级唯一 AddonInstanceID string `gorm:"type:varchar(64)"` // addon 实例 ID AddonInstanceRoutingID string `gorm:"type:varchar(64)"` // addon 实例 ID Config string `gorm:"type:text"` OrgID string ProjectID string AppID string `gorm:"column:app_id"` Workspace string `gorm:"type:varchar(20)"` // DEV/TEST/STAGING/PROD Deleted string `gorm:"column:is_deleted"` // Y: 已删除 N: 未删除 KmsKey string `gorm:"column:kms_key"` Reference int CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonInstance addon 租户
func (AddonInstanceTenant) TableName ¶
func (AddonInstanceTenant) TableName() string
type AddonManagement ¶
type AddonManagement struct { ID uint64 `gorm:"primary_key"` AddonID string `gorm:"type:varchar(64)"` // 主键 Name string `gorm:"type:varchar(64)"` ProjectID string OrgID string AddonConfig string `gorm:"type:text"` CPU float64 Mem uint64 Nodes int CreateTime time.Time `gorm:"column:create_time"` UpdateTime time.Time `gorm:"column:update_time"` }
addon management
func (AddonManagement) TableName ¶
func (AddonManagement) TableName() string
type AddonMicroAttach ¶
type AddonMicroAttach struct { ID uint64 `gorm:"primary_key"` AddonName string `gorm:"type:varchar(64)"` RoutingInstanceID string `gorm:"type:varchar(64)"` InstanceID string `gorm:"type:varchar(64)"` ProjectID string `gorm:"type:varchar(64)"` OrgID string `gorm:"type:varchar(64)"` Env string `gorm:"type:varchar(16)"` Count uint32 `gorm:"type:int(11)"` Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
Microservices and project associations
func (AddonMicroAttach) TableName ¶
func (AddonMicroAttach) TableName() string
type AddonNode ¶
type AddonNode struct { ID string `gorm:"type:varchar(64)"` InstanceID string `gorm:"type:varchar(64)"` // AddonInstance 主键 Namespace string `gorm:"type:text"` NodeName string CPU float64 Mem uint64 Deleted string `gorm:"column:is_deleted"` // Y: 已删除 N: 未删除 CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
AddonNode addon node信息
type AddonPrebuild ¶
type AddonPrebuild struct { ID uint64 `gorm:"primary_key"` ApplicationID string `gorm:"type:varchar(32)"` GitBranch string `gorm:"type:varchar(128)"` Env string `gorm:"type:varchar(10)"` RuntimeID string `gorm:"type:varchar(32)"` RoutingInstanceID string `gorm:"type:varchar(64)"` InstanceID string `gorm:"type:varchar(64)"` InstanceName string `gorm:"type:varchar(128)"` AddonName string `gorm:"type:varchar(128)"` Plan string `gorm:"column:addon_class;type:varchar(64)"` Options string `gorm:"type:varchar(1024)"` Config string `gorm:"type:varchar(1024)"` BuildFrom int `gorm:"type:int(1);default:0"` // 0: dice.yml 来源 1: 重新分析 DeleteStatus int `gorm:"type:int(1),column:delete_status"` // 0: 未删除,1: diceyml删除,2: 重新分析删除 Deleted string `gorm:"column:is_deleted"` CreatedAt time.Time `gorm:"column:create_time"` UpdatedAt time.Time `gorm:"column:update_time"` }
Addon prebuild信息
func (AddonPrebuild) TableName ¶
func (AddonPrebuild) TableName() string
type DBClient ¶
func (*DBClient) ClearRuntimeServiceErrors ¶
func (*DBClient) CountAddonReferenceByClusterAndOrg ¶
CountAddonReferenceByClusterAndOrg 统计集群中addon数量
func (*DBClient) CountServiceReferenceByClusterAndOrg ¶
CountServiceReferenceByClusterAndOrg 统计集群中service数量
func (*DBClient) CreateAddonAudit ¶
func (db *DBClient) CreateAddonAudit(addonAudit AddonAudit) error
CreateAddonAudit insert AddonAudit
func (*DBClient) CreateAddonDeploy ¶
func (db *DBClient) CreateAddonDeploy(addonDeploy *AddonDeploy) error
CreateAddonDeploy insert AddonDeploy
func (*DBClient) CreateAddonExtra ¶
func (db *DBClient) CreateAddonExtra(addonExtra *AddonExtra) error
CreateAddonExtra insert AddonExtra
func (*DBClient) CreateAddonInstance ¶
func (db *DBClient) CreateAddonInstance(instance *AddonInstance) error
CreateAddonInstance 创建 addon instance
func (*DBClient) CreateAddonInstanceExtra ¶
func (db *DBClient) CreateAddonInstanceExtra(addonInstanceExtra *AddonInstanceExtra) error
CreateAddonInstanceExtra insert AddonExtra
func (*DBClient) CreateAddonInstanceRelation ¶
func (db *DBClient) CreateAddonInstanceRelation(addonInstanceRelation *AddonInstanceRelation) error
CreateAddonInstanceRelation insert AddonInstanceRelation
func (*DBClient) CreateAddonInstanceRouting ¶
func (db *DBClient) CreateAddonInstanceRouting(addonRouting *AddonInstanceRouting) error
CreateAddonInstanceRouting insert addon routing info
func (*DBClient) CreateAddonInstanceTenant ¶
func (db *DBClient) CreateAddonInstanceTenant(tenant *AddonInstanceTenant) error
func (*DBClient) CreateAddonNode ¶
CreateAddonNode insert addonNode
func (*DBClient) CreateAttachment ¶
func (db *DBClient) CreateAttachment(addonAttachment *AddonAttachment) error
CreateAttachment insert addonAttachment
func (*DBClient) CreateDeployment ¶
func (db *DBClient) CreateDeployment(deployment *Deployment) error
func (*DBClient) CreateInstance ¶
func (db *DBClient) CreateInstance(instance *RuntimeInstance) error
func (*DBClient) CreateMicroAttach ¶
func (db *DBClient) CreateMicroAttach(addonMicroAttach *AddonMicroAttach) error
CreateMicroAttach insert microservice attachment
func (*DBClient) CreateMigrationLog ¶
func (db *DBClient) CreateMigrationLog(migrationLog *MigrationLog) error
CreateMigrationLog insert migrationLog
func (*DBClient) CreateOrUpdateRuntimeService ¶
func (db *DBClient) CreateOrUpdateRuntimeService(service *RuntimeService, overrideStatus bool) error
func (*DBClient) CreatePrebuild ¶
func (db *DBClient) CreatePrebuild(addonPrebuild *AddonPrebuild) error
CreatePrebuild insert addon prebuild info
func (*DBClient) CreateRuntime ¶
func (*DBClient) DeleteAddonInstance ¶
DeleteAddonInstance 删除 addon instance
func (*DBClient) DeleteAddonInstanceTenant ¶
func (*DBClient) DeleteAttachmentByRuntimeAndInstanceID ¶
DeleteAttachmentByRuntimeAndInstanceID 根据 runtimeID & InstanceID 删除 attachment
func (*DBClient) DeleteAttachmentByRuntimeAndRoutingInstanceID ¶
func (db *DBClient) DeleteAttachmentByRuntimeAndRoutingInstanceID(runtimeID, routingInstanceID string) error
DeleteAttachmentByRuntimeAndRoutingInstanceID 根据 runtimeID & routingInstanceID 删除 attachment
func (*DBClient) DeleteAttachmentsByRoutingInstanceID ¶
DeleteAttachmentsByRoutingInstanceID 根据 routingInstanceID 删除 attachment
func (*DBClient) DeleteDomain ¶
func (*DBClient) DeleteDomainsByRuntimeId ¶
func (*DBClient) DeleteRuntime ¶
func (*DBClient) DestroyById ¶
DestroyById 根据Id删除引用
func (*DBClient) DestroyByInstanceId ¶
DestroyByInstanceId 根据addon实例Id,删除引用
func (*DBClient) DestroyByIntsanceID ¶
DestroyByIntsanceID 根据instanceID逻辑删除attach信息
func (*DBClient) DestroyByProjectAndEnvAndRoutingId ¶
DestroyByProjectAndEnvAndRoutingId 根据项目Id、环境、addon路由Id,删除引用
func (*DBClient) DestroyByRoutingID ¶
DestroyByRoutingID 根据routingId删除信息
func (*DBClient) DestroyPrebuildByRuntimeID ¶
DestroyPrebuildByRuntimeID 根据runtimeId删除信息
func (*DBClient) ExistRoost ¶
ExistRoost 给定 projectID+workspace下是否有roost
func (*DBClient) FindDeletingRuntimes ¶
func (*DBClient) FindDeployments ¶
func (db *DBClient) FindDeployments(runtimeId uint64, filter DeploymentFilter, offset int, limit int) ([]Deployment, int, error)
func (*DBClient) FindDomains ¶
func (db *DBClient) FindDomains(domainValues []string) ([]RuntimeDomain, error)
func (*DBClient) FindDomainsByRuntimeId ¶
func (db *DBClient) FindDomainsByRuntimeId(runtimeId uint64) ([]RuntimeDomain, error)
func (*DBClient) FindDomainsByRuntimeIdAndServiceName ¶
func (db *DBClient) FindDomainsByRuntimeIdAndServiceName(runtimeId uint64, serviceName string) ([]RuntimeDomain, error)
func (*DBClient) FindLastDeployment ¶
func (db *DBClient) FindLastDeployment(runtimeId uint64) (*Deployment, error)
if not found, will return (nil, nil)
func (*DBClient) FindMultiRuntimesDeployments ¶
func (db *DBClient) FindMultiRuntimesDeployments(runtimeids []uint64, filter DeploymentFilter, offset int, limit int) ([]Deployment, int, error)
func (*DBClient) FindNotOutdatedOlderThan ¶
func (db *DBClient) FindNotOutdatedOlderThan(runtimeId uint64, maxId uint64) ([]Deployment, error)
find not-outdated deployments older than maxId (id < maxId)
func (*DBClient) FindPreDeployment ¶
func (db *DBClient) FindPreDeployment(uniqueId spec.RuntimeUniqueId) (*PreDeployment, error)
func (*DBClient) FindPreDeploymentOrCreate ¶
func (db *DBClient) FindPreDeploymentOrCreate(uniqueId spec.RuntimeUniqueId, dice *diceyml.DiceYaml) (*PreDeployment, error)
func (*DBClient) FindRuntime ¶
func (db *DBClient) FindRuntime(uniqueId spec.RuntimeUniqueId) (*Runtime, error)
if not found, return (nil, nil)
func (*DBClient) FindRuntimeOrCreate ¶
func (db *DBClient) FindRuntimeOrCreate(uniqueId spec.RuntimeUniqueId, operator string, source apistructs.RuntimeSource, clusterName string, clusterId uint64, gitRepoAbbrev string, projectID, orgID uint64) (*Runtime, bool, error)
func (*DBClient) FindRuntimeServices ¶
func (db *DBClient) FindRuntimeServices(runtimeId uint64) ([]RuntimeService, error)
func (*DBClient) FindRuntimesByAppId ¶
func (*DBClient) FindRuntimesByIds ¶
func (*DBClient) FindRuntimesNewerThan ¶
find runtimes newer than minId (id > minId)
func (*DBClient) FindSuccessfulDeployments ¶
func (db *DBClient) FindSuccessfulDeployments(runtimeId uint64, limit int) ([]Deployment, error)
func (*DBClient) FindTopDeployments ¶
func (db *DBClient) FindTopDeployments(runtimeId uint64, limit int) ([]Deployment, error)
func (*DBClient) FindUnfinishedDeployments ¶
func (db *DBClient) FindUnfinishedDeployments() ([]Deployment, error)
func (*DBClient) GetAddonInstance ¶
func (db *DBClient) GetAddonInstance(id string) (*AddonInstance, error)
GetAddonInstance 获取 addon instance
func (*DBClient) GetAddonInstanceRoutingByOrgAndAddonName ¶
func (db *DBClient) GetAddonInstanceRoutingByOrgAndAddonName(OrgID, clusterName, addonName, workspace, shareScope string) ( *[]AddonInstanceRouting, error)
GetAddonInstanceRoutingByOrgAndAddonName 根据 OrgID & addonName & clusterName & workspace 获取
func (*DBClient) GetAddonInstanceRoutingByProjectAndAddonName ¶
func (db *DBClient) GetAddonInstanceRoutingByProjectAndAddonName(projectID, clusterName, addonName, workspace string) ( *[]AddonInstanceRouting, error)
GetAddonInstanceRoutingByProjectAndAddonName 根据 projectID & addonName & clusterName & workspace 获取
func (*DBClient) GetAddonInstanceTenant ¶
func (db *DBClient) GetAddonInstanceTenant(id string) (*AddonInstanceTenant, error)
func (*DBClient) GetAddonNodesByInstanceID ¶
GetAddonNodesByInstanceID 根据instanceID获取addonNode信息
func (*DBClient) GetAddonNodesByInstanceIDs ¶
GetAddonNodesByInstanceIDs 根据instanceID列表获取addonNode信息
func (*DBClient) GetAliveByAddonIDs ¶
func (db *DBClient) GetAliveByAddonIDs(addonIDs []string) (*[]AddonInstanceRouting, error)
GetAliveByAddonIDs 根据addonId列表获取信息
func (*DBClient) GetAliveClusterAddon ¶
func (db *DBClient) GetAliveClusterAddon(addonName, clusterName string, status []apistructs.AddonStatus) (*[]AddonInstanceRouting, error)
GetAliveClusterAddon 获取cluster级别微服务addon信息
func (*DBClient) GetAliveDiceAddon ¶
func (db *DBClient) GetAliveDiceAddon(addonName string, status []apistructs.AddonStatus) (*[]AddonInstanceRouting, error)
GetAliveDiceAddon 获取dice级别addon信息
func (*DBClient) GetAliveProjectAddons ¶
func (db *DBClient) GetAliveProjectAddons(projectID, clusterName, workspace string) (*[]AddonInstanceRouting, error)
GetAliveProjectAddon 获取project级别微服务addon信息
func (*DBClient) GetAttachMentsByRuntimeID ¶
func (db *DBClient) GetAttachMentsByRuntimeID(runtimeID uint64) (*[]AddonAttachment, error)
GetAttachMentsByRuntimeID 根据runtimeID获取attachment信息
func (*DBClient) GetAttachmentCountByInstanceID ¶
GetAttachmentCountByInstanceID count数据量
func (*DBClient) GetAttachmentCountByRoutingInstanceID ¶
GetAttachmentCountByRoutingInstanceID count数据量
func (*DBClient) GetAttachmentsByInstanceID ¶
func (db *DBClient) GetAttachmentsByInstanceID(instanceID string) (*[]AddonAttachment, error)
GetAttachmentsByInstanceID 根据instanceId获取attachment信息
func (*DBClient) GetAttachmentsByRoutingInstanceID ¶
func (db *DBClient) GetAttachmentsByRoutingInstanceID(routingInstanceID string) (*[]AddonAttachment, error)
GetAttachmentsByRoutingInstanceID 根据routingInstanceID获取attachment信息
func (*DBClient) GetAttachmentsByTenantInstanceID ¶
func (db *DBClient) GetAttachmentsByTenantInstanceID(tenantInstanceID string) (*[]AddonAttachment, error)
GetAttachmentsByTenantInstanceID 根据 tenantInstanceID 获取 attachment 信息
func (*DBClient) GetByAddonNameAndField ¶
func (db *DBClient) GetByAddonNameAndField(addonName, field string) (*AddonExtra, error)
GetByAddonNameAndField 根据addonName、field获取AddonExtra信息
func (*DBClient) GetByAppIdAndBranchAndEnv ¶
func (db *DBClient) GetByAppIdAndBranchAndEnv(applicationID, gitBranch, env string) (*[]AddonPrebuild, error)
GetByAppIdAndBranchAndEnv 通过applicationID、branch、env获取prebuild信息
func (*DBClient) GetByAppIdAndBranchAndEnvAndInstanceName ¶
func (db *DBClient) GetByAppIdAndBranchAndEnvAndInstanceName(applicationID, gitBranch, env, instanceName string) (*[]AddonPrebuild, error)
GetByAppIdAndBranchAndEnvAndInstanceName 获取prebuild信息
func (*DBClient) GetById ¶
func (db *DBClient) GetById(id int64) (*AddonPrebuild, error)
GetById 通过id获取prebuild信息
func (*DBClient) GetByInSideInstanceID ¶
func (db *DBClient) GetByInSideInstanceID(instanceID string) (*AddonInstanceRelation, error)
GetByInSideInstanceID 根据addonName、field获取AddonExtra信息
func (*DBClient) GetByInstanceIDAndField ¶
func (db *DBClient) GetByInstanceIDAndField(instanceID, field string) (*AddonInstanceExtra, error)
GetByInstanceIDAndField 根据addonName、field获取AddonExtra信息
func (*DBClient) GetByOutSideInstanceID ¶
func (db *DBClient) GetByOutSideInstanceID(instanceID string) (*[]AddonInstanceRelation, error)
GetByInstanceIDAndField 根据addonName、field获取AddonExtra信息
func (*DBClient) GetByRealInstance ¶
func (db *DBClient) GetByRealInstance(realInstanceID string) (*[]AddonInstanceRouting, error)
GetByRealInstance 获取 realInstanceID 的数据信息
func (*DBClient) GetByRoutingIDs ¶
func (db *DBClient) GetByRoutingIDs(routingInstanceIDs []string) (*[]AddonInstanceRouting, error)
GetByRoutingIDs 根据Id列表获取routingInstance信息
func (*DBClient) GetByRuntimeIDAndInstanceID ¶
func (db *DBClient) GetByRuntimeIDAndInstanceID(runtimeID, instanceID string) (*[]AddonAttachment, error)
GetByRuntimeIDAndInstanceID 根据runtimeID、instanceId获取attachment信息
func (*DBClient) GetByRuntimeIDAndRoutingInstanceID ¶
func (db *DBClient) GetByRuntimeIDAndRoutingInstanceID(runtimeID, routingInstanceID string) (*[]AddonAttachment, error)
GetByRuntimeIDAndRoutingInstanceID 根据runtimeID、routingInstanceID获取attachment信息
func (*DBClient) GetClusterAddon ¶
func (db *DBClient) GetClusterAddon(addonName string, clusterName []string) (*[]AddonInstanceRouting, error)
GetClusterAddon 获取cluster级别addon信息
func (*DBClient) GetConfigCenterAddonInstance ¶
func (db *DBClient) GetConfigCenterAddonInstance() (*AddonInstance, error)
GetConfigCenterAddonInstance 获取配置中心的instance
func (*DBClient) GetDefaultDomainOrCreate ¶
func (*DBClient) GetDeployByAddonName ¶
func (db *DBClient) GetDeployByAddonName(addonName string) (*[]AddonDeploy, error)
GetDeployByAddonName 根据addonName获取AddonDeploy信息
func (*DBClient) GetDeployById ¶
func (db *DBClient) GetDeployById(id int64) (*AddonDeploy, error)
GetDeployById 根据id获取addonDeploy信息
func (*DBClient) GetDeployment ¶
func (db *DBClient) GetDeployment(id uint64) (*Deployment, error)
func (*DBClient) GetDistinctProjectInfo ¶
GetDistinctProjectInfo 获取所有project信息
func (*DBClient) GetExtraByAddonName ¶
func (db *DBClient) GetExtraByAddonName(addonName string) (*[]AddonExtra, error)
GetByAddonName 根据addonName获取AddonExtra信息
func (*DBClient) GetInstanceByTaskId ¶
func (db *DBClient) GetInstanceByTaskId(taskId string) (*RuntimeInstance, error)
func (*DBClient) GetInstanceCountByServiceId ¶
func (*DBClient) GetInstanceExtraByAddonName ¶
func (db *DBClient) GetInstanceExtraByAddonName(addonName string) (*[]AddonExtra, error)
GetByAddonName 根据addonName获取AddonExtra信息
func (*DBClient) GetInstanceRouting ¶
func (db *DBClient) GetInstanceRouting(id string) (*AddonInstanceRouting, error)
GetInstanceRouting 获取 instanceRouting 实例
func (*DBClient) GetInstanceRoutingByRealInstance ¶
func (db *DBClient) GetInstanceRoutingByRealInstance(realIns string) (*[]AddonInstanceRouting, error)
GetInstanceRoutingByRealInstance 通过真实例Id查找routing信息
func (*DBClient) GetInstanceRoutingsByIDs ¶
func (db *DBClient) GetInstanceRoutingsByIDs(ids []string) (*[]AddonInstanceRouting, error)
GetInstanceRoutingsByIDs 根据 ID 查询实例路由
func (*DBClient) GetInstanceRoutingsByProjectIDs ¶
func (db *DBClient) GetInstanceRoutingsByProjectIDs(platformServiceType int, projectIDs []string, az, env string) (*[]AddonInstanceRouting, error)
GetInstanceRoutingsByProjectIDs 获取project级别的实例路由
func (*DBClient) GetInstancesByIDs ¶
func (db *DBClient) GetInstancesByIDs(ids []string) (*[]AddonInstance, error)
GetInstancesByIDs 根据 ID 查询实例
func (*DBClient) GetMicroAttachByAddonName ¶
func (db *DBClient) GetMicroAttachByAddonName(addonName string) (*[]AddonMicroAttach, error)
GetMicroAttachByAddonName 通过addonName来获取microservice attach信息
func (*DBClient) GetMicroAttachByOrgId ¶
func (db *DBClient) GetMicroAttachByOrgId(orgID string) (*[]AddonMicroAttach, error)
GetMicroAttachByOrgId 通过orgID来获取microservice attach信息
func (*DBClient) GetMicroAttachByProjectAndEnv ¶
func (db *DBClient) GetMicroAttachByProjectAndEnv(projectID, env string) (*[]AddonMicroAttach, error)
GetMicroAttachByProjectAndEnv 通过projectID和env来获取microservice attach信息
func (*DBClient) GetMicroAttachByProjects ¶
func (db *DBClient) GetMicroAttachByProjects(projectIDs []string) (*[]AddonMicroAttach, error)
GetMicroAttachByProjects 通过projectID列表获取microservice attach信息
func (*DBClient) GetMicroAttachesByAddonName ¶
func (db *DBClient) GetMicroAttachesByAddonName(addonName, orgID string, projectIDs []string) (*[]AddonMicroAttach, error)
GetAttachmentsByProjectIDs 根据项目 ID 和环境获取微服务引用
func (*DBClient) GetMicroAttachesByAddonNameAndProjectIDs ¶
func (db *DBClient) GetMicroAttachesByAddonNameAndProjectIDs(addonName string, projectIDs []string, env string) (*[]AddonMicroAttach, error)
GetAttachmentsByProjectIDs 根据项目 ID 和环境获取微服务引用
func (*DBClient) GetMigrationLogByDeploymentID ¶
func (db *DBClient) GetMigrationLogByDeploymentID(deploymentID uint64) (*MigrationLog, error)
GetMigrationLogByDeploymentID 根据 deployID 查询migration信息
func (*DBClient) GetMigrationLogExpiredThreeDays ¶
func (db *DBClient) GetMigrationLogExpiredThreeDays() (*[]MigrationLog, error)
GetMigrationLogExpired 获取已经过期的migration操作记录
func (*DBClient) GetOrgRoutingInstances ¶
func (db *DBClient) GetOrgRoutingInstances(orgID, workspace, cluster string) (*[]AddonInstanceRouting, error)
GetOrgRoutingInstances 获取企业下可用的企业级共享 addon 实例列表
func (*DBClient) GetPreBuildsByRuntimeID ¶
func (db *DBClient) GetPreBuildsByRuntimeID(runtimeID uint64) (*[]AddonPrebuild, error)
GetPreBuildsByRuntimeID 通过 runtimeID 获取 prebuild 信息
func (*DBClient) GetProjectAddon ¶
func (db *DBClient) GetProjectAddon(addonName, orgID, env string, projectIds []string) (*[]AddonInstanceRouting, error)
GetProjectAddon 获取project级别addon信息
func (*DBClient) GetProjectRoutingInstances ¶
func (db *DBClient) GetProjectRoutingInstances(orgID, projectID, workspace, cluster string) (*[]AddonInstanceRouting, error)
GetProjectRoutingInstances 获取项目下可用的项目级共享 addon 实例列表
func (*DBClient) GetRoutingInstanceByProjectAndName ¶
func (db *DBClient) GetRoutingInstanceByProjectAndName(projectID uint64, workspace, addonName, name, clusterName string) (*AddonInstanceRouting, error)
GetRoutingInstanceByProjectAndName 根据 projectID 等信息获取 addon
func (*DBClient) GetRoutingInstancesByAddonName ¶
func (db *DBClient) GetRoutingInstancesByAddonName(orgID uint64, addonName string) (*[]AddonInstanceRouting, error)
GetRoutingInstancesByAddonName 根据 addonName 获取指定企业下的 addon 实例列表
func (*DBClient) GetRoutingInstancesByCategory ¶
func (db *DBClient) GetRoutingInstancesByCategory(orgID uint64, category string) (*[]AddonInstanceRouting, error)
GetRoutingInstancesByCategory 根据 category 获取指定企业下的 addon 实例列表
func (*DBClient) GetRoutingInstancesByOrg ¶
func (db *DBClient) GetRoutingInstancesByOrg(orgID uint64) (*[]AddonInstanceRouting, error)
GetRoutingInstancesByOrg 根据 orgID 获取 addon 实例列表
func (*DBClient) GetRoutingInstancesByProject ¶
func (db *DBClient) GetRoutingInstancesByProject(orgID, projectID uint64, category string) (*[]AddonInstanceRouting, error)
GetRoutingInstancesByProject 根据 projectID 获取 addon 实例列表
func (*DBClient) GetRoutingInstancesBySimilar ¶
func (db *DBClient) GetRoutingInstancesBySimilar(addonNames []string, params *apistructs.AddonHandlerCreateItem) (*[]AddonInstanceRouting, error)
GetRoutingInstancesBySimilar 根据similar查询对应的addon信息
func (*DBClient) GetRoutingInstancesByWorkbench ¶
func (db *DBClient) GetRoutingInstancesByWorkbench(orgID uint64, projectIDs []string, category string) (*[]AddonInstanceRouting, error)
GetRoutingInstancesByWorkbench 获取用户有权限访问的 addon 实例列表
func (*DBClient) GetRunningInstancesByServiceId ¶
func (db *DBClient) GetRunningInstancesByServiceId(serviceId uint64) ([]RuntimeInstance, error)
func (*DBClient) GetRuntime ¶
if not found, return (nil, error)
func (*DBClient) GetRuntimeAllowNil ¶
func (*DBClient) GetRuntimeByProjectIDs ¶
GetRuntimeByProjectIDs 通过projectIDs获取对应runtime
func (*DBClient) GetRuntimeByScheduleName ¶
if not found, return (nil, error)
func (*DBClient) ListAddonInstanceByAddonName ¶
func (db *DBClient) ListAddonInstanceByAddonName(projectID, workspace, addonName string) (*[]AddonInstance, error)
ListAddonInstanceByAddonName 根据 addonName 获取实例列表
func (*DBClient) ListAddonInstanceByOrg ¶
func (db *DBClient) ListAddonInstanceByOrg(orgID uint64) (*[]AddonInstance, error)
ListAddonInstanceByOrg 根据 orgID 获取实例列表
func (*DBClient) ListAddonInstanceTenant ¶
func (db *DBClient) ListAddonInstanceTenant() ([]AddonInstanceTenant, error)
func (*DBClient) ListAddonInstanceTenantByAddonInstanceID ¶
func (db *DBClient) ListAddonInstanceTenantByAddonInstanceID(addoninstanceId string) ([]AddonInstanceTenant, error)
func (*DBClient) ListAddonInstanceTenantByAddonInstanceRoutingID ¶
func (db *DBClient) ListAddonInstanceTenantByAddonInstanceRoutingID(addoninstanceroutingId string) ([]AddonInstanceTenant, error)
func (*DBClient) ListAddonInstanceTenantByProjectIDs ¶
func (db *DBClient) ListAddonInstanceTenantByProjectIDs(projectIDs []uint64, workspace ...string) ([]AddonInstanceTenant, error)
func (*DBClient) ListAddonInstancesByParams ¶
func (db *DBClient) ListAddonInstancesByParams(orgID uint64, params *apistructs.MiddlewareListRequest) (int, *[]AddonInstance, error)
ListAddonInstancesByParams 根据参数获取 addon 列表
func (*DBClient) ListAddonInstancesByParamsWithoutPage ¶
func (db *DBClient) ListAddonInstancesByParamsWithoutPage(orgID uint64, params *apistructs.MiddlewareListRequest) (*[]AddonInstance, error)
ListAddonInstancesByParamsWithoutPage 根据参数获取 addon 列表
func (*DBClient) ListAddonInstancesByProjectIDs ¶
func (db *DBClient) ListAddonInstancesByProjectIDs(projectIDs []uint64, exclude ...string) (*[]AddonInstance, error)
ListAddonInstancesByProjectIDs 根据projectIDS列表来返回对应数据
func (*DBClient) ListAttachedAddonInstance ¶
func (db *DBClient) ListAttachedAddonInstance() ([]AddonInstance, error)
func (*DBClient) ListAttachedRoutingInstance ¶
func (db *DBClient) ListAttachedRoutingInstance() ([]AddonInstanceRouting, error)
func (*DBClient) ListAttachingAddonInstance ¶
func (db *DBClient) ListAttachingAddonInstance() (*[]AddonInstance, error)
ListAttachingAddonInstance 查询出所有attaching的addon信息
func (*DBClient) ListNoAttachAddon ¶
func (db *DBClient) ListNoAttachAddon() (*[]RemoveAddonID, error)
ListNoAttachAddon 查询出所有没有引用关系的addon
func (*DBClient) ListRoutingInstanceByCluster ¶
func (db *DBClient) ListRoutingInstanceByCluster(clusterName string) ([]AddonInstanceRouting, error)
ListRoutingInstanceByCluster 根据 clusterName 查找 addon 列表
func (*DBClient) ListRuntimeByCluster ¶
ListRuntimeByCluster 根据 clusterName 查找 runtime 列表
func (*DBClient) ResetPreDice ¶
func (db *DBClient) ResetPreDice(uniqueId spec.RuntimeUniqueId) error
func (*DBClient) SaveDomain ¶
func (db *DBClient) SaveDomain(domain *RuntimeDomain) error
func (*DBClient) SetRuntimeServiceErrors ¶
func (db *DBClient) SetRuntimeServiceErrors(serviceId uint64, errs []apistructs.ErrorResponse) error
func (*DBClient) UpdateAddonDeploy ¶
func (db *DBClient) UpdateAddonDeploy(addonDeploy *AddonDeploy) error
UpdateAddonDeploy update AddonDeploy
func (*DBClient) UpdateAddonExtra ¶
func (db *DBClient) UpdateAddonExtra(addonExtra *AddonExtra) error
UpdateAddonExtra update AddonExtra
func (*DBClient) UpdateAddonInstance ¶
func (db *DBClient) UpdateAddonInstance(instance *AddonInstance) error
UpdateAddonInstance 更新 addon instance
func (*DBClient) UpdateAddonInstanceExtra ¶
func (db *DBClient) UpdateAddonInstanceExtra(addonInstanceExtra *AddonInstanceExtra) error
UpdateAddonInstanceExtra update AddonInstanceExtra
func (*DBClient) UpdateAddonInstanceRelation ¶
func (db *DBClient) UpdateAddonInstanceRelation(addonInstanceRelation *AddonInstanceRelation) error
UpdateAddonInstanceRelation update AddonInstanceRelation
func (*DBClient) UpdateAddonInstanceResource ¶
func (db *DBClient) UpdateAddonInstanceResource(ID string, cpurequest, cpulimit float64, memrequest, memlimit int) error
UpdateAddonInstanceResource 根据 Id 更新 resource 信息
func (*DBClient) UpdateAddonInstanceRoutingStatus ¶
UpdateAddonInstanceRoutingStatus 根据Id更新信息
func (*DBClient) UpdateAddonInstanceStatus ¶
UpdateAddonInstanceStatus 根据Id更新信息
func (*DBClient) UpdateAddonInstanceTenant ¶
func (db *DBClient) UpdateAddonInstanceTenant(tenant *AddonInstanceTenant) error
func (*DBClient) UpdateAttachment ¶
func (db *DBClient) UpdateAttachment(addonAttachment *AddonAttachment) error
UpdateAttachment update addonAttachment
func (*DBClient) UpdateCount ¶
UpdateCount 更新引用数量信息
func (*DBClient) UpdateDeleteStatus ¶
UpdateDeleteSTatus 更新prebuild中删除状态
func (*DBClient) UpdateDeployment ¶
func (db *DBClient) UpdateDeployment(deployment *Deployment) error
func (*DBClient) UpdateInstance ¶
func (db *DBClient) UpdateInstance(instance *RuntimeInstance) error
func (*DBClient) UpdateInstanceId ¶
UpdateInstanceId 更新prebuild中addon实例Id信息
func (*DBClient) UpdateInstanceRouting ¶
func (db *DBClient) UpdateInstanceRouting(routing *AddonInstanceRouting) error
UpdateInstanceRouting 更新 instanceRouting 信息
func (*DBClient) UpdateMigrationLog ¶
func (db *DBClient) UpdateMigrationLog(migrationLog *MigrationLog) error
UpdateMigrationLog update migrationLog
func (*DBClient) UpdatePreDeployment ¶
func (db *DBClient) UpdatePreDeployment(pre *PreDeployment) error
func (*DBClient) UpdatePrebuild ¶
func (db *DBClient) UpdatePrebuild(addonPrebuild *AddonPrebuild) error
UpdatePrebuild 更新prebuild信息
func (*DBClient) UpdateRuntime ¶
func (*DBClient) UpdateRuntimeId ¶
UpdateRuntimeId 更新prebuild中runtime信息
type Deployment ¶
type Deployment struct { dbengine.BaseModel RuntimeId uint64 `gorm:"not null;index:idx_runtime_id"` ReleaseId string Outdated bool // Deprecated: use ReleaseID instead, or only use for redundancy Dice string `gorm:"type:text"` // Deprecated BuiltDockerImages string `gorm:"type:text"` Operator string `gorm:"not null;index:idx_operator"` Status apistructs.DeploymentStatus `gorm:"not null;index:idx_status"` Phase apistructs.DeploymentPhase `gorm:"column:step"` FailCause string `gorm:"type:text"` Extra DeploymentExtra `gorm:"type:text"` // 需要审批 NeedApproval bool // userid ApprovedByUser string ApprovedAt *time.Time ApprovalStatus string ApprovalReason string FinishedAt *time.Time BuildId uint64 Type string DiceType uint64 SkipPushByOrch bool }
func (*Deployment) Convert ¶
func (d *Deployment) Convert() *apistructs.Deployment
TODO: refactor the convert logic
func (Deployment) TableName ¶
func (Deployment) TableName() string
type DeploymentExtra ¶
type DeploymentExtra struct { FakeHealthyCount uint64 `json:"fakeHealthyCount,omitempty"` AddonPhaseStartAt *time.Time `json:"addonPhaseStartAt,omitempty"` AddonPhaseEndAt *time.Time `json:"addonPhaseEndAt,omitempty"` ServicePhaseStartAt *time.Time `json:"servicePhaseStartAt,omitempty"` ServicePhaseEndAt *time.Time `json:"servicePhaseEndAt,omitempty"` CancelStartAt *time.Time `json:"cancelStartAt,omitempty"` CancelEndAt *time.Time `json:"cancelEndAt,omitempty"` ForceCanceled bool `json:"forceCanceled,omitempty"` AutoTimeout bool `json:"autoTimeout,omitempty"` }
func (*DeploymentExtra) Scan ¶
func (ex *DeploymentExtra) Scan(value interface{}) error
type DeploymentFilter ¶
type MigrationLog ¶
type MigrationLog struct { dbengine.BaseModel ProjectID uint64 ApplicationID uint64 RuntimeID uint64 DeploymentID uint64 OperatorID uint64 Status string AddonInstanceID string AddonInstanceConfig string }
MigrationLog migration执行记录表
type PreDeployment ¶
type PreDeployment struct { dbengine.BaseModel ApplicationId uint64 `gorm:"column:project_id;unique_index:idx_unique_project_env_branch"` Workspace string `gorm:"column:env;unique_index:idx_unique_project_env_branch"` RuntimeName string `gorm:"column:git_branch;unique_index:idx_unique_project_env_branch"` Dice string `gorm:"type:text"` DiceOverlay string `gorm:"type:text"` DiceType uint64 }
Deprecated
func (PreDeployment) TableName ¶
func (PreDeployment) TableName() string
type RemoveAddonID ¶
type RemoveAddonID struct {
ID string `gorm:"column:id"`
}
type Runtime ¶
type Runtime struct { dbengine.BaseModel Name string `gorm:"not null;unique_index:idx_unique_app_id_name"` ApplicationID uint64 `gorm:"not null;unique_index:idx_unique_app_id_name"` Workspace string `gorm:"not null;unique_index:idx_unique_app_id_name"` GitBranch string // Deprecated ProjectID uint64 `gorm:"not null"` // TODO: currently equal to applicationID, fix later Env string // Deprecated ClusterName string ClusterId uint64 // Deprecated: use clusterName Creator string `gorm:"not null"` ScheduleName ScheduleName Status string `gorm:"column:runtime_status"` LegacyStatus string `gorm:"column:status"` Deployed bool Deleting bool `gorm:"-"` // TODO: after legacyStatus removed, we use deleting instead Version string Source apistructs.RuntimeSource DiceVersion string CPU float64 Mem float64 // 单位: MB ConfigUpdatedDate *time.Time // Deprecated ReadableUniqueId string // Deprecated GitRepoAbbrev string OrgID uint64 `gorm:"not null"` }
ServiceGroup is the common resource based on which deployments are created projectId, git branch and working dev determine a runtime
func (*Runtime) InitScheduleName ¶
type RuntimeDomain ¶
type RuntimeDomain struct { dbengine.BaseModel RuntimeId uint64 `gorm:"not null"` Domain string `gorm:"unique_index:unique_domain_key"` DomainType string EndpointName string UseHttps bool }
RuntimeDomain indicated default and custom domain for endpoints
func (RuntimeDomain) TableName ¶
func (RuntimeDomain) TableName() string
type RuntimeInstance ¶
type RuntimeInstance struct { dbengine.BaseModel InstanceId string `gorm:"not null;unique_index:idx_instance_id"` RuntimeId uint64 `gorm:"not null"` ServiceId uint64 `gorm:"not null;index:idx_service_id"` Ip string Status string // stage记录容器退出的阶段, 只体现在增量事件中的退出(Killed, Failed, Finished)事件 // 当前分的阶段为: // a) 容器启动阶段(健康检查超时之前退出),"BeforeHealthCheckTimeout" // b) 健康检查超时阶段(被健康检查所杀),"HealthCheckTimeout" // c) 后健康检查阶段(健康检查完成后退出),"AfterHealthCheckTimeout" Stage string }
func (RuntimeInstance) TableName ¶
func (RuntimeInstance) TableName() string
TableName runtime instance 表名
type RuntimeService ¶
type RuntimeService struct { dbengine.BaseModel RuntimeId uint64 `gorm:"not null;unique_index:idx_runtime_id_service_name"` ServiceName string `gorm:"not null;unique_index:idx_runtime_id_service_name"` Cpu string Mem int Environment string `gorm:"type:text"` Ports string Replica int Status string Errors string `gorm:"type:text"` }
func (RuntimeService) TableName ¶
func (RuntimeService) TableName() string
TableName runtime service 表名
type ScheduleName ¶
func (ScheduleName) Args ¶
func (s ScheduleName) Args() (string, string)
func (*ScheduleName) Scan ¶
func (s *ScheduleName) Scan(value interface{}) error
Source Files ¶
- addon_attachment.go
- addon_audit.go
- addon_deploy_info.go
- addon_extra.go
- addon_instance.go
- addon_instance_extra.go
- addon_instance_relation.go
- addon_instance_routing.go
- addon_instance_tenant.go
- addon_management.go
- addon_micro_attach.go
- addon_node.go
- addon_prebuild.go
- dbclient.go
- deployment.go
- domain.go
- migration_log.go
- runtime.go