Documentation ¶
Index ¶
- Constants
- type Containers
- type DockerEngineConfiguration
- type HatcheryConfiguration
- type HatcherySwarm
- func (h *HatcherySwarm) ApplyConfiguration(cfg interface{}) error
- func (h *HatcherySwarm) CanSpawn(ctx context.Context, model sdk.WorkerStarterWorkerModel, jobID string, ...) bool
- func (h *HatcherySwarm) CheckConfiguration(cfg interface{}) error
- func (h *HatcherySwarm) Configuration() service.HatcheryCommonConfiguration
- func (h *HatcherySwarm) Init(config interface{}) (cdsclient.ServiceConfig, error)
- func (h *HatcherySwarm) InitHatchery(ctx context.Context) error
- func (h *HatcherySwarm) InitWorkersMetrics(ctx context.Context) error
- func (*HatcherySwarm) ModelType() string
- func (h *HatcherySwarm) NeedRegistration(ctx context.Context, m *sdk.Model) bool
- func (h *HatcherySwarm) Serve(ctx context.Context) error
- func (h *HatcherySwarm) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, ...) error
- func (h *HatcherySwarm) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
- func (h *HatcherySwarm) SpawnWorkerService(ctx context.Context, dockerClient *dockerClient, ...) (string, error)
- func (h *HatcherySwarm) Start(ctx context.Context) error
- func (h *HatcherySwarm) StartWorkerMetricsRoutine(ctx context.Context, delay int64)
- func (h *HatcherySwarm) Status(ctx context.Context) *sdk.MonitoringStatus
- func (h *HatcherySwarm) WorkerModelSecretList(m sdk.Model) (sdk.WorkerModelSecrets, error)
- func (h *HatcherySwarm) WorkerModelsEnabled() ([]sdk.Model, error)
- func (h *HatcherySwarm) WorkersMetrics(ctx context.Context) ([]WorkerMetricsResource, error)
- func (h *HatcherySwarm) WorkersStarted(ctx context.Context) ([]string, error)
- type RegistryCredential
- type WorkerMetricsResource
Constants ¶
const ( TagNodeName string = "node_name" TagJobID string = "job_id" TagWorkerName string = "worker_name" TagResourceName string = "resource_name" )
const ( LabelHatchery = "hatchery" LabelWorkerName = "worker_name" LabelServiceName = "service_name" LabelWorkerRequirements = "worker_requirements" LabelWorkerModelPath = "worker_model_path" LabelJobID = "job_id" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Containers ¶
func (Containers) FilterWorkers ¶
func (c Containers) FilterWorkers() Containers
type DockerEngineConfiguration ¶
type DockerEngineConfiguration struct { Host string `mapstructure:"host" toml:"host" comment:"DOCKER_HOST" json:"host"` // DOCKER_HOST CertPath string `mapstructure:"certPath" toml:"certPath" comment:"DOCKER_CERT_PATH" json:"-"` // DOCKER_CERT_PATH InsecureSkipTLSVerify bool `` // !DOCKER_TLS_VERIFY /* 136-byte string literal not displayed */ TLSCAPEM string `mapstructure:"TLSCAPEM" toml:"TLSCAPEM" comment:"content of your ca.pem" json:"-"` TLSCERTPEM string `mapstructure:"TLSCERTPEM" toml:"TLSCERTPEM" comment:"content of your cert.pem" json:"-"` TLSKEYPEM string `mapstructure:"TLSKEYPEM" toml:"TLSKEYPEM" comment:"content of your key.pem" json:"-"` APIVersion string `mapstructure:"APIVersion" toml:"APIVersion" default:"1.41" comment:"DOCKER_API_VERSION" json:"APIVersion"` // DOCKER_API_VERSION MaxContainers int `` /* 159-byte string literal not displayed */ }
DockerEngineConfiguration is a configuration to be able to connect to a docker engine
type HatcheryConfiguration ¶
type HatcheryConfiguration struct { service.HatcheryCommonConfiguration `mapstructure:"commonConfiguration" toml:"commonConfiguration"` // MaxContainers MaxContainers int `` /* 159-byte string literal not displayed */ // DefaultMemory Worker default memory DefaultMemory int `` /* 141-byte string literal not displayed */ DisableMemorySwap bool `` /* 160-byte string literal not displayed */ // DockerOpts Docker options DockerOpts string `` /* 243-byte string literal not displayed */ // TODO refactor DockerOpts globally: issue #4594 DisableDockerOptsOnRequirements bool `` /* 158-byte string literal not displayed */ // NetworkEnableIPv6 if true: set ipv6 to true NetworkEnableIPv6 bool `` /* 203-byte string literal not displayed */ DockerEngines map[string]DockerEngineConfiguration `mapstructure:"dockerEngines" toml:"dockerEngines" comment:"List of Docker Engines" json:"dockerEngines,omitempty"` RegistryCredentials []RegistryCredential `` /* 133-byte string literal not displayed */ WorkerMetricsRefreshDelay int64 `` /* 179-byte string literal not displayed */ }
HatcheryConfiguration is the configuration for hatchery
type HatcherySwarm ¶
type HatcherySwarm struct { hatcheryCommon.Common Config HatcheryConfiguration // contains filtered or unexported fields }
HatcherySwarm is a hatchery which can be connected to a remote to a docker remote api
func (*HatcherySwarm) ApplyConfiguration ¶
func (h *HatcherySwarm) ApplyConfiguration(cfg interface{}) error
ApplyConfiguration apply an object of type HatcheryConfiguration after checking it
func (*HatcherySwarm) CanSpawn ¶
func (h *HatcherySwarm) CanSpawn(ctx context.Context, model sdk.WorkerStarterWorkerModel, jobID string, requirements []sdk.Requirement) bool
CanSpawn checks if the model can be spawned by this hatchery it checks on every docker engine is one of the docker has availability
func (*HatcherySwarm) CheckConfiguration ¶
func (h *HatcherySwarm) CheckConfiguration(cfg interface{}) error
CheckConfiguration checks the validity of the configuration object
func (*HatcherySwarm) Configuration ¶
func (h *HatcherySwarm) Configuration() service.HatcheryCommonConfiguration
Configuration returns Hatchery CommonConfiguration
func (*HatcherySwarm) Init ¶
func (h *HatcherySwarm) Init(config interface{}) (cdsclient.ServiceConfig, error)
Init initializes the swarm hatchery
func (*HatcherySwarm) InitHatchery ¶
func (h *HatcherySwarm) InitHatchery(ctx context.Context) error
InitHatchery connect the hatchery to the docker api
func (*HatcherySwarm) InitWorkersMetrics ¶ added in v0.53.0
func (h *HatcherySwarm) InitWorkersMetrics(ctx context.Context) error
func (*HatcherySwarm) ModelType ¶
func (*HatcherySwarm) ModelType() string
ModelType returns type of hatchery
func (*HatcherySwarm) NeedRegistration ¶
NeedRegistration return true if worker model need regsitration
func (*HatcherySwarm) Serve ¶
func (h *HatcherySwarm) Serve(ctx context.Context) error
Serve start the hatchery server
func (*HatcherySwarm) Signin ¶ added in v0.53.0
func (h *HatcherySwarm) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, srvConfig interface{}) error
func (*HatcherySwarm) SpawnWorker ¶
func (h *HatcherySwarm) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) error
SpawnWorker start a new docker container User can add option on prerequisite, as --port and --privileged but only hatchery NOT 'shared.infra' can launch containers with options
func (*HatcherySwarm) SpawnWorkerService ¶ added in v0.53.1
func (h *HatcherySwarm) SpawnWorkerService(ctx context.Context, dockerClient *dockerClient, spawnArgs hatchery.SpawnArguments, sName string, service sdk.V2JobService, network string) (string, error)
v2
func (*HatcherySwarm) Start ¶
func (h *HatcherySwarm) Start(ctx context.Context) error
Start inits client and routines for hatchery
func (*HatcherySwarm) StartWorkerMetricsRoutine ¶ added in v0.53.0
func (h *HatcherySwarm) StartWorkerMetricsRoutine(ctx context.Context, delay int64)
func (*HatcherySwarm) Status ¶
func (h *HatcherySwarm) Status(ctx context.Context) *sdk.MonitoringStatus
Status returns sdk.MonitoringStatus, implements interface service.Service
func (*HatcherySwarm) WorkerModelSecretList ¶
func (h *HatcherySwarm) WorkerModelSecretList(m sdk.Model) (sdk.WorkerModelSecrets, error)
WorkerModelSecretList returns secret for given model.
func (*HatcherySwarm) WorkerModelsEnabled ¶
func (h *HatcherySwarm) WorkerModelsEnabled() ([]sdk.Model, error)
WorkerModelsEnabled returns Worker model enabled
func (*HatcherySwarm) WorkersMetrics ¶ added in v0.53.0
func (h *HatcherySwarm) WorkersMetrics(ctx context.Context) ([]WorkerMetricsResource, error)
func (*HatcherySwarm) WorkersStarted ¶
func (h *HatcherySwarm) WorkersStarted(ctx context.Context) ([]string, error)
WorkersStarted returns the number of instances started but not necessarily register on CDS yet
type RegistryCredential ¶
type RegistryCredential struct { Domain string `mapstructure:"domain" default:"docker.io" commented:"true" toml:"domain" json:"-"` Username string `mapstructure:"username" commented:"true" toml:"username" json:"-"` Password string `mapstructure:"password" commented:"true" toml:"password" json:"-"` }