Documentation
¶
Index ¶
- Constants
- type EngineConfig
- func (e *EngineConfig) GetAddCaps() string
- func (e *EngineConfig) GetAllowSUID() bool
- func (e *EngineConfig) GetBindPath() []string
- func (e *EngineConfig) GetBootInstance() bool
- func (e *EngineConfig) GetCommand() string
- func (e *EngineConfig) GetContain() bool
- func (e *EngineConfig) GetDropCaps() string
- func (e *EngineConfig) GetHome() string
- func (e *EngineConfig) GetHomeDir() string
- func (e *EngineConfig) GetHostname() string
- func (e *EngineConfig) GetImage() string
- func (e *EngineConfig) GetInstance() bool
- func (e *EngineConfig) GetKeepPrivs() bool
- func (e *EngineConfig) GetNoHome() bool
- func (e *EngineConfig) GetNoPrivs() bool
- func (e *EngineConfig) GetNv() bool
- func (e *EngineConfig) GetOverlayFsEnabled() bool
- func (e *EngineConfig) GetOverlayImage() []string
- func (e *EngineConfig) GetScratchDir() []string
- func (e *EngineConfig) GetShell() string
- func (e *EngineConfig) GetTmpDir() string
- func (e *EngineConfig) GetWorkdir() string
- func (e *EngineConfig) GetWritableImage() bool
- func (e *EngineConfig) MarshalJSON() ([]byte, error)
- func (e *EngineConfig) SetAddCaps(caps string)
- func (e *EngineConfig) SetAllowSUID(allow bool)
- func (e *EngineConfig) SetBindPath(bindpath []string)
- func (e *EngineConfig) SetBootInstance(boot bool)
- func (e *EngineConfig) SetCommand(command string)
- func (e *EngineConfig) SetContain(contain bool)
- func (e *EngineConfig) SetDropCaps(caps string)
- func (e *EngineConfig) SetHome(home string)
- func (e *EngineConfig) SetHomeDir(name string)
- func (e *EngineConfig) SetHostname(hostname string)
- func (e *EngineConfig) SetImage(name string)
- func (e *EngineConfig) SetInstance(instance bool)
- func (e *EngineConfig) SetKeepPrivs(keep bool)
- func (e *EngineConfig) SetNoHome(val bool)
- func (e *EngineConfig) SetNoPrivs(nopriv bool)
- func (e *EngineConfig) SetNv(nv bool)
- func (e *EngineConfig) SetOverlayFsEnabled(enabled bool)
- func (e *EngineConfig) SetOverlayImage(paths []string)
- func (e *EngineConfig) SetScratchDir(scratchdir []string)
- func (e *EngineConfig) SetShell(shell string)
- func (e *EngineConfig) SetTmpDir(name string)
- func (e *EngineConfig) SetWorkdir(name string)
- func (e *EngineConfig) SetWritableImage(writable bool)
- func (e *EngineConfig) UnmarshalJSON(b []byte) error
- type EngineOperations
- func (engine *EngineOperations) CleanupContainer() error
- func (e *EngineOperations) Config() config.EngineConfig
- func (engine *EngineOperations) CreateContainer(pid int, rpcConn net.Conn) error
- func (e *EngineOperations) InitConfig(cfg *config.Common)
- func (engine *EngineOperations) MonitorContainer(pid int) (syscall.WaitStatus, error)
- func (e *EngineOperations) PrepareConfig(masterConn net.Conn, wrapperConfig *wrapper.Config) error
- func (engine *EngineOperations) StartProcess(masterConn net.Conn) error
- type FileConfig
- type JSONConfig
Constants ¶
const Name = "singularity"
Name is the name of the runtime.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EngineConfig ¶
type EngineConfig struct {
JSON *JSONConfig `json:"jsonConfig"`
File *FileConfig `json:"-"`
}
EngineConfig stores both the JSONConfig and the FileConfig
func NewConfig ¶
func NewConfig() *EngineConfig
NewConfig returns singularity.EngineConfig with a parsed FileConfig
func (*EngineConfig) GetAddCaps ¶
func (e *EngineConfig) GetAddCaps() string
GetAddCaps retrieves bounding/effective/permitted/inheritable/ambient capabilities to add.
func (*EngineConfig) GetAllowSUID ¶
func (e *EngineConfig) GetAllowSUID() bool
GetAllowSUID returns if allow-suid is set or not.
func (*EngineConfig) GetBindPath ¶
func (e *EngineConfig) GetBindPath() []string
GetBindPath retrieves bind paths.
func (*EngineConfig) GetBootInstance ¶
func (e *EngineConfig) GetBootInstance() bool
GetBootInstance returns if boot flag is set or not
func (*EngineConfig) GetCommand ¶
func (e *EngineConfig) GetCommand() string
GetCommand retrieves action command.
func (*EngineConfig) GetContain ¶
func (e *EngineConfig) GetContain() bool
GetContain returns if contain flag is set or not.
func (*EngineConfig) GetDropCaps ¶
func (e *EngineConfig) GetDropCaps() string
GetDropCaps retrieves bounding/effective/permitted/inheritable/ambient capabilities to drop.
func (*EngineConfig) GetHome ¶
func (e *EngineConfig) GetHome() string
GetHome retrieves user home directory
func (*EngineConfig) GetHomeDir ¶
func (e *EngineConfig) GetHomeDir() string
GetHomeDir retrieves the home directory path.
func (*EngineConfig) GetHostname ¶
func (e *EngineConfig) GetHostname() string
GetHostname retrieves hostname to use in containee.JSON.
func (*EngineConfig) GetImage ¶
func (e *EngineConfig) GetImage() string
GetImage retrieves the container image path.
func (*EngineConfig) GetInstance ¶
func (e *EngineConfig) GetInstance() bool
GetInstance returns if container run as instance or not.
func (*EngineConfig) GetKeepPrivs ¶
func (e *EngineConfig) GetKeepPrivs() bool
GetKeepPrivs returns if keep-privs is set or not
func (*EngineConfig) GetNoHome ¶
func (e *EngineConfig) GetNoHome() bool
GetNoHome returns if no-home flag is set or not
func (*EngineConfig) GetNoPrivs ¶
func (e *EngineConfig) GetNoPrivs() bool
GetNoPrivs return if no-privs flag is set or not
func (*EngineConfig) GetNv ¶
func (e *EngineConfig) GetNv() bool
GetNv returns if nv flag is set or not.
func (*EngineConfig) GetOverlayFsEnabled ¶
func (e *EngineConfig) GetOverlayFsEnabled() bool
GetOverlayFsEnabled returns if overlay filesystem is enabled or not.
func (*EngineConfig) GetOverlayImage ¶
func (e *EngineConfig) GetOverlayImage() []string
GetOverlayImage retrieves the overlay image path.
func (*EngineConfig) GetScratchDir ¶
func (e *EngineConfig) GetScratchDir() []string
GetScratchDir retrieves the scratch directory path.
func (*EngineConfig) GetShell ¶
func (e *EngineConfig) GetShell() string
GetShell retrieves shell for shell command.
func (*EngineConfig) GetTmpDir ¶
func (e *EngineConfig) GetTmpDir() string
GetTmpDir retrieves temporary directory path.
func (*EngineConfig) GetWorkdir ¶
func (e *EngineConfig) GetWorkdir() string
GetWorkdir retrieves the work directory path.
func (*EngineConfig) GetWritableImage ¶
func (e *EngineConfig) GetWritableImage() bool
GetWritableImage returns if the container image is writable or not.
func (*EngineConfig) MarshalJSON ¶
func (e *EngineConfig) MarshalJSON() ([]byte, error)
MarshalJSON is for json.Marshaler
func (*EngineConfig) SetAddCaps ¶
func (e *EngineConfig) SetAddCaps(caps string)
SetAddCaps sets bounding/effective/permitted/inheritable/ambient capabilities to add.
func (*EngineConfig) SetAllowSUID ¶
func (e *EngineConfig) SetAllowSUID(allow bool)
SetAllowSUID sets allow-suid flag to allow to run setuid binary inside containee.JSON.
func (*EngineConfig) SetBindPath ¶
func (e *EngineConfig) SetBindPath(bindpath []string)
SetBindPath sets paths to bind into containee.JSON.
func (*EngineConfig) SetBootInstance ¶
func (e *EngineConfig) SetBootInstance(boot bool)
SetBootInstance sets boot flag to execute /sbin/init as main instance process.
func (*EngineConfig) SetCommand ¶
func (e *EngineConfig) SetCommand(command string)
SetCommand sets action command to execute.
func (*EngineConfig) SetContain ¶
func (e *EngineConfig) SetContain(contain bool)
SetContain sets contain flag.
func (*EngineConfig) SetDropCaps ¶
func (e *EngineConfig) SetDropCaps(caps string)
SetDropCaps sets bounding/effective/permitted/inheritable/ambient capabilities to drop.
func (*EngineConfig) SetHome ¶
func (e *EngineConfig) SetHome(home string)
SetHome set user home directory
func (*EngineConfig) SetHomeDir ¶
func (e *EngineConfig) SetHomeDir(name string)
SetHomeDir sets the home directory path.
func (*EngineConfig) SetHostname ¶
func (e *EngineConfig) SetHostname(hostname string)
SetHostname sets hostname to use in containee.JSON.
func (*EngineConfig) SetImage ¶
func (e *EngineConfig) SetImage(name string)
SetImage sets the container image path to be used by EngineConfig.JSON.
func (*EngineConfig) SetInstance ¶
func (e *EngineConfig) SetInstance(instance bool)
SetInstance sets if container run as instance or not.
func (*EngineConfig) SetKeepPrivs ¶
func (e *EngineConfig) SetKeepPrivs(keep bool)
SetKeepPrivs sets keep-privs flag to allow root to retain all privileges.
func (*EngineConfig) SetNoHome ¶
func (e *EngineConfig) SetNoHome(val bool)
SetNoHome set no-home flag to not mount home user home directory
func (*EngineConfig) SetNoPrivs ¶
func (e *EngineConfig) SetNoPrivs(nopriv bool)
SetNoPrivs set no-privs flag to force root user to lose all privileges.
func (*EngineConfig) SetNv ¶
func (e *EngineConfig) SetNv(nv bool)
SetNv sets nv flag to bind cuda libraries into containee.JSON.
func (*EngineConfig) SetOverlayFsEnabled ¶
func (e *EngineConfig) SetOverlayFsEnabled(enabled bool)
SetOverlayFsEnabled defines if overlay filesystem is enabled or not.
func (*EngineConfig) SetOverlayImage ¶
func (e *EngineConfig) SetOverlayImage(paths []string)
SetOverlayImage sets the overlay image path to be used on top of container image.
func (*EngineConfig) SetScratchDir ¶
func (e *EngineConfig) SetScratchDir(scratchdir []string)
SetScratchDir set a scratch directory path.
func (*EngineConfig) SetShell ¶
func (e *EngineConfig) SetShell(shell string)
SetShell sets shell to be used by shell command.
func (*EngineConfig) SetTmpDir ¶
func (e *EngineConfig) SetTmpDir(name string)
SetTmpDir sets temporary directory path.
func (*EngineConfig) SetWorkdir ¶
func (e *EngineConfig) SetWorkdir(name string)
SetWorkdir sets a work directory path.
func (*EngineConfig) SetWritableImage ¶
func (e *EngineConfig) SetWritableImage(writable bool)
SetWritableImage defines the container image as writable or not.
func (*EngineConfig) UnmarshalJSON ¶
func (e *EngineConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON is for json.Unmarshaler
type EngineOperations ¶
type EngineOperations struct {
CommonConfig *config.Common `json:"-"`
EngineConfig *EngineConfig `json:"engineConfig"`
}
EngineOperations describes a runtime engine
func (*EngineOperations) CleanupContainer ¶
func (engine *EngineOperations) CleanupContainer() error
CleanupContainer cleans up the container
func (*EngineOperations) Config ¶
func (e *EngineOperations) Config() config.EngineConfig
Config returns a pointer to a singularity.EngineConfig literal as a config.EngineConfig interface. This pointer gets stored in the Engine.Common field.
func (*EngineOperations) CreateContainer ¶
func (engine *EngineOperations) CreateContainer(pid int, rpcConn net.Conn) error
CreateContainer creates a container
func (*EngineOperations) InitConfig ¶
func (e *EngineOperations) InitConfig(cfg *config.Common)
InitConfig stores the pointer to config.Common
func (*EngineOperations) MonitorContainer ¶
func (engine *EngineOperations) MonitorContainer(pid int) (syscall.WaitStatus, error)
MonitorContainer monitors a container
func (*EngineOperations) PrepareConfig ¶
PrepareConfig checks and prepares the runtime engine config
func (*EngineOperations) StartProcess ¶
func (engine *EngineOperations) StartProcess(masterConn net.Conn) error
StartProcess starts the process
type FileConfig ¶
type FileConfig struct {
AllowSetuid bool `default:"yes" authorized:"yes,no" directive:"allow setuid"`
MaxLoopDevices uint `default:"256" directive:"max loop devices"`
AllowPidNs bool `default:"yes" authorized:"yes,no" directive:"allow pid ns"`
ConfigPasswd bool `default:"yes" authorized:"yes,no" directive:"config passwd"`
ConfigGroup bool `default:"yes" authorized:"yes,no" directive:"config group"`
ConfigResolvConf bool `default:"yes" authorized:"yes,no" directive:"config resolv_conf"`
MountProc bool `default:"yes" authorized:"yes,no" directive:"mount proc"`
MountSys bool `default:"yes" authorized:"yes,no" directive:"mount sys"`
MountDev string `default:"yes" authorized:"yes,no,minimal" directive:"mount dev"`
MountDevPts bool `default:"yes" authorized:"yes,no" directive:"mount devpts"`
MountHome bool `default:"yes" authorized:"yes,no" directive:"mount home"`
MountTmp bool `default:"yes" authorized:"yes,no" directive:"mount tmp"`
MountHostfs bool `default:"no" authorized:"yes,no" directive:"mount hostfs"`
BindPath []string `default:"/etc/localtime,/etc/hosts" directive:"bind path"`
UserBindControl bool `default:"yes" authorized:"yes,no" directive:"user bind control"`
EnableOverlay string `default:"try" authorized:"yes,no,try" directive:"enable overlay"`
EnableUnderlay bool `default:"yes" authorized:"yes,no" directive:"enable underlay"`
MountSlave bool `default:"yes" authorized:"yes,no" directive:"mount slave"`
SessiondirMaxSize uint `default:"16" directive:"sessiondir max size"`
LimitContainerOwners []string `directive:"limit container owners"`
LimitContainerGroups []string `directive:"limit container groups"`
LimitContainerPaths []string `directive:"limit container paths"`
AllowContainerSquashfs bool `default:"yes" authorized:"yes,no" directive:"allow container squashfs"`
AllowContainerExtfs bool `default:"yes" authorized:"yes,no" directive:"allow container extfs"`
AllowContainerDir bool `default:"yes" authorized:"yes,no" directive:"allow container dir"`
AutofsBugPath []string `directive:"autofs bug path"`
AlwaysUseNv bool `default:"no" authorized:"yes,no" directive:"always use nv"`
RootDefaultCapabilities string `default:"full" authorized:"full,file,no" directive:"root default capabilities"`
AllowRootCapabilities bool `default:"yes" authorized:"yes,no" directive:"allow root capabilities"`
AllowUserCapabilities bool `default:"no" authorized:"yes,no" directive:"allow user capabilities"`
MemoryFSType string `default:"tmpfs" authorized:"tmpfs,ramfs" directive:"memory fs type"`
}
FileConfig describes the singularity.conf file options
type JSONConfig ¶
type JSONConfig struct {
Image string `json:"image"`
WritableImage bool `json:"writableImage,omitempty"`
OverlayImage []string `json:"overlayImage,omitempty"`
OverlayFsEnabled bool `json:"overlayFsEnabled,omitempty"`
Contain bool `json:"container,omitempty"`
Nv bool `json:"nv,omitempty"`
Workdir string `json:"workdir,omitempty"`
ScratchDir []string `json:"scratchdir,omitempty"`
HomeDir string `json:"homedir,omitempty"`
BindPath []string `json:"bindpath,omitempty"`
Command string `json:"command,omitempty"`
Shell string `json:"shell,omitempty"`
TmpDir string `json:"tmpdir,omitempty"`
IsInstance bool `json:"isInstance,omitempty"`
BootInstance bool `json:"bootInstance,omitempty"`
RunPrivileged bool `json:"runPrivileged,omitempty"`
AddCaps string `json:"addCaps,omitempty"`
DropCaps string `json:"dropCaps,omitempty"`
Hostname string `json:"hostname,omitempty"`
AllowSUID bool `json:"allowSUID,omitempty"`
KeepPrivs bool `json:"keepPrivs,omitempty"`
NoPrivs bool `json:"noPrivs,omitempty"`
Home string `json:"home,omitempty"`
NoHome bool `json:"noHome,omitempty"`
}
JSONConfig stores engine specific confguration that is allowed to be set by the user