service

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: AGPL-3.0, Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	HTTP     api.Config     `toml:"http"`
	Security SecurityConfig `toml:"security"`
}

func (APIConfig) IsValid

func (c APIConfig) IsValid() error

type Config

type Config struct {
	API    APIConfig
	Store  StoreConfig
	Jobs   JobsConfig
	Logger logger.Config
}

func (Config) IsValid

func (c Config) IsValid() error

func (*Config) ParseFromEnv added in v0.4.1

func (c *Config) ParseFromEnv() error

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type JobAPIType

type JobAPIType string
const (
	JobAPITypeDocker     JobAPIType = "docker"
	JobAPITypeKubernetes            = "kubernetes"
)

type JobService

type JobService interface {
	Init(cfg job.ServiceConfig) error
	CreateJob(cfg job.Config, onStopCb job.StopCb) (job.Job, error)
	DeleteJob(jobID string) error
	GetJobLogs(jobID string, stdout, stderr io.Writer) error
	Shutdown() error
}

func NewJobService

func NewJobService(cfg JobsConfig, log mlog.LoggerIFace) (JobService, error)

type JobsConfig

type JobsConfig struct {
	APIType                 JobAPIType                  `toml:"api_type"`
	MaxConcurrentJobs       int                         `toml:"max_concurrent_jobs"`
	FailedJobsRetentionTime RetentionTime               `toml:"failed_jobs_retention_time" ignored:"true"`
	ImageRegistry           string                      `toml:"image_registry"`
	Kubernetes              kubernetes.JobServiceConfig `toml:"kubernetes"`
	Docker                  docker.JobServiceConfig     `toml:"docker"`
}

func (JobsConfig) IsValid

func (c JobsConfig) IsValid() error

type RetentionTime added in v0.6.0

type RetentionTime time.Duration

Alias is needed to implement custom unmarshaler.

func (*RetentionTime) UnmarshalText added in v0.6.0

func (rt *RetentionTime) UnmarshalText(data []byte) error

type SecurityConfig

type SecurityConfig struct {
	// Whether or not to enable admin API access.
	EnableAdmin bool `toml:"enable_admin"`
	// The secret key used to authenticate admin requests.
	AdminSecretKey string `toml:"admin_secret_key"`
	// Whether or not to allow clients to self-register.
	AllowSelfRegistration bool                    `toml:"allow_self_registration"`
	SessionCache          auth.SessionCacheConfig `toml:"session_cache"`
}

func (SecurityConfig) IsValid

func (c SecurityConfig) IsValid() error

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (*Service, error)

func (*Service) DeleteJob

func (s *Service) DeleteJob(jobID string) error

func (*Service) GetJob

func (s *Service) GetJob(jobID string) (job.Job, error)

func (*Service) SaveJob

func (s *Service) SaveJob(job job.Job) error

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

type StoreConfig

type StoreConfig struct {
	DataSource string `toml:"data_source"`
}

func (StoreConfig) IsValid

func (c StoreConfig) IsValid() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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