Documentation
¶
Index ¶
- Variables
- type AppBackup
- type AppPublish
- type AppStatus
- type CodeCheckResult
- type EventLogMessage
- type IDModel
- type Image
- type Interface
- type K8sDeployReplication
- type K8sPod
- type K8sService
- type LicenseInfo
- type LocalScheduler
- type Model
- type NotificationEvent
- type RegionAPIClass
- type RegionProcotols
- type RegionUserInfo
- type ServiceEvent
- type ServiceProbe
- type TenantPlugin
- type TenantPluginBuildVersion
- type TenantPluginDefaultENV
- type TenantPluginVersionEnv
- type TenantServiceEnvVar
- type TenantServiceLBMappingPort
- type TenantServiceLable
- type TenantServiceMountRelation
- type TenantServicePluginRelation
- type TenantServiceRelation
- type TenantServiceStatus
- type TenantServiceVolume
- type TenantServices
- func (t *TenantServices) Autodomain(tenantName string, containerPort int) string
- func (t *TenantServices) ChangeDelete() *TenantServicesDelete
- func (t *TenantServices) CreateShareImage(hubURL, namespace, version string) (string, error)
- func (t *TenantServices) CreateShareSlug(servicekey, namespace, version string) string
- func (t *TenantServices) IsSlug() bool
- func (t *TenantServices) TableName() string
- type TenantServicesDelete
- type TenantServicesPort
- type TenantServicesStreamPluginPort
- type Tenants
- type VersionInfo
- type VolumeType
Constants ¶
This section is empty.
Variables ¶
var ALLPOWER = "all_power"
ALLPOWER ALLPOWER
var DownNetPlugin = "net-plugin:down"
DownNetPlugin 下游网络插件
var GeneralPlugin = "general-plugin"
GeneralPlugin 一般插件,默认分类,优先级最低
var HTTPGROUP = "http"
HTTPGROUP HTTPGROUP
var InitPlugin = "init-plugin"
InitPlugin 初始化插件
var LabelKeyNodeAffinity = "node-affinity"
LabelKeyNodeAffinity 节点亲和标签
var LabelKeyNodeAntyAffinity = "node-anti-affinity"
LabelKeyNodeAntyAffinity 节点反亲和标签
var LabelKeyNodeSelector = "node-selector"
LabelKeyNodeSelector 节点选择标签
var LabelKeyServiceAffinity = "service-affinity"
LabelKeyServiceAffinity 应用亲和标签
var LabelKeyServiceAntyAffinity = "service-anti-affinity"
LabelKeyServiceAntyAffinity 应用反亲和标签
var LabelKeyServiceType = "service-type"
LabelKeyServiceType 应用部署类型标签
var MYSQLPROTOCOL = "mysql"
MYSQLPROTOCOL MYSQLPROTOCOL
var NODEMANAGER = "node_manager"
NODEMANAGER NODEMANAGER
var SERVERSOURCE = "server_source"
SERVERSOURCE SERVERSOURCE
var STREAMGROUP = "stream"
STREAMGROUP STREAMGROUP
var TCPPROTOCOL = "tcp"
TCPPROTOCOL TCPPROTOCOL
var TypeDeployment = "deployment"
var TypeReplicationController = "replicationcontroller"
var TypeStatefulSet = "statefulset"
var UDPPROTOCOL = "udp"
UDPPROTOCOL UDPPROTOCOL
var UpNetPlugin = "net-plugin:up"
UpNetPlugin 上游网络插件
var V2VERSION = "v2"
V2VERSION region version
Functions ¶
This section is empty.
Types ¶
type AppBackup ¶
type AppBackup struct {
Model
EventID string `gorm:"column:event_id;size:32;" json:"event_id"`
BackupID string `gorm:"column:backup_id;size:32;" json:"backup_id"`
GroupID string `gorm:"column:group_id;size:32;" json:"group_id"`
//Status in starting,failed,success,restore
Status string `gorm:"column:status;size:32" json:"status"`
Version string `gorm:"column:version;size:32" json:"version"`
SourceDir string `gorm:"column:source_dir;size:255" json:"source_dir"`
SourceType string `gorm:"column:source_type;size:255;default:'local'" json:"source_type"`
BackupMode string `gorm:"column:backup_mode;size:32" json:"backup_mode"`
BuckupSize int `gorm:"column:backup_size" json:"backup_size"`
Deleted bool `gorm:"column:deleted" json:"deleted"`
}
AppBackup app backup info
type AppPublish ¶
type AppPublish struct {
Model
ServiceKey string `gorm:"column:service_key;size:70"`
AppVersion string `gorm:"column:app_version;size:70"`
Status string `gorm:"column:status;size:10"`
Image string `gorm:"column:image;size:200"`
Slug string `gorm:"column:slug;size:200"`
DestYS bool `gorm:"column:dest_ys"`
DestYB bool `gorm:"column:dest_yb"`
}
AppPublish AppPublish
type AppStatus ¶
type AppStatus struct {
EventID string `gorm:"column:event_id;size:32;primary_key" json:"event_id"`
Format string `gorm:"column:format;size:32" json:"format"` // only rainbond-app/docker-compose
SourceDir string `gorm:"column:source_dir;size:255" json:"source_dir"`
Apps string `gorm:"column:apps;type:text" json:"apps"`
Status string `gorm:"column:status;size:32" json:"status"` // only exporting/importing/failed/success/cleaned
TarFileHref string `gorm:"column:tar_file_href;size:255" json:"tar_file_href"`
Metadata string `gorm:"column:metadata;type:text" json:"metadata"`
}
type CodeCheckResult ¶
type CodeCheckResult struct {
Model
ServiceID string `gorm:"column:service_id;size:70"`
Condition string `gorm:"column:condition"`
Language string `gorm:"column:language"`
CheckType string `gorm:"column:check_type"`
GitURL string `gorm:"column:git_url"`
CodeVersion string `gorm:"column:code_version"`
GitProjectId string `gorm:"column:git_project_id"`
CodeFrom string `gorm:"column:code_from"`
URLRepos string `gorm:"column:url_repos"`
DockerFileReady bool `gorm:"column:docker_file_ready"`
InnerPort string `gorm:"column:inner_port"`
VolumeMountPath string `gorm:"column:volume_mount_path"`
BuildImageName string `gorm:"column:image"`
PortList string `gorm:"column:port_list"`
VolumeList string `gorm:"column:volume_list"`
}
CodeCheckResult codecheck result struct
type EventLogMessage ¶
type EventLogMessage struct {
Model
EventID string `gorm:"column:event_id;size:40"`
StartTime string `gorm:"column:start_time;size:40"`
Message []byte `gorm:"column:message"`
}
EventLogMessage event log message struct
type K8sDeployReplication ¶
type K8sDeployReplication struct {
Model
TenantID string `gorm:"column:tenant_id;size:32"`
ServiceID string `gorm:"column:service_id;size:32"`
//部署资源的ID ,例如rc ,deploment, statefulset
ReplicationID string `gorm:"column:rc_id;size:32"`
ReplicationType string `gorm:"column:rc_type;"`
DeployVersion string `gorm:"column:deploy_version"`
IsDelete bool `gorm:"column:is_delete"`
}
K8sDeployReplication 应用与k8s资源对应情况
func (*K8sDeployReplication) TableName ¶
func (t *K8sDeployReplication) TableName() string
TableName 表名
type K8sPod ¶
type K8sPod struct {
Model
ServiceID string `gorm:"column:service_id;size:32"`
//部署资源的ID ,例如rc ,deploment, statefulset
ReplicationID string `gorm:"column:rc_id;size:32"`
ReplicationType string `gorm:"column:rc_type;"`
PodName string `gorm:"column:pod_name;size:60"`
PodIP string `gorm:"column:pod_ip;size:32"`
}
K8sPod 应用Pod信息
type K8sService ¶
type K8sService struct {
Model
TenantID string `gorm:"column:tenant_id;size:32"`
ServiceID string `gorm:"column:service_id;size:32"`
//部署资源的ID ,例如rc ,deploment, statefulset
ReplicationID string `gorm:"column:rc_id;size:32"`
ReplicationType string `gorm:"column:rc_type;"`
K8sServiceID string `gorm:"column:inner_service_id;size:60;unique_index"`
ContainerPort int `gorm:"column:container_port;default:0"`
//是否是对外服务
IsOut bool `gorm:"column:is_out"`
}
K8sService service source in k8s
type LicenseInfo ¶
type LicenseInfo struct {
//Model
IDModel
Token string `gorm:"column:token;size:40;" json:"token"`
License string `gorm:"column:license;" json:"license"`
Label string `gorm:"column:label" json:"label"`
}
LicenseInfo 信息
type LocalScheduler ¶
type LocalScheduler struct {
Model
ServiceID string `gorm:"column:service_id;size:32"`
NodeIP string `gorm:"column:node_ip;size:32"`
PodName string `gorm:"column:pod_name;size:32"`
}
LocalScheduler 本地调度暂存信息
type Model ¶
type Model struct {
ID uint `gorm:"column:ID;primary_key"`
CreatedAt time.Time `gorm:"column:create_time"`
}
Model 默认字段
type NotificationEvent ¶
type NotificationEvent struct {
Model
//Kind could be service, tenant, cluster, node
Kind string `gorm:"column:kind;size:40"`
//KindID could be service_id,tenant_id,cluster_id,node_id
KindID string `gorm:"column:kind_id;size:40"`
Hash string `gorm:"column:hash;size:100"`
//Type could be Normal UnNormal Notification
Type string `gorm:"column:type;size:40"`
Message string `gorm:"column:message;size:200"`
Reason string `gorm:"column:reson;size:200"`
Count int `gorm:"column:count;"`
LastTime time.Time `gorm:"column:last_time;"`
FirstTime time.Time `gorm:"column:first_time;"`
IsHandle bool `gorm:"column:is_handle;"`
HandleMessage string `gorm:"column:handle_message;"`
ServiceName string `gorm:"column:service_name;size:40"`
TenantName string `gorm:"column:tenant_name;size:40"`
}
NotificationEvent NotificationEvent
func (*NotificationEvent) TableName ¶
func (n *NotificationEvent) TableName() string
TableName table name
type RegionAPIClass ¶
type RegionAPIClass struct {
Model
ClassLevel string `gorm:"column:class_level;size:24;" json:"class_level"`
Prefix string `gorm:"column:prefix;size:128;" json:"prefix"`
URI string `gorm:"column:uri;size:256" json:"uri"`
Alias string `gorm:"column:alias;size:64" json:"alias"`
Remark string `gorm:"column:remark;size:64" json:"remark"`
}
RegionAPIClass RegionAPIClass
type RegionProcotols ¶
type RegionProcotols struct {
Model
ProtocolGroup string `gorm:"column:protocol_group;size:32;" json:"protocol_group"`
ProtocolChild string `gorm:"column:protocol_child;size:32;" json:"protocol_child"`
APIVersion string `gorm:"column:api_version;size:8" json:"api_version"`
IsSupport bool `gorm:"column:is_support;default:false" json:"is_support"`
}
RegionProcotols RegionProcotol
type RegionUserInfo ¶
type RegionUserInfo struct {
Model
EID string `gorm:"column:eid;size:34" json:"eid"`
APIRange string `gorm:"column:api_range;size:24" json:"api_range"`
RegionTag string `gorm:"column:region_tag;size:24" json:"region_tag"`
ValidityPeriod int `gorm:"column:validity_period;size:10" json:"validity_period"`
Token string `gorm:"column:token;size:32" json:"token"`
CA string `gorm:"column:ca;size:4096" json:"ca"`
Key string `gorm:"column:key;size:4096" json:"key"`
}
RegionUserInfo RegionUserInfo
type ServiceEvent ¶
type ServiceEvent struct {
Model
EventID string `gorm:"column:event_id;size:40"`
TenantID string `gorm:"column:tenant_id;size:40"`
ServiceID string `gorm:"column:service_id;size:40"`
UserName string `gorm:"column:user_name;size:40"`
StartTime string `gorm:"column:start_time;size:40"`
EndTime string `gorm:"column:end_time;size:40"`
OptType string `gorm:"column:opt_type;size:40"`
Status string `gorm:"column:status;size:40"`
FinalStatus string `gorm:"column:final_status;size:40"`
DeployVersion string `gorm:"column:deploy_version;size:40"`
OldDeployVersion string `gorm:"column:old_deploy_version;size:40"`
CodeVersion string `gorm:"column:code_version;size:200"`
OldCodeVersion string `gorm:"column:old_code_version;size:200"`
Message string `gorm:"column:message"`
}
ServiceEvent event struct
type ServiceProbe ¶
type ServiceProbe struct {
Model
ServiceID string `gorm:"column:service_id;size:32" json:"service_id" validate:"service_id|between:30,33"`
ProbeID string `gorm:"column:probe_id;size:32" json:"probe_id" validate:"probe_id|between:30,33"`
Mode string `gorm:"column:mode;default:'liveness'" json:"mode" validate:"mode"`
Scheme string `gorm:"column:scheme;default:'scheme'" json:"scheme" validate:"scheme"`
Path string `gorm:"column:path" json:"path" validate:"path"`
Port int `gorm:"column:port;size:5;default:80" json:"port" validate:"port|required|numeric_between:1,65535"`
Cmd string `gorm:"column:cmd;size:150" json:"cmd" validate:"cmd"`
//http请求头,key=value,key2=value2
HTTPHeader string `gorm:"column:http_header;size:300" json:"http_header" validate:"http_header"`
//初始化等候时间
InitialDelaySecond int `gorm:"column:initial_delay_second;size:2;default:1" json:"initial_delay_second" validate:"initial_delay_second"`
//检测间隔时间
PeriodSecond int `gorm:"column:period_second;size:2;default:3" json:"period_second" validate:"period_second"`
//检测超时时间
TimeoutSecond int `gorm:"column:timeout_second;size:3;default:30" json:"timeout_second" validate:"timeout_second"`
//是否启用
IsUsed int `gorm:"column:is_used;size:1;default:1" json:"is_used" validate:"is_used"`
//标志为失败的检测次数
FailureThreshold int `gorm:"column:failure_threshold;size:2;default:3" json:"failure_threshold" validate:"failure_threshold"`
//标志为成功的检测次数
SuccessThreshold int `gorm:"column:success_threshold;size:2;default:1" json:"success_threshold" validate:"success_threshold"`
}
ServiceProbe 应用探针信息
type TenantPlugin ¶
type TenantPlugin struct {
Model
PluginID string `gorm:"column:plugin_id;size:32"`
//plugin name
PluginName string `gorm:"column:plugin_name;size:32" json:"plugin_name"`
//plugin describe
PluginInfo string `gorm:"column:plugin_info;size:255" json:"plugin_info"`
//plugin build by docker image name
ImageURL string `gorm:"column:image_url" json:"image_url"`
//plugin build by git code url
GitURL string `gorm:"column:git_url" json:"git_url"`
//build mode
BuildModel string `gorm:"column:build_model" json:"build_model"`
//plugin model
PluginModel string `gorm:"column:plugin_model" json:"plugin_model"`
//tenant id
TenantID string `gorm:"column:tenant_id" json:"tenant_id"`
//tenant_name Used to calculate CPU and Memory.
Domain string `gorm:"column:domain" json:"domain"`
//gitlab; github The deprecated
CodeFrom string `gorm:"column:code_from" json:"code_from"`
}
TenantPlugin plugin model
type TenantPluginBuildVersion ¶
type TenantPluginBuildVersion struct {
Model
//plugin version eg v1.0.0
VersionID string `gorm:"column:version_id;size:32" json:"version_id"`
//deploy version eg 20180528071717
DeployVersion string `gorm:"column:deploy_version;size:32" json:"deploy_version"`
PluginID string `gorm:"column:plugin_id;size:32" json:"plugin_id"`
Kind string `gorm:"column:kind;size:24" json:"kind"`
BaseImage string `gorm:"column:base_image;size:200" json:"base_image"`
BuildLocalImage string `gorm:"column:build_local_image;size:200" json:"build_local_image"`
BuildTime string `gorm:"column:build_time" json:"build_time"`
Repo string `gorm:"column:repo" json:"repo"`
GitURL string `gorm:"column:git_url" json:"git_url"`
Info string `gorm:"column:info" json:"info"`
Status string `gorm:"column:status;size:24" json:"status"`
// container default cpu
ContainerCPU int `gorm:"column:container_cpu;default:125" json:"container_cpu"`
// container default memory
ContainerMemory int `gorm:"column:container_memory;default:64" json:"container_memory"`
// container args
ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd"`
}
TenantPluginBuildVersion plugin build version
func (*TenantPluginBuildVersion) CreateShareImage ¶
func (t *TenantPluginBuildVersion) CreateShareImage(hubURL, namespace string) (string, error)
CreateShareImage CreateShareImage
func (*TenantPluginBuildVersion) TableName ¶
func (t *TenantPluginBuildVersion) TableName() string
TableName table name
type TenantPluginDefaultENV ¶
type TenantPluginDefaultENV struct {
Model
//plugin id
PluginID string `gorm:"column:plugin_id" json:"plugin_id"`
//plugin version
VersionID string `gorm:"column:version_id;size:32" json:"version_id"`
//env name
ENVName string `gorm:"column:env_name" json:"env_name"`
//env value
ENVValue string `gorm:"column:env_value" json:"env_value"`
//value is change
IsChange bool `gorm:"column:is_change;default:false" json:"is_change"`
}
TenantPluginDefaultENV plugin default env config
func (*TenantPluginDefaultENV) TableName ¶
func (t *TenantPluginDefaultENV) TableName() string
TableName table name
type TenantPluginVersionEnv ¶
type TenantPluginVersionEnv struct {
Model
//VersionID string `gorm:"column:version_id;size:32"`
PluginID string `gorm:"column:plugin_id;size:32" json:"plugin_id"`
EnvName string `gorm:"column:env_name" json:"env_name"`
EnvValue string `gorm:"column:env_value" json:"env_value"`
ServiceID string `gorm:"column:service_id" json:"service_id"`
}
TenantPluginVersionEnv TenantPluginVersionEnv
func (*TenantPluginVersionEnv) TableName ¶
func (t *TenantPluginVersionEnv) TableName() string
TableName table name
type TenantServiceEnvVar ¶
type TenantServiceEnvVar struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" validate:"service_id|between:30,33" json:"service_id"`
ContainerPort int `gorm:"column:container_port" validate:"container_port|numeric_between:1,65535" json:"container_port"`
Name string `gorm:"column:name;size:100" validate:"name" json:"name"`
AttrName string `gorm:"column:attr_name" validate:"env_name|required" json:"attr_name"`
AttrValue string `gorm:"column:attr_value" validate:"env_value|required" json:"attr_value"`
IsChange bool `gorm:"column:is_change" validate:"is_change|bool" json:"is_change"`
Scope string `gorm:"column:scope;default:'outer'" validate:"scope|in:outer,inner,both" json:"scope"`
}
TenantServiceEnvVar 应用环境变量
func (*TenantServiceEnvVar) TableName ¶
func (t *TenantServiceEnvVar) TableName() string
TableName 表名
type TenantServiceLBMappingPort ¶
type TenantServiceLBMappingPort struct {
Model
ServiceID string `gorm:"column:service_id;size:32"`
//负载均衡VS使用端口
Port int `gorm:"column:port;unique_index"`
//此字段废除
// IP string `gorm:"column:ip"`
//应用原端口
ContainerPort int `gorm:"column:container_port"`
}
TenantServiceLBMappingPort stream应用端口映射情况
func (*TenantServiceLBMappingPort) TableName ¶
func (t *TenantServiceLBMappingPort) TableName() string
TableName 表名
type TenantServiceLable ¶
type TenantServiceLable struct {
Model
ServiceID string `gorm:"column:service_id;size:32"`
LabelKey string `gorm:"column:label_key;size:50"`
LabelValue string `gorm:"column:label_value;size:50"`
}
TenantServiceLable 应用高级标签
type TenantServiceMountRelation ¶
type TenantServiceMountRelation struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" json:"tenant_id" validate:"tenant_id|between:30,33"`
ServiceID string `gorm:"column:service_id;size:32" json:"service_id" validate:"service_id|between:30,33"`
DependServiceID string `gorm:"column:dep_service_id;size:32" json:"dep_service_id" validate:"dep_service_id|between:30,33"`
//挂载路径(挂载应用可自定义)
VolumePath string `gorm:"column:mnt_name" json:"volume_path" validate:"volume_path|required"`
//主机路径(依赖应用的共享存储对应的主机路径)
HostPath string `gorm:"column:mnt_dir" json:"host_path" validate:"host_path"`
//存储名称(依赖应用的共享存储对应的名称)
VolumeName string `gorm:"column:volume_name;size:40" json:"volume_name" validate:"volume_name|required"`
}
TenantServiceMountRelation 应用挂载依赖纪录
func (*TenantServiceMountRelation) TableName ¶
func (t *TenantServiceMountRelation) TableName() string
TableName 表名
type TenantServicePluginRelation ¶
type TenantServicePluginRelation struct {
Model
VersionID string `gorm:"column:version_id;size:32" json:"version_id"`
PluginID string `gorm:"column:plugin_id;size:32" json:"plugin_id"`
ServiceID string `gorm:"column:service_id;size:32" json:"service_id"`
PluginModel string `gorm:"column:plugin_model;size:24" json:"plugin_model"`
// container default cpu v3.5.1 add
ContainerCPU int `gorm:"column:container_cpu;default:125" json:"container_cpu"`
// container default memory v3.5.1 add
ContainerMemory int `gorm:"column:container_memory;default:64" json:"container_memory"`
Switch bool `gorm:"column:switch;default:false" json:"switch"`
}
TenantServicePluginRelation TenantServicePluginRelation
func (*TenantServicePluginRelation) TableName ¶
func (t *TenantServicePluginRelation) TableName() string
TableName table name
type TenantServiceRelation ¶
type TenantServiceRelation struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" validate:"tenant_id" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" validate:"service_id" json:"service_id"`
DependServiceID string `gorm:"column:dep_service_id;size:32" validate:"depend_service_id" json:"depend_service_id"`
DependServiceType string `gorm:"column:dep_service_type" validate:"dep_service_type" json:"dep_service_type"`
DependOrder int `gorm:"column:dep_order" validate:"dep_order" json:"dep_order"`
}
TenantServiceRelation 应用依赖关系
func (*TenantServiceRelation) TableName ¶
func (t *TenantServiceRelation) TableName() string
TableName 表名
type TenantServiceStatus ¶
type TenantServiceStatus struct {
Model
ServiceID string `gorm:"column:service_id;size:32;unique_index"`
Status string `gorm:"column:status;size:24"`
}
TenantServiceStatus 应用实时状态
func (*TenantServiceStatus) TableName ¶
func (t *TenantServiceStatus) TableName() string
TableName 表名
type TenantServiceVolume ¶
type TenantServiceVolume struct {
Model
ServiceID string `gorm:"column:service_id;size:32" json:"service_id"`
//服务类型
Category string `gorm:"column:category;size:50" json:"category"`
//存储类型(share,local,tmpfs)
VolumeType string `gorm:"column:volume_type;size:20" json:"volume_type"`
//存储名称
VolumeName string `gorm:"column:volume_name;size:40" json:"volume_name"`
//主机地址
HostPath string `gorm:"column:host_path" json:"host_path"`
//挂载地址
VolumePath string `gorm:"column:volume_path" json:"volume_path"`
//是否只读
IsReadOnly bool `gorm:"column:is_read_only;default:false" json:"is_read_only"`
}
TenantServiceVolume 应用持久化纪录
func (*TenantServiceVolume) TableName ¶
func (t *TenantServiceVolume) TableName() string
TableName 表名
type TenantServices ¶
type TenantServices struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" json:"service_id"`
// 服务key
ServiceKey string `gorm:"column:service_key;size:32" json:"service_key"`
// 服务别名
ServiceAlias string `gorm:"column:service_alias;size:30" json:"service_alias"`
// 服务描述
Comment string `gorm:"column:comment" json:"comment"`
// 服务版本
ServiceVersion string `gorm:"column:service_version;size:32" json:"service_version"`
// 镜像名称
ImageName string `gorm:"column:image_name;size:100" json:"image_name"`
// 容器CPU权重
ContainerCPU int `gorm:"column:container_cpu;default:500" json:"container_cpu"`
// 容器最大内存
ContainerMemory int `gorm:"column:container_memory;default:128" json:"container_memory"`
// 容器启动命令
ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd"`
// 容器环境变量
ContainerEnv string `gorm:"column:container_env;size:255" json:"container_env"`
// 卷名字
VolumePath string `gorm:"column:volume_path" json:"volume_path"`
// 容器挂载目录
VolumeMountPath string `gorm:"column:volume_mount_path" json:"volume_mount_path"`
// 宿主机目录
HostPath string `gorm:"column:host_path" json:"host_path"`
// 扩容方式;0:无状态;1:有状态;2:分区
ExtendMethod string `gorm:"column:extend_method;default:'stateless';" json:"extend_method"`
// 节点数
Replicas int `gorm:"column:replicas;default:1" json:"replicas"`
// 部署版本
DeployVersion string `gorm:"column:deploy_version" json:"deploy_version"`
// 服务分类:application,cache,store
Category string `gorm:"column:category" json:"category"`
// 服务当前状态:undeploy,running,closed,unusual,starting,checking,stoping
CurStatus string `gorm:"column:cur_status;default:'undeploy'" json:"cur_status"`
// 计费状态 为1 计费,为0不计费
Status int `gorm:"column:status;default:0" json:"status"`
// 最新操作ID
EventID string `gorm:"column:event_id" json:"event_id"`
// 服务类型
ServiceType string `gorm:"column:service_type" json:"service_type"`
// 镜像来源
Namespace string `gorm:"column:namespace" json:"namespace"`
// 共享类型shared、exclusive
VolumeType string `gorm:"column:volume_type;default:'shared'" json:"volume_type"`
// 端口类型,one_outer;dif_protocol;multi_outer
PortType string `gorm:"column:port_type;default:'multi_outer'" json:"port_type"`
// 更新时间
UpdateTime time.Time `gorm:"column:update_time" json:"update_time"`
// 服务创建类型cloud云市服务,assistant云帮服务
ServiceOrigin string `gorm:"column:service_origin;default:'assistant'" json:"service_origin"`
// 代码来源:gitlab,github
CodeFrom string `gorm:"column:code_from" json:"code_from"`
Domain string `gorm:"column:domain" json:"domain"`
}
TenantServices 租户应用
func (*TenantServices) Autodomain ¶
func (t *TenantServices) Autodomain(tenantName string, containerPort int) string
Autodomain 构建默认域名
func (*TenantServices) ChangeDelete ¶
func (t *TenantServices) ChangeDelete() *TenantServicesDelete
ChangeDelete ChangeDelete
func (*TenantServices) CreateShareImage ¶
func (t *TenantServices) CreateShareImage(hubURL, namespace, version string) (string, error)
CreateShareImage 生成镜像分享的地址
func (*TenantServices) CreateShareSlug ¶
func (t *TenantServices) CreateShareSlug(servicekey, namespace, version string) string
CreateShareSlug 生成源码包分享的地址
type TenantServicesDelete ¶
type TenantServicesDelete struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" json:"service_id"`
// 服务key
ServiceKey string `gorm:"column:service_key;size:32" json:"service_key"`
// 服务别名
ServiceAlias string `gorm:"column:service_alias;size:30" json:"service_alias"`
// 服务描述
Comment string `gorm:"column:comment" json:"comment"`
// 服务版本
ServiceVersion string `gorm:"column:service_version;size:32" json:"service_version"`
// 镜像名称
ImageName string `gorm:"column:image_name;size:100" json:"image_name"`
// 容器CPU权重
ContainerCPU int `gorm:"column:container_cpu;default:500" json:"container_cpu"`
// 容器最大内存
ContainerMemory int `gorm:"column:container_memory;default:128" json:"container_memory"`
// 容器启动命令
ContainerCMD string `gorm:"column:container_cmd;size:2048" json:"container_cmd"`
// 容器环境变量
ContainerEnv string `gorm:"column:container_env;size:255" json:"container_env"`
// 卷名字
VolumePath string `gorm:"column:volume_path" json:"volume_path"`
// 容器挂载目录
VolumeMountPath string `gorm:"column:volume_mount_path" json:"volume_mount_path"`
// 宿主机目录
HostPath string `gorm:"column:host_path" json:"host_path"`
// 扩容方式;0:无状态;1:有状态;2:分区
ExtendMethod string `gorm:"column:extend_method;default:'stateless';" json:"extend_method"`
// 节点数
Replicas int `gorm:"column:replicas;default:1" json:"replicas"`
// 部署版本
DeployVersion string `gorm:"column:deploy_version" json:"deploy_version"`
// 服务分类:application,cache,store
Category string `gorm:"column:category" json:"category"`
// 服务当前状态:undeploy,running,closed,unusual,starting,checking,stoping
CurStatus string `gorm:"column:cur_status;default:'undeploy'" json:"cur_status"`
// 计费状态 为1 计费,为0不计费
Status int `gorm:"column:status;default:0" json:"status"`
// 最新操作ID
EventID string `gorm:"column:event_id" json:"event_id"`
// 服务类型
ServiceType string `gorm:"column:service_type" json:"service_type"`
// 镜像来源
Namespace string `gorm:"column:namespace" json:"namespace"`
// 共享类型shared、exclusive
VolumeType string `gorm:"column:volume_type;default:'shared'" json:"volume_type"`
// 端口类型,one_outer;dif_protocol;multi_outer
PortType string `gorm:"column:port_type;default:'multi_outer'" json:"port_type"`
// 更新时间
UpdateTime time.Time `gorm:"column:update_time" json:"update_time"`
// 服务创建类型cloud云市服务,assistant云帮服务
ServiceOrigin string `gorm:"column:service_origin;default:'assistant'" json:"service_origin"`
// 代码来源:gitlab,github
CodeFrom string `gorm:"column:code_from" json:"code_from"`
Domain string `gorm:"column:domain" json:"domain"`
}
TenantServicesDelete 已删除的应用表
func (*TenantServicesDelete) TableName ¶
func (t *TenantServicesDelete) TableName() string
TableName 表名
type TenantServicesPort ¶
type TenantServicesPort struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" validate:"service_id|between:30,33" json:"service_id"`
ContainerPort int `gorm:"column:container_port" validate:"container_port|required|numeric_between:1,65535" json:"container_port"`
MappingPort int `gorm:"column:mapping_port" validate:"mapping_port|required|numeric_between:1,65535" json:"mapping_port"`
Protocol string `gorm:"column:protocol" validate:"protocol|required|in:http,https,stream,grpc" json:"protocol"`
PortAlias string `gorm:"column:port_alias" validate:"port_alias|required|alpha_dash" json:"port_alias"`
IsInnerService bool `gorm:"column:is_inner_service" validate:"is_inner_service|bool" json:"is_inner_service"`
IsOuterService bool `gorm:"column:is_outer_service" validate:"is_outer_service|bool" json:"is_outer_service"`
}
TenantServicesPort 应用端口信息
type TenantServicesStreamPluginPort ¶
type TenantServicesStreamPluginPort struct {
Model
TenantID string `gorm:"column:tenant_id;size:32" validate:"tenant_id|between:30,33" json:"tenant_id"`
ServiceID string `gorm:"column:service_id;size:32" validate:"service_id|between:30,33" json:"service_id"`
PluginModel string `gorm:"column:plugin_model;size:24" json:"plugin_model"`
ContainerPort int `gorm:"column:container_port" validate:"container_port|required|numeric_between:1,65535" json:"container_port"`
PluginPort int `gorm:"column:plugin_port" json:"plugin_port"`
}
TenantServicesStreamPluginPort 绑定stream类型插件后端口映射信息
func (*TenantServicesStreamPluginPort) TableName ¶
func (t *TenantServicesStreamPluginPort) TableName() string
TableName 表名
type Tenants ¶
type Tenants struct {
Model
Name string `gorm:"column:name;size:40;unique_index"`
UUID string `gorm:"column:uuid;size:33;unique_index"`
EID string `gorm:"column:eid"`
}
Tenants 租户信息
type VersionInfo ¶
type VersionInfo struct {
Model
BuildVersion string `gorm:"column:build_version;size:40"` //唯一
EventID string `gorm:"column:event_id;size:40"`
ServiceID string `gorm:"column:service_id;size:40"`
Kind string `gorm:"column:kind;size:40"` //kind
//DeliveredType app version delivered type
//image: this is a docker image
//slug: this is a source code tar file
DeliveredType string `gorm:"column:delivered_type;size:40"` //kind
DeliveredPath string `gorm:"column:delivered_path;size:250"` //交付物path
ImageName string `gorm:"column:image_name;size:250"` //交付物path
RepoURL string `gorm:"column:repo_url;size:100"`
CodeVersion string `gorm:"column:code_version;size:40"`
CommitMsg string `gorm:"column:code_commit_msg;size:200"`
Author string `gorm:"column:code_commit_author;size:40"`
//FinalStatus app version status
//success: version available
//failure: build failure
//lost: there is no delivered
FinalStatus string `gorm:"column:final_status;size:40"`
}
VersionInfo version info struct
func (*VersionInfo) CreateShareImage ¶
func (t *VersionInfo) CreateShareImage(hubURL, namespace, appVersion string) (string, error)
CreateShareImage create share image name
type VolumeType ¶
type VolumeType string
VolumeType 存储类型
var LocalVolumeType VolumeType = "local"
LocalVolumeType 本地文件存储
var MemoryFSVolumeType VolumeType = "memoryfs"
MemoryFSVolumeType 内存文件存储
ShareFileVolumeType 共享文件存储
func (VolumeType) String ¶
func (vt VolumeType) String() string