cronjob

package
v0.0.0-...-7c3836c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

*

  • Created by GoLand.
  • Email: xzghua@gmail.com
  • Date: 2019-07-09
  • Time: 14:59

*

  • Created by GoLand.
  • Email: xzghua@gmail.com
  • Date: 2019-07-09
  • Time: 15:01

*

  • Created by GoLand.
  • Email: xzghua@gmail.com
  • Date: 2019-07-09
  • Time: 15:01

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCronJobNameExists         = errors.New("定时任务名已存在")
	ErrCreateCronJobFailed       = errors.New("创建定时任务失败")
	ErrGetTempByKindFailed       = errors.New("获取CronJob yaml模板失败")
	ErrCreateCronYamlFailed      = errors.New("创建CronJob yaml模板失败")
	ErrCronJobInfoFailed         = errors.New("从K8S获取定时任务信息失败")
	ErrStrconvFailed             = errors.New("格式转换失败")
	ErrIfIsInGroupFailed         = errors.New("判断是否在组里查询失败")
	ErrUserIsNotInGroup          = errors.New("用户不在该组里")
	ErrCronJobCountFailed        = errors.New("定时任务总数获取失败")
	ErrCronJobListFailed         = errors.New("定时任务列表数据获取失败")
	ErrGetCronJobFromK8sFailed   = errors.New("从k8s拉取定时任务信息失败")
	ErrCronJobNotExists          = errors.New("定时任务不存在")
	ErrDelCronJobFailed          = errors.New("删除定时任务失败")
	ErrK8sDelCronJobFailed       = errors.New("从k8s删除job失败")
	ErrConfigMapDelFailed        = errors.New("从configMap删除数据失败")
	ErrCronJobUpdateFailed       = errors.New("定时任务数据库更新失败")
	ErrBuildJenkinsJob           = errors.New("Jenkins Build Job错误:")
	ErrCronJobClientCreateFailed = errors.New("cronjob client 创建失败")
	ErrBuildQueuePublish         = errors.New("构建入列出错了,请联系管理员")
	ErrCreateConfMapFailed       = errors.New("创建config map 失败")
	ErrConfMapYamlFailed         = errors.New("更新远程configMapYaml")
	ErrGetTemplateFailed         = errors.New("获取模板信息错误")
	ErrFileBeatYamlFailed        = errors.New("FileBeatYaml 错误")
	ErrGetConfigDataFailed       = errors.New("获取configData信息错误")
	ErrCreateConfMapDataFailed   = errors.New("创建configData信息失败")
	ErrUpdateConfMapDataFailed   = errors.New("更新configData信息失败")
	ErrExchangeCronJobTemp       = errors.New("转换模板 失败")
	ErrJenkinsCreateJob          = errors.New("jenkins创建job失败")
	ErrJenkinsBuildFailed        = errors.New("jenkins构建失败")
)

Functions

func ExchangeCronJobTemp

func ExchangeCronJobTemp(name, namespace string,
	k8sClient kubernetes.K8sClient,
	confClient *config.Config,
	repository repository.Repository) (cronjobInfo *v1beta1.CronJob, err error)

func MakeHandler

func MakeHandler(svc Service, logger log.Logger, repository repository.Repository) http.Handler

Types

type DetailReturnData

type DetailReturnData struct {
	Name          string                   `json:"name"`
	Namespace     string                   `json:"namespace"`
	Schedule      string                   `json:"schedule"`
	GitType       string                   `json:"git_type"`
	GitPath       string                   `json:"git_path"`
	Image         string                   `json:"image"`
	Suspend       bool                     `json:"suspend"`
	Active        int64                    `json:"active"`
	LastSchedule  null.Time                `json:"last_schedule"`
	ConfMapName   string                   `json:"conf_map_name"`
	Args          []interface{}            `json:"args"`
	Command       string                   `json:"Command"`
	LogPath       string                   `json:"log_path"`
	AddType       string                   `json:"add_type"`
	CronjobInfo   map[string]interface{}   `json:"cronjob_info"`
	CronjobPods   []map[string]interface{} `json:"cronjob_pods"`
	CronjobEvents []map[string]interface{} `json:"cronjob_events"`
	CronjobYaml   *v1beta1.CronJob         `json:"cronjob_yaml"`
}

type JenkinsCronjobData

type JenkinsCronjobData struct {
	Name      string
	Namespace string
	BuildId   int64
	BuildTime time.Time
}

type Param

type Param struct {
	Username  string
	UserToken string
	GitAddr   string
	GitToken  string
	GitType   string
	Branch    string
}

type Service

type Service interface {
	// 添加定时任务
	AddCronJob(ctx context.Context, acj addCronJob) error

	// 定时任务列表
	List(ctx context.Context, name string, ns string, group string, page int, limit int) (map[string]interface{}, error)

	// 定时任务详情
	Detail(ctx context.Context, name string, ns string) (res *DetailReturnData, err error)

	// 定时任务修改
	Put(ctx context.Context, name string, acj addCronJob) error

	// 删除定时任务
	Delete(ctx context.Context, name string, ns string) error

	// 删除所有
	DeleteJobAll(ctx context.Context, ns string) error

	// 定时任务处理队列
	CronJobQueuePop(ctx context.Context, data string) error

	// 更新日志
	UpdateLog(ctx context.Context, req cronJobLogUpdate) error
}

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

func NewService

func NewService(logger log.Logger, config *config.Config,
	jenkins jenkins.Jenkins,
	k8sClient kubernetes.K8sClient,
	amqpClient amqpClient.AmqpClient,
	repository repository.Repository) Service

Jump to

Keyboard shortcuts

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