Documentation ¶
Index ¶
- Variables
- func GetPluginMap(w io.Writer) map[string]plugin.Plugin
- func GetTaskEnv(alloc *allocdir.AllocDir, node *structs.Node, task *structs.Task) (*env.TaskEnvironment, error)
- type DockerDriver
- type DockerDriverAuth
- type DockerDriverConfig
- type DockerHandle
- type Driver
- func NewDockerDriver(ctx *DriverContext) Driver
- func NewDriver(name string, ctx *DriverContext) (Driver, error)
- func NewExecDriver(ctx *DriverContext) Driver
- func NewJavaDriver(ctx *DriverContext) Driver
- func NewQemuDriver(ctx *DriverContext) Driver
- func NewRawExecDriver(ctx *DriverContext) Driver
- func NewRktDriver(ctx *DriverContext) Driver
- type DriverContext
- type DriverHandle
- type ExecContext
- type ExecDriver
- func (d *ExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error)
- func (d *ExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
- func (d *ExecDriver) Periodic() (bool, time.Duration)
- func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
- type ExecDriverConfig
- type ExecutorPlugin
- type ExecutorRPC
- func (e *ExecutorRPC) Exit() error
- func (e *ExecutorRPC) LaunchCmd(cmd *executor.ExecCommand, ctx *executor.ExecutorContext) (*executor.ProcessState, error)
- func (e *ExecutorRPC) ShutDown() error
- func (e *ExecutorRPC) UpdateLogConfig(logConfig *structs.LogConfig) error
- func (e *ExecutorRPC) Wait() (*executor.ProcessState, error)
- type ExecutorRPCServer
- func (e *ExecutorRPCServer) Exit(args interface{}, resp *interface{}) error
- func (e *ExecutorRPCServer) LaunchCmd(args LaunchCmdArgs, ps *executor.ProcessState) error
- func (e *ExecutorRPCServer) ShutDown(args interface{}, resp *interface{}) error
- func (e *ExecutorRPCServer) UpdateLogConfig(args *structs.LogConfig, resp *interface{}) error
- func (e *ExecutorRPCServer) Wait(args interface{}, ps *executor.ProcessState) error
- type Factory
- type JavaDriver
- type JavaDriverConfig
- type LaunchCmdArgs
- type LaunchCollectorArgs
- type PluginReattachConfig
- type QemuDriver
- type QemuDriverConfig
- type RawExecDriver
- type RktDriver
- type RktDriverConfig
- type SyslogCollectorPlugin
- type SyslogCollectorRPC
- type SyslogCollectorRPCServer
- func (s *SyslogCollectorRPCServer) Exit(args interface{}, resp *interface{}) error
- func (s *SyslogCollectorRPCServer) LaunchCollector(args LaunchCollectorArgs, resp *logging.SyslogCollectorState) error
- func (s *SyslogCollectorRPCServer) UpdateLogConfig(logConfig *structs.LogConfig, resp *interface{}) error
Constants ¶
This section is empty.
Variables ¶
var BuiltinDrivers = map[string]Factory{ "docker": NewDockerDriver, "exec": NewExecDriver, "raw_exec": NewRawExecDriver, "java": NewJavaDriver, "qemu": NewQemuDriver, "rkt": NewRktDriver, }
BuiltinDrivers contains the built in registered drivers which are available for allocation handling
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "NOMAD_PLUGIN_MAGIC_COOKIE",
MagicCookieValue: "e4327c2e01eabfd75a8a67adb114fb34a757d57eee7728d857a8cec6e91a7255",
}
Functions ¶
func GetPluginMap ¶ added in v0.3.0
Types ¶
type DockerDriver ¶
type DockerDriver struct { DriverContext fingerprint.StaticFingerprinter }
func (*DockerDriver) Fingerprint ¶
func (*DockerDriver) Open ¶
func (d *DockerDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*DockerDriver) Start ¶
func (d *DockerDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
type DockerDriverAuth ¶ added in v0.2.0
type DockerDriverAuth struct { Username string `mapstructure:"username"` // username for the registry Password string `mapstructure:"password"` // password to access the registry Email string `mapstructure:"email"` // email address of the user who is allowed to access the registry ServerAddress string `mapstructure:"server_address"` // server address of the registry }
type DockerDriverConfig ¶ added in v0.2.0
type DockerDriverConfig struct { ImageName string `mapstructure:"image"` // Container's Image Name Command string `mapstructure:"command"` // The Command/Entrypoint to run when the container starts up Args []string `mapstructure:"args"` // The arguments to the Command/Entrypoint IpcMode string `mapstructure:"ipc_mode"` // The IPC mode of the container - host and none NetworkMode string `mapstructure:"network_mode"` // The network mode of the container - host, net and none PidMode string `mapstructure:"pid_mode"` // The PID mode of the container - host and none UTSMode string `mapstructure:"uts_mode"` // The UTS mode of the container - host and none PortMapRaw []map[string]int `mapstructure:"port_map"` // PortMap map[string]int `mapstructure:"-"` // A map of host port labels and the ports exposed on the container Privileged bool `mapstructure:"privileged"` // Flag to run the container in priviledged mode DNSServers []string `mapstructure:"dns_servers"` // DNS Server for containers DNSSearchDomains []string `mapstructure:"dns_search_domains"` // DNS Search domains for containers Hostname string `mapstructure:"hostname"` // Hostname for containers LabelsRaw []map[string]string `mapstructure:"labels"` // Labels map[string]string `mapstructure:"-"` // Labels to set when the container starts up Auth []DockerDriverAuth `mapstructure:"auth"` // Authentication credentials for a private Docker registry }
func (*DockerDriverConfig) Validate ¶ added in v0.2.0
func (c *DockerDriverConfig) Validate() error
type DockerHandle ¶ added in v0.2.1
type DockerHandle struct {
// contains filtered or unexported fields
}
func (*DockerHandle) ContainerID ¶ added in v0.2.1
func (h *DockerHandle) ContainerID() string
func (*DockerHandle) ID ¶ added in v0.2.1
func (h *DockerHandle) ID() string
func (*DockerHandle) Kill ¶ added in v0.2.1
func (h *DockerHandle) Kill() error
Kill is used to terminate the task. This uses `docker stop -t killTimeout`
func (*DockerHandle) Update ¶ added in v0.2.1
func (h *DockerHandle) Update(task *structs.Task) error
func (*DockerHandle) WaitCh ¶ added in v0.2.1
func (h *DockerHandle) WaitCh() chan *cstructs.WaitResult
type Driver ¶
type Driver interface { // Drivers must support the fingerprint interface for detection fingerprint.Fingerprint // Start is used to being task execution Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error) // Open is used to re-open a handle to a task Open(ctx *ExecContext, handleID string) (DriverHandle, error) }
Driver is used for execution of tasks. This allows Nomad to support many pluggable implementations of task drivers. Examples could include LXC, Docker, Qemu, etc.
func NewDockerDriver ¶
func NewDockerDriver(ctx *DriverContext) Driver
func NewDriver ¶
func NewDriver(name string, ctx *DriverContext) (Driver, error)
NewDriver is used to instantiate and return a new driver given the name and a logger
func NewExecDriver ¶
func NewExecDriver(ctx *DriverContext) Driver
NewExecDriver is used to create a new exec driver
func NewJavaDriver ¶
func NewJavaDriver(ctx *DriverContext) Driver
NewJavaDriver is used to create a new exec driver
func NewQemuDriver ¶
func NewQemuDriver(ctx *DriverContext) Driver
NewQemuDriver is used to create a new exec driver
func NewRawExecDriver ¶ added in v0.2.0
func NewRawExecDriver(ctx *DriverContext) Driver
NewRawExecDriver is used to create a new raw exec driver
func NewRktDriver ¶ added in v0.2.0
func NewRktDriver(ctx *DriverContext) Driver
NewRktDriver is used to create a new exec driver
type DriverContext ¶
type DriverContext struct {
// contains filtered or unexported fields
}
DriverContext is a means to inject dependencies such as loggers, configs, and node attributes into a Driver without having to change the Driver interface each time we do it. Used in conjection with Factory, above.
func NewDriverContext ¶
func NewDriverContext(taskName string, config *config.Config, node *structs.Node, logger *log.Logger, taskEnv *env.TaskEnvironment) *DriverContext
NewDriverContext initializes a new DriverContext with the specified fields. This enables other packages to create DriverContexts but keeps the fields private to the driver. If we want to change this later we can gorename all of the fields in DriverContext.
func (*DriverContext) KillTimeout ¶ added in v0.3.0
func (d *DriverContext) KillTimeout(task *structs.Task) time.Duration
KillTimeout returns the timeout that should be used for the task between signaling and killing the task.
type DriverHandle ¶
type DriverHandle interface { // Returns an opaque handle that can be used to re-open the handle ID() string // WaitCh is used to return a channel used wait for task completion WaitCh() chan *cstructs.WaitResult // Update is used to update the task if possible and update task related // configurations. Update(task *structs.Task) error // Kill is used to stop the task Kill() error }
DriverHandle is an opaque handle into a driver used for task manipulation
type ExecContext ¶
type ExecContext struct { sync.Mutex // AllocDir contains information about the alloc directory structure. AllocDir *allocdir.AllocDir // Alloc ID AllocID string }
ExecContext is shared between drivers within an allocation
func NewExecContext ¶
func NewExecContext(alloc *allocdir.AllocDir, allocID string) *ExecContext
NewExecContext is used to create a new execution context
type ExecDriver ¶
type ExecDriver struct {
DriverContext
}
ExecDriver fork/execs tasks using as many of the underlying OS's isolation features.
func (*ExecDriver) Fingerprint ¶
func (*ExecDriver) Open ¶
func (d *ExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*ExecDriver) Start ¶
func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
type ExecDriverConfig ¶ added in v0.2.0
type ExecutorPlugin ¶ added in v0.3.0
type ExecutorPlugin struct { Impl *ExecutorRPCServer // contains filtered or unexported fields }
func (*ExecutorPlugin) Client ¶ added in v0.3.0
func (p *ExecutorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*ExecutorPlugin) Server ¶ added in v0.3.0
func (p *ExecutorPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type ExecutorRPC ¶ added in v0.3.0
type ExecutorRPC struct {
// contains filtered or unexported fields
}
func (*ExecutorRPC) Exit ¶ added in v0.3.0
func (e *ExecutorRPC) Exit() error
func (*ExecutorRPC) LaunchCmd ¶ added in v0.3.0
func (e *ExecutorRPC) LaunchCmd(cmd *executor.ExecCommand, ctx *executor.ExecutorContext) (*executor.ProcessState, error)
func (*ExecutorRPC) ShutDown ¶ added in v0.3.0
func (e *ExecutorRPC) ShutDown() error
func (*ExecutorRPC) UpdateLogConfig ¶ added in v0.3.0
func (e *ExecutorRPC) UpdateLogConfig(logConfig *structs.LogConfig) error
func (*ExecutorRPC) Wait ¶ added in v0.3.0
func (e *ExecutorRPC) Wait() (*executor.ProcessState, error)
type ExecutorRPCServer ¶ added in v0.3.0
func (*ExecutorRPCServer) Exit ¶ added in v0.3.0
func (e *ExecutorRPCServer) Exit(args interface{}, resp *interface{}) error
func (*ExecutorRPCServer) LaunchCmd ¶ added in v0.3.0
func (e *ExecutorRPCServer) LaunchCmd(args LaunchCmdArgs, ps *executor.ProcessState) error
func (*ExecutorRPCServer) ShutDown ¶ added in v0.3.0
func (e *ExecutorRPCServer) ShutDown(args interface{}, resp *interface{}) error
func (*ExecutorRPCServer) UpdateLogConfig ¶ added in v0.3.0
func (e *ExecutorRPCServer) UpdateLogConfig(args *structs.LogConfig, resp *interface{}) error
func (*ExecutorRPCServer) Wait ¶ added in v0.3.0
func (e *ExecutorRPCServer) Wait(args interface{}, ps *executor.ProcessState) error
type JavaDriver ¶
type JavaDriver struct { DriverContext fingerprint.StaticFingerprinter }
JavaDriver is a simple driver to execute applications packaged in Jars. It literally just fork/execs tasks with the java command.
func (*JavaDriver) Fingerprint ¶
func (*JavaDriver) Open ¶
func (d *JavaDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*JavaDriver) Start ¶
func (d *JavaDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
type JavaDriverConfig ¶ added in v0.2.0
type LaunchCmdArgs ¶ added in v0.3.0
type LaunchCmdArgs struct { Cmd *executor.ExecCommand Ctx *executor.ExecutorContext }
LaunchCmdArgs wraps a user command and the args for the purposes of RPC
type LaunchCollectorArgs ¶ added in v0.3.0
type LaunchCollectorArgs struct {
Ctx *logging.LogCollectorContext
}
type PluginReattachConfig ¶ added in v0.3.0
ExecutorReattachConfig is the config that we seralize and de-serialize and store in disk
func NewPluginReattachConfig ¶ added in v0.3.0
func NewPluginReattachConfig(c *plugin.ReattachConfig) *PluginReattachConfig
func (*PluginReattachConfig) PluginConfig ¶ added in v0.3.0
func (c *PluginReattachConfig) PluginConfig() *plugin.ReattachConfig
PluginConfig returns a config from an ExecutorReattachConfig
type QemuDriver ¶
type QemuDriver struct { DriverContext fingerprint.StaticFingerprinter }
QemuDriver is a driver for running images via Qemu We attempt to chose sane defaults for now, with more configuration available planned in the future
func (*QemuDriver) Fingerprint ¶
func (*QemuDriver) Open ¶
func (d *QemuDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*QemuDriver) Start ¶
func (d *QemuDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
Run an existing Qemu image. Start() will pull down an existing, valid Qemu image and save it to the Drivers Allocation Dir
type QemuDriverConfig ¶ added in v0.2.0
type RawExecDriver ¶ added in v0.2.0
type RawExecDriver struct { DriverContext fingerprint.StaticFingerprinter }
The RawExecDriver is a privileged version of the exec driver. It provides no resource isolation and just fork/execs. The Exec driver should be preferred and this should only be used when explicitly needed.
func (*RawExecDriver) Fingerprint ¶ added in v0.2.0
func (*RawExecDriver) Open ¶ added in v0.2.0
func (d *RawExecDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*RawExecDriver) Start ¶ added in v0.2.0
func (d *RawExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
type RktDriver ¶ added in v0.2.0
type RktDriver struct { DriverContext fingerprint.StaticFingerprinter }
RktDriver is a driver for running images via Rkt We attempt to chose sane defaults for now, with more configuration available planned in the future
func (*RktDriver) Fingerprint ¶ added in v0.2.0
func (*RktDriver) Open ¶ added in v0.2.0
func (d *RktDriver) Open(ctx *ExecContext, handleID string) (DriverHandle, error)
func (*RktDriver) Start ¶ added in v0.2.0
func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, error)
Run an existing Rkt image.
type RktDriverConfig ¶ added in v0.2.0
type SyslogCollectorPlugin ¶ added in v0.3.0
type SyslogCollectorPlugin struct { Impl *SyslogCollectorRPCServer // contains filtered or unexported fields }
func (*SyslogCollectorPlugin) Client ¶ added in v0.3.0
func (p *SyslogCollectorPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*SyslogCollectorPlugin) Server ¶ added in v0.3.0
func (p *SyslogCollectorPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type SyslogCollectorRPC ¶ added in v0.3.0
type SyslogCollectorRPC struct {
// contains filtered or unexported fields
}
func (*SyslogCollectorRPC) Exit ¶ added in v0.3.0
func (e *SyslogCollectorRPC) Exit() error
func (*SyslogCollectorRPC) LaunchCollector ¶ added in v0.3.0
func (e *SyslogCollectorRPC) LaunchCollector(ctx *logging.LogCollectorContext) (*logging.SyslogCollectorState, error)
func (*SyslogCollectorRPC) UpdateLogConfig ¶ added in v0.3.0
func (e *SyslogCollectorRPC) UpdateLogConfig(logConfig *structs.LogConfig) error
type SyslogCollectorRPCServer ¶ added in v0.3.0
type SyslogCollectorRPCServer struct {
Impl logging.LogCollector
}
func (*SyslogCollectorRPCServer) Exit ¶ added in v0.3.0
func (s *SyslogCollectorRPCServer) Exit(args interface{}, resp *interface{}) error
func (*SyslogCollectorRPCServer) LaunchCollector ¶ added in v0.3.0
func (s *SyslogCollectorRPCServer) LaunchCollector(args LaunchCollectorArgs, resp *logging.SyslogCollectorState) error
func (*SyslogCollectorRPCServer) UpdateLogConfig ¶ added in v0.3.0
func (s *SyslogCollectorRPCServer) UpdateLogConfig(logConfig *structs.LogConfig, resp *interface{}) error