Documentation
¶
Index ¶
- Constants
- func GetAgentRunningStatus() []string
- func GetMigrationModels() []interface{}
- type Account
- type Agent
- type Build
- type BuildMessage
- type Daily
- type Downflow
- type Image
- type ImageLabel
- type KubernetesVersion
- type Label
- type Logo
- type Namespace
- type Notification
- type Rainbowd
- type RainbowdEvent
- type Registry
- type Review
- type Subscribe
- type SubscribeMessage
- type Tag
- type Task
- type TaskMessage
- type User
Constants ¶
View Source
const ( RunAgentType string = "在线" UnRunAgentType string = "离线" UnknownAgentType string = "未知" ErrorAgentType string = "异常" UnStartType string = "未启动" // agent 的中间处理状态 DeletingAgentType string = "删除中" StartingAgentType string = "启动中" StoppingAgentType string = "停止中" RestartingAgentType string = "重启中" UpgradeAgentType string = "升级中" OfflineAgentType string = "下线中" UpgradeAgentBinaryType string = "进程升级中" PublicAgentType string = "public" PrivateAgentType string = "private" )
Variables ¶
This section is empty.
Functions ¶
func GetAgentRunningStatus ¶
func GetAgentRunningStatus() []string
func GetMigrationModels ¶
func GetMigrationModels() []interface{}
Types ¶
type Account ¶
type Agent ¶
type Agent struct {
rainbow.Model
Name string `gorm:"index:idx_name,unique" json:"name"`
LastTransitionTime time.Time `gorm:"column:last_transition_time;type:datetime;default:current_timestamp;not null" json:"last_transition_time"`
Type string `json:"type"`
Status string `gorm:"column:status;" json:"status"`
Message string `json:"message"`
RainbowdName string `json:"rainbowd_name"`
GithubUser string `json:"github_user"` // github 后端用户名
GithubEmail string `json:"github_email"` // github 邮箱
GithubRepository string `json:"github_repository"` // github 仓库地址
GithubToken string `json:"github_token"` // github token
GrossAmount float64 `json:"gross_amount"` // github 账号开销金额,每个账号上限 16 美金,达到之后自动下线 agent
}
type Build ¶
type Build struct {
rainbow.Model
rainbow.UserModel
Name string `json:"name"`
Status string `json:"status"`
Arch string `json:"arch"` // 架构
Dockerfile string `json:"dockerfile"` // 镜像构建 dockerfile
RegistryId int64 `json:"registry_id"` // 推送镜像仓库
AgentName string `json:"agent_name"` // 执行代理
Namespace string `json:"namespace"` // 命名空间
Repo string `json:"repo"`
}
type BuildMessage ¶
type BuildMessage struct {
rainbow.Model
BuildId int64 `json:"build_id" gorm:"index:idx"`
Message string `json:"message"`
}
func (*BuildMessage) TableName ¶
func (b *BuildMessage) TableName() string
type Downflow ¶
type Image ¶
type Image struct {
rainbow.Model
GmtDeleted gorm.DeletedAt
Name string `json:"name"`
UserId string `json:"user_id"`
UserName string `json:"user_name"`
RegisterId int64 `json:"register_id"`
Logo string `json:"logo"`
Labels []Label `gorm:"many2many:image_label;constraint:OnDelete:CASCADE"` // 标记镜像类型,比如 ai,k8s
Namespace string `json:"namespace"`
Mirror string `json:"mirror"`
Size int64 `json:"size"`
Pull int64 `json:"pull"`
Tags []Tag `json:"tags" gorm:"foreignKey:ImageId;constraint:OnDelete:CASCADE;"`
TagsCount int64 `json:"tags_count"`
Description string `json:"description"`
IsPublic bool `json:"is_public"`
IsOfficial bool `json:"is_official"`
PublicUpdated bool `json:"public_updated"` // 是否已经同步过远端仓库状态
ReadSize string `json:"read_size"` // 转换之后的,方便人读的大小
LastSyncTime time.Time `json:"last_sync_time"` // 上次同步时间,超过10分钟则同步一次
IsLocked bool `json:"is_locked"` // 锁字段,默认 false 表示未锁定
}
type ImageLabel ¶
type ImageLabel struct {
rainbow.Model
ImageID int64 `gorm:"primaryKey"`
LabelID int64 `gorm:"primaryKey"`
}
ImageLabel 显式定义关联表,便于扩展字段(如操作人、时间等)
func (*ImageLabel) TableName ¶
func (l *ImageLabel) TableName() string
type KubernetesVersion ¶
type KubernetesVersion struct {
rainbow.Model
Tag string `gorm:"index:idx_tag,unique" json:"tag"` // k8s, db, ai等标识
}
func (*KubernetesVersion) TableName ¶
func (t *KubernetesVersion) TableName() string
type Label ¶
type Namespace ¶
type Notification ¶
type Notification struct {
rainbow.Model
rainbow.UserModel
Name string `gorm:"index:idx_notifications_name" json:"name"`
Role int `json:"role"`
Enable bool `json:"enable"`
Type string `json:"type"` // 支持 webhook, dingtalk, wecom, feishu, email, sms, lark
PushCfg string `json:"push_cfg"` // json 格式
ShortDesc string `json:"short_desc"`
}
func (*Notification) TableName ¶
func (t *Notification) TableName() string
type Rainbowd ¶
type RainbowdEvent ¶
type RainbowdEvent struct {
rainbow.Model
RainbowdId int64 `json:"rainbowd_id" gorm:"index:idx"`
Message string `json:"message"`
}
func (*RainbowdEvent) TableName ¶
func (t *RainbowdEvent) TableName() string
type Registry ¶
type Registry struct {
rainbow.Model
Name string `json:"name"`
UserId string `gorm:"index:idx_user" json:"user_id"` // 所属用户
Role int `json:"role"` // 0. 常规权限 1. 超级权限 2. 默认华为仓库
Repository string `json:"repository"`
Namespace string `json:"namespace"`
Username string `json:"username"`
Password string `json:"password"`
// 默认华为仓库客户端依赖配置
RegionId string `json:"region_id"`
Ak string `json:"ak"`
Sk string `json:"sk"`
}
type Subscribe ¶
type Subscribe struct {
rainbow.Model
rainbow.UserModel
Path string `json:"path"` // 订阅名称,对应仓库显示镜像名
RawPath string `json:"raw_path"` // 自动填充命名空间,比如 nginx 表示 library/nginx, jenkins/jenkins 则直接使用
DestPath string `json:"dest_path"` // pixiu 对应的镜像名称,追加自定义仓库前置
Enable bool `json:"enable"` // 启动或者关闭
Status string `json:"status"`
Size int `json:"size"` // 同步最新多少个版本
RegisterId int64 `json:"register_id"`
Namespace string `json:"namespace"`
LastNotifyTime time.Time `json:"last_notify_time" gorm:"column:last_notify_time;type:datetime;default:current_timestamp;not null"` // 上次触发时间
Interval time.Duration `json:"interval"` // 间隔多久同步一次
FailTimes int `json:"fail_times"` // 失败次数
ImageFrom string `json:"image_from"` // 镜像来源,支持 dockerhub, gcr, quay.io
Policy string `json:"policy"` // 默认定义所有版本镜像,支持正则表达式,比如 v1.*
Arch string `json:"arch"`
Rewrite bool `json:"rewrite"`
}
type SubscribeMessage ¶
type SubscribeMessage struct {
rainbow.Model
SubscribeId int64 `json:"subscribe_id" gorm:"index:idx"`
Message string `json:"message"`
}
func (*SubscribeMessage) TableName ¶
func (t *SubscribeMessage) TableName() string
type Tag ¶
type Tag struct {
rainbow.Model
GmtDeleted gorm.DeletedAt
ImageId int64 `gorm:"index:idx_image" json:"image_id"`
TaskIds string `json:"task_ids"` // 关联的任务IDs 多个id以逗号隔开
Path string `json:"path"`
Mirror string `json:"mirror"`
Name string `json:"name"`
Size int64 `json:"size"`
Status string `json:"status"`
Message string `json:"message"` // 错误信息
Manifest string `json:"manifest"`
Digest string `json:"digest"`
Architecture string `json:"architecture"` // 版本对应的架构,默认是 arm64,也可以是 amd64
ReadSize string `json:"read_size"` // 转换之后的,方便人读的大小
}
type Task ¶
type Task struct {
rainbow.Model
Name string `json:"name"`
UserId string `json:"user_id"`
UserName string `json:"user_name"`
RegisterId int64 `json:"register_id"`
AgentName string `json:"agent_name"`
Process int `json:"process"`
Mode int64 `json:"mode"`
Status string `json:"status"`
Message string `json:"message"`
Type int `json:"type"` // 0:直接指定镜像列表 1: 指定 kubernetes 版本
KubernetesVersion string `json:"kubernetes_version"`
Driver string `json:"driver"` // docker or skopeo
Namespace string `json:"namespace"`
IsPublic bool `json:"is_public"`
IsOfficial bool `json:"is_official"`
Logo string `json:"logo"`
OnlyPushError bool `json:"only_push_error"` // 仅同步推送异常
Architecture string `json:"architecture"`
OwnerRef int `json:"owner_ref"` // 任务所属,直接创建 0,订阅创建 1
SubscribeId int64 `json:"subscribe_id"` // 所属关联订阅ID,默认为 0 手动创建 1 订阅创建
}
type TaskMessage ¶
type TaskMessage struct {
rainbow.Model
TaskId int64 `json:"task_id" gorm:"index:idx"`
Message string `json:"message"`
}
func (*TaskMessage) TableName ¶
func (t *TaskMessage) TableName() string
type User ¶
type User struct {
rainbow.Model
UserId string `gorm:"type:varchar(255);uniqueIndex:idx_user" json:"user_id"` // 用户ID
Name string `json:"name"` // 用户名
UserType int `json:"user_type"` // 0 个人版,1 专有版
PaymentType int `json:"payment_type"` // 付费模式 0 按量付费, 1 包年包月
ExpireTime time.Time `gorm:"column:expire_time;type:datetime;default:current_timestamp;not null" json:"expire_time"` // 包年包月时到期时间
RemainCount int `json:"remain_count"` // 按量付费时剩余次数
EnableChart bool `json:"enable_chart"` // 启用 chart 仓库
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.