Documentation ¶
Index ¶
- func DefaultConfig() *config.Config
- type AllocRunner
- func (r *AllocRunner) Alloc() *structs.Allocation
- func (r *AllocRunner) Destroy()
- func (r *AllocRunner) DestroyContext() error
- func (r *AllocRunner) DestroyState() error
- func (r *AllocRunner) RestoreState() error
- func (r *AllocRunner) Run()
- func (r *AllocRunner) SaveState() error
- func (r *AllocRunner) Update(update *structs.Allocation)
- func (r *AllocRunner) WaitCh() <-chan struct{}
- type AllocStateUpdater
- type Client
- func (c *Client) Leave() error
- func (c *Client) Node() *structs.Node
- func (c *Client) RPC(method string, args interface{}, reply interface{}) error
- func (c *Client) Servers() []string
- func (c *Client) SetServers(servers []string)
- func (c *Client) Shutdown() error
- func (c *Client) Stats() map[string]map[string]string
- type ConsulService
- type TaskRunner
- type TaskStateUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶
DefaultConfig returns the default configuration
Types ¶
type AllocRunner ¶
type AllocRunner struct { RestartPolicy *structs.RestartPolicy // contains filtered or unexported fields }
AllocRunner is used to wrap an allocation and provide the execution context.
func NewAllocRunner ¶
func NewAllocRunner(logger *log.Logger, config *config.Config, updater AllocStateUpdater, alloc *structs.Allocation, consulService *ConsulService) *AllocRunner
NewAllocRunner is used to create a new allocation context
func (*AllocRunner) Alloc ¶
func (r *AllocRunner) Alloc() *structs.Allocation
Alloc returns the associated allocation
func (*AllocRunner) Destroy ¶
func (r *AllocRunner) Destroy()
Destroy is used to indicate that the allocation context should be destroyed
func (*AllocRunner) DestroyContext ¶
func (r *AllocRunner) DestroyContext() error
DestroyContext is used to destroy the context
func (*AllocRunner) DestroyState ¶
func (r *AllocRunner) DestroyState() error
DestroyState is used to cleanup after ourselves
func (*AllocRunner) RestoreState ¶
func (r *AllocRunner) RestoreState() error
RestoreState is used to restore the state of the alloc runner
func (*AllocRunner) Run ¶
func (r *AllocRunner) Run()
Run is a long running goroutine used to manage an allocation
func (*AllocRunner) SaveState ¶
func (r *AllocRunner) SaveState() error
SaveState is used to snapshot the state of the alloc runner if the fullSync is marked as false only the state of the Alloc Runner is snapshotted. If fullSync is marked as true, we snapshot all the Task Runners associated with the Alloc
func (*AllocRunner) Update ¶
func (r *AllocRunner) Update(update *structs.Allocation)
Update is used to update the allocation of the context
func (*AllocRunner) WaitCh ¶ added in v0.1.2
func (r *AllocRunner) WaitCh() <-chan struct{}
WaitCh returns a channel to wait for termination
type AllocStateUpdater ¶
type AllocStateUpdater func(alloc *structs.Allocation) error
AllocStateUpdater is used to update the status of an allocation
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to implement the client interaction with Nomad. Clients are expected to register as a schedulable node to the servers, and to run allocations as determined by the servers.
func (*Client) Servers ¶
Servers is used to return the current known servers list. When an agent is first started, this list comes directly from configuration files.
func (*Client) SetServers ¶
SetServers is used to modify the known servers list. This avoids forcing a config rollout + rolling restart and enables auto-join features. The full set of servers is passed to support adding and/or removing servers.
type ConsulService ¶ added in v0.2.1
type ConsulService struct {
// contains filtered or unexported fields
}
ConsulService is the service which tracks tasks and syncs the services and checks defined in them with Consul Agent
func NewConsulService ¶ added in v0.2.1
func NewConsulService(logger *log.Logger, consulAddr string, token string, auth string, enableSSL bool, verifySSL bool) (*ConsulService, error)
A factory method to create new consul service
func (*ConsulService) Deregister ¶ added in v0.2.1
func (c *ConsulService) Deregister(task *structs.Task, allocID string) error
Deregister stops tracking a task for changes to it's services and checks and removes all the services and checks associated with the Task
func (*ConsulService) Register ¶ added in v0.2.1
func (c *ConsulService) Register(task *structs.Task, allocID string) error
Register starts tracking a task for changes to it's services and tasks and adds/removes services and checks associated with it.
func (*ConsulService) ShutDown ¶ added in v0.2.1
func (c *ConsulService) ShutDown()
func (*ConsulService) SyncWithConsul ¶ added in v0.2.1
func (c *ConsulService) SyncWithConsul()
SyncWithConsul is a long lived function that performs calls to sync checks and services periodically with Consul Agent
type TaskRunner ¶
type TaskRunner struct {
// contains filtered or unexported fields
}
TaskRunner is used to wrap a task within an allocation and provide the execution context.
func NewTaskRunner ¶
func NewTaskRunner(logger *log.Logger, config *config.Config, updater TaskStateUpdater, ctx *driver.ExecContext, allocID string, task *structs.Task, state *structs.TaskState, restartTracker restartTracker, consulService *ConsulService) *TaskRunner
NewTaskRunner is used to create a new task context
func (*TaskRunner) Destroy ¶
func (r *TaskRunner) Destroy()
Destroy is used to indicate that the task context should be destroyed
func (*TaskRunner) DestroyState ¶
func (r *TaskRunner) DestroyState() error
DestroyState is used to cleanup after ourselves
func (*TaskRunner) RestoreState ¶
func (r *TaskRunner) RestoreState() error
RestoreState is used to restore our state
func (*TaskRunner) Run ¶
func (r *TaskRunner) Run()
Run is a long running routine used to manage the task
func (*TaskRunner) SaveState ¶
func (r *TaskRunner) SaveState() error
SaveState is used to snapshot our state
func (*TaskRunner) Update ¶
func (r *TaskRunner) Update(update *structs.Task)
Update is used to update the task of the context
func (*TaskRunner) WaitCh ¶
func (r *TaskRunner) WaitCh() <-chan struct{}
WaitCh returns a channel to wait for termination
type TaskStateUpdater ¶
type TaskStateUpdater func(taskName string)
TaskStateUpdater is used to signal that tasks state has changed.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Functions shared between linux/darwin.
|
Functions shared between linux/darwin. |
executor
Package executor is used to invoke child processes across various operating systems in a way that provides the following features: - Least privilege - Resource constraints - Process isolation An operating system may be something like "windows" or "linux with systemd".
|
Package executor is used to invoke child processes across various operating systems in a way that provides the following features: - Least privilege - Resource constraints - Process isolation An operating system may be something like "windows" or "linux with systemd". |