cli

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelNamespace = "chadburn"
)

Variables

View Source
var ErrNoContainerWithChadburnEnabled = errors.New("Couldn't find containers with label 'chadburn.enabled=true'")

Functions

This section is empty.

Types

type Config

type Config struct {
	Global struct {
		middlewares.SlackConfig  `mapstructure:",squash"`
		middlewares.SaveConfig   `mapstructure:",squash"`
		middlewares.MailConfig   `mapstructure:",squash"`
		middlewares.GotifyConfig `mapstructure:",squash"`
	}
	ExecJobs      map[string]*ExecJobConfig      `gcfg:"job-exec" mapstructure:"job-exec,squash"`
	RunJobs       map[string]*RunJobConfig       `gcfg:"job-run" mapstructure:"job-run,squash"`
	ServiceJobs   map[string]*RunServiceConfig   `gcfg:"job-service-run" mapstructure:"job-service-run,squash"`
	LocalJobs     map[string]*LocalJobConfig     `gcfg:"job-local" mapstructure:"job-local,squash"`
	LifecycleJobs map[string]*LifecycleJobConfig `gcfg:"job-lifecycle" mapstructure:"job-lifecycle,squash"`
	// contains filtered or unexported fields
}

Config contains the configuration

func BuildFromFile

func BuildFromFile(filename string, logger core.Logger) (*Config, error)

BuildFromFile builds a scheduler using the config from a file

func BuildFromString

func BuildFromString(config string, logger core.Logger) (*Config, error)

BuildFromString builds a scheduler using the config from a string

func NewConfig

func NewConfig(logger core.Logger) *Config

func (*Config) InitializeApp

func (c *Config) InitializeApp(dd bool) error

Call this only once at app init

type DaemonCommand

type DaemonCommand struct {
	ConfigFile    string `long:"config" description:"configuration file" default:"/etc/chadburn.conf"`
	Metrics       bool   `long:"metrics" description:"Enable Prometheus compatible metrics endpoint"`
	MetricsAddr   string `long:"listen-address" description:"Metrics endpoint listen address." default:":8080"`
	DisableDocker bool   `long:"disable-docker" description:"Disable docker integration. All job kinds except 'job-local' will be ignored"`

	Logger core.Logger
	// contains filtered or unexported fields
}

DaemonCommand daemon process

func (*DaemonCommand) Execute

func (c *DaemonCommand) Execute(args []string) error

Execute runs the daemon

type DockerHandler

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

func NewDockerHandler

func NewDockerHandler(notifier dockerLabelsUpdate, logger core.Logger) (*DockerHandler, error)

func (*DockerHandler) GetDockerLabels

func (c *DockerHandler) GetDockerLabels() (map[string]map[string]string, error)

func (*DockerHandler) GetInternalDockerClient

func (c *DockerHandler) GetInternalDockerClient() core.DockerClient

GetInternalDockerClient returns the internal Docker client

func (*DockerHandler) GetLifecycleJobs added in v1.6.0

func (c *DockerHandler) GetLifecycleJobs() map[string]*LifecycleJobConfig

GetLifecycleJobs returns the lifecycle jobs

func (*DockerHandler) SetLifecycleJobs added in v1.6.0

func (c *DockerHandler) SetLifecycleJobs(jobs map[string]*LifecycleJobConfig)

SetLifecycleJobs sets the lifecycle jobs

type ExecJobConfig

type ExecJobConfig struct {
	core.ExecJob              `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	middlewares.GotifyConfig  `mapstructure:",squash"`
	FromDockerLabel           bool `mapstructure:"fromDockerLabel"`
}

ExecJobConfig contains all configuration params needed to build a ExecJob

type LifecycleJobConfig added in v1.6.0

type LifecycleJobConfig struct {
	core.LifecycleJob         `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	middlewares.GotifyConfig  `mapstructure:",squash"`
	FromDockerLabel           bool `mapstructure:"fromDockerLabel" default:"false"`
}

LifecycleJobConfig contains all configuration params needed to build a LifecycleJob

type LocalJobConfig

type LocalJobConfig struct {
	core.LocalJob             `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	middlewares.GotifyConfig  `mapstructure:",squash"`
	FromDockerLabel           bool `mapstructure:"fromDockerLabel" default:"false"`
}

LocalJobConfig contains all configuration params needed to build a RunJob

type OfficialDockerHandler added in v1.7.0

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

OfficialDockerHandler is a Docker handler that uses the official Docker client

func NewOfficialDockerHandler added in v1.7.0

func NewOfficialDockerHandler(notifier dockerLabelsUpdate, logger core.Logger) (*OfficialDockerHandler, error)

NewOfficialDockerHandler creates a new Docker handler using the official Docker client

func (*OfficialDockerHandler) Close added in v1.7.0

func (c *OfficialDockerHandler) Close() error

Close closes the Docker client

func (*OfficialDockerHandler) GetDockerLabels added in v1.7.0

func (c *OfficialDockerHandler) GetDockerLabels() (map[string]map[string]string, error)

GetDockerLabels gets Docker labels from containers

func (*OfficialDockerHandler) GetLifecycleJobs added in v1.7.0

func (c *OfficialDockerHandler) GetLifecycleJobs() map[string]*LifecycleJobConfig

GetLifecycleJobs returns the lifecycle jobs

func (*OfficialDockerHandler) SetLifecycleJobs added in v1.7.0

func (c *OfficialDockerHandler) SetLifecycleJobs(jobs map[string]*LifecycleJobConfig)

SetLifecycleJobs sets the lifecycle jobs

type RunJobConfig

type RunJobConfig struct {
	core.RunJob               `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	middlewares.GotifyConfig  `mapstructure:",squash"`

	// Added for backward compatibility with tests
	Pull string `default:"true"`
}

type RunServiceConfig

type RunServiceConfig struct {
	core.RunServiceJob        `mapstructure:",squash"`
	middlewares.OverlapConfig `mapstructure:",squash"`
	middlewares.SlackConfig   `mapstructure:",squash"`
	middlewares.SaveConfig    `mapstructure:",squash"`
	middlewares.MailConfig    `mapstructure:",squash"`
	middlewares.GotifyConfig  `mapstructure:",squash"`
}

RunServiceConfig contains all configuration params needed to build a RunJob

type ValidateCommand

type ValidateCommand struct {
	ConfigFile string `long:"config" description:"configuration file" default:"/etc/chadburn.conf"`
	Logger     core.Logger
}

ValidateCommand validates the config file

func (*ValidateCommand) Execute

func (c *ValidateCommand) Execute(args []string) error

Execute runs the validation command

Jump to

Keyboard shortcuts

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