instance

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 1 Imported by: 0

README

应用实例管理

  • Pod: 多副本实例
  • Container: 具体的应用实例

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterInstance

type ClusterInstance struct {
	// Id
	Id string `json:"id" gorm:"column:id;primaryKey"`
	// 关联应用集群Id
	RefClusterId string `json:"ref_cluster_id" gorm:"column:ref_cluster_id;type:varchar(60)" description:"关联应用集群Id"`
	// 引用Group名称
	RefGroupName string `json:"ref_group_name" gorm:"column:ref_group_name;type:varchar(60)"`
	// 部署制品的URL地址
	ArtifactURL string `json:"artifact_url" gorm:"column:artifact_url;type:varchar(200)"`
	// 实例名称, 通常为应用名称
	Name string `json:"name" gorm:"column:name;type:varchar(120)"`
	// 实例IP地址
	InstanceIp string `json:"instance_ip" gorm:"column:instance_ip;tpye:varchar(120)"`
	// 状态
	Status INSTANCE_STATUS `json:"status" gorm:"column:status;type:varchar(60)"`
	// 运行失败时的错误信息
	Message string `json:"message" gorm:"column:message"`
	// 重启次数
	RestartCount int `json:"restart_count" gorm:"column:restart_count"`
	// 启动时间
	StartAt *time.Time `json:"start_at" gorm:"column:start_at"`
	// 更新时间
	UpdateAt *time.Time `json:"update_at" gorm:"column:update_at"`
	// 结束时间
	EndAt *time.Time `json:"end_at" gorm:"column:end_at"`
	// 单位:MB
	LimitCpu float64 `json:"limit_cpu" gorm:"column:limit_cpu"`
	// 单位:MB
	LimitMemory float64 `json:"limit_memory" gorm:"column:limit_memory"`
	// 单位M
	LimitStorage float64 `json:"limit_storage" gorm:"column:limit_storage"`
	// 节点Ip
	NodeIp string `json:"node_ip" gorm:"column:node_ip;type:varchar(120)"`
	// 节点组
	NodeSelector map[string]string `json:"node_selector" gorm:"column:node_selector;serializer:json;type:json"`
	// 是不是应用实例, 可能是工具的实例, 比如init container相关信息, 需要看到工具镜像状态
	IsAppInstance bool `json:"is_app_instance" gorm:"column:is_app_instance"`
}

type ClusterInstanceGroup

type ClusterInstanceGroup struct {
	// Id
	Id string `json:"id" gorm:"column:id;primaryKey"`
	// 关联应用集群Id
	RefClusterId string `json:"ref_cluster_id" gorm:"column:ref_cluster_id;type:varchar(60)" description:"关联应用集群Id"`
	// 配置同步时间
	SyncAt time.Time `json:"sync_at" gorm:"column:sync_at" description:"同步时间"`

	// 实例组名称, Pod名称
	Name string `json:"name" gorm:"column:name;type:varchar(120)" description:"名称"`
	// 配置同步时间
	CreateAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	// 启动时间
	StarteAt time.Time `json:"start_at" gorm:"column:start_at" description:"启动时间"`
	// 组状态
	Status INSTANCE_GROUP_STATUS `json:"status" gorm:"column:status;type:varchar(60)" description:"名称"`
	// 状态原因
	Message string `json:"message" gorm:"column:message" description:"状态原因"`
	// 应用配置更新时间
	UpdateAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	// 配置详情
	Detail string `json:"detail" gorm:"column:detail" description:"详情"`
	// 具体的实例信息
	Instances []ClusterInstance `json:"instances" gorm:"-" description:"详情"`
}

type INSTANCE_GROUP_STATUS

type INSTANCE_GROUP_STATUS string
const (
	// 容器镜像正在下载,调度问题(如资源不足),挂载卷配置问题
	INSTANCE_GROUP_STATUS_PENDING INSTANCE_GROUP_STATUS = "PENDING"
	// 所有容器正常运行且就绪
	INSTANCE_GROUP_STATUS_RUNNING_HEALTHY INSTANCE_GROUP_STATUS = "RUNNING_HEALTHY"
	// 所有容器在运行但未全部就绪
	INSTANCE_GROUP_STATUS_RUNNING_NOT_READY INSTANCE_GROUP_STATUS = "RUNNING_NOT_READY"
	// 容器在运行但频繁重启(可能有问题)
	INSTANCE_GROUP_STATUS_RUNNING_RESTARTING INSTANCE_GROUP_STATUS = "RUNNING_RESTARTING"
	// 容器在运行但资源使用异常(CPU/内存超过阈值)
	INSTANCE_GROUP_STATUS_RUNNING_OVERLOADED INSTANCE_GROUP_STATUS = "RUNNING_OVERLOADED"
	// 容器在运行但就绪检查/存活检查失败
	INSTANCE_GROUP_STATUS_RUNNING_UNHEALTHY INSTANCE_GROUP_STATUS = "RUNNING_UNHEALTHY"
	// 所有容器正常退出(exit code 0)
	INSTANCE_GROUP_STATUS_SUCCEEDED INSTANCE_GROUP_STATUS = "SUCCEEDED"
	// 至少一个容器非正常退出(exit code 非 0),容器因资源限制被系统杀死
	INSTANCE_GROUP_STATUS_FAILED INSTANCE_GROUP_STATUS = "FAILED"
	// 无法与 Pod 所在节点通信,节点可能已宕机或网络分区
	INSTANCE_GROUP_STATUS_UNKNOWN INSTANCE_GROUP_STATUS = "UNKNOWN"
	// Pod 正在被删除
	INSTANCE_GROUP_STATUS_TERMINATING INSTANCE_GROUP_STATUS = "TERMINATING"
)

type INSTANCE_STATUS

type INSTANCE_STATUS string
const (
	// 容器处于 Waiting 状态
	INSTANCE_STATUS_PENDING INSTANCE_STATUS = "PENDING"
	// 容器正常终止 (exit code 0)
	INSTANCE_STATUS_SUCCEEDED INSTANCE_STATUS = "SUCCEEDED"
	// 容器异常终止 (exit code 非 0)
	INSTANCE_STATUS_FAILED INSTANCE_STATUS = "FAILED"
	// 状态无法确定
	INSTANCE_STATUS_UNKNOWN INSTANCE_STATUS = "UNKNOWN"
	// 容器状态为 Running, Ready 状态为 true,重启次数为 0, 没有异常的终止记录
	INSTANCE_STATUS_RUNNING_HEALTHY INSTANCE_STATUS = "RUNNING_HEALTHY"
	// 容器状态为 Running, Ready 状态为 false, 可能是启动中或临时不可用
	INSTANCE_STATUS_RUNNING_NOT_READY INSTANCE_STATUS = "RUNNING_NOT_READY"
	// 容器状态为 Running, 重启次数大于 0, 表明容器曾经崩溃或重启过 (最近5分钟)
	INSTANCE_STATUS_RUNNING_RESTARTING INSTANCE_STATUS = "RUNNING_RESTARTING"
	// 容器状态为 Running, 有异常的 LastTerminationState, 表明容器虽然运行但曾经异常终止 (最近5分钟)
	INSTANCE_STATUS_RUNNING_UNHEALTHY INSTANCE_STATUS = "RUNNING_UNHEALTHY"
)

type UpdateInstanceStatusRequest

type UpdateInstanceStatusRequest struct {
	ClusterInstanceGroup
}

Jump to

Keyboard shortcuts

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