Documentation
¶
Overview ¶
Package deployment 提供代理部署与运行环境适配能力。
Index ¶
- type AutoScaleConfig
- type DeployOptions
- type Deployer
- func (d *Deployer) Delete(ctx context.Context, deploymentID string) error
- func (d *Deployer) Deploy(ctx context.Context, opts DeployOptions) (*Deployment, error)
- func (d *Deployer) ExportManifest(deploymentID string) ([]byte, error)
- func (d *Deployer) GetDeployment(deploymentID string) (*Deployment, error)
- func (d *Deployer) ListDeployments() []*Deployment
- func (d *Deployer) RegisterProvider(target DeploymentTarget, provider DeploymentProvider)
- func (d *Deployer) Scale(ctx context.Context, deploymentID string, replicas int) error
- func (d *Deployer) Update(ctx context.Context, deploymentID string, config DeploymentConfig) error
- type Deployment
- type DeploymentConfig
- type DeploymentProvider
- type DeploymentStatus
- type DeploymentTarget
- type HealthCheck
- type ResourceConfig
- type SecretRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoScaleConfig ¶
type AutoScaleConfig struct {
MinReplicas int `json:"min_replicas"`
MaxReplicas int `json:"max_replicas"`
TargetCPU int `json:"target_cpu_percent,omitempty"`
TargetMemory int `json:"target_memory_percent,omitempty"`
TargetQPS int `json:"target_qps,omitempty"`
ScaleDownDelay time.Duration `json:"scale_down_delay,omitempty"`
}
自动缩放配置自动缩放 。
type DeployOptions ¶
type DeployOptions struct {
Name string
AgentID string
Target DeploymentTarget
Replicas int
Config DeploymentConfig
Resources ResourceConfig
Metadata map[string]string
}
部署选项配置部署 。
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
部署人员管理代理部署。
func (*Deployer) Deploy ¶
func (d *Deployer) Deploy(ctx context.Context, opts DeployOptions) (*Deployment, error)
向指定目标部署特工。
func (*Deployer) ExportManifest ¶
按 K8s 显示的“出口管理”出口部署。
func (*Deployer) GetDeployment ¶
func (d *Deployer) GetDeployment(deploymentID string) (*Deployment, error)
得到部署返回一个部署的ID。
func (*Deployer) RegisterProvider ¶
func (d *Deployer) RegisterProvider(target DeploymentTarget, provider DeploymentProvider)
提供人员登记部署提供者。
type Deployment ¶
type Deployment struct {
ID string `json:"id"`
Name string `json:"name"`
AgentID string `json:"agent_id"`
Target DeploymentTarget `json:"target"`
Status DeploymentStatus `json:"status"`
Endpoint string `json:"endpoint,omitempty"`
Replicas int `json:"replicas"`
Config DeploymentConfig `json:"config"`
Resources ResourceConfig `json:"resources"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Metadata map[string]string `json:"metadata,omitempty"`
HealthCheck *HealthCheck `json:"health_check,omitempty"`
}
部署是部署的代理人实例。
type DeploymentConfig ¶
type DeploymentConfig struct {
Image string `json:"image,omitempty"`
Port int `json:"port"`
Environment map[string]string `json:"environment,omitempty"`
Secrets []SecretRef `json:"secrets,omitempty"`
AutoScale *AutoScaleConfig `json:"auto_scale,omitempty"`
Timeout time.Duration `json:"timeout,omitempty"`
}
部署配置包含部署配置。
type DeploymentProvider ¶
type DeploymentProvider interface {
Deploy(ctx context.Context, deployment *Deployment) error
Update(ctx context.Context, deployment *Deployment) error
Delete(ctx context.Context, deploymentID string) error
GetStatus(ctx context.Context, deploymentID string) (*Deployment, error)
Scale(ctx context.Context, deploymentID string, replicas int) error
GetLogs(ctx context.Context, deploymentID string, lines int) ([]string, error)
}
部署提供方定义了部署后端的接口.
type DeploymentStatus ¶
type DeploymentStatus string
部署状况是部署状况。
const ( StatusPending DeploymentStatus = "pending" StatusDeploying DeploymentStatus = "deploying" StatusRunning DeploymentStatus = "running" StatusFailed DeploymentStatus = "failed" StatusStopped DeploymentStatus = "stopped" StatusScaling DeploymentStatus = "scaling" )
type DeploymentTarget ¶
type DeploymentTarget string
部署 目标定义了部署目标类型.
const ( TargetKubernetes DeploymentTarget = "kubernetes" TargetCloudRun DeploymentTarget = "cloud_run" TargetLambda DeploymentTarget = "lambda" TargetLocal DeploymentTarget = "local" )
type HealthCheck ¶
type HealthCheck struct {
Path string `json:"path"`
Port int `json:"port"`
Interval time.Duration `json:"interval"`
Timeout time.Duration `json:"timeout"`
FailureThreshold int `json:"failure_threshold"`
}
健康检查定义了健康检查配置.
type ResourceConfig ¶
type ResourceConfig struct {
CPURequest string `json:"cpu_request,omitempty"`
CPULimit string `json:"cpu_limit,omitempty"`
MemoryRequest string `json:"memory_request,omitempty"`
MemoryLimit string `json:"memory_limit,omitempty"`
GPUCount int `json:"gpu_count,omitempty"`
}
资源Config定义了资源限制.
Click to show internal directories.
Click to hide internal directories.