plugin

package
v0.1.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var PluginID = loader.PluginID{
	Name:       name,
	PluginType: base.PluginTypeDriver,
}

PluginID is the exec plugin metadata registered in the plugin catalog.

Functions

func New

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) ConfigSchema

func (*Plugin) ConfigSchema() (*hclspec.Spec, error)

func (*Plugin) DestroyTask

func (p *Plugin) DestroyTask(taskID string, force bool) error

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 (p *Plugin) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)

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) SetConfig

func (p *Plugin) SetConfig(c *base.Config) error

func (*Plugin) SignalTask

func (p *Plugin) SignalTask(taskID, signal string) error

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

func (p *Plugin) StopTask(taskID string, timeout time.Duration, signal string) error

StopTask will issue the given signal to the task, followed by KILL if the process does not exit within the given timeout.

func (*Plugin) TaskConfigSchema

func (*Plugin) TaskConfigSchema() (*hclspec.Spec, error)

func (*Plugin) TaskEvents

func (*Plugin) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)

TaskEvents produces an empty chan of TaskEvents.

func (*Plugin) TaskStats

func (p *Plugin) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)

TaskStats starts a background goroutine that produces TaskResourceUsage every interval and returns them on the returned channel.

func (*Plugin) WaitTask

func (p *Plugin) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)

WaitTask returns a channel upon which callers may wait for the task to exit and produce a drivers.ExitResult.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL