swarm

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 43 Imported by: 5

Documentation

Index

Constants

View Source
const (
	TagNodeName     string = "node_name"
	TagJobID        string = "job_id"
	TagWorkerName   string = "worker_name"
	TagResourceName string = "resource_name"
)
View Source
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

type Containers []types.Container

func (Containers) FilterWorkers

func (c Containers) FilterWorkers() Containers

func (Containers) GetByID

func (c Containers) GetByID(id string) *types.Container

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 New

func New() *HatcherySwarm

New instanciates a new Hatchery Swarm

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

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

func (h *HatcherySwarm) NeedRegistration(ctx context.Context, m *sdk.Model) bool

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

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:"-"`
}

type WorkerMetricsResource added in v0.53.0

type WorkerMetricsResource struct {
	WorkerName    string
	JobID         int64
	Node          string
	Name          string
	CPU           float64
	CPURequest    float64
	Memory        int64
	MemoryRequest int64
}

Jump to

Keyboard shortcuts

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