pot

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

imported from: https://github.com/hashicorp/nomad/tree/v1.3.3/drivers/shared/executor/exec_utils.go

Index

Constants

This section is empty.

Variables

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

func (d *Driver) ConfigSchema() (*hclspec.Spec, error)

ConfigSchema return a hclspec.Spec struct

func (*Driver) DestroyTask

func (d *Driver) DestroyTask(taskID string, force bool) error

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 (d *Driver) ExecTaskStreamingRaw(ctx context.Context,
	taskID string,
	command []string,
	tty bool,
	stream drivers.ExecTaskStream) error

func (*Driver) Fingerprint

func (d *Driver) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)

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

func (d *Driver) SetConfig(cfg *base.Config) error

SetConfig set the nomad agent config based on base.Config

func (*Driver) Shutdown

func (d *Driver) Shutdown(ctx context.Context) error

Shutdown the plugin

func (*Driver) SignalTask

func (d *Driver) SignalTask(taskID string, signal string) error

SignalTask send a specific signal to a taskID

func (*Driver) StartTask

StartTask setup the task exec and calls the container excecutor

func (*Driver) StopTask

func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error

StopTask shutdown a tasked based on its taskID

func (*Driver) TaskConfigSchema

func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error)

TaskConfigSchema returns a hclspec.Spec struct

func (*Driver) TaskEvents

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

TaskEvents return a chan *drivers.TaskEvent

func (*Driver) TaskStats

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

TaskStats get task stats

func (*Driver) WaitTask

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

WaitTask waits for task completion

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.

Jump to

Keyboard shortcuts

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