Documentation ¶
Overview ¶
imported from: https://github.com/hashicorp/nomad/tree/v1.3.3/drivers/shared/executor/exec_utils.go
Index ¶
- Variables
- func NewPotDriver(logger hclog.Logger) drivers.DriverPlugin
- type Config
- type Driver
- func (d *Driver) Capabilities() (*drivers.Capabilities, error)
- func (d *Driver) ConfigSchema() (*hclspec.Spec, error)
- func (d *Driver) DestroyTask(taskID string, force bool) error
- func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (d *Driver) ExecTaskStreamingRaw(ctx context.Context, taskID string, command []string, tty bool, ...) error
- func (d *Driver) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)
- func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error
- func (d *Driver) SetConfig(cfg *base.Config) error
- func (d *Driver) Shutdown(ctx context.Context) error
- func (d *Driver) SignalTask(taskID string, signal string) error
- func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
- func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error
- func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error)
- func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (d *Driver) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
- type TaskConfig
- type TaskState
Constants ¶
This section is empty.
Variables ¶
var (
LookupSignal = reverseSignalMap(signals.SignalLookup)
)
Functions ¶
func NewPotDriver ¶
func NewPotDriver(logger hclog.Logger) drivers.DriverPlugin
NewPotDriver returns a new DriverPlugin implementation
Types ¶
type Config ¶
type Config struct { // Enabled is set to true to enable the Pot driver Enabled bool `codec:"enabled"` }
Config is the driver configuration set by the SetConfig RPC call
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is a driver for running Pot containers https://github.com/pizzamig/pot
func (*Driver) Capabilities ¶
func (d *Driver) Capabilities() (*drivers.Capabilities, error)
Capabilities a drivers.Capabilities struct
func (*Driver) ConfigSchema ¶
ConfigSchema return a hclspec.Spec struct
func (*Driver) DestroyTask ¶
DestroyTask delete task
func (*Driver) ExecTask ¶
func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
ExecTask calls a exec cmd over a running task
func (*Driver) ExecTaskStreamingRaw ¶ added in v0.10.0
func (*Driver) Fingerprint ¶
Fingerprint return the plugin fingerprint
func (*Driver) InspectTask ¶
func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask retrieves task info
func (*Driver) PluginInfo ¶
func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)
PluginInfo return a base.PluginInfoResponse struct
func (*Driver) RecoverTask ¶
func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask try to recover a failed task, if not return error
func (*Driver) SignalTask ¶
SignalTask send a specific signal to a taskID
func (*Driver) StartTask ¶
func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
StartTask setup the task exec and calls the container excecutor
func (*Driver) TaskConfigSchema ¶
TaskConfigSchema returns a hclspec.Spec struct
func (*Driver) TaskEvents ¶
TaskEvents return a chan *drivers.TaskEvent
type TaskConfig ¶
type TaskConfig struct { Image string `codec:"image"` Pot string `codec:"pot"` Tag string `codec:"tag"` Alloc string `codec:"alloc"` // Command can be run or exec , shell is not supported via plugin Command string `codec:"command"` Args []string `codec:"args"` //Port []string `codec:"port"` PortMap hclutils.MapStrStr `codec:"port_map"` Name string `codec:"name"` //Network Mode NetworkMode string `codec:"network_mode"` // Enable debug-verbose global options Debug bool `codec:"debug"` Verbose bool `codec:"verbose"` Mount []string `codec:"mount"` // Host-Volumes to mount in, syntax: /path/to/host/directory:/destination/path/in/container MountReadOnly []string `codec:"mount_read_only"` // Host-Volumes to mount in, syntax: /path/to/host/directory:/destination/path/in/container Copy []string `codec:"copy"` // Files in host to copy in, syntax: /path/to/host/file.ext:/destination/path/in/container/file.ext ExtraHosts []string `codec:"extra_hosts"` // ExtraHosts a list of hosts, given as host:IP, to be added to /etc/hosts Attributes []string `codec:"attributes"` // Pot attributes, syntax: Attribute:Value }
TaskConfig is the driver configuration of a task within a job
type TaskState ¶
type TaskState struct { ReattachConfig *structs.ReattachConfig TaskConfig *drivers.TaskConfig StartedAt time.Time ContainerName string PID int }
TaskState is the state which is encoded in the handle returned in StartTask. This information is needed to rebuild the task state and handler during recovery.