Documentation
¶
Index ¶
- Variables
- func New(log hclog.Logger) drivers.DriverPlugin
- type Config
- type Plugin
- func (*Plugin) Capabilities() (*drivers.Capabilities, error)
- func (*Plugin) ConfigSchema() (*hclspec.Spec, error)
- func (p *Plugin) DestroyTask(taskID string, force bool) error
- func (*Plugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
- func (*Plugin) ExecTaskStreaming(ctx context.Context, taskID string, execOptions *drivers.ExecOptions) (*drivers.ExitResult, error)
- func (p *Plugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)
- func (p *Plugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
- func (*Plugin) PluginInfo() (*base.PluginInfoResponse, error)
- func (p *Plugin) RecoverTask(handle *drivers.TaskHandle) error
- func (p *Plugin) SetConfig(c *base.Config) error
- func (p *Plugin) SignalTask(taskID, signal string) error
- func (p *Plugin) StartTask(config *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
- func (p *Plugin) StopTask(taskID string, timeout time.Duration, signal string) error
- func (*Plugin) TaskConfigSchema() (*hclspec.Spec, error)
- func (*Plugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)
- func (p *Plugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)
- func (p *Plugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)
- type TaskConfig
Constants ¶
This section is empty.
Variables ¶
var PluginConfig = &loader.InternalPluginConfig{ Config: make(map[string]any), Factory: func(_ context.Context, l hclog.Logger) any { return New(l) }, }
PluginConfig is the exec driver factory function registered in the plugin catalog.
var PluginID = loader.PluginID{ Name: name, PluginType: base.PluginTypeDriver, }
PluginID is the exec plugin metadata registered in the plugin catalog.
Functions ¶
Types ¶
type Config ¶
type Config struct {
UnveilDefaults bool `codec:"unveil_defaults"`
UnveilPaths []string `codec:"unveil_paths"`
UnveilByTask bool `codec:"unveil_by_task"`
}
Config represents the exec2 driver plugin configuration that gets set in the Nomad client configuration file.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) Capabilities ¶
func (*Plugin) Capabilities() (*drivers.Capabilities, error)
func (*Plugin) DestroyTask ¶
DestroyTask will stop the given task if necessary and remove its state from memory. If the task is currently running it will only be stopped and removed if the force option is set.
func (*Plugin) ExecTask ¶
func (*Plugin) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)
ExecTask is not yet implemented.
func (*Plugin) ExecTaskStreaming ¶
func (*Plugin) ExecTaskStreaming(ctx context.Context, taskID string, execOptions *drivers.ExecOptions) (*drivers.ExitResult, error)
ExecTaskStreaming is not yet implemented.
func (*Plugin) Fingerprint ¶
func (*Plugin) InspectTask ¶
func (p *Plugin) InspectTask(taskID string) (*drivers.TaskStatus, error)
InspectTask returns status information for the task associated with the given taskID.
func (*Plugin) PluginInfo ¶
func (*Plugin) PluginInfo() (*base.PluginInfoResponse, error)
func (*Plugin) RecoverTask ¶
func (p *Plugin) RecoverTask(handle *drivers.TaskHandle) error
RecoverTask will re-create the in-memory state of a task from a TaskHandle coming from Nomad.
func (*Plugin) SignalTask ¶
SignalTask will use the kill() syscall to send signal to the unix process of the task.
func (*Plugin) StartTask ¶
func (p *Plugin) StartTask(config *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error)
StartTask will setup the environment for and then launch the actual unix process of the task. This information will be encoded into, stored as, and returned as a task handle.
func (*Plugin) StopTask ¶
StopTask will issue the given signal to the task, followed by KILL if the process does not exit within the given timeout.
func (*Plugin) TaskEvents ¶
TaskEvents produces an empty chan of TaskEvents.
type TaskConfig ¶
type TaskConfig struct {
Command string `codec:"command"`
Args []string `codec:"args"`
Unveil []string `codec:"unveil"`
}
TaskConfig represents the exec2 driver task configuration that gets set in a Nomad job file.