native

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SuPath      string `json:"su_path"`      // Path to the su (login as user) binary
	SudoPath    string `json:"sudo_path"`    // Path to the sudo (privilege escalation) binary
	ShPath      string `json:"sh_path"`      // Path to the sh (simple user shell) binary
	TarPath     string `json:"tar_path"`     // Path to the tar (unpacking images) binary
	MountPath   string `json:"mount_path"`   // Path to the mount (list of mounted volumes) binary
	ChownPath   string `json:"chown_path"`   // Path to the chown (change file/dir ownership) binary
	ChmodPath   string `json:"chmod_path"`   // Path to the chmod (change file/dir access) binary
	KillallPath string `json:"killall_path"` // Path to the killall (send signals to multiple processes) binary
	RmPath      string `json:"rm_path"`      // Path to the rm (cleanup after execution) binary

	ImagesPath    string `json:"images_path"`    // Where to store/look the environment images
	WorkspacePath string `json:"workspace_path"` // Where to place the env disks

	DsclPath          string `json:"dscl_path"`          // Path to the dscl (macos user control) binary
	HdiutilPath       string `json:"hdiutil_path"`       // Path to the hdiutil (macos images create/mount/umount) binary
	MdutilPath        string `json:"mdutil_path"`        // Path to the mdutil (macos disable indexing for disks) binary
	CreatehomedirPath string `json:"createhomedir_path"` // Path to the createhomedir (macos create/prefill user directory) binary

	// 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) is also available, but you're going to put more load on the scheduler
	//   Please be careful here - noone wants the workload to fail allocation because of that...
	CpuAlter int `json:"cpu_alter"` // 0 do nothing, <0 reduces number available CPUs, >0 increases it (dangerous)
	RamAlter int `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 uint `json:"cpu_overbook"` // How much CPUs could be reused by multiple tenants
	RamOverbook uint `json:"ram_overbook"` // How much RAM (GB) could be reused by multiple tenants

	DownloadUser     string `json:"download_user"`     // The user will be used to auth in download operations
	DownloadPassword string `json:"download_password"` // The password will be used to auth in download operations
}

func (*Config) Apply

func (c *Config) Apply(config []byte) (err error)

func (*Config) Validate

func (c *Config) Validate() (err error)

type Driver

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

Implements drivers.ResourceDriver interface

func (*Driver) Allocate

func (d *Driver) Allocate(def types.LabelDefinition, metadata map[string]any) (*types.Resource, error)

*

  • Allocate workload environment with the provided images *
  • It automatically download the required images, unpack them and runs the workload.
  • Using metadata to pass the env to the entry point of the image.

func (*Driver) AvailableCapacity

func (d *Driver) AvailableCapacity(node_usage types.Resources, req types.LabelDefinition) int64

Allow Fish to ask the driver about it's capacity (free slots) of a specific definition

func (*Driver) Deallocate

func (d *Driver) Deallocate(res *types.Resource) error

func (*Driver) GetTask

func (d *Driver) GetTask(name, options string) drivers.ResourceDriverTask

func (*Driver) IsRemote

func (d *Driver) IsRemote() bool

func (*Driver) Name

func (d *Driver) Name() string

func (*Driver) Prepare

func (d *Driver) Prepare(config []byte) error

func (*Driver) Status

func (d *Driver) Status(res *types.Resource) (string, error)

func (*Driver) ValidateDefinition

func (d *Driver) ValidateDefinition(def types.LabelDefinition) error

type EnvData

type EnvData struct {
	Disks map[string]string // Map with disk_name = mount_path
}

Is used to provide some data to the entry/metadata values which could contain templates

type Options

type Options struct {
	Images []drivers.Image `json:"images"` // Optional list of image dependencies, they will be unpacked in order
	//TODO: Setup  string          `json:"setup"`  // Optional path to the executable, it will be started before the Entry with escalated priveleges
	Entry  string   `json:"entry"`  // Optional path to the executable, it will be running as workload (default: init.sh / init.ps1)
	Groups []string `json:"groups"` // Optional user groups user should have, first one is primary (default: staff)
}

*

func (*Options) Apply

func (o *Options) Apply(options util.UnparsedJson) error

func (*Options) Validate

func (o *Options) Validate() error

Note: there is no mandatory options, because in theory the native env could be pre-created

Jump to

Keyboard shortcuts

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