Documentation ¶
Index ¶
- Constants
- Variables
- func AddBaseImages(m *BaseImages) (err error)
- func AddImageMeta(m *ImageMeta) (id int64, err error)
- func AddJobLog(m *JobLog) (err error)
- func AddKickStart(m *KickStart) (err error)
- func Authorize() gin.HandlerFunc
- func CheckAuthorization(tokenString string) (userInfo map[string]interface{}, err error)
- func CheckPodStatus(ns, jobname string) (result map[string]interface{}, job *batchv1.Job, err error)
- func CreateRedisJobName(jobname string) string
- func CreateTables() (err error)
- func DeleteBaseImagesById(userid, id int) (deleteNum int, err error)
- func DeleteImageMeta(id int) (err error)
- func DeleteJobLogById(jobName string) (err error)
- func DeleteKickStartById(userid int, id int) (deleteNum int, err error)
- func DeleteMultiJobLogs(names string) (err error)
- func DeleteMultiKickStarts(names string) (err error)
- func GetAllImageMeta(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetAllJobLog(query map[string]string, fields []string, sortby []string, order []string, ...) (ml []interface{}, err error)
- func GetClientSet() *kubernetes.Clientset
- func GetImagesAndKickStart(userid int) (result map[string]interface{}, err error)
- func GetJwtString(expire int, id, name, provider string) (string, error)
- func GetK8sConfig() *rest.Config
- func GetUserInfoByToekn(token string) error
- func InitAuthing(userpoolid, secret string)
- func InitCustomPkgs() error
- func InitK8sClient() (err error)
- func IsUtf8(data []byte) bool
- func MakeConfigMap(release string, customRpms []string) (cm *v1.ConfigMap)
- func MakeJob(cm *v1.ConfigMap, buildtype, release string) (job *batchv1.Job, outputName string, err error)
- func ParseAuthingUserInput(userinput *CreateUserInput) *model.CreateUserRequest
- func PersistenceJob(m *JobLog) (err error)
- func StartWebSocket()
- func SyncJobStatus()
- func UpdateBaseImages(m *BaseImages) (err error)
- func UpdateBaseImagesStatus(m *BaseImages) (err error)
- func UpdateImageMetaById(m *ImageMeta) (err error)
- func UpdateJobLogStatusById(jobname, newStatus string) (err error)
- func UpdateJobStatus(m *ImageMeta) (err error)
- func UpdateKickStart(m *KickStart) (err error)
- type AuthingJWKS
- type AuthingKey
- type BaseImageConfig
- type BaseImages
- type BaseImagesKickStart
- type BuildParam
- type CreateUserInput
- type CustomPkg
- type CustomSigs
- type ImageInputData
- type ImageMeta
- type JobLog
- type JobStatuItem
- type KickStart
- type PkgItem
- type SummaryStatus
Constants ¶
const ( ImageStatusStart string = "created" ImageStatusDownloading string = "downloading" ImageStatusDone string = "succeed" ImageStatusFailed string = "failed" )
const ( BuildImageFromRelease string = "buildimagefromrelease" BuildImageFromISO string = "buildimagefromiso" )
const ( //job status JOB_STATUS_RUNNING = "running" JOB_STATUS_SUCCEED = "succeed" JOB_STATUS_FAILED = "failed" JOB_STATUS_CREATED = "created" JOB_STATUS_STOPPED = "stopped" JOB_BUILD_STATUS_SUCCEED = "JobSucceed" JOB_BUILD_STATUS_FAILED = "JobFailed" JOB_BUILD_STATUS_CREATED = "JobCreated" JOB_BUILD_STATUS_STOPPED = "JobStopped" JOB_BUILD_STATUS_RUNNING = "JobRunning" )
const (
JwtString = "omni-manager@98524"
)
Variables ¶
var AppClient *model.Application
var AuthingClient *management.Client
var UserClient *authentication.Client
Functions ¶
func AddBaseImages ¶
func AddBaseImages(m *BaseImages) (err error)
AddBaseImages insert a new BaseImages into database and returns last inserted Id on success.
func AddImageMeta ¶
AddImageMeta insert a new ImageMeta into database and returns last inserted Id on success.
func AddJobLog ¶
AddJobLog insert a new ImageMeta into database and returns last inserted Id on success.
func AddKickStart ¶
AddKickStart insert a new ImageMeta into database and returns last inserted Id on success.
func Authorize ¶
func Authorize() gin.HandlerFunc
func CheckAuthorization ¶
check user token status
func CheckPodStatus ¶
func CreateRedisJobName ¶
func DeleteBaseImagesById ¶
DeleteBaseImagesById
func DeleteImageMeta ¶
DeleteImageMeta deletes ImageMeta by Id and returns error if the record to be deleted doesn't exist
func DeleteKickStartById ¶
DeleteKickStartById
func DeleteMultiKickStarts ¶
DeleteMultiKickStarts
func GetAllImageMeta ¶
func GetAllImageMeta(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllImageMeta retrieves all ImageMeta matches certain condition. Returns empty list if no records exist
func GetAllJobLog ¶
func GetAllJobLog(query map[string]string, fields []string, sortby []string, order []string, offset int64, limit int64) (ml []interface{}, err error)
GetAllJobLog retrieves all ImageMeta matches certain condition. Returns empty list if no records exist
func GetClientSet ¶
func GetClientSet() *kubernetes.Clientset
func GetImagesAndKickStart ¶
func GetJwtString ¶
GetJwtString GetJwtString
func GetK8sConfig ¶
func GetUserInfoByToekn ¶
func InitAuthing ¶
func InitAuthing(userpoolid, secret string)
func InitK8sClient ¶
func InitK8sClient() (err error)
func MakeConfigMap ¶
make ConfigMap
func MakeJob ¶
func MakeJob(cm *v1.ConfigMap, buildtype, release string) (job *batchv1.Job, outputName string, err error)
make job yaml and start job
func ParseAuthingUserInput ¶
func ParseAuthingUserInput(userinput *CreateUserInput) *model.CreateUserRequest
func PersistenceJob ¶
Persistence a Job_log from redis to db
func StartWebSocket ¶
func StartWebSocket()
func SyncJobStatus ¶
func SyncJobStatus()
func UpdateBaseImagesStatus ¶
func UpdateBaseImagesStatus(m *BaseImages) (err error)
UpdateBaseImagesStatus
func UpdateImageMetaById ¶
UpdateImageMeta updates ImageMeta by Id and returns error if the record to be updated doesn't exist
func UpdateJobLogStatusById ¶
UpdateJobLogStatusById
Types ¶
type AuthingKey ¶
type BaseImageConfig ¶
type BaseImages ¶
type BaseImages struct { ID int ` description:"id" gorm:"primaryKey"` Name string ` description:"name"` ExtName string ` description:"ext name"` Desc string ` description:"desc"` Checksum string ` description:"checksum"` Url string ` description:"url" gorm:"-"` Arch string ` description:"arch"` Status string ` description:"status"` UserId int ` description:"user id"` CreateTime time.Time ` description:"create time"` }
func GetBaseImagesByID ¶
func GetBaseImagesByID(id int) (v *BaseImages, err error)
func GetMyBaseImages ¶
GetMyBaseImages
func (*BaseImages) TableName ¶
func (t *BaseImages) TableName() string
type BaseImagesKickStart ¶
type BaseImagesKickStart struct { Label string ` description:"name"` Desc string ` description:"desc"` BaseImageID string ` description:"BaseImages ID"` KickStartID string ` description:"KickStart ID"` KickStartContent string ` description:"KickStart Content"` KickStartName string ` description:"KickStart name"` }
type BuildParam ¶
type BuildParam struct { // Id int `gorm:"primaryKey"` Arch string ` description:"architecture"` Release string ` description:"release openEuler Version"` BuildType string ` description:"iso , zip ...."` CustomPkg []string ` description:"custom"` Label string ` description:"name"` Desc string ` description:"description"` }
post this body to backend
type CreateUserInput ¶
type CreateUserInput struct { Username *string `json:"username,omitempty"` Email *string `json:"email,omitempty"` EmailVerified *bool `json:"emailVerified,omitempty"` Phone *string `json:"phone,omitempty"` PhoneVerified *bool `json:"phoneVerified,omitempty"` Unionid *string `json:"unionid,omitempty"` Openid *string `json:"openid,omitempty"` Nickname *string `json:"nickname,omitempty"` Photo *string `json:"photo,omitempty"` Password *string `json:"password,omitempty"` RegisterSource []string `json:"registerSource,omitempty"` Browser *string `json:"browser,omitempty"` Oauth *string `json:"oauth,omitempty"` LoginsCount *int64 `json:"loginsCount,omitempty"` LastLogin *string `json:"lastLogin,omitempty"` Company *string `json:"company,omitempty"` LastIP *string `json:"lastIP,omitempty"` SignedUp *string `json:"signedUp,omitempty"` Blocked *bool `json:"blocked,omitempty"` IsDeleted *bool `json:"isDeleted,omitempty"` Device *string `json:"device,omitempty"` Name *string `json:"name,omitempty"` GivenName *string `json:"givenName,omitempty"` FamilyName *string `json:"familyName,omitempty"` MiddleName *string `json:"middleName,omitempty"` Profile *string `json:"profile,omitempty"` PreferredUsername *string `json:"preferredUsername,omitempty"` Website *string `json:"website,omitempty"` Gender *string `json:"gender,omitempty"` Birthdate *string `json:"birthdate,omitempty"` Zoneinfo *string `json:"zoneinfo,omitempty"` Locale *string `json:"locale,omitempty"` Address *string `json:"address,omitempty"` Formatted *string `json:"formatted,omitempty"` StreetAddress *string `json:"streetAddress,omitempty"` Locality *string `json:"locality,omitempty"` Region *string `json:"region,omitempty"` PostalCode *string `json:"postalCode,omitempty"` Country *string `json:"country,omitempty"` ExternalId *string `json:"externalId,omitempty"` }
type ImageInputData ¶
type ImageInputData struct { Id int `gorm:"primaryKey"` Packages string ` description:"architecture"` Version string ` description:"release openEuler Version"` BuildType string ` description:"iso , zip ...."` // BasePkg []pkgData ` description:"default package"` CustomPkg []string ` description:"custom"` }
post this body to backend
type ImageMeta ¶
type ImageMeta struct { Id int `gorm:"primaryKey"` Packages string ` description:"architecture"` Version string ` description:"release openEuler Version"` BuildType string ` description:"iso , zip ...."` BasePkg string ` description:"default package"` CustomPkg string ` description:"custom"` UserId int ` description:"user id"` UserName string ` description:"user name"` CreateTime time.Time ` description:"create time"` Status string ` description:"current status :running ,success, failed"` JobName string ` description:"pod name"` }
func GetImageMetaById ¶
GetImageMetaById retrieves ImageMeta by Id. Returns error if Id doesn't exist
type JobLog ¶
type JobLog struct { JobName string ` description:"pod name" gorm:"primaryKey"` Arch string ` description:"architecture"` Release string ` description:"release openEuler Version"` BuildType string ` description:"iso , zip ...."` BasePkg string ` gorm:"size:5055" description:"default package"` CustomPkg string ` gorm:"size:5055" description:"custom"` UserId int ` description:"user id" gorm:"index:"` UserName string ` description:"user name"` CreateTime time.Time ` description:"create time"` Status string ` description:"current status :running ,success, failed" gorm:"index"` DownloadUrl string ` description:"download the result of build iso file"` ConfigMapName string ` description:"configMap name"` JobLabel string ` description:"job label"` JobDesc string ` description:"job description"` StartTime time.Time ` description:"create time"` EndTime time.Time ` description:"create time"` JobType string ` description:"job type"` KickStartID string ` description:"KickStart id" ` BaseImageID string ` description:"BaseImage id" ` KickStartContent string ` description:"kick_start_content" ` }
func GetJobLogByJobName ¶
type JobStatuItem ¶
type KickStart ¶
type KickStart struct { ID int ` description:"id" gorm:"primaryKey"` Name string ` description:"name"` Desc string ` description:"desc"` Content string ` description:"content"` UserId int ` description:"user id"` CreateTime time.Time ` description:"create time"` UpdateTime time.Time ` description:"update time"` }
func GetKickStartByID ¶
func GetMyKickStart ¶
GetMyKickStart
type SummaryStatus ¶
type SummaryStatus struct { Succeed int `json:"succeed"` Running int `json:"running"` Failed int `json:"failed"` Created int `json:"created"` Stopped int `json:"stopped"` }
func CountSummaryStatus ¶
func CountSummaryStatus(userid int) (result *SummaryStatus, err error)
CountSummaryStatus