runtime

package
v1.3.0-rc.0...-d217119 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Package runtime 应用实例相关操作

Index

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 WithAddon

func WithAddon(a *addon.Addon) Option

WithAddon 配置 addon service

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithClusterInfo

func WithClusterInfo(clusterinfo clusterinfo.ClusterInfo) Option

func WithClusterSvc

func WithClusterSvc(clusterSvc clusterpb.ClusterServiceServer) Option

func WithDBClient

func WithDBClient(db *dbclient.DBClient) Option

WithDBClient 配置 db client

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 New

func New(options ...Option) *Runtime

New 新建应用实例 service

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

func (r *Runtime) CountARByWorkspace(appId uint64, env string) (uint64, error)

CountARByWorkspace count appliaction runtimes by workspace .

func (*Runtime) CountPRByWorkspace

func (r *Runtime) CountPRByWorkspace(projectId uint64, env string) (uint64, error)

CountPRByWorkspace count project runtimes by workspace .

func (*Runtime) Create

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

func (r *Runtime) Destroy(runtimeID uint64) error

Destroy 摧毁应用实例

func (*Runtime) FullGC

func (r *Runtime) FullGC()

FullGC 定时全量 GC 过期的部署单

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

func (r *Runtime) GetOrg(orgID uint64) (*orgpb.Org, error)

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

func (r *Runtime) KillPod(runtimeID uint64, podname string) error

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

func (r *Runtime) MarkOutdatedForDelete(runtimeID uint64)

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

func (r *Runtime) PreCheck(dice *diceyml.DiceYaml, workspace string) error

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

func (r *Runtime) ReferCluster(clusterName string, orgID uint64) bool

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 (r *Runtime) RollbackPipeline(ctx context.Context, operator user.ID, orgID uint64, runtimeID uint64, deploymentID uint64) (
	*apistructs.RuntimeDeployDTO, error)

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 服务

Jump to

Keyboard shortcuts

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