Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func CacheID(clusterID, nodeName, CacheDir, fsID string) string
 - type ArtifactEvent
 - type ClusterInfo
 - type FSCache
 - type FSCacheConfig
 - type FileSystem
 - type Flavour
 - type Grant
 - type Image
 - type Job
 - type JobLabel
 - type JobTask
 - type LabelInfo
 - type Link
 - type Model
 - type NodeInfo
 - type Pipeline
 - type PipelineVersion
 - type PodInfo
 - type Queue
 - type ResourceInfo
 - type ResourceInfoResponse
 - type ResourceLimit
 - type TaskAllocateStatus
 - type User
 - type UserInfo
 
Constants ¶
      View Source
      
  
    const ( CreatedAt = "created_at" UpdatedAt = "updated_at" Type = "type" ID = "id" FsID = "fs_id" UserName = "user_name" FsName = "name" TimeFormat = "2006-01-02 15:04:05" )
      View Source
      
  
    const ( DefaultClusterSource = "OnPremise" ClusterStatusOnLine = "online" ClusterStatusOffLine = "offline" DefaultClusterStatus = ClusterStatusOnLine )
      View Source
      
  
    const ( ObjectTypeNode = "node" ObjectTypePod = "pod" )
      View Source
      
  
    const (
	FileSystemTableName = "filesystem"
)
    
      View Source
      
  
    const FlavourTableName = "flavour"
    
      View Source
      
  
    const FsCacheTableName = "fs_cache"
    
      View Source
      
  
    const (
	JobTaskTableName = "job_task"
)
    
      View Source
      
  
const (
	LinkTableName = "link"
)
    Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArtifactEvent ¶ added in v0.14.4
type ArtifactEvent struct {
	Pk           int64          `json:"-"                    gorm:"primaryKey;autoIncrement;not null"`
	Md5          string         `json:"-"                    gorm:"type:varchar(32);not null"`
	RunID        string         `json:"runID"                gorm:"type:varchar(60);not null"`
	FsID         string         `json:"-"                    gorm:"type:varchar(60);not null"`
	FsName       string         `json:"fsname"               gorm:"type:varchar(60);not null"`
	UserName     string         `json:"username"             gorm:"type:varchar(60);not null"`
	ArtifactPath string         `json:"artifactPath"         gorm:"type:varchar(256);not null"`
	Step         string         `json:"step"                 gorm:"type:varchar(256);not null"`
	JobID        string         `json:"jobID"                gorm:"type:varchar(60);not null"`
	Type         string         `json:"type"                 gorm:"type:varchar(16);not null"`
	ArtifactName string         `json:"artifactName"         gorm:"type:varchar(32);not null"`
	Meta         string         `json:"meta"                 gorm:"type:text;size:65535"`
	CreateTime   string         `json:"createTime"           gorm:"-"`
	UpdateTime   string         `json:"updateTime,omitempty" gorm:"-"`
	CreatedAt    time.Time      `json:"-"`
	UpdatedAt    time.Time      `json:"-"`
	DeletedAt    gorm.DeletedAt `json:"-"                    gorm:"index"`
}
    func (*ArtifactEvent) AfterFind ¶ added in v0.14.4
func (a *ArtifactEvent) AfterFind(*gorm.DB) error
func (ArtifactEvent) TableName ¶ added in v0.14.4
func (ArtifactEvent) TableName() string
type ClusterInfo ¶ added in v0.14.4
type ClusterInfo struct {
	Model            `gorm:"embedded"  json:",inline"`
	Pk               int64    `gorm:"primaryKey;autoIncrement" json:"-"`      // 自增主键
	Name             string   `gorm:"column:name" json:"clusterName"`         // 集群名字
	Description      string   `gorm:"column:description" json:"description"`  // 集群描述
	Endpoint         string   `gorm:"column:endpoint" json:"endpoint"`        // 集群endpoint, 比如 http://10.11.11.47:8080
	Source           string   `gorm:"column:source" json:"source"`            // 来源, 比如 OnPremise (内部部署)、AWS、CCE
	ClusterType      string   `gorm:"column:cluster_type" json:"clusterType"` // 集群类型,比如Kubernetes/Local
	Version          string   `gorm:"column:version" json:"version"`          // 集群版本,比如v1.16
	Status           string   `gorm:"column:status" json:"status"`            // 集群状态,可选值为online, offline
	Credential       string   `gorm:"column:credential" json:"credential"`    // 用于存储集群的凭证信息,比如k8s的kube_config配置
	Setting          string   `gorm:"column:setting" json:"setting"`          // 存储额外配置信息
	RawNamespaceList string   `gorm:"column:namespace_list" json:"-"`         // 命名空间列表,json类型,如["ns1", "ns2"]
	NamespaceList    []string `gorm:"-" json:"namespaceList"`                 // 命名空间列表,json类型,如["ns1", "ns2"]
	DeletedAt        string   `gorm:"column:deleted_at" json:"-"`             // 删除标识,非空表示软删除
}
    func (*ClusterInfo) AfterFind ¶ added in v0.14.4
func (clusterInfo *ClusterInfo) AfterFind(*gorm.DB) error
func (*ClusterInfo) BeforeSave ¶ added in v0.14.4
func (clusterInfo *ClusterInfo) BeforeSave(*gorm.DB) error
func (ClusterInfo) MarshalJSON ¶ added in v0.14.4
func (clusterInfo ClusterInfo) MarshalJSON() ([]byte, error)
func (ClusterInfo) TableName ¶ added in v0.14.4
func (ClusterInfo) TableName() string
type FSCache ¶
type FSCache struct {
	PK          int64          `json:"-" gorm:"primaryKey;autoIncrement"`
	CacheID     string         `json:"cacheID" gorm:"type:varchar(36);column:cache_id"`
	CacheHashID string         `json:"cacheHashID" gorm:"type:varchar(36);column:cache_hash_id"`
	FsID        string         `json:"fsID" gorm:"type:varchar(36);column:fs_id"`
	CacheDir    string         `json:"cacheDir" gorm:"type:varchar(4096);column:cache_dir"`
	NodeName    string         `json:"nodename" gorm:"type:varchar(256);column:nodename"`
	UsedSize    int            `json:"usedSize" gorm:"type:bigint(20);column:usedsize"`
	ClusterID   string         `json:"-"   gorm:"column:cluster_id;default:''"`
	CreatedAt   time.Time      `json:"-"`
	UpdatedAt   time.Time      `json:"-"`
	DeletedAt   gorm.DeletedAt `json:"-"`
}
    type FSCacheConfig ¶
type FSCacheConfig struct {
	PK                      int64                  `json:"-"                    gorm:"primaryKey;autoIncrement"`
	FsID                    string                 `json:"fsID"                 gorm:"type:varchar(36);unique_index"`
	CacheDir                string                 `json:"cacheDir"`
	Quota                   int                    `json:"quota"`
	MetaDriver              string                 `json:"metaDriver"`
	BlockSize               int                    `json:"blockSize"`
	Debug                   bool                   `json:"debug"`
	CleanCache              bool                   `json:"cleanCache"`
	Resource                ResourceLimit          `json:"resource"             gorm:"-"`
	ResourceJson            string                 `json:"-"                    gorm:"column:resource;type:text"`
	NodeAffinityJson        string                 `json:"-"                    gorm:"column:node_affinity;type:text;default:'{}'"`
	NodeAffinity            corev1.NodeAffinity    `json:"nodeAffinity"         gorm:"-"`
	NodeTaintTolerationJson string                 `json:"-"                    gorm:"column:node_tainttoleration;type:text;default:'{}'"`
	NodeTaintTolerationMap  map[string]interface{} `json:"nodeTaintToleration"  gorm:"-"`
	ExtraConfigJson         string                 `json:"-"                    gorm:"column:extra_config;type:text;default:'{}'"`
	ExtraConfigMap          map[string]string      `json:"extraConfig"          gorm:"-"`
	CreateTime              string                 `json:"createTime"           gorm:"-"`
	UpdateTime              string                 `json:"updateTime,omitempty" gorm:"-"`
	CreatedAt               time.Time              `json:"-"`
	UpdatedAt               time.Time              `json:"-"`
	DeletedAt               gorm.DeletedAt         `json:"-"`
}
    func (*FSCacheConfig) BeforeSave ¶
func (s *FSCacheConfig) BeforeSave(*gorm.DB) error
func (*FSCacheConfig) TableName ¶
func (s *FSCacheConfig) TableName() string
type FileSystem ¶
type FileSystem struct {
	Model
	Name                    string            `json:"name"`
	Type                    string            `json:"type"`
	ServerAddress           string            `json:"serverAddress"`
	SubPath                 string            `json:"subPath" gorm:"column:subpath"`
	PropertiesJson          string            `json:"-" gorm:"column:properties;type:text;default:'{}'"`
	PropertiesMap           map[string]string `json:"properties" gorm:"-"`
	UserName                string            `json:"userName"`
	IndependentMountProcess bool              `json:"independentMountProcess"`
}
    FileSystem defined file system model, which can be used to create file system
func (*FileSystem) AfterFind ¶
func (s *FileSystem) AfterFind(*gorm.DB) error
AfterFind is the callback methods doing after the find file system
func (*FileSystem) BeforeSave ¶
func (s *FileSystem) BeforeSave(*gorm.DB) error
BeforeSave is the callback methods for saving file system
func (FileSystem) TableName ¶
func (FileSystem) TableName() string
type Flavour ¶ added in v0.14.4
type Flavour struct {
	Model              `gorm:"embedded"  json:",inline"`
	Pk                 int64                      `json:"-"           gorm:"primaryKey;autoIncrement"`
	Name               string                     `json:"name"        gorm:"uniqueIndex"`
	ClusterID          string                     `json:"-"   gorm:"column:cluster_id;default:''"`
	ClusterName        string                     `json:"-" gorm:"column:cluster_name;->"`
	CPU                string                     `json:"cpu"         gorm:"column:cpu"`
	Mem                string                     `json:"mem"         gorm:"column:mem"`
	RawScalarResources string                     `json:"-"           gorm:"column:scalar_resources;type:text;default:'{}'"`
	ScalarResources    schema.ScalarResourcesType `json:"scalarResources" gorm:"-"`
	UserName           string                     `json:"-" gorm:"column:user_name"`
	DeletedAt          gorm.DeletedAt             `json:"-" gorm:"index"`
}
    Flavour records request resource info for each job
func (*Flavour) BeforeSave ¶ added in v0.14.4
BeforeSave is the callback methods for saving flavour
func (Flavour) MarshalJSON ¶ added in v0.14.4
MarshalJSON decorate format of time
type Grant ¶
type Grant struct {
	Pk           int64          `json:"-" gorm:"primaryKey;autoIncrement"`
	ID           string         `json:"grantID" gorm:"uniqueIndex"`
	UserName     string         `json:"userName"`
	ResourceType string         `json:"resourceType"`
	ResourceID   string         `json:"resourceID"`
	CreatedAt    time.Time      `json:"createTime"`
	UpdatedAt    time.Time      `json:"updateTime,omitempty"`
	DeletedAt    gorm.DeletedAt `json:"-" gorm:"index"`
}
    type Image ¶ added in v0.14.4
type Image struct {
	Pk        int64          `json:"-"         gorm:"primaryKey;autoIncrement;not null"`
	ID        string         `json:"PFImageID" gorm:"type:varchar(128);not null;uniqueIndex"`
	ImageID   string         `json:"imageID"   gorm:"type:varchar(64)"`
	FsID      string         `json:"fsID"      gorm:"type:varchar(60);not null"`
	Source    string         `json:"source"    gorm:"type:varchar(256);not null"`
	Url       string         `json:"url"       gorm:"type:varchar(256)"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"         gorm:"index"`
}
    type Job ¶ added in v0.14.4
type Job struct {
	Pk                int64               `json:"-" gorm:"primaryKey;autoIncrement"`
	ID                string              `json:"jobID" gorm:"type:varchar(60);index:idx_id,unique;NOT NULL"`
	Name              string              `json:"jobName" gorm:"type:varchar(512);default:''"`
	UserName          string              `json:"userName" gorm:"NOT NULL"`
	QueueID           string              `json:"queueID" gorm:"NOT NULL"`
	Type              string              `json:"type" gorm:"type:varchar(20);NOT NULL"`
	ConfigJson        string              `json:"-" gorm:"column:config;type:text"`
	Config            *schema.Conf        `json:"config" gorm:"-"`
	RuntimeInfoJson   string              `json:"-" gorm:"column:runtime_info;default:'{}'"`
	RuntimeInfo       interface{}         `json:"runtimeInfo" gorm:"-"`
	RuntimeStatusJson string              `json:"-" gorm:"column:runtime_status;default:'{}'"`
	RuntimeStatus     interface{}         `json:"runtimeStatus" gorm:"-"`
	Status            schema.JobStatus    `json:"status" gorm:"type:varchar(32);"`
	Message           string              `json:"message"`
	ResourceJson      string              `json:"-" gorm:"column:resource;type:text;default:'{}'"`
	Resource          *resources.Resource `json:"resource" gorm:"-"`
	Framework         schema.Framework    `json:"framework" gorm:"type:varchar(30)"`
	MembersJson       string              `json:"-" gorm:"column:members;type:text"`
	Members           []schema.Member     `json:"members" gorm:"-"`
	ExtensionTemplate string              `json:"-" gorm:"type:text"`
	ParentJob         string              `json:"-" gorm:"type:varchar(60)"`
	CreatedAt         time.Time           `json:"createTime"`
	ActivatedAt       sql.NullTime        `json:"activateTime"`
	UpdatedAt         time.Time           `json:"updateTime,omitempty"`
	DeletedAt         string              `json:"-" gorm:"index:idx_id"`
}
    type JobLabel ¶ added in v0.14.4
type JobTask ¶ added in v0.14.4
type JobTask struct {
	Pk                   int64             `json:"-" gorm:"primaryKey;autoIncrement"`
	ID                   string            `json:"id" gorm:"type:varchar(64);uniqueIndex"` // k8s:podID
	JobID                string            `json:"jobID" gorm:"type:varchar(60)"`
	Namespace            string            `json:"namespace" gorm:"type:varchar(64)"`
	Name                 string            `json:"name" gorm:"type:varchar(512)"`
	MemberRole           schema.MemberRole `json:"memberRole"`
	Status               schema.TaskStatus `json:"status"`
	Message              string            `json:"message"`
	LogURL               string            `json:"logURL"`
	ExtRuntimeStatusJSON string            `json:"extRuntimeStatus" gorm:"column:ext_runtime_status;default:'{}'"`
	ExtRuntimeStatus     interface{}       `json:"-" gorm:"-"` // k8s:v1.PodStatus
	NodeName             string            `json:"nodeName"`
	CreatedAt            time.Time         `json:"-"`
	StartedAt            sql.NullTime      `json:"-"`
	UpdatedAt            time.Time         `json:"-"`
	DeletedAt            sql.NullTime      `json:"-"`
}
    type LabelInfo ¶ added in v0.14.6
type LabelInfo struct {
	Pk         int64  `gorm:"primaryKey;autoIncrement" json:"-"`
	ID         string `gorm:"column:id" json:"id"`
	Name       string `gorm:"column:label_name;index:idx_name" json:"labelName"`
	Value      string `gorm:"column:label_value" json:"labelValue"`
	ObjectID   string `gorm:"column:object_id;index:idx_obj,priority:2" json:"objectID"`
	ObjectType string `gorm:"column:object_type;index:idx_obj,priority:1" json:"objectType"`
}
    type Link ¶
type Link struct {
	Model
	FsID           string            `json:"fsID"`
	FsPath         string            `json:"FsPath"`
	ServerAddress  string            `json:"serverAddress"`
	SubPath        string            `json:"subPath" gorm:"column:subpath"`
	Type           string            `json:"type"`
	PropertiesJson string            `json:"-" gorm:"column:properties;type:text;default:'{}'"`
	PropertiesMap  map[string]string `json:"properties" gorm:"-"`
	UserName       string            `json:"userName"`
}
    Link defined file system model, which can be used to create link
func (*Link) BeforeSave ¶
BeforeSave is the callback methods for saving file system
type Model ¶
type NodeInfo ¶ added in v0.14.6
type NodeInfo struct {
	Pk           int64             `gorm:"primaryKey;autoIncrement" json:"-"`
	ID           string            `gorm:"column:id" json:"nodeID"`
	Name         string            `gorm:"column:name" json:"nodeName"`
	ClusterID    string            `gorm:"column:cluster_id" json:"-"`
	ClusterName  string            `gorm:"column:cluster_name" json:"clusterName"`
	Status       string            `gorm:"column:status" json:"nodeStatus"`
	CapacityJSON string            `gorm:"column:capacity" json:"-"`
	Capacity     map[string]string `gorm:"-" json:"nodeCapacity"`
	LabelsJSON   string            `gorm:"column:labels" json:"-"`
	Labels       map[string]string `gorm:"-" json:"nodeLabels"`
}
    type Pipeline ¶ added in v0.14.4
type Pipeline struct {
	Pk        int64          `json:"-"                    gorm:"primaryKey;autoIncrement;not null"`
	ID        string         `json:"pipelineID"           gorm:"type:varchar(60);not null;index"`
	Name      string         `json:"name"                 gorm:"type:varchar(128);not null;index:idx_fs_name"`
	Desc      string         `json:"desc"                 gorm:"type:varchar(256);not null"`
	UserName  string         `json:"username"             gorm:"type:varchar(60);not null;index:idx_fs_name"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-"`
}
    type PipelineVersion ¶ added in v0.14.4
type PipelineVersion struct {
	Pk           int64          `json:"-"                    gorm:"primaryKey;autoIncrement;not null"`
	ID           string         `json:"pipelineVersionID"    gorm:"type:varchar(60);not null"`
	PipelineID   string         `json:"pipelineID"           gorm:"type:varchar(60);not null"`
	FsID         string         `json:"-"                    gorm:"type:varchar(60);not null"`
	FsName       string         `json:"fsName"               gorm:"type:varchar(60);not null"`
	YamlPath     string         `json:"yamlPath"             gorm:"type:text;size:65535;not null"`
	PipelineYaml string         `json:"pipelineYaml"         gorm:"type:text;size:65535;not null"`
	PipelineMd5  string         `json:"pipelineMd5"          gorm:"type:varchar(32);not null"`
	UserName     string         `json:"username"             gorm:"type:varchar(60);not null"`
	CreatedAt    time.Time      `json:"-"`
	UpdatedAt    time.Time      `json:"-"`
	DeletedAt    gorm.DeletedAt `json:"-"`
}
    func (PipelineVersion) TableName ¶ added in v0.14.4
func (PipelineVersion) TableName() string
type PodInfo ¶ added in v0.14.6
type PodInfo struct {
	Pk        int64             `gorm:"primaryKey;autoIncrement" json:"-"`
	ID        string            `gorm:"column:id" json:"id"`
	Name      string            `gorm:"column:name" json:"name"`
	NodeID    string            `gorm:"column:node_id" json:"nodeID"`
	NodeName  string            `gorm:"column:node_name" json:"nodeName"`
	Status    int               `gorm:"column:status" json:"status"`
	Labels    map[string]string `gorm:"-" json:"labels"`
	Resources map[string]int64  `gorm:"-" json:"resources"`
}
    type Queue ¶ added in v0.14.4
type Queue struct {
	Model           `gorm:"embedded"`
	Pk              int64               `json:"-" gorm:"primaryKey;autoIncrement"`
	Name            string              `json:"name" gorm:"uniqueIndex"`
	Namespace       string              `json:"namespace" gorm:"column:"`
	ClusterId       string              `json:"-" gorm:"column:cluster_id"`
	ClusterName     string              `json:"clusterName" gorm:"column:cluster_name;->"`
	QuotaType       string              `json:"quotaType"`
	RawMinResources string              `json:"-" gorm:"column:min_resources;default:'{}'"`
	MinResources    *resources.Resource `json:"minResources" gorm:"-"`
	RawMaxResources string              `json:"-" gorm:"column:max_resources;default:'{}'"`
	MaxResources    *resources.Resource `json:"maxResources" gorm:"-"`
	RawLocation     string              `json:"-" gorm:"column:location;type:text;default:'{}'"`
	Location        map[string]string   `json:"location" gorm:"-"`
	// 任务调度策略
	RawSchedulingPolicy string         `json:"-" gorm:"column:scheduling_policy"`
	SchedulingPolicy    []string       `json:"schedulingPolicy,omitempty" gorm:"-"`
	Status              string         `json:"status"`
	DeletedAt           gorm.DeletedAt `json:"-" gorm:"index"`
	UsedResources *resources.Resource `json:"usedResources,omitempty" gorm:"-"`
	IdleResources *resources.Resource `json:"idleResources,omitempty" gorm:"-"`
}
    func (*Queue) BeforeSave ¶ added in v0.14.4
BeforeSave is the callback methods for saving file system
func (Queue) MarshalJSON ¶ added in v0.14.4
type ResourceInfo ¶ added in v0.14.6
type ResourceInfo struct {
	Pk       int64  `gorm:"primaryKey;autoIncrement" json:"-"`
	PodID    string `gorm:"column:pod_id;index:idx_pod_id" json:"podID"`
	NodeID   string `gorm:"column:node_id;index:idx_node_id" json:"nodeID"`
	NodeName string `gorm:"column:node_name" json:"nodeName"`
	Name     string `gorm:"column:resource_name;index:idx_resource_name" json:"resourceName"`
	Value    int64  `gorm:"column:resource_value" json:"resourceValue"`
}
    func NewResources ¶ added in v0.14.6
func NewResources(podID, nodeID, nodeName string, resources map[string]int64) []ResourceInfo
func (ResourceInfo) TableName ¶ added in v0.14.6
func (ResourceInfo) TableName() string
type ResourceInfoResponse ¶ added in v0.14.6
type ResourceInfoResponse struct {
	NodeName     string `gorm:"column:node_name" json:"nodeName"`
	ResourceName string `gorm:"column:resource_name;index:idx_resource_name;default:cpu;comment:resource name" json:"resourceName"`
	Value        int64  `gorm:"column:resource_value;default:0;comment:sum of resource value" json:"resourceValue"`
	CapacityJSON string `gorm:"column:capacity" json:"-"`
	ClusterName  string `gorm:"column:cluster_name" json:"clusterName"`
}
    type ResourceLimit ¶ added in v0.14.5
type TaskAllocateStatus ¶ added in v0.14.6
type TaskAllocateStatus int
const ( TaskCreating TaskAllocateStatus = iota TaskRunning TaskTerminating TaskDeleted )
 Click to show internal directories. 
   Click to hide internal directories.