Documentation ¶
Index ¶
- Constants
- func NewTritonDriver(logger hclog.Logger) drivers.DriverPlugin
- type Client
- type CloudAPI
- type CloudImage
- type DockerAPI
- type DockerAuth
- type DockerImage
- 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 DriverConfig
- type LogConfig
- type Network
- type Package
- type Ports
- type RebootTask
- type StateChange
- type TaskConfig
- type TaskState
Constants ¶
const ( JobTypeService = "service" JobTypeBatch = "batch" APITypeCloud = "cloudapi" APITypeDocker = "dockerapi" DockerRestartNever = "Never" DockerRestartAlways = "Always" DockerRestartOnFailure = "OnFailure" )
Variables ¶
This section is empty.
Functions ¶
func NewTritonDriver ¶
func NewTritonDriver(logger hclog.Logger) drivers.DriverPlugin
NewTritonDriver returns a new DriverPlugin implementation
Types ¶
type Client ¶
type Client struct { Config *triton.ClientConfig InsecureSkipTLSVerify bool AffinityLock *sync.RWMutex }
Client represents all internally accessible Triton APIs utilized by this driver and the configuration necessary to connect to them.
type CloudAPI ¶
type CloudAPI struct { CloudConfig string `codec:"cloud_config" json:"cloud_config"` Image CloudImage `codec:"image" json:"image"` Networks []Network `codec:"networks" json:"networks"` UserData string `codec:"user_data" json:"user_data"` UserScript string `codec:"user_script" json:"user_script"` }
type CloudImage ¶
type DockerAPI ¶
type DockerAPI struct { Cmd []string `codec:"cmd" json:"cmd"` Entrypoint []string `codec:"entrypoint" json:"entrypoint"` OpenStdin bool `codec:"openstdin" json:"openstdin"` StdInOnce bool `codec:"stdinonce" json:"stdinonce"` TTY bool `codec:"tty" json:"tty"` WorkingDir string `codec:"workingdir" json:"workingdir"` Image DockerImage `codec:"image" json:"image"` Auth DockerAuth `codec:"auth" json:"auth"` Labels map[string]string `codec:"labels" json:"labels"` PublicNetwork string `codec:"public_network" json:"public_network"` PrivateNetwork string `codec:"private_network" json:"private_network"` RestartPolicy string `codec:"restart_policy" json:"restart_policy"` Ports Ports `codec:"ports" json:"ports"` Hostname string `codec:"hostname" json:"hostname"` DNS []string `codec:"dns" json:"dns"` DNSSearch []string `codec:"dns_search" json:"dns_search"` User string `codec:"user" json:"user"` Domainname string `codec:"domain_name" json:"domain_name"` ExtraHosts []string `codec:"extra_hosts" json:"extra_hosts"` LogConfig LogConfig `codec:"log_config" json:"log_config"` }
type DockerAuth ¶
type DockerImage ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is a nomad driver plugin for provisioning instances on triton
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 DriverConfig ¶
type DriverConfig struct { // decoded plugin configuration struct // // This struct is the decoded version of the schema defined in the // configSpec variable above. It's used to convert the HCL configuration // passed by the Nomad agent into Go contructs. //Shell string `codec:"shell"` Cluster string `codec:"cluster"` Enabled bool `codec:"enabled"` CloudAPIEnabled bool `codec:"cloudapi"` DockerAPIEnabled bool `codec:"dockerapi"` Region string `codec:"region"` }
DriverConfig contains configuration information for the plugin
type RebootTask ¶ added in v0.0.4
type RebootTask struct {
InstanceUUID string `json:"instance_uuid"`
}
type StateChange ¶ added in v0.0.4
type TaskConfig ¶
type TaskConfig struct { Affinity []string `codec:"affinity" json:"affinity"` CNS []string `codec:"cns" json:"cns"` Cloud CloudAPI `codec:"cloud_api" json:"cloud_api"` DeletionProtection bool `codec:"deletion_protection" json:"deletion_protection"` Docker DockerAPI `codec:"docker_api" json:"docker_api"` FWEnabled bool `codec:"fwenabled" json:"fwenabled"` Package Package `codec:"package" json:"package"` Tags map[string]string `codec:"tags" json:"tags"` }
type TaskState ¶
type TaskState struct { TaskConfig *drivers.TaskConfig StartedAt time.Time // The plugin keeps track of its running tasks in a in-memory data // structure. If the plugin crashes, this data will be lost, so Nomad // will respawn a new instance of the plugin and try to restore its // in-memory representation of the running tasks using the RecoverTask() // method below. InstUUID string }
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.