Documentation
¶
Overview ¶
Package docker implements driver
Index ¶
- type Config
- type Driver
- func (d *Driver) Allocate(def typesv2.LabelDefinition, metadata map[string]any) (*typesv2.ApplicationResource, error)
- func (d *Driver) AvailableCapacity(nodeUsage typesv2.Resources, req typesv2.LabelDefinition) int64
- func (d *Driver) Deallocate(res typesv2.ApplicationResource) error
- func (d *Driver) GetTask(name, options string) provider.DriverTask
- func (d *Driver) IsRemote() bool
- func (d *Driver) Name() string
- func (d *Driver) Prepare(config []byte) error
- func (d *Driver) SetName(name string)
- func (d *Driver) Status(res typesv2.ApplicationResource) (string, error)
- func (d *Driver) ValidateDefinition(def typesv2.LabelDefinition) error
- type Factory
- type Options
- type TaskImage
- type TaskSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DockerPath string `json:"docker_path"` // '/Applications/Docker.app/Contents/Resources/bin/docker'
IsRemote bool `json:"is_remote"` // In case the docker client does not use the local node resources
IgnoreNonControlled bool `json:"ignore_non_controlled"` // If you want to allow non-controlled docker containers to be running
ImagesPath string `json:"images_path"` // Where to look/store docker file images
WorkspacePath string `json:"workspace_path"` // Where to place the disks
// Alter allows you to control how much resources will be used:
// * Negative (<0) value will alter the total resource count before provisioning so you will be
// able to save some resources for the host system (recommended -2 for CPU and -10 for RAM
// for disk caching)
// * Positive (>0) value could also be available (but check it in your docker dist in advance)
// Please be careful here - noone wants the container to fail allocation because of that...
CPUAlter int32 `json:"cpu_alter"` // 0 do nothing, <0 reduces number available CPUs, >0 increases it (dangerous)
RAMAlter int32 `json:"ram_alter"` // 0 do nothing, <0 reduces amount of available RAM (GB), >0 increases it (dangerous)
// Overbook options allows tenants to reuse the resources
// It will be used only when overbook is allowed by the tenants. It works by just adding those
// amounts to the existing total before checking availability. For example if you have 16CPU
// and want to run 2 tenants with requirement of 14 CPUs each - you can put 12 in CPUOverbook -
// to have virtually 28 CPUs. 3rd will not be running because 2 tenants will eat all 28 virtual
// CPUs. Same applies to the RamOverbook.
CPUOverbook uint32 `json:"cpu_overbook"` // How much CPUs could be reused by multiple tenants
RAMOverbook uint32 `json:"ram_overbook"` // How much RAM (GB) could be reused by multiple tenants
DownloadUser string `json:"download_user"` // The user will be used in download operations
DownloadPassword string `json:"download_password"` // The password will be used in download operations
}
Config - node driver configuration
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements provider.Driver interface
func (*Driver) Allocate ¶
func (d *Driver) Allocate(def typesv2.LabelDefinition, metadata map[string]any) (*typesv2.ApplicationResource, error)
Allocate container out of the images
It automatically download the required images, unpack them and runs the container. Using metadata to create env file and pass it to the container.
func (*Driver) AvailableCapacity ¶
AvailableCapacity allows Fish to ask the driver about it's capacity (free slots) of a specific definition
func (*Driver) Deallocate ¶
func (d *Driver) Deallocate(res typesv2.ApplicationResource) error
Deallocate the resource
func (*Driver) GetTask ¶
func (d *Driver) GetTask(name, options string) provider.DriverTask
GetTask returns task struct by name
func (*Driver) IsRemote ¶
IsRemote needed to detect the out-of-node resources managed by this driver
func (*Driver) Status ¶
func (d *Driver) Status(res typesv2.ApplicationResource) (string, error)
Status shows status of the resource
func (*Driver) ValidateDefinition ¶
func (d *Driver) ValidateDefinition(def typesv2.LabelDefinition) error
ValidateDefinition checks LabelDefinition is ok
type Options ¶
type Options struct {
Images []provider.Image `json:"images"` // List of image dependencies, last one is running one
// TaskImage options
TaskImageName string `json:"task_image_name"` // Create new image with defined name and "image-DATE.TIME" version
}
Options for label definition
Example:
images:
- url: https://artifact-storage/aquarium/image/docker/ubuntu2004/ubuntu2004-VERSION.tar.xz
sum: sha256:1234567890abcdef1234567890abcdef1
- url: https://artifact-storage/aquarium/image/docker/ubuntu2004-python3/ubuntu2004-python3-VERSION.tar.xz
sum: sha256:1234567890abcdef1234567890abcdef2
- url: https://artifact-storage/aquarium/image/docker/ubuntu2004-python3-ci/ubuntu2004-python3-ci-VERSION.tar.xz
sum: sha256:1234567890abcdef1234567890abcdef3
type TaskImage ¶ added in v0.9.0
type TaskImage struct {
*typesv2.ApplicationTask `json:"-"` // Info about the requested task
*typesv2.LabelDefinition `json:"-"` // Info about the used label definition
*typesv2.ApplicationResource `json:"-"` // Info about the processed resource
Full bool `json:"full"` // Make full (all disks including connected disks), or just the root OS disk image
// contains filtered or unexported fields
}
TaskImage stores the task data
func (*TaskImage) Clone ¶ added in v0.9.0
func (t *TaskImage) Clone() provider.DriverTask
Clone makes a copy of the initial task to execute
func (*TaskImage) Execute ¶ added in v0.9.0
Execute - Image task could be executed during ALLOCATED & DEALLOCATE ApplicationStatus
func (*TaskImage) SetInfo ¶ added in v0.9.0
func (t *TaskImage) SetInfo(task *typesv2.ApplicationTask, def *typesv2.LabelDefinition, res *typesv2.ApplicationResource)
SetInfo defines information of the environment
type TaskSnapshot ¶ added in v0.9.0
type TaskSnapshot struct {
*typesv2.ApplicationTask `json:"-"` // Info about the requested task
*typesv2.LabelDefinition `json:"-"` // Info about the used label definition
*typesv2.ApplicationResource `json:"-"` // Info about the processed resource
Full bool `json:"full"` // Make full (all disks including OS image), or just the additional disks snapshot
// contains filtered or unexported fields
}
TaskSnapshot stores the task data
func (*TaskSnapshot) Clone ¶ added in v0.9.0
func (t *TaskSnapshot) Clone() provider.DriverTask
Clone makes a copy of the initial task to execute
func (*TaskSnapshot) Execute ¶ added in v0.9.0
func (t *TaskSnapshot) Execute() (result []byte, err error)
Execute - Snapshot task could be executed during ALLOCATED & DEALLOCATE ApplicationStatus
func (*TaskSnapshot) Name ¶ added in v0.9.0
func (*TaskSnapshot) Name() string
Name returns name of the task
func (*TaskSnapshot) SetInfo ¶ added in v0.9.0
func (t *TaskSnapshot) SetInfo(task *typesv2.ApplicationTask, def *typesv2.LabelDefinition, res *typesv2.ApplicationResource)
SetInfo defines information of the environment