Documentation
¶
Index ¶
- func DestroyCgroup(groups *cgroupConfig.Cgroup, cgPaths map[string]string) error
- type ConsulContext
- type DockerScriptCheck
- type ExecCommand
- type ExecScriptCheck
- type Executor
- type ExecutorContext
- type ExecutorVersion
- type ProcessState
- type SyslogServerState
- type UniversalExecutor
- func (e *UniversalExecutor) DeregisterServices() error
- func (e *UniversalExecutor) Exit() error
- func (e *UniversalExecutor) LaunchCmd(command *ExecCommand, ctx *ExecutorContext) (*ProcessState, error)
- func (e *UniversalExecutor) LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error)
- func (e *UniversalExecutor) ShutDown() error
- func (e *UniversalExecutor) SyncServices(ctx *ConsulContext) error
- func (e *UniversalExecutor) UpdateLogConfig(logConfig *structs.LogConfig) error
- func (e *UniversalExecutor) UpdateTask(task *structs.Task) error
- func (e *UniversalExecutor) Version() (*ExecutorVersion, error)
- func (e *UniversalExecutor) Wait() (*ProcessState, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DestroyCgroup ¶ added in v0.3.0
func DestroyCgroup(groups *cgroupConfig.Cgroup, cgPaths map[string]string) error
destroyCgroup kills all processes in the cgroup and removes the cgroup configuration from the host.
Types ¶
type ConsulContext ¶ added in v0.3.2
type ConsulContext struct {
// ConsulConfig is the configuration used to create a consul client
ConsulConfig *consul.ConsulConfig
// ContainerID is the ID of the container
ContainerID string
// TLSCert is the cert which docker client uses while interactng with the docker
// daemon over TLS
TLSCert string
// TLSCa is the CA which the docker client uses while interacting with the docker
// daeemon over TLS
TLSCa string
// TLSKey is the TLS key which the docker client uses while interacting with
// the docker daemon
TLSKey string
// DockerEndpoint is the endpoint of the docker daemon
DockerEndpoint string
}
ConsulContext holds context to configure the consul client and run checks
type DockerScriptCheck ¶ added in v0.3.2
type DockerScriptCheck struct {
// contains filtered or unexported fields
}
DockerScriptCheck runs nagios compatible scripts in a docker container and provides the check result
func (*DockerScriptCheck) ID ¶ added in v0.3.2
func (d *DockerScriptCheck) ID() string
ID returns the check id
func (*DockerScriptCheck) Interval ¶ added in v0.3.2
func (d *DockerScriptCheck) Interval() time.Duration
Interval returns the interval at which the check has to run
func (*DockerScriptCheck) Run ¶ added in v0.3.2
func (d *DockerScriptCheck) Run() *cstructs.CheckResult
Run runs a script check inside a docker container
type ExecCommand ¶ added in v0.3.0
type ExecCommand struct {
// Cmd is the command that the user wants to run.
Cmd string
// Args is the args of the command that the user wants to run.
Args []string
// FSIsolation determines whether the command would be run in a chroot.
FSIsolation bool
// User is the user which the executor uses to run the command.
User string
// ResourceLimits determines whether resource limits are enforced by the
// executor.
ResourceLimits bool
}
ExecCommand holds the user command, args, and other isolation related settings.
type ExecScriptCheck ¶ added in v0.3.2
type ExecScriptCheck struct {
FSIsolation bool
// contains filtered or unexported fields
}
ExecScriptCheck runs a nagios compatible script and returns the check result
func (*ExecScriptCheck) ID ¶ added in v0.3.2
func (e *ExecScriptCheck) ID() string
ID returns the check id
func (*ExecScriptCheck) Interval ¶ added in v0.3.2
func (e *ExecScriptCheck) Interval() time.Duration
Interval returns the interval at which the check has to run
func (*ExecScriptCheck) Run ¶ added in v0.3.2
func (e *ExecScriptCheck) Run() *cstructs.CheckResult
Run runs an exec script check
type Executor ¶
type Executor interface {
LaunchCmd(command *ExecCommand, ctx *ExecutorContext) (*ProcessState, error)
LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error)
Wait() (*ProcessState, error)
ShutDown() error
Exit() error
UpdateLogConfig(logConfig *structs.LogConfig) error
UpdateTask(task *structs.Task) error
SyncServices(ctx *ConsulContext) error
DeregisterServices() error
Version() (*ExecutorVersion, error)
}
Executor is the interface which allows a driver to launch and supervise a process
type ExecutorContext ¶ added in v0.3.0
type ExecutorContext struct {
// TaskEnv holds information about the environment of a Task
TaskEnv *env.TaskEnvironment
// AllocDir is the handle to do operations on the alloc dir of
// the task
AllocDir *allocdir.AllocDir
// Task is the task whose executor is being launched
Task *structs.Task
// AllocID is the allocation id to which the task belongs
AllocID string
// Driver is the name of the driver that invoked the executor
Driver string
// PortUpperBound is the upper bound of the ports that we can use to start
// the syslog server
PortUpperBound uint
// PortLowerBound is the lower bound of the ports that we can use to start
// the syslog server
PortLowerBound uint
}
ExecutorContext holds context to configure the command user wants to run and isolate it
type ExecutorVersion ¶ added in v0.3.2
type ExecutorVersion struct {
Version string
}
ExecutorVersion is the version of the executor
func (*ExecutorVersion) GoString ¶ added in v0.3.2
func (v *ExecutorVersion) GoString() string
type ProcessState ¶ added in v0.3.0
type ProcessState struct {
Pid int
ExitCode int
Signal int
IsolationConfig *cstructs.IsolationConfig
Time time.Time
}
ProcessState holds information about the state of a user process.
type SyslogServerState ¶ added in v0.3.2
type SyslogServerState struct {
IsolationConfig *cstructs.IsolationConfig
Addr string
}
SyslogServerState holds the address and islation information of a launched syslog server
type UniversalExecutor ¶ added in v0.3.0
type UniversalExecutor struct {
// contains filtered or unexported fields
}
UniversalExecutor is an implementation of the Executor which launches and supervises processes. In addition to process supervision it provides resource and file system isolation
func (*UniversalExecutor) DeregisterServices ¶ added in v0.3.2
func (e *UniversalExecutor) DeregisterServices() error
func (*UniversalExecutor) Exit ¶ added in v0.3.0
func (e *UniversalExecutor) Exit() error
Exit cleans up the alloc directory, destroys cgroups and kills the user process
func (*UniversalExecutor) LaunchCmd ¶ added in v0.3.0
func (e *UniversalExecutor) LaunchCmd(command *ExecCommand, ctx *ExecutorContext) (*ProcessState, error)
LaunchCmd launches a process and returns it's state. It also configures an applies isolation on certain platforms.
func (*UniversalExecutor) LaunchSyslogServer ¶ added in v0.3.2
func (e *UniversalExecutor) LaunchSyslogServer(ctx *ExecutorContext) (*SyslogServerState, error)
func (*UniversalExecutor) ShutDown ¶ added in v0.3.0
func (e *UniversalExecutor) ShutDown() error
Shutdown sends an interrupt signal to the user process
func (*UniversalExecutor) SyncServices ¶ added in v0.3.2
func (e *UniversalExecutor) SyncServices(ctx *ConsulContext) error
func (*UniversalExecutor) UpdateLogConfig ¶ added in v0.3.0
func (e *UniversalExecutor) UpdateLogConfig(logConfig *structs.LogConfig) error
COMPAT: prior to Nomad 0.3.2, UpdateTask didn't exist. UpdateLogConfig updates the log configuration
func (*UniversalExecutor) UpdateTask ¶ added in v0.3.2
func (e *UniversalExecutor) UpdateTask(task *structs.Task) error
func (*UniversalExecutor) Version ¶ added in v0.3.2
func (e *UniversalExecutor) Version() (*ExecutorVersion, error)
Version returns the api version of the executor
func (*UniversalExecutor) Wait ¶ added in v0.3.0
func (e *UniversalExecutor) Wait() (*ProcessState, error)
Wait waits until a process has exited and returns it's exitcode and errors