Documentation ¶
Overview ¶
Package runtime 应用实例相关操作
Index ¶
- func IsDeploying(status apistructs.DeploymentStatus) bool
- type DeployContext
- type Option
- func WithAddon(a *addon.Addon) Option
- func WithBundle(bdl *bundle.Bundle) Option
- func WithClusterInfo(clusterinfo clusterinfo.ClusterInfo) Option
- func WithClusterSvc(clusterSvc clusterpb.ClusterServiceServer) Option
- func WithDBClient(db *dbclient.DBClient) Option
- func WithEventManager(evMgr *events.EventManager) Option
- func WithOrg(org org.ClientInterface) Option
- func WithPipelineSvc(svc pipelinepb.PipelineServiceServer) Option
- func WithReleaseSvc(svc pb.ReleaseServiceServer) Option
- func WithServiceGroup(serviceGroupImpl servicegroup.ServiceGroup) Option
- type Runtime
- func (r *Runtime) AppliedScaledObjects(uniqueID spec.RuntimeUniqueId) (map[string]string, map[string]string, error)
- func (r *Runtime) CountARByWorkspace(appId uint64, env string) (uint64, error)
- func (r *Runtime) CountPRByWorkspace(projectId uint64, env string) (uint64, error)
- func (r *Runtime) Create(operator user.ID, req *apistructs.RuntimeCreateRequest) (*apistructs.DeploymentCreateResponseDTO, error)
- func (r *Runtime) CreateByReleaseID(ctx context.Context, operator user.ID, ...) (*apistructs.DeploymentCreateResponseDTO, error)
- func (r *Runtime) CreateByReleaseIDPipeline(ctx context.Context, orgid uint64, operator user.ID, ...) (*apistructs.RuntimeDeployDTO, error)
- func (r *Runtime) Delete(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.RuntimeDTO, error)
- func (r *Runtime) Destroy(runtimeID uint64) error
- func (r *Runtime) FullGC()
- func (r *Runtime) Get(ctx context.Context, userID user.ID, orgID uint64, idOrName string, ...) (*apistructs.RuntimeInspectDTO, error)
- func (r *Runtime) GetOrg(orgID uint64) (*orgpb.Org, error)
- func (r *Runtime) GetRuntimeServiceCurrentPods(runtimeID uint64, serviceName string) (*apistructs.ServiceGroup, error)
- func (r *Runtime) GetServiceByRuntime(runtimeIDs []uint64) (map[uint64]*apistructs.RuntimeSummaryDTO, error)
- func (r *Runtime) GetSpec(userID user.ID, orgID uint64, runtimeID uint64) (*apistructs.ServiceGroup, error)
- func (r *Runtime) KillPod(runtimeID uint64, podname string) error
- func (r *Runtime) List(userID user.ID, orgID uint64, appID uint64, workspace, name string) ([]apistructs.RuntimeSummaryDTO, error)
- func (r *Runtime) ListGroupByApps(appIDs []uint64, env string) (map[uint64][]*apistructs.RuntimeSummaryDTO, error)
- func (r *Runtime) MarkOutdatedForDelete(runtimeID uint64)
- func (r *Runtime) OrgJobLogs(ctx context.Context, userID user.ID, orgID uint64, orgName string, ...) (*apistructs.DashboardSpotLogData, error)
- func (r *Runtime) PreCheck(dice *diceyml.DiceYaml, workspace string) error
- func (r *Runtime) Redeploy(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.DeploymentCreateResponseDTO, error)
- func (r *Runtime) RedeployPipeline(ctx context.Context, operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.RuntimeDeployDTO, error)
- func (r *Runtime) ReferCluster(clusterName string, orgID uint64) bool
- func (r *Runtime) Rollback(operator user.ID, orgID uint64, runtimeID uint64, deploymentID uint64) (*apistructs.DeploymentCreateResponseDTO, error)
- func (r *Runtime) RollbackPipeline(ctx context.Context, operator user.ID, orgID uint64, runtimeID uint64, ...) (*apistructs.RuntimeDeployDTO, error)
- func (r *Runtime) RuntimeDeployLogs(userID user.ID, orgID uint64, orgName string, deploymentID uint64, ...) (*apistructs.DashboardSpotLogData, error)
- func (r *Runtime) StopRuntime(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.DeploymentCreateResponseDTO, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDeploying ¶
func IsDeploying(status apistructs.DeploymentStatus) bool
Types ¶
type DeployContext ¶
type DeployContext struct { Runtime *dbclient.Runtime App *apistructs.ApplicationDTO LastDeployment *dbclient.Deployment // ReleaseId to deploy ReleaseID string Operator string DeployType string // Extras: // used for pipeline BuildID uint64 // used for ability AddonActions map[string]interface{} // used for runtime-addon InstanceID string // used for Scale0 bool // 不由 orchestrator 来推进部署 SkipPushByOrch bool // deployment order DeploymentOrderId string Param string }
DeployContext 部署上下文
type Option ¶
type Option func(*Runtime)
Option 应用实例对象配置选项
func WithClusterInfo ¶
func WithClusterInfo(clusterinfo clusterinfo.ClusterInfo) Option
func WithClusterSvc ¶
func WithClusterSvc(clusterSvc clusterpb.ClusterServiceServer) Option
func WithEventManager ¶
func WithEventManager(evMgr *events.EventManager) Option
WithEventManager 配置 EventManager
func WithOrg ¶
func WithOrg(org org.ClientInterface) Option
func WithPipelineSvc ¶
func WithPipelineSvc(svc pipelinepb.PipelineServiceServer) Option
func WithReleaseSvc ¶
func WithReleaseSvc(svc pb.ReleaseServiceServer) Option
WithReleaseSvc 配置 dicehub release service
func WithServiceGroup ¶
func WithServiceGroup(serviceGroupImpl servicegroup.ServiceGroup) Option
WithServiceGroup 配置 serviceGroupImpl
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime 应用实例对象封装
func (*Runtime) AppliedScaledObjects ¶
func (r *Runtime) AppliedScaledObjects(uniqueID spec.RuntimeUniqueId) (map[string]string, map[string]string, error)
get pod autoscaler rules in k8s, include hpa and vpa
func (*Runtime) CountARByWorkspace ¶
CountARByWorkspace count appliaction runtimes by workspace .
func (*Runtime) CountPRByWorkspace ¶
CountPRByWorkspace count project runtimes by workspace .
func (*Runtime) Create ¶
func (r *Runtime) Create(operator user.ID, req *apistructs.RuntimeCreateRequest) ( *apistructs.DeploymentCreateResponseDTO, error)
Create 创建应用实例
func (*Runtime) CreateByReleaseID ¶
func (r *Runtime) CreateByReleaseID(ctx context.Context, operator user.ID, releaseReq *apistructs.RuntimeReleaseCreateRequest) (*apistructs.DeploymentCreateResponseDTO, error)
Create 创建应用实例
func (*Runtime) CreateByReleaseIDPipeline ¶
func (r *Runtime) CreateByReleaseIDPipeline(ctx context.Context, orgid uint64, operator user.ID, releaseReq *apistructs.RuntimeReleaseCreateRequest) (*apistructs.RuntimeDeployDTO, error)
func (*Runtime) Delete ¶
func (r *Runtime) Delete(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.RuntimeDTO, error)
Delete 标记应用实例删除
func (*Runtime) Get ¶
func (r *Runtime) Get(ctx context.Context, userID user.ID, orgID uint64, idOrName string, appID string, workspace string) (*apistructs.RuntimeInspectDTO, error)
Get 查询应用实例
func (*Runtime) GetRuntimeServiceCurrentPods ¶
func (r *Runtime) GetRuntimeServiceCurrentPods(runtimeID uint64, serviceName string) (*apistructs.ServiceGroup, error)
func (*Runtime) GetServiceByRuntime ¶
func (r *Runtime) GetServiceByRuntime(runtimeIDs []uint64) (map[uint64]*apistructs.RuntimeSummaryDTO, error)
func (*Runtime) GetSpec ¶
func (r *Runtime) GetSpec(userID user.ID, orgID uint64, runtimeID uint64) (*apistructs.ServiceGroup, error)
GetSpec 查询应用实例规格
func (*Runtime) List ¶
func (r *Runtime) List(userID user.ID, orgID uint64, appID uint64, workspace, name string) ([]apistructs.RuntimeSummaryDTO, error)
List 查询应用实例列表
func (*Runtime) ListGroupByApps ¶
func (r *Runtime) ListGroupByApps(appIDs []uint64, env string) (map[uint64][]*apistructs.RuntimeSummaryDTO, error)
ListGroupByApps lists all runtimes for given apps. The key in the returned result map is appID.
func (*Runtime) MarkOutdatedForDelete ¶
MarkOutdatedForDelete 将删除的应用实例,他们的所有部署单,标记为废弃
func (*Runtime) OrgJobLogs ¶
func (r *Runtime) OrgJobLogs(ctx context.Context, userID user.ID, orgID uint64, orgName string, jobID, clusterName string, paramValues url.Values) (*apistructs.DashboardSpotLogData, error)
OrgJobLogs 数据中心--->任务列表 日志接口
func (*Runtime) Redeploy ¶
func (r *Runtime) Redeploy(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.DeploymentCreateResponseDTO, error)
Redeploy 重新部署
func (*Runtime) RedeployPipeline ¶
func (r *Runtime) RedeployPipeline(ctx context.Context, operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.RuntimeDeployDTO, error)
func (*Runtime) ReferCluster ¶
ReferCluster 查看 runtime & addon 是否有使用集群
func (*Runtime) Rollback ¶
func (r *Runtime) Rollback(operator user.ID, orgID uint64, runtimeID uint64, deploymentID uint64) ( *apistructs.DeploymentCreateResponseDTO, error)
func (*Runtime) RollbackPipeline ¶
func (*Runtime) RuntimeDeployLogs ¶
func (r *Runtime) RuntimeDeployLogs(userID user.ID, orgID uint64, orgName string, deploymentID uint64, paramValues url.Values) (*apistructs.DashboardSpotLogData, error)
RuntimeDeployLogs deploy发布日志接口
func (*Runtime) StopRuntime ¶
func (r *Runtime) StopRuntime(operator user.ID, orgID uint64, runtimeID uint64) (*apistructs.DeploymentCreateResponseDTO, error)
StopRuntime scale 0 服务