Documentation ¶
Index ¶
- func GetAbsolutePath(bin string) (string, error)
- func NewPlugin(logger log.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) 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 ¶
This section is empty.
Functions ¶
func GetAbsolutePath ¶
Types ¶
type Config ¶
type Config struct {
FirejailPath string `codec:"firejail_path"`
}
Config contains configuration information for the plugin
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
HelloDriverPlugin is an example driver plugin. When provisioned in a job, the taks will output a greet specified by the user.
func (*Driver) Capabilities ¶
func (d *Driver) Capabilities() (*drivers.Capabilities, error)
Capabilities returns the features supported by the driver.
func (*Driver) ConfigSchema ¶
ConfigSchema returns the plugin configuration schema.
func (*Driver) DestroyTask ¶
DestroyTask cleans up and removes a task that has terminated.
func (*Driver) ExecTask ¶
func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
ExecTask returns the result of executing the given command inside a task. This is an optional capability.
func (*Driver) Fingerprint ¶
Fingerprint returns a channel that will be used to send health information and other driver specific node attributes.
func (*Driver) InspectTask ¶
func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask returns detailed status information for the referenced taskID.
func (*Driver) PluginInfo ¶
func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)
PluginInfo returns information describing the plugin.
func (*Driver) RecoverTask ¶
func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask recreates the in-memory state of a task from a TaskHandle.
func (*Driver) SetConfig ¶
SetConfig is called by the client to pass the configuration for the plugin.
func (*Driver) SignalTask ¶
SignalTask forwards a signal to a task. This is an optional capability.
func (*Driver) StartTask ¶
func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
StartTask returns a task handle and a driver network if necessary.
func (*Driver) StopTask ¶
StopTask stops a running task with the given signal and within the timeout window.
func (*Driver) TaskConfigSchema ¶
TaskConfigSchema returns the HCL schema for the configuration of a task.
func (*Driver) TaskEvents ¶
TaskEvents returns a channel that the plugin can use to emit task related events.
type TaskConfig ¶
type TaskConfig struct { Options []string `codec:"options"` Command string `codec:"command"` Args []string `codec:"args"` }
TaskConfig contains configuration information for a task that runs with this plugin
type TaskState ¶
type TaskState struct { ReattachConfig *structs.ReattachConfig TaskConfig *drivers.TaskConfig StartedAt time.Time Pid int }
TaskState is the runtime state which is encoded in the handle returned to Nomad client. This information is needed to rebuild the task state and handler during recovery.