Documentation ¶
Index ¶
- Constants
- Variables
- func Decode(buf []byte, out interface{}) error
- func DispatchedID(templateID string, t time.Time) string
- func Encode(t MessageType, msg interface{}) ([]byte, error)
- func GenerateUUID() string
- func IsRecoverable(e error) bool
- func IsUniqueNamespace(key string) bool
- func NewRecoverableError(e error, recoverable bool) error
- func PathEscapesAllocDir(prefix, path string) (bool, error)
- func ScoreFit(node *Node, util *Resources) float64
- func ShouldDrainNode(status string) bool
- func UniqueNamespace(key string) string
- func ValidNodeStatus(status string) bool
- func VaultPoliciesSet(policies map[string]map[string]*Vault) []string
- type AllocListRequest
- type AllocListResponse
- type AllocListStub
- type AllocMetric
- type AllocSpecificRequest
- type AllocUpdateRequest
- type Allocation
- type AllocsGetRequest
- type AllocsGetResponse
- type Bitmap
- type Constraint
- type DeriveVaultTokenRequest
- type DeriveVaultTokenResponse
- type DesiredUpdates
- type DiffType
- type DispatchPayloadConfig
- type EphemeralDisk
- type EvalAckRequest
- type EvalAllocationsResponse
- type EvalDeleteRequest
- type EvalDequeueRequest
- type EvalDequeueResponse
- type EvalListRequest
- type EvalListResponse
- type EvalSpecificRequest
- type EvalUpdateRequest
- type Evaluation
- func (e *Evaluation) Copy() *Evaluation
- func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool, escaped bool) *Evaluation
- func (e *Evaluation) GoString() string
- func (e *Evaluation) MakePlan(j *Job) *Plan
- func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation
- func (e *Evaluation) ShouldBlock() bool
- func (e *Evaluation) ShouldEnqueue() bool
- func (e *Evaluation) TerminalStatus() bool
- type FieldDiff
- type FieldDiffs
- type GenericRequest
- type GenericResponse
- type Job
- func (j *Job) Canonicalize()
- func (j *Job) CombinedTaskMeta(groupName, taskName string) map[string]string
- func (j *Job) Copy() *Job
- func (j *Job) Diff(other *Job, contextual bool) (*JobDiff, error)
- func (j *Job) IsParameterized() bool
- func (j *Job) IsPeriodic() bool
- func (j *Job) LookupTaskGroup(name string) *TaskGroup
- func (j *Job) RequiredSignals() map[string]map[string][]string
- func (j *Job) Stub(summary *JobSummary) *JobListStub
- func (j *Job) Validate() error
- func (j *Job) VaultPolicies() map[string]map[string]*Vault
- type JobAllocationsResponse
- type JobChildrenSummary
- type JobDeregisterRequest
- type JobDeregisterResponse
- type JobDiff
- type JobDispatchRequest
- type JobDispatchResponse
- type JobEvaluateRequest
- type JobEvaluationsResponse
- type JobListRequest
- type JobListResponse
- type JobListStub
- type JobPlanRequest
- type JobPlanResponse
- type JobRegisterRequest
- type JobRegisterResponse
- type JobSpecificRequest
- type JobSummary
- type JobSummaryRequest
- type JobSummaryResponse
- type KeyringRequest
- type KeyringResponse
- type LogConfig
- type MessageType
- type NetworkIndex
- func (idx *NetworkIndex) AddAllocs(allocs []*Allocation) (collide bool)
- func (idx *NetworkIndex) AddReserved(n *NetworkResource) (collide bool)
- func (idx *NetworkIndex) AssignNetwork(ask *NetworkResource) (out *NetworkResource, err error)
- func (idx *NetworkIndex) Overcommitted() bool
- func (idx *NetworkIndex) Release()
- func (idx *NetworkIndex) SetNode(node *Node) (collide bool)
- type NetworkResource
- func (n *NetworkResource) Add(delta *NetworkResource)
- func (n *NetworkResource) Canonicalize()
- func (n *NetworkResource) Copy() *NetworkResource
- func (r *NetworkResource) Diff(other *NetworkResource, contextual bool) *ObjectDiff
- func (n *NetworkResource) GoString() string
- func (n *NetworkResource) MapLabelToValues(port_map map[string]int) map[string]int
- func (n *NetworkResource) MeetsMinResources() error
- type Node
- func (n *Node) ComputeClass() error
- func (n *Node) Copy() *Node
- func (n Node) HashInclude(field string, v interface{}) (bool, error)
- func (n Node) HashIncludeMap(field string, k, v interface{}) (bool, error)
- func (n *Node) Ready() bool
- func (n *Node) Stub() *NodeListStub
- func (n *Node) TerminalStatus() bool
- type NodeAllocsResponse
- type NodeClientAllocsResponse
- type NodeDeregisterRequest
- type NodeDrainUpdateResponse
- type NodeEvaluateRequest
- type NodeListRequest
- type NodeListResponse
- type NodeListStub
- type NodeRegisterRequest
- type NodeServerInfo
- type NodeSpecificRequest
- type NodeUpdateDrainRequest
- type NodeUpdateResponse
- type NodeUpdateStatusRequest
- type ObjectDiff
- type ObjectDiffs
- type ParameterizedJobConfig
- type PeriodicConfig
- type PeriodicForceRequest
- type PeriodicForceResponse
- type PeriodicLaunch
- type Plan
- type PlanAnnotations
- type PlanRequest
- type PlanResponse
- type PlanResult
- type Port
- type QueryMeta
- type QueryOptions
- type RPCInfo
- type RecoverableError
- type Resources
- func (r *Resources) Add(delta *Resources) error
- func (r *Resources) Canonicalize()
- func (r *Resources) Copy() *Resources
- func (r *Resources) Diff(other *Resources, contextual bool) *ObjectDiff
- func (r *Resources) DiskInBytes() int64
- func (r *Resources) GoString() string
- func (r *Resources) MeetsMinResources() error
- func (r *Resources) Merge(other *Resources)
- func (r *Resources) NetIndex(n *NetworkResource) int
- func (r *Resources) Superset(other *Resources) (bool, string)
- type RestartPolicy
- type ServerMember
- type ServerMembersResponse
- type Service
- type ServiceCheck
- type SingleAllocResponse
- type SingleEvalResponse
- type SingleJobResponse
- type SingleNodeResponse
- type Task
- func (t *Task) Canonicalize(job *Job, tg *TaskGroup)
- func (t *Task) Copy() *Task
- func (t *Task) Diff(other *Task, contextual bool) (*TaskDiff, error)
- func (t *Task) FindHostAndPortFor(portLabel string) (string, int)
- func (t *Task) GoString() string
- func (t *Task) Validate(ephemeralDisk *EphemeralDisk) error
- type TaskArtifact
- type TaskDiff
- type TaskDiffs
- type TaskEvent
- func (te *TaskEvent) Copy() *TaskEvent
- func (te *TaskEvent) GoString() string
- func (e *TaskEvent) SetDiskLimit(limit int64) *TaskEvent
- func (e *TaskEvent) SetDownloadError(err error) *TaskEvent
- func (e *TaskEvent) SetDriverError(err error) *TaskEvent
- func (e *TaskEvent) SetDriverMessage(m string) *TaskEvent
- func (e *TaskEvent) SetExitCode(c int) *TaskEvent
- func (e *TaskEvent) SetExitMessage(err error) *TaskEvent
- func (e *TaskEvent) SetFailedSibling(sibling string) *TaskEvent
- func (e *TaskEvent) SetFailsTask() *TaskEvent
- func (e *TaskEvent) SetKillError(err error) *TaskEvent
- func (e *TaskEvent) SetKillReason(r string) *TaskEvent
- func (e *TaskEvent) SetKillTimeout(timeout time.Duration) *TaskEvent
- func (e *TaskEvent) SetRestartDelay(delay time.Duration) *TaskEvent
- func (e *TaskEvent) SetRestartReason(reason string) *TaskEvent
- func (e *TaskEvent) SetSetupError(err error) *TaskEvent
- func (e *TaskEvent) SetSignal(s int) *TaskEvent
- func (e *TaskEvent) SetTaskSignal(s os.Signal) *TaskEvent
- func (e *TaskEvent) SetTaskSignalReason(r string) *TaskEvent
- func (e *TaskEvent) SetValidationError(err error) *TaskEvent
- func (e *TaskEvent) SetVaultRenewalError(err error) *TaskEvent
- type TaskGroup
- type TaskGroupDiff
- type TaskGroupDiffs
- type TaskGroupSummary
- type TaskState
- type Template
- type UpdateStrategy
- type Vault
- type VaultAccessor
- type VaultAccessorsRequest
- type VersionResponse
- type WriteMeta
- type WriteRequest
Constants ¶
const ( // MinDynamicPort is the smallest dynamic port generated MinDynamicPort = 20000 // MaxDynamicPort is the largest dynamic port generated MaxDynamicPort = 60000 )
const ( // IgnoreUnknownTypeFlag is set along with a MessageType // to indicate that the message type can be safely ignored // if it is not recognized. This is for future proofing, so // that new commands can be added in a way that won't cause // old servers to crash when the FSM attempts to process them. IgnoreUnknownTypeFlag MessageType = 128 // ApiMajorVersion is returned as part of the Status.Version request. // It should be incremented anytime the APIs are changed in a way // that would break clients for sane client versioning. ApiMajorVersion = 1 // ApiMinorVersion is returned as part of the Status.Version request. // It should be incremented anytime the APIs are changed to allow // for sane client versioning. Minor changes should be compatible // within the major version. ApiMinorVersion = 1 ProtocolVersion = "protocol" APIMajorVersion = "api.major" APIMinorVersion = "api.minor" )
const ( NodeStatusInit = "initializing" NodeStatusReady = "ready" NodeStatusDown = "down" )
const ( // JobTypeNomad is reserved for internal system tasks and is // always handled by the CoreScheduler. JobTypeCore = "_core" JobTypeService = "service" JobTypeBatch = "batch" JobTypeSystem = "system" )
const ( JobStatusPending = "pending" // Pending means the job is waiting on scheduling JobStatusRunning = "running" // Running means the job has non-terminal allocations JobStatusDead = "dead" // Dead means all evaluation's and allocations are terminal )
const ( // JobMinPriority is the minimum allowed priority JobMinPriority = 1 // JobDefaultPriority is the default priority if not // not specified. JobDefaultPriority = 50 // JobMaxPriority is the maximum allowed priority JobMaxPriority = 100 // Ensure CoreJobPriority is higher than any user // specified job so that it gets priority. This is important // for the system to remain healthy. CoreJobPriority = JobMaxPriority * 2 )
const ( // PeriodicSpecCron is used for a cron spec. PeriodicSpecCron = "cron" // PeriodicSpecTest is only used by unit tests. It is a sorted, comma // separated list of unix timestamps at which to launch. PeriodicSpecTest = "_internal_test" )
const ( DispatchPayloadForbidden = "forbidden" DispatchPayloadOptional = "optional" DispatchPayloadRequired = "required" // DispatchLaunchSuffix is the string appended to the parameterized job's ID // when dispatching instances of it. DispatchLaunchSuffix = "/dispatch-" )
const ( // RestartPolicyModeDelay causes an artificial delay till the next interval is // reached when the specified attempts have been reached in the interval. RestartPolicyModeDelay = "delay" // RestartPolicyModeFail causes a job to fail if the specified number of // attempts are reached within an interval. RestartPolicyModeFail = "fail" )
const ( // TODO add Consul TTL check ServiceCheckHTTP = "http" ServiceCheckTCP = "tcp" ServiceCheckScript = "script" )
const ( // TemplateChangeModeNoop marks that no action should be taken if the // template is re-rendered TemplateChangeModeNoop = "noop" // TemplateChangeModeSignal marks that the task should be signaled if the // template is re-rendered TemplateChangeModeSignal = "signal" // TemplateChangeModeRestart marks that the task should be restarted if the // template is re-rendered TemplateChangeModeRestart = "restart" )
const ( TaskStatePending = "pending" // The task is waiting to be run. TaskStateRunning = "running" // The task is currently running. TaskStateDead = "dead" // Terminal state of task. )
Set of possible states for a task.
const ( // TaskSetupFailure indicates that the task could not be started due to a // a setup failure. TaskSetupFailure = "Setup Failure" // TaskDriveFailure indicates that the task could not be started due to a // failure in the driver. TaskDriverFailure = "Driver Failure" // TaskReceived signals that the task has been pulled by the client at the // given timestamp. TaskReceived = "Received" // TaskFailedValidation indicates the task was invalid and as such was not // run. TaskFailedValidation = "Failed Validation" // TaskStarted signals that the task was started and its timestamp can be // used to determine the running length of the task. TaskStarted = "Started" // TaskTerminated indicates that the task was started and exited. TaskTerminated = "Terminated" // TaskKilling indicates a kill signal has been sent to the task. TaskKilling = "Killing" // TaskKilled indicates a user has killed the task. TaskKilled = "Killed" // TaskRestarting indicates that task terminated and is being restarted. TaskRestarting = "Restarting" // TaskNotRestarting indicates that the task has failed and is not being // restarted because it has exceeded its restart policy. TaskNotRestarting = "Not Restarting" // TaskRestartSignal indicates that the task has been signalled to be // restarted TaskRestartSignal = "Restart Signaled" // TaskSignaling indicates that the task is being signalled. TaskSignaling = "Signaling" // TaskDownloadingArtifacts means the task is downloading the artifacts // specified in the task. TaskDownloadingArtifacts = "Downloading Artifacts" // TaskArtifactDownloadFailed indicates that downloading the artifacts // failed. TaskArtifactDownloadFailed = "Failed Artifact Download" // TaskDiskExceeded indicates that one of the tasks in a taskgroup has // exceeded the requested disk resources. TaskDiskExceeded = "Disk Resources Exceeded" // TaskSiblingFailed indicates that a sibling task in the task group has // failed. TaskSiblingFailed = "Sibling task failed" // TaskDriverMessage is an informational event message emitted by // drivers such as when they're performing a long running action like // downloading an image. TaskDriverMessage = "Driver" )
const ( ConstraintDistinctHosts = "distinct_hosts" ConstraintRegex = "regexp" ConstraintVersion = "version" ConstraintSetContains = "set_contains" )
const ( // VaultChangeModeNoop takes no action when a new token is retrieved. VaultChangeModeNoop = "noop" // VaultChangeModeSignal signals the task when a new token is retrieved. VaultChangeModeSignal = "signal" // VaultChangeModeRestart restarts the task when a new token is retrieved. VaultChangeModeRestart = "restart" )
const ( AllocDesiredStatusRun = "run" // Allocation should run AllocDesiredStatusStop = "stop" // Allocation should stop AllocDesiredStatusEvict = "evict" // Allocation should stop, and was evicted )
const ( AllocClientStatusPending = "pending" AllocClientStatusRunning = "running" AllocClientStatusComplete = "complete" AllocClientStatusFailed = "failed" AllocClientStatusLost = "lost" )
const ( EvalStatusBlocked = "blocked" EvalStatusPending = "pending" EvalStatusComplete = "complete" EvalStatusFailed = "failed" EvalStatusCancelled = "canceled" )
const ( EvalTriggerJobRegister = "job-register" EvalTriggerJobDeregister = "job-deregister" EvalTriggerPeriodicJob = "periodic-job" EvalTriggerNodeUpdate = "node-update" EvalTriggerScheduled = "scheduled" EvalTriggerRollingUpdate = "rolling-update" EvalTriggerMaxPlans = "max-plan-attempts" )
const ( // CoreJobEvalGC is used for the garbage collection of evaluations // and allocations. We periodically scan evaluations in a terminal state, // in which all the corresponding allocations are also terminal. We // delete these out of the system to bound the state. CoreJobEvalGC = "eval-gc" // CoreJobNodeGC is used for the garbage collection of failed nodes. // We periodically scan nodes in a terminal state, and if they have no // corresponding allocations we delete these out of the system. CoreJobNodeGC = "node-gc" // CoreJobJobGC is used for the garbage collection of eligible jobs. We // periodically scan garbage collectible jobs and check if both their // evaluations and allocations are terminal. If so, we delete these out of // the system. CoreJobJobGC = "job-gc" // CoreJobForceGC is used to force garbage collection of all GCable objects. CoreJobForceGC = "force-gc" )
const (
BytesInMegabyte = 1024 * 1024
)
const ( // DefaultKillTimeout is the default timeout between signaling a task it // will be killed and killing it. DefaultKillTimeout = 5 * time.Second )
const ( // NodeUniqueNamespace is a prefix that can be appended to node meta or // attribute keys to mark them for exclusion in computed node class. NodeUniqueNamespace = "unique." )
const ( // PeriodicLaunchSuffix is the string appended to the periodic jobs ID // when launching derived instances of it. PeriodicLaunchSuffix = "/periodic-" )
Variables ¶
var ( ErrNoLeader = fmt.Errorf("No cluster leader") ErrNoRegionPath = fmt.Errorf("No path to region") )
var ( // AllocationIndexRegex is a regular expression to find the allocation index. AllocationIndexRegex = regexp.MustCompile(".+\\[(\\d+)\\]$") )
var HashiMsgpackHandle = func() *hcodec.MsgpackHandle { h := &hcodec.MsgpackHandle{RawToString: true} h.MapType = reflect.TypeOf(map[string]interface{}(nil)) return h }()
var MsgpackHandle = func() *codec.MsgpackHandle { h := &codec.MsgpackHandle{RawToString: true} h.MapType = reflect.TypeOf(map[string]interface{}(nil)) return h }()
msgpackHandle is a shared handle for encoding/decoding of structs
var ( // TemplateChangeModeInvalidError is the error for when an invalid change // mode is given TemplateChangeModeInvalidError = errors.New("Invalid change mode. Must be one of the following: noop, signal, restart") )
Functions ¶
func DispatchedID ¶ added in v0.5.3
DispatchedID returns an ID appropriate for a job dispatched against a particular parameterized job
func Encode ¶
func Encode(t MessageType, msg interface{}) ([]byte, error)
Encode is used to encode a MsgPack object with type prefix
func IsRecoverable ¶ added in v0.5.3
IsRecoverable returns true if error is a RecoverableError with Recoverable=true. Otherwise false is returned.
func IsUniqueNamespace ¶ added in v0.3.0
IsUniqueNamespace returns whether the key is under the unique namespace.
func NewRecoverableError ¶ added in v0.5.0
NewRecoverableError is used to wrap an error and mark it as recoverable or not.
func PathEscapesAllocDir ¶ added in v0.5.0
PathEscapesAllocDir returns if the given path escapes the allocation directory. The prefix allows adding a prefix if the path will be joined, for example a "task/local" prefix may be provided if the path will be joined against that prefix.
func ScoreFit ¶
ScoreFit is used to score the fit based on the Google work published here: http://www.columbia.edu/~cs2035/courses/ieor4405.S13/datacenter_scheduling.ppt This is equivalent to their BestFit v3
func ShouldDrainNode ¶
ShouldDrainNode checks if a given node status should trigger an evaluation. Some states don't require any further action.
func UniqueNamespace ¶ added in v0.3.0
UniqueNamespace takes a key and returns the key marked under the unique namespace.
func ValidNodeStatus ¶
ValidNodeStatus is used to check if a node status is valid
Types ¶
type AllocListRequest ¶
type AllocListRequest struct {
QueryOptions
}
AllocListRequest is used to request a list of allocations
type AllocListResponse ¶
type AllocListResponse struct { Allocations []*AllocListStub QueryMeta }
AllocListResponse is used for a list request
type AllocListStub ¶
type AllocListStub struct { ID string EvalID string Name string NodeID string JobID string TaskGroup string DesiredStatus string DesiredDescription string ClientStatus string ClientDescription string TaskStates map[string]*TaskState CreateIndex uint64 ModifyIndex uint64 CreateTime int64 }
AllocListStub is used to return a subset of alloc information
type AllocMetric ¶
type AllocMetric struct { // NodesEvaluated is the number of nodes that were evaluated NodesEvaluated int // NodesFiltered is the number of nodes filtered due to a constraint NodesFiltered int // NodesAvailable is the number of nodes available for evaluation per DC. NodesAvailable map[string]int // ClassFiltered is the number of nodes filtered by class ClassFiltered map[string]int // ConstraintFiltered is the number of failures caused by constraint ConstraintFiltered map[string]int // NodesExhausted is the number of nodes skipped due to being // exhausted of at least one resource NodesExhausted int // ClassExhausted is the number of nodes exhausted by class ClassExhausted map[string]int // DimensionExhausted provides the count by dimension or reason DimensionExhausted map[string]int // Scores is the scores of the final few nodes remaining // for placement. The top score is typically selected. Scores map[string]float64 // AllocationTime is a measure of how long the allocation // attempt took. This can affect performance and SLAs. AllocationTime time.Duration // CoalescedFailures indicates the number of other // allocations that were coalesced into this failed allocation. // This is to prevent creating many failed allocations for a // single task group. CoalescedFailures int }
AllocMetric is used to track various metrics while attempting to make an allocation. These are used to debug a job, or to better understand the pressure within the system.
func (*AllocMetric) Copy ¶ added in v0.3.0
func (a *AllocMetric) Copy() *AllocMetric
func (*AllocMetric) EvaluateNode ¶
func (a *AllocMetric) EvaluateNode()
func (*AllocMetric) ExhaustedNode ¶
func (a *AllocMetric) ExhaustedNode(node *Node, dimension string)
func (*AllocMetric) FilterNode ¶
func (a *AllocMetric) FilterNode(node *Node, constraint string)
type AllocSpecificRequest ¶
type AllocSpecificRequest struct { AllocID string QueryOptions }
AllocSpecificRequest is used to query a specific allocation
type AllocUpdateRequest ¶
type AllocUpdateRequest struct { // Alloc is the list of new allocations to assign Alloc []*Allocation // Job is the shared parent job of the allocations. // It is pulled out since it is common to reduce payload size. Job *Job WriteRequest }
AllocUpdateRequest is used to submit changes to allocations, either to cause evictions or to assign new allocaitons. Both can be done within a single transaction
type Allocation ¶
type Allocation struct { // ID of the allocation (UUID) ID string // ID of the evaluation that generated this allocation EvalID string // Name is a logical name of the allocation. Name string // NodeID is the node this is being placed on NodeID string // Job is the parent job of the task group being allocated. // This is copied at allocation time to avoid issues if the job // definition is updated. JobID string Job *Job // TaskGroup is the name of the task group that should be run TaskGroup string // Resources is the total set of resources allocated as part // of this allocation of the task group. Resources *Resources // allocation SharedResources *Resources // TaskResources is the set of resources allocated to each // task. These should sum to the total Resources. TaskResources map[string]*Resources // Metrics associated with this allocation Metrics *AllocMetric // Desired Status of the allocation on the client DesiredStatus string // DesiredStatusDescription is meant to provide more human useful information DesiredDescription string // Status of the allocation on the client ClientStatus string // ClientStatusDescription is meant to provide more human useful information ClientDescription string // TaskStates stores the state of each task, TaskStates map[string]*TaskState // PreviousAllocation is the allocation that this allocation is replacing PreviousAllocation string // Raft Indexes CreateIndex uint64 ModifyIndex uint64 // AllocModifyIndex is not updated when the client updates allocations. This // lets the client pull only the allocs updated by the server. AllocModifyIndex uint64 // CreateTime is the time the allocation has finished scheduling and been // verified by the plan applier. CreateTime int64 }
Allocation is used to allocate the placement of a task group to a node.
func FilterTerminalAllocs ¶
func FilterTerminalAllocs(allocs []*Allocation) ([]*Allocation, map[string]*Allocation)
FilterTerminalAllocs filters out all allocations in a terminal state and returns the latest terminal allocations
func RemoveAllocs ¶
func RemoveAllocs(alloc []*Allocation, remove []*Allocation) []*Allocation
RemoveAllocs is used to remove any allocs with the given IDs from the list of allocations
func (*Allocation) Copy ¶ added in v0.3.0
func (a *Allocation) Copy() *Allocation
func (*Allocation) Index ¶ added in v0.3.1
func (a *Allocation) Index() int
Index returns the index of the allocation. If the allocation is from a task group with count greater than 1, there will be multiple allocations for it.
func (*Allocation) RanSuccessfully ¶ added in v0.4.0
func (a *Allocation) RanSuccessfully() bool
RanSuccessfully returns whether the client has ran the allocation and all tasks finished successfully
func (*Allocation) ShouldMigrate ¶ added in v0.5.0
func (a *Allocation) ShouldMigrate() bool
ShouldMigrate returns if the allocation needs data migration
func (*Allocation) Stub ¶
func (a *Allocation) Stub() *AllocListStub
Stub returns a list stub for the allocation
func (*Allocation) TerminalStatus ¶
func (a *Allocation) TerminalStatus() bool
TerminalStatus returns if the desired or actual status is terminal and will no longer transition.
func (*Allocation) Terminated ¶ added in v0.5.0
func (a *Allocation) Terminated() bool
Terminated returns if the allocation is in a terminal state on a client.
type AllocsGetRequest ¶ added in v0.3.0
type AllocsGetRequest struct { AllocIDs []string QueryOptions }
AllocsGetRequest is used to query a set of allocations
type AllocsGetResponse ¶ added in v0.3.0
type AllocsGetResponse struct { Allocs []*Allocation QueryMeta }
AllocsGetResponse is used to return a set of allocations
type Bitmap ¶ added in v0.3.0
type Bitmap []byte
Bitmap is a simple uncompressed bitmap
func (Bitmap) Clear ¶ added in v0.3.0
func (b Bitmap) Clear()
Clear is used to efficiently clear the bitmap
func (Bitmap) IndexesInRange ¶ added in v0.4.1
IndexesInRange returns the indexes in which the values are either set or unset based on the passed parameter in the passed range
type Constraint ¶
type Constraint struct { LTarget string // Left-hand target RTarget string // Right-hand target Operand string // Constraint operand (<=, <, =, !=, >, >=), contains, near // contains filtered or unexported fields }
Constraints are used to restrict placement options.
func CopySliceConstraints ¶ added in v0.3.0
func CopySliceConstraints(s []*Constraint) []*Constraint
func EscapedConstraints ¶ added in v0.3.0
func EscapedConstraints(constraints []*Constraint) []*Constraint
EscapedConstraints takes a set of constraints and returns the set that escapes computed node classes.
func (*Constraint) Copy ¶ added in v0.3.0
func (c *Constraint) Copy() *Constraint
func (*Constraint) Equal ¶ added in v0.5.0
func (c *Constraint) Equal(o *Constraint) bool
Equal checks if two constraints are equal
func (*Constraint) String ¶
func (c *Constraint) String() string
func (*Constraint) Validate ¶ added in v0.2.0
func (c *Constraint) Validate() error
type DeriveVaultTokenRequest ¶ added in v0.5.0
type DeriveVaultTokenRequest struct { NodeID string SecretID string AllocID string Tasks []string QueryOptions }
DeriveVaultTokenRequest is used to request wrapped Vault tokens for the following tasks in the given allocation
type DeriveVaultTokenResponse ¶ added in v0.5.0
type DeriveVaultTokenResponse struct { // Tasks is a mapping between the task name and the wrapped token Tasks map[string]string // Error stores any error that occured. Errors are stored here so we can // communicate whether it is retriable Error *RecoverableError QueryMeta }
DeriveVaultTokenResponse returns the wrapped tokens for each requested task
type DesiredUpdates ¶ added in v0.4.0
type DesiredUpdates struct { Ignore uint64 Place uint64 Migrate uint64 Stop uint64 InPlaceUpdate uint64 DestructiveUpdate uint64 }
DesiredUpdates is the set of changes the scheduler would like to make given sufficient resources and cluster capacity.
type DispatchPayloadConfig ¶ added in v0.5.3
type DispatchPayloadConfig struct { // File specifies a relative path to where the input data should be written File string }
DispatchPayloadConfig configures how a task gets its input from a job dispatch
func (*DispatchPayloadConfig) Copy ¶ added in v0.5.3
func (d *DispatchPayloadConfig) Copy() *DispatchPayloadConfig
func (*DispatchPayloadConfig) Validate ¶ added in v0.5.3
func (d *DispatchPayloadConfig) Validate() error
type EphemeralDisk ¶ added in v0.5.0
type EphemeralDisk struct { // Sticky indicates whether the allocation is sticky to a node Sticky bool // SizeMB is the size of the local disk SizeMB int `mapstructure:"size"` // Migrate determines if Nomad client should migrate the allocation dir for // sticky allocations Migrate bool }
EphemeralDisk is an ephemeral disk object
func DefaultEphemeralDisk ¶ added in v0.5.0
func DefaultEphemeralDisk() *EphemeralDisk
DefaultEphemeralDisk returns a EphemeralDisk with default configurations
func (*EphemeralDisk) Copy ¶ added in v0.5.0
func (d *EphemeralDisk) Copy() *EphemeralDisk
Copy copies the EphemeralDisk struct and returns a new one
func (*EphemeralDisk) Validate ¶ added in v0.5.0
func (d *EphemeralDisk) Validate() error
Validate validates EphemeralDisk
type EvalAckRequest ¶
type EvalAckRequest struct { EvalID string Token string WriteRequest }
EvalAckRequest is used to Ack/Nack a specific evaluation
type EvalAllocationsResponse ¶
type EvalAllocationsResponse struct { Allocations []*AllocListStub QueryMeta }
EvalAllocationsResponse is used to return the allocations for an evaluation
type EvalDeleteRequest ¶
type EvalDeleteRequest struct { Evals []string Allocs []string WriteRequest }
EvalDeleteRequest is used for deleting an evaluation.
type EvalDequeueRequest ¶
type EvalDequeueRequest struct { Schedulers []string Timeout time.Duration SchedulerVersion uint16 WriteRequest }
EvalDequeueRequest is used when we want to dequeue an evaluation
type EvalDequeueResponse ¶
type EvalDequeueResponse struct { Eval *Evaluation Token string QueryMeta }
EvalDequeueResponse is used to return from a dequeue
type EvalListRequest ¶
type EvalListRequest struct {
QueryOptions
}
EvalListRequest is used to list the evaluations
type EvalListResponse ¶
type EvalListResponse struct { Evaluations []*Evaluation QueryMeta }
EvalListResponse is used for a list request
type EvalSpecificRequest ¶
type EvalSpecificRequest struct { EvalID string QueryOptions }
EvalSpecificRequest is used when we just need to specify a target evaluation
type EvalUpdateRequest ¶
type EvalUpdateRequest struct { Evals []*Evaluation EvalToken string WriteRequest }
EvalUpdateRequest is used for upserting evaluations.
type Evaluation ¶
type Evaluation struct { // ID is a randonly generated UUID used for this evaluation. This // is assigned upon the creation of the evaluation. ID string // Priority is used to control scheduling importance and if this job // can preempt other jobs. Priority int // Type is used to control which schedulers are available to handle // this evaluation. Type string // TriggeredBy is used to give some insight into why this Eval // was created. (Job change, node failure, alloc failure, etc). TriggeredBy string // JobID is the job this evaluation is scoped to. Evaluations cannot // be run in parallel for a given JobID, so we serialize on this. JobID string // JobModifyIndex is the modify index of the job at the time // the evaluation was created JobModifyIndex uint64 // NodeID is the node that was affected triggering the evaluation. NodeID string // NodeModifyIndex is the modify index of the node at the time // the evaluation was created NodeModifyIndex uint64 // Status of the evaluation Status string // StatusDescription is meant to provide more human useful information StatusDescription string // Wait is a minimum wait time for running the eval. This is used to // support a rolling upgrade. Wait time.Duration // NextEval is the evaluation ID for the eval created to do a followup. // This is used to support rolling upgrades, where we need a chain of evaluations. NextEval string // PreviousEval is the evaluation ID for the eval creating this one to do a followup. // This is used to support rolling upgrades, where we need a chain of evaluations. PreviousEval string // BlockedEval is the evaluation ID for a created blocked eval. A // blocked eval will be created if all allocations could not be placed due // to constraints or lacking resources. BlockedEval string // FailedTGAllocs are task groups which have allocations that could not be // made, but the metrics are persisted so that the user can use the feedback // to determine the cause. FailedTGAllocs map[string]*AllocMetric // ClassEligibility tracks computed node classes that have been explicitly // marked as eligible or ineligible. ClassEligibility map[string]bool // EscapedComputedClass marks whether the job has constraints that are not // captured by computed node classes. EscapedComputedClass bool // AnnotatePlan triggers the scheduler to provide additional annotations // during the evaluation. This should not be set during normal operations. AnnotatePlan bool // SnapshotIndex is the Raft index of the snapshot used to process the // evaluation. As such it will only be set once it has gone through the // scheduler. SnapshotIndex uint64 // QueuedAllocations is the number of unplaced allocations at the time the // evaluation was processed. The map is keyed by Task Group names. QueuedAllocations map[string]int // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
Evaluation is used anytime we need to apply business logic as a result of a change to our desired state (job specification) or the emergent state (registered nodes). When the inputs change, we need to "evaluate" them, potentially taking action (allocation of work) or doing nothing if the state of the world does not require it.
func (*Evaluation) Copy ¶
func (e *Evaluation) Copy() *Evaluation
func (*Evaluation) CreateBlockedEval ¶ added in v0.4.0
func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool, escaped bool) *Evaluation
CreateBlockedEval creates a blocked evaluation to followup this eval to place any failed allocations. It takes the classes marked explicitly eligible or ineligible and whether the job has escaped computed node classes.
func (*Evaluation) GoString ¶
func (e *Evaluation) GoString() string
func (*Evaluation) MakePlan ¶
func (e *Evaluation) MakePlan(j *Job) *Plan
MakePlan is used to make a plan from the given evaluation for a given Job
func (*Evaluation) NextRollingEval ¶
func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation
NextRollingEval creates an evaluation to followup this eval for rolling updates
func (*Evaluation) ShouldBlock ¶ added in v0.3.0
func (e *Evaluation) ShouldBlock() bool
ShouldBlock checks if a given evaluation should be entered into the blocked eval tracker.
func (*Evaluation) ShouldEnqueue ¶
func (e *Evaluation) ShouldEnqueue() bool
ShouldEnqueue checks if a given evaluation should be enqueued into the eval_broker
func (*Evaluation) TerminalStatus ¶
func (e *Evaluation) TerminalStatus() bool
TerminalStatus returns if the current status is terminal and will no longer transition.
type FieldDiffs ¶ added in v0.4.0
type FieldDiffs []*FieldDiff
For sorting FieldDiffs
func (FieldDiffs) Len ¶ added in v0.4.0
func (f FieldDiffs) Len() int
func (FieldDiffs) Less ¶ added in v0.4.0
func (f FieldDiffs) Less(i, j int) bool
func (FieldDiffs) Swap ¶ added in v0.4.0
func (f FieldDiffs) Swap(i, j int)
type GenericRequest ¶
type GenericRequest struct {
QueryOptions
}
GenericRequest is used to request where no specific information is needed.
type GenericResponse ¶
type GenericResponse struct {
WriteMeta
}
GenericResponse is used to respond to a request where no specific response information is needed.
type Job ¶
type Job struct { // Region is the Nomad region that handles scheduling this job Region string // ID is a unique identifier for the job per region. It can be // specified hierarchically like LineOfBiz/OrgName/Team/Project ID string // ParentID is the unique identifier of the job that spawned this job. ParentID string // Name is the logical name of the job used to refer to it. This is unique // per region, but not unique globally. Name string // Type is used to control various behaviors about the job. Most jobs // are service jobs, meaning they are expected to be long lived. // Some jobs are batch oriented meaning they run and then terminate. // This can be extended in the future to support custom schedulers. Type string // Priority is used to control scheduling importance and if this job // can preempt other jobs. Priority int // AllAtOnce is used to control if incremental scheduling of task groups // is allowed or if we must do a gang scheduling of the entire job. This // can slow down larger jobs if resources are not available. AllAtOnce bool `mapstructure:"all_at_once"` // Datacenters contains all the datacenters this job is allowed to span Datacenters []string // Constraints can be specified at a job level and apply to // all the task groups and tasks. Constraints []*Constraint // TaskGroups are the collections of task groups that this job needs // to run. Each task group is an atomic unit of scheduling and placement. TaskGroups []*TaskGroup // Update is used to control the update strategy Update UpdateStrategy // Periodic is used to define the interval the job is run at. Periodic *PeriodicConfig // ParameterizedJob is used to specify the job as a parameterized job // for dispatching. ParameterizedJob *ParameterizedJobConfig // Payload is the payload supplied when the job was dispatched. Payload []byte // Meta is used to associate arbitrary metadata with this // job. This is opaque to Nomad. Meta map[string]string // VaultToken is the Vault token that proves the submitter of the job has // access to the specified Vault policies. This field is only used to // transfer the token and is not stored after Job submission. VaultToken string `mapstructure:"vault_token"` // Job status Status string // StatusDescription is meant to provide more human useful information StatusDescription string // Raft Indexes CreateIndex uint64 ModifyIndex uint64 JobModifyIndex uint64 }
Job is the scope of a scheduling request to Nomad. It is the largest scoped object, and is a named collection of task groups. Each task group is further composed of tasks. A task group (TG) is the unit of scheduling however.
func (*Job) Canonicalize ¶ added in v0.4.1
func (j *Job) Canonicalize()
Canonicalize is used to canonicalize fields in the Job. This should be called when registering a Job.
func (*Job) CombinedTaskMeta ¶ added in v0.5.3
CombinedTaskMeta takes a TaskGroup and Task name and returns the combined meta data for the task. When joining Job, Group and Task Meta, the precedence is by deepest scope (Task > Group > Job).
func (*Job) Copy ¶ added in v0.3.0
Copy returns a deep copy of the Job. It is expected that callers use recover. This job can panic if the deep copy failed as it uses reflection.
func (*Job) Diff ¶ added in v0.4.0
Diff returns a diff of two jobs and a potential error if the Jobs are not diffable. If contextual diff is enabled, objects within the job will contain field information even if unchanged.
func (*Job) IsParameterized ¶ added in v0.5.3
IsParameterized returns whether a job is parameterized job.
func (*Job) IsPeriodic ¶ added in v0.2.2
IsPeriodic returns whether a job is periodic.
func (*Job) LookupTaskGroup ¶
LookupTaskGroup finds a task group by name
func (*Job) RequiredSignals ¶ added in v0.5.0
RequiredSignals returns a mapping of task groups to tasks to their required set of signals
func (*Job) Stub ¶
func (j *Job) Stub(summary *JobSummary) *JobListStub
Stub is used to return a summary of the job
type JobAllocationsResponse ¶
type JobAllocationsResponse struct { Allocations []*AllocListStub QueryMeta }
JobAllocationsResponse is used to return the allocations for a job
type JobChildrenSummary ¶ added in v0.5.3
JobChildrenSummary contains the summary of children job statuses
func (*JobChildrenSummary) Copy ¶ added in v0.5.3
func (jc *JobChildrenSummary) Copy() *JobChildrenSummary
Copy returns a new copy of a JobChildrenSummary
type JobDeregisterRequest ¶
type JobDeregisterRequest struct { JobID string WriteRequest }
JobDeregisterRequest is used for Job.Deregister endpoint to deregister a job as being a schedulable entity.
type JobDeregisterResponse ¶
type JobDeregisterResponse struct { EvalID string EvalCreateIndex uint64 JobModifyIndex uint64 QueryMeta }
JobDeregisterResponse is used to respond to a job deregistration
type JobDiff ¶ added in v0.4.0
type JobDiff struct { Type DiffType ID string Fields []*FieldDiff Objects []*ObjectDiff TaskGroups []*TaskGroupDiff }
JobDiff contains the diff of two jobs.
type JobDispatchRequest ¶ added in v0.5.3
type JobDispatchRequest struct { JobID string Payload []byte Meta map[string]string WriteRequest }
JobDispatchRequest is used to dispatch a job based on a parameterized job
type JobDispatchResponse ¶ added in v0.5.3
type JobEvaluateRequest ¶
type JobEvaluateRequest struct { JobID string WriteRequest }
JobEvaluateRequest is used when we just need to re-evaluate a target job
type JobEvaluationsResponse ¶
type JobEvaluationsResponse struct { Evaluations []*Evaluation QueryMeta }
JobEvaluationsResponse is used to return the evaluations for a job
type JobListRequest ¶
type JobListRequest struct {
QueryOptions
}
JobListRequest is used to parameterize a list request
type JobListResponse ¶
type JobListResponse struct { Jobs []*JobListStub QueryMeta }
JobListResponse is used for a list request
type JobListStub ¶
type JobListStub struct { ID string ParentID string Name string Type string Priority int Status string StatusDescription string JobSummary *JobSummary CreateIndex uint64 ModifyIndex uint64 JobModifyIndex uint64 }
JobListStub is used to return a subset of job information for the job list
type JobPlanRequest ¶ added in v0.4.0
type JobPlanRequest struct { Job *Job Diff bool // Toggles an annotated diff WriteRequest }
JobPlanRequest is used for the Job.Plan endpoint to trigger a dry-run evaluation of the Job.
type JobPlanResponse ¶ added in v0.4.0
type JobPlanResponse struct { // Annotations stores annotations explaining decisions the scheduler made. Annotations *PlanAnnotations // FailedTGAllocs is the placement failures per task group. FailedTGAllocs map[string]*AllocMetric // JobModifyIndex is the modification index of the job. The value can be // used when running `nomad run` to ensure that the Job wasn’t modified // since the last plan. If the job is being created, the value is zero. JobModifyIndex uint64 // CreatedEvals is the set of evaluations created by the scheduler. The // reasons for this can be rolling-updates or blocked evals. CreatedEvals []*Evaluation // Diff contains the diff of the job and annotations on whether the change // causes an in-place update or create/destroy Diff *JobDiff // NextPeriodicLaunch is the time duration till the job would be launched if // submitted. NextPeriodicLaunch time.Time WriteMeta }
JobPlanResponse is used to respond to a job plan request
type JobRegisterRequest ¶
type JobRegisterRequest struct { Job *Job // If EnforceIndex is set then the job will only be registered if the passed // JobModifyIndex matches the current Jobs index. If the index is zero, the // register only occurs if the job is new. EnforceIndex bool JobModifyIndex uint64 WriteRequest }
JobRegisterRequest is used for Job.Register endpoint to register a job as being a schedulable entity.
type JobRegisterResponse ¶
type JobRegisterResponse struct { EvalID string EvalCreateIndex uint64 JobModifyIndex uint64 QueryMeta }
JobRegisterResponse is used to respond to a job registration
type JobSpecificRequest ¶
type JobSpecificRequest struct { JobID string AllAllocs bool QueryOptions }
JobSpecificRequest is used when we just need to specify a target job
type JobSummary ¶ added in v0.4.1
type JobSummary struct { JobID string // Summmary contains the summary per task group for the Job Summary map[string]TaskGroupSummary // Children contains a summary for the children of this job. Children *JobChildrenSummary // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
JobSummary summarizes the state of the allocations of a job
func (*JobSummary) Copy ¶ added in v0.4.1
func (js *JobSummary) Copy() *JobSummary
Copy returns a new copy of JobSummary
type JobSummaryRequest ¶ added in v0.4.1
type JobSummaryRequest struct { JobID string QueryOptions }
JobSummaryRequest is used when we just need to get a specific job summary
type JobSummaryResponse ¶ added in v0.4.1
type JobSummaryResponse struct { JobSummary *JobSummary QueryMeta }
JobSummaryResponse is used to return a single job summary
type KeyringRequest ¶ added in v0.5.0
type KeyringRequest struct {
Key string
}
KeyringRequest is request objects for serf key operations.
type KeyringResponse ¶ added in v0.5.0
KeyringResponse is a unified key response and can be used for install, remove, use, as well as listing key queries.
type LogConfig ¶ added in v0.3.0
type LogConfig struct { MaxFiles int `mapstructure:"max_files"` MaxFileSizeMB int `mapstructure:"max_file_size"` }
LogConfig provides configuration for log rotation
func DefaultLogConfig ¶ added in v0.3.0
func DefaultLogConfig() *LogConfig
DefaultLogConfig returns the default LogConfig values.
type MessageType ¶
type MessageType uint8
const ( NodeRegisterRequestType MessageType = iota NodeDeregisterRequestType NodeUpdateStatusRequestType NodeUpdateDrainRequestType JobRegisterRequestType JobDeregisterRequestType EvalUpdateRequestType EvalDeleteRequestType AllocUpdateRequestType AllocClientUpdateRequestType ReconcileJobSummariesRequestType VaultAccessorRegisterRequestType VaultAccessorDegisterRequestType )
type NetworkIndex ¶
type NetworkIndex struct { AvailNetworks []*NetworkResource // List of available networks AvailBandwidth map[string]int // Bandwidth by device UsedPorts map[string]Bitmap // Ports by IP UsedBandwidth map[string]int // Bandwidth by device }
NetworkIndex is used to index the available network resources and the used network resources on a machine given allocations
func NewNetworkIndex ¶
func NewNetworkIndex() *NetworkIndex
NewNetworkIndex is used to construct a new network index
func (*NetworkIndex) AddAllocs ¶
func (idx *NetworkIndex) AddAllocs(allocs []*Allocation) (collide bool)
AddAllocs is used to add the used network resources. Returns true if there is a collision
func (*NetworkIndex) AddReserved ¶
func (idx *NetworkIndex) AddReserved(n *NetworkResource) (collide bool)
AddReserved is used to add a reserved network usage, returns true if there is a port collision
func (*NetworkIndex) AssignNetwork ¶
func (idx *NetworkIndex) AssignNetwork(ask *NetworkResource) (out *NetworkResource, err error)
AssignNetwork is used to assign network resources given an ask. If the ask cannot be satisfied, returns nil
func (*NetworkIndex) Overcommitted ¶
func (idx *NetworkIndex) Overcommitted() bool
Overcommitted checks if the network is overcommitted
func (*NetworkIndex) Release ¶ added in v0.3.0
func (idx *NetworkIndex) Release()
Release is called when the network index is no longer needed to attempt to re-use some of the memory it has allocated
func (*NetworkIndex) SetNode ¶
func (idx *NetworkIndex) SetNode(node *Node) (collide bool)
SetNode is used to setup the available network resources. Returns true if there is a collision
type NetworkResource ¶
type NetworkResource struct { Device string // Name of the device CIDR string // CIDR block of addresses IP string // IP address MBits int // Throughput ReservedPorts []Port // Reserved ports DynamicPorts []Port // Dynamically assigned ports }
NetworkResource is used to represent available network resources
func (*NetworkResource) Add ¶
func (n *NetworkResource) Add(delta *NetworkResource)
Add adds the resources of the delta to this, potentially returning an error if not possible.
func (*NetworkResource) Canonicalize ¶ added in v0.4.1
func (n *NetworkResource) Canonicalize()
func (*NetworkResource) Copy ¶
func (n *NetworkResource) Copy() *NetworkResource
Copy returns a deep copy of the network resource
func (*NetworkResource) Diff ¶ added in v0.4.0
func (r *NetworkResource) Diff(other *NetworkResource, contextual bool) *ObjectDiff
Diff returns a diff of two network resources. If contextual diff is enabled, non-changed fields will still be returned.
func (*NetworkResource) GoString ¶
func (n *NetworkResource) GoString() string
func (*NetworkResource) MapLabelToValues ¶ added in v0.2.0
func (n *NetworkResource) MapLabelToValues(port_map map[string]int) map[string]int
func (*NetworkResource) MeetsMinResources ¶ added in v0.3.0
func (n *NetworkResource) MeetsMinResources() error
MeetsMinResources returns an error if the resources specified are less than the minimum allowed.
type Node ¶
type Node struct { // ID is a unique identifier for the node. It can be constructed // by doing a concatenation of the Name and Datacenter as a simple // approach. Alternatively a UUID may be used. ID string // SecretID is an ID that is only known by the Node and the set of Servers. // It is not accessible via the API and is used to authenticate nodes // conducting priviledged activities. SecretID string // Datacenter for this node Datacenter string // Node name Name string // HTTPAddr is the address on which the Nomad client is listening for http // requests HTTPAddr string // TLSEnabled indicates if the Agent has TLS enabled for the HTTP API TLSEnabled bool // Attributes is an arbitrary set of key/value // data that can be used for constraints. Examples // include "kernel.name=linux", "arch=386", "driver.docker=1", // "docker.runtime=1.8.3" Attributes map[string]string // Resources is the available resources on the client. // For example 'cpu=2' 'memory=2048' Resources *Resources // Reserved is the set of resources that are reserved, // and should be subtracted from the total resources for // the purposes of scheduling. This may be provide certain // high-watermark tolerances or because of external schedulers // consuming resources. Reserved *Resources // Links are used to 'link' this client to external // systems. For example 'consul=foo.dc1' 'aws=i-83212' // 'ami=ami-123' Links map[string]string // Meta is used to associate arbitrary metadata with this // client. This is opaque to Nomad. Meta map[string]string // NodeClass is an opaque identifier used to group nodes // together for the purpose of determining scheduling pressure. NodeClass string // ComputedClass is a unique id that identifies nodes with a common set of // attributes and capabilities. ComputedClass string // Drain is controlled by the servers, and not the client. // If true, no jobs will be scheduled to this node, and existing // allocations will be drained. Drain bool // Status of this node Status string // StatusDescription is meant to provide more human useful information StatusDescription string // StatusUpdatedAt is the time stamp at which the state of the node was // updated StatusUpdatedAt int64 // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
Node is a representation of a schedulable client node
func (*Node) ComputeClass ¶ added in v0.3.0
ComputeClass computes a derived class for the node based on its attributes. ComputedClass is a unique id that identifies nodes with a common set of attributes and capabilities. Thus, when calculating a node's computed class we avoid including any uniquely identifing fields.
func (Node) HashInclude ¶ added in v0.3.0
HashInclude is used to blacklist uniquely identifying node fields from being included in the computed node class.
func (Node) HashIncludeMap ¶ added in v0.3.0
HashIncludeMap is used to blacklist uniquely identifying node map keys from being included in the computed node class.
func (*Node) Stub ¶
func (n *Node) Stub() *NodeListStub
Stub returns a summarized version of the node
func (*Node) TerminalStatus ¶
TerminalStatus returns if the current status is terminal and will no longer transition.
type NodeAllocsResponse ¶
type NodeAllocsResponse struct { Allocs []*Allocation QueryMeta }
NodeAllocsResponse is used to return allocs for a single node
type NodeClientAllocsResponse ¶ added in v0.3.0
NodeClientAllocsResponse is used to return allocs meta data for a single node
type NodeDeregisterRequest ¶
type NodeDeregisterRequest struct { NodeID string WriteRequest }
NodeDeregisterRequest is used for Node.Deregister endpoint to deregister a node as being a schedulable entity.
type NodeDrainUpdateResponse ¶
type NodeDrainUpdateResponse struct { EvalIDs []string EvalCreateIndex uint64 NodeModifyIndex uint64 QueryMeta }
NodeDrainUpdateResponse is used to respond to a node drain update
type NodeEvaluateRequest ¶
type NodeEvaluateRequest struct { NodeID string WriteRequest }
NodeEvaluateRequest is used to re-evaluate the ndoe
type NodeListRequest ¶
type NodeListRequest struct {
QueryOptions
}
NodeListRequest is used to parameterize a list request
type NodeListResponse ¶
type NodeListResponse struct { Nodes []*NodeListStub QueryMeta }
JobListResponse is used for a list request
type NodeListStub ¶
type NodeListStub struct { ID string Datacenter string Name string NodeClass string Drain bool Status string StatusDescription string CreateIndex uint64 ModifyIndex uint64 }
NodeListStub is used to return a subset of job information for the job list
type NodeRegisterRequest ¶
type NodeRegisterRequest struct { Node *Node WriteRequest }
NodeRegisterRequest is used for Node.Register endpoint to register a node as being a schedulable entity.
type NodeServerInfo ¶ added in v0.4.0
type NodeServerInfo struct { // RPCAdvertiseAddr is the IP endpoint that a Nomad Server wishes to // be contacted at for RPCs. RPCAdvertiseAddr string // RpcMajorVersion is the major version number the Nomad Server // supports RPCMajorVersion int32 // RpcMinorVersion is the minor version number the Nomad Server // supports RPCMinorVersion int32 // Datacenter is the datacenter that a Nomad server belongs to Datacenter string }
NodeServerInfo is used to in NodeUpdateResponse to return Nomad server information used in RPC server lists.
type NodeSpecificRequest ¶
type NodeSpecificRequest struct { NodeID string SecretID string QueryOptions }
NodeSpecificRequest is used when we just need to specify a target node
type NodeUpdateDrainRequest ¶
type NodeUpdateDrainRequest struct { NodeID string Drain bool WriteRequest }
NodeUpdateDrainRequest is used for updatin the drain status
type NodeUpdateResponse ¶
type NodeUpdateResponse struct { HeartbeatTTL time.Duration EvalIDs []string EvalCreateIndex uint64 NodeModifyIndex uint64 // LeaderRPCAddr is the RPC address of the current Raft Leader. If // empty, the current Nomad Server is in the minority of a partition. LeaderRPCAddr string // NumNodes is the number of Nomad nodes attached to this quorum of // Nomad Servers at the time of the response. This value can // fluctuate based on the health of the cluster between heartbeats. NumNodes int32 // Servers is the full list of known Nomad servers in the local // region. Servers []*NodeServerInfo QueryMeta }
NodeUpdateResponse is used to respond to a node update
type NodeUpdateStatusRequest ¶
type NodeUpdateStatusRequest struct { NodeID string Status string WriteRequest }
NodeUpdateStatusRequest is used for Node.UpdateStatus endpoint to update the status of a node.
type ObjectDiff ¶ added in v0.4.0
type ObjectDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff }
ObjectDiff contains the diff of two generic objects.
func (*ObjectDiff) GoString ¶ added in v0.4.0
func (o *ObjectDiff) GoString() string
func (*ObjectDiff) Less ¶ added in v0.4.0
func (o *ObjectDiff) Less(other *ObjectDiff) bool
type ObjectDiffs ¶ added in v0.4.0
type ObjectDiffs []*ObjectDiff
For sorting ObjectDiffs
func (ObjectDiffs) Len ¶ added in v0.4.0
func (o ObjectDiffs) Len() int
func (ObjectDiffs) Less ¶ added in v0.4.0
func (o ObjectDiffs) Less(i, j int) bool
func (ObjectDiffs) Swap ¶ added in v0.4.0
func (o ObjectDiffs) Swap(i, j int)
type ParameterizedJobConfig ¶ added in v0.5.3
type ParameterizedJobConfig struct { // Payload configure the payload requirements Payload string // MetaRequired is metadata keys that must be specified by the dispatcher MetaRequired []string `mapstructure:"meta_required"` // MetaOptional is metadata keys that may be specified by the dispatcher MetaOptional []string `mapstructure:"meta_optional"` }
ParameterizedJobConfig is used to configure the parameterized job
func (*ParameterizedJobConfig) Canonicalize ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Canonicalize()
func (*ParameterizedJobConfig) Copy ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Copy() *ParameterizedJobConfig
func (*ParameterizedJobConfig) Validate ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Validate() error
type PeriodicConfig ¶ added in v0.2.2
type PeriodicConfig struct { // Enabled determines if the job should be run periodically. Enabled bool // Spec specifies the interval the job should be run as. It is parsed based // on the SpecType. Spec string // SpecType defines the format of the spec. SpecType string // ProhibitOverlap enforces that spawned jobs do not run in parallel. ProhibitOverlap bool `mapstructure:"prohibit_overlap"` }
Periodic defines the interval a job should be run at.
func (*PeriodicConfig) Copy ¶ added in v0.3.0
func (p *PeriodicConfig) Copy() *PeriodicConfig
func (*PeriodicConfig) Next ¶ added in v0.2.2
func (p *PeriodicConfig) Next(fromTime time.Time) time.Time
Next returns the closest time instant matching the spec that is after the passed time. If no matching instance exists, the zero value of time.Time is returned. The `time.Location` of the returned value matches that of the passed time.
func (*PeriodicConfig) Validate ¶ added in v0.2.2
func (p *PeriodicConfig) Validate() error
type PeriodicForceRequest ¶ added in v0.3.0
type PeriodicForceRequest struct { JobID string WriteRequest }
PeriodicForceReqeuest is used to force a specific periodic job.
type PeriodicForceResponse ¶ added in v0.3.0
PeriodicForceResponse is used to respond to a periodic job force launch
type PeriodicLaunch ¶ added in v0.3.0
type PeriodicLaunch struct { ID string // ID of the periodic job. Launch time.Time // The last launch time. // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
PeriodicLaunch tracks the last launch time of a periodic job.
type Plan ¶
type Plan struct { // EvalID is the evaluation ID this plan is associated with EvalID string // EvalToken is used to prevent a split-brain processing of // an evaluation. There should only be a single scheduler running // an Eval at a time, but this could be violated after a leadership // transition. This unique token is used to reject plans that are // being submitted from a different leader. EvalToken string // Priority is the priority of the upstream job Priority int // AllAtOnce is used to control if incremental scheduling of task groups // is allowed or if we must do a gang scheduling of the entire job. // If this is false, a plan may be partially applied. Otherwise, the // entire plan must be able to make progress. AllAtOnce bool // Job is the parent job of all the allocations in the Plan. // Since a Plan only involves a single Job, we can reduce the size // of the plan by only including it once. Job *Job // NodeUpdate contains all the allocations for each node. For each node, // this is a list of the allocations to update to either stop or evict. NodeUpdate map[string][]*Allocation // NodeAllocation contains all the allocations for each node. // The evicts must be considered prior to the allocations. NodeAllocation map[string][]*Allocation // Annotations contains annotations by the scheduler to be used by operators // to understand the decisions made by the scheduler. Annotations *PlanAnnotations }
Plan is used to submit a commit plan for task allocations. These are submitted to the leader which verifies that resources have not been overcommitted before admiting the plan.
func (*Plan) AppendAlloc ¶
func (p *Plan) AppendAlloc(alloc *Allocation)
func (*Plan) AppendUpdate ¶
func (p *Plan) AppendUpdate(alloc *Allocation, desiredStatus, desiredDesc, clientStatus string)
AppendUpdate marks the allocation for eviction. The clientStatus of the allocation may be optionally set by passing in a non-empty value.
func (*Plan) PopUpdate ¶
func (p *Plan) PopUpdate(alloc *Allocation)
type PlanAnnotations ¶ added in v0.4.0
type PlanAnnotations struct { // DesiredTGUpdates is the set of desired updates per task group. DesiredTGUpdates map[string]*DesiredUpdates }
PlanAnnotations holds annotations made by the scheduler to give further debug information to operators.
type PlanRequest ¶
type PlanRequest struct { Plan *Plan WriteRequest }
PlanRequest is used to submit an allocation plan to the leader
type PlanResponse ¶
type PlanResponse struct { Result *PlanResult WriteMeta }
PlanResponse is used to return from a PlanRequest
type PlanResult ¶
type PlanResult struct { // NodeUpdate contains all the updates that were committed. NodeUpdate map[string][]*Allocation // NodeAllocation contains all the allocations that were committed. NodeAllocation map[string][]*Allocation // RefreshIndex is the index the worker should refresh state up to. // This allows all evictions and allocations to be materialized. // If any allocations were rejected due to stale data (node state, // over committed) this can be used to force a worker refresh. RefreshIndex uint64 // AllocIndex is the Raft index in which the evictions and // allocations took place. This is used for the write index. AllocIndex uint64 }
PlanResult is the result of a plan submitted to the leader.
func (*PlanResult) FullCommit ¶
func (p *PlanResult) FullCommit(plan *Plan) (bool, int, int)
FullCommit is used to check if all the allocations in a plan were committed as part of the result. Returns if there was a match, and the number of expected and actual allocations.
func (*PlanResult) IsNoOp ¶
func (p *PlanResult) IsNoOp() bool
IsNoOp checks if this plan result would do nothing
type QueryMeta ¶
type QueryMeta struct { // This is the index associated with the read Index uint64 // If AllowStale is used, this is time elapsed since // last contact between the follower and leader. This // can be used to gauge staleness. LastContact time.Duration // Used to indicate if there is a known leader node KnownLeader bool }
QueryMeta allows a query response to include potentially useful metadata about a query
type QueryOptions ¶
type QueryOptions struct { // The target region for this query Region string // If set, wait until query exceeds given index. Must be provided // with MaxQueryTime. MinQueryIndex uint64 // Provided with MinQueryIndex to wait for change. MaxQueryTime time.Duration // If set, any follower can service the request. Results // may be arbitrarily stale. AllowStale bool // If set, used as prefix for resource list searches Prefix string }
QueryOptions is used to specify various flags for read queries
func (QueryOptions) AllowStaleRead ¶
func (q QueryOptions) AllowStaleRead() bool
func (QueryOptions) IsRead ¶
func (q QueryOptions) IsRead() bool
QueryOption only applies to reads, so always true
func (QueryOptions) RequestRegion ¶
func (q QueryOptions) RequestRegion() string
type RecoverableError ¶ added in v0.5.0
RecoverableError wraps an error and marks whether it is recoverable and could be retried or it is fatal.
func (*RecoverableError) Error ¶ added in v0.5.0
func (r *RecoverableError) Error() string
type Resources ¶
type Resources struct { CPU int MemoryMB int `mapstructure:"memory"` DiskMB int `mapstructure:"disk"` IOPS int Networks []*NetworkResource }
Resources is used to define the resources available on a client
func AllocsFit ¶
func AllocsFit(node *Node, allocs []*Allocation, netIdx *NetworkIndex) (bool, string, *Resources, error)
AllocsFit checks if a given set of allocations will fit on a node. The netIdx can optionally be provided if its already been computed. If the netIdx is provided, it is assumed that the client has already ensured there are no collisions.
func DefaultResources ¶ added in v0.3.0
func DefaultResources() *Resources
DefaultResources returns the default resources for a task.
func (*Resources) Add ¶
Add adds the resources of the delta to this, potentially returning an error if not possible.
func (*Resources) Canonicalize ¶ added in v0.4.1
func (r *Resources) Canonicalize()
func (*Resources) Diff ¶ added in v0.4.0
func (r *Resources) Diff(other *Resources, contextual bool) *ObjectDiff
Diff returns a diff of two resource objects. If contextual diff is enabled, non-changed fields will still be returned.
func (*Resources) DiskInBytes ¶ added in v0.5.0
DiskInBytes returns the amount of disk resources in bytes.
func (*Resources) MeetsMinResources ¶ added in v0.3.0
MeetsMinResources returns an error if the resources specified are less than the minimum allowed.
func (*Resources) NetIndex ¶
func (r *Resources) NetIndex(n *NetworkResource) int
NetIndex finds the matching net index using device name
type RestartPolicy ¶ added in v0.2.0
type RestartPolicy struct { // Attempts is the number of restart that will occur in an interval. Attempts int // Interval is a duration in which we can limit the number of restarts // within. Interval time.Duration // Delay is the time between a failure and a restart. Delay time.Duration // Mode controls what happens when the task restarts more than attempt times // in an interval. Mode string }
RestartPolicy configures how Tasks are restarted when they crash or fail.
func NewRestartPolicy ¶ added in v0.2.0
func NewRestartPolicy(jobType string) *RestartPolicy
func (*RestartPolicy) Copy ¶ added in v0.3.0
func (r *RestartPolicy) Copy() *RestartPolicy
func (*RestartPolicy) Validate ¶ added in v0.2.0
func (r *RestartPolicy) Validate() error
type ServerMember ¶ added in v0.5.0
type ServerMember struct { Name string Addr net.IP Port uint16 Tags map[string]string Status string ProtocolMin uint8 ProtocolMax uint8 ProtocolCur uint8 DelegateMin uint8 DelegateMax uint8 DelegateCur uint8 }
ServerMember holds information about a Nomad server agent in a cluster
type ServerMembersResponse ¶ added in v0.5.0
type ServerMembersResponse struct { ServerName string ServerRegion string ServerDC string Members []*ServerMember }
ServerMembersResponse has the list of servers in a cluster
type Service ¶ added in v0.2.0
type Service struct { // Name of the service registered with Consul. Consul defaults the // Name to ServiceID if not specified. The Name if specified is used // as one of the seed values when generating a Consul ServiceID. Name string // PortLabel is either the numeric port number or the `host:port`. // To specify the port number using the host's Consul Advertise // address, specify an empty host in the PortLabel (e.g. `:port`). PortLabel string `mapstructure:"port"` Tags []string // List of tags for the service Checks []*ServiceCheck // List of checks associated with the service }
Service represents a Consul service definition in Nomad
func (*Service) Canonicalize ¶ added in v0.4.1
Canonicalize interpolates values of Job, Task Group and Task in the Service Name. This also generates check names, service id and check ids.
func (*Service) Hash ¶ added in v0.2.1
Hash calculates the hash of the check based on it's content and the service which owns it
func (*Service) ValidateName ¶ added in v0.5.0
ValidateName checks if the services Name is valid and should be called after the name has been interpolated
type ServiceCheck ¶ added in v0.2.0
type ServiceCheck struct { Name string // Name of the check, defaults to id Type string // Type of the check - tcp, http, docker and script Command string // Command is the command to run for script checks Args []string // Args is a list of argumes for script checks Path string // path of the health check url for http type check Protocol string // Protocol to use if check is http, defaults to http PortLabel string `mapstructure:"port"` // The port to use for tcp/http checks Interval time.Duration // Interval of the check Timeout time.Duration // Timeout of the response from the check before consul fails the check InitialStatus string `mapstructure:"initial_status"` // Initial status of the check }
The ServiceCheck data model represents the consul health check that Nomad registers for a Task
func (*ServiceCheck) Canonicalize ¶ added in v0.4.1
func (sc *ServiceCheck) Canonicalize(serviceName string)
func (*ServiceCheck) Copy ¶ added in v0.3.0
func (sc *ServiceCheck) Copy() *ServiceCheck
func (*ServiceCheck) Hash ¶ added in v0.2.1
func (sc *ServiceCheck) Hash(serviceID string) string
func (*ServiceCheck) RequiresPort ¶ added in v0.3.2
func (sc *ServiceCheck) RequiresPort() bool
RequiresPort returns whether the service check requires the task has a port.
type SingleAllocResponse ¶
type SingleAllocResponse struct { Alloc *Allocation QueryMeta }
SingleAllocResponse is used to return a single allocation
type SingleEvalResponse ¶
type SingleEvalResponse struct { Eval *Evaluation QueryMeta }
SingleEvalResponse is used to return a single evaluation
type SingleJobResponse ¶
SingleJobResponse is used to return a single job
type SingleNodeResponse ¶
SingleNodeResponse is used to return a single node
type Task ¶
type Task struct { // Name of the task Name string // Driver is used to control which driver is used Driver string // User is used to determine which user will run the task. It defaults to // the same user the Nomad client is being run as. User string // Config is provided to the driver to initialize Config map[string]interface{} // Map of environment variables to be used by the driver Env map[string]string // List of service definitions exposed by the Task Services []*Service // Vault is used to define the set of Vault policies that this task should // have access to. Vault *Vault // Templates are the set of templates to be rendered for the task. Templates []*Template // Constraints can be specified at a task level and apply only to // the particular task. Constraints []*Constraint // Resources is the resources needed by this task Resources *Resources // DispatchPayload configures how the task retrieves its input from a dispatch DispatchPayload *DispatchPayloadConfig // Meta is used to associate arbitrary metadata with this // task. This is opaque to Nomad. Meta map[string]string // KillTimeout is the time between signaling a task that it will be // killed and killing it. KillTimeout time.Duration `mapstructure:"kill_timeout"` // LogConfig provides configuration for log rotation LogConfig *LogConfig `mapstructure:"logs"` // Artifacts is a list of artifacts to download and extract before running // the task. Artifacts []*TaskArtifact }
Task is a single process typically that is executed as part of a task group.
func (*Task) Canonicalize ¶ added in v0.4.1
Canonicalize canonicalizes fields in the task.
func (*Task) Diff ¶ added in v0.4.0
Diff returns a diff of two tasks. If contextual diff is enabled, objects within the task will contain field information even if unchanged.
func (*Task) FindHostAndPortFor ¶ added in v0.2.1
func (*Task) Validate ¶
func (t *Task) Validate(ephemeralDisk *EphemeralDisk) error
Validate is used to sanity check a task
type TaskArtifact ¶ added in v0.3.1
type TaskArtifact struct { // GetterSource is the source to download an artifact using go-getter GetterSource string `mapstructure:"source"` // GetterOptions are options to use when downloading the artifact using // go-getter. GetterOptions map[string]string `mapstructure:"options"` // RelativeDest is the download destination given relative to the task's // directory. RelativeDest string `mapstructure:"destination"` }
TaskArtifact is an artifact to download before running the task.
func (*TaskArtifact) Copy ¶ added in v0.3.1
func (ta *TaskArtifact) Copy() *TaskArtifact
func (*TaskArtifact) GoString ¶ added in v0.3.2
func (ta *TaskArtifact) GoString() string
func (*TaskArtifact) Validate ¶ added in v0.3.1
func (ta *TaskArtifact) Validate() error
type TaskDiff ¶ added in v0.4.0
type TaskDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff Annotations []string }
TaskDiff contains the diff of two Tasks
type TaskEvent ¶ added in v0.2.0
type TaskEvent struct { Type string Time int64 // Unix Nanosecond timestamp // FailsTask marks whether this event fails the task FailsTask bool // Restart fields. RestartReason string // Setup Failure fields. SetupError string // Driver Failure fields. DriverError string // A driver error occurred while starting the task. // Task Terminated Fields. ExitCode int // The exit code of the task. Signal int // The signal that terminated the task. Message string // A possible message explaining the termination of the task. // Killing fields KillTimeout time.Duration // Task Killed Fields. KillError string // Error killing the task. // KillReason is the reason the task was killed KillReason string // TaskRestarting fields. StartDelay int64 // The sleep period before restarting the task in unix nanoseconds. // Artifact Download fields DownloadError string // Error downloading artifacts // Validation fields ValidationError string // Validation error // The maximum allowed task disk size. DiskLimit int64 // Name of the sibling task that caused termination of the task that // the TaskEvent refers to. FailedSibling string // VaultError is the error from token renewal VaultError string // TaskSignalReason indicates the reason the task is being signalled. TaskSignalReason string // TaskSignal is the signal that was sent to the task TaskSignal string // DriverMessage indicates a driver action being taken. DriverMessage string }
TaskEvent is an event that effects the state of a task and contains meta-data appropriate to the events type.
func NewTaskEvent ¶ added in v0.2.0
func (*TaskEvent) SetDiskLimit ¶ added in v0.5.0
func (*TaskEvent) SetDownloadError ¶ added in v0.3.1
func (*TaskEvent) SetDriverError ¶ added in v0.2.0
func (*TaskEvent) SetDriverMessage ¶ added in v0.5.2
func (*TaskEvent) SetExitCode ¶ added in v0.2.0
func (*TaskEvent) SetExitMessage ¶ added in v0.2.0
func (*TaskEvent) SetFailedSibling ¶ added in v0.5.0
func (*TaskEvent) SetFailsTask ¶ added in v0.5.0
func (*TaskEvent) SetKillError ¶ added in v0.2.0
func (*TaskEvent) SetKillReason ¶ added in v0.5.0
func (*TaskEvent) SetKillTimeout ¶ added in v0.4.1
func (*TaskEvent) SetRestartDelay ¶ added in v0.3.1
func (*TaskEvent) SetRestartReason ¶ added in v0.3.2
func (*TaskEvent) SetSetupError ¶ added in v0.5.0
SetSetupError is used to store an error that occured while setting up the task
func (*TaskEvent) SetTaskSignal ¶ added in v0.5.0
func (*TaskEvent) SetTaskSignalReason ¶ added in v0.5.0
func (*TaskEvent) SetValidationError ¶ added in v0.3.2
func (*TaskEvent) SetVaultRenewalError ¶ added in v0.5.0
type TaskGroup ¶
type TaskGroup struct { // Name of the task group Name string // Count is the number of replicas of this task group that should // be scheduled. Count int // Constraints can be specified at a task group level and apply to // all the tasks contained. Constraints []*Constraint //RestartPolicy of a TaskGroup RestartPolicy *RestartPolicy // Tasks are the collection of tasks that this task group needs to run Tasks []*Task // EphemeralDisk is the disk resources that the task group requests EphemeralDisk *EphemeralDisk // Meta is used to associate arbitrary metadata with this // task group. This is opaque to Nomad. Meta map[string]string }
TaskGroup is an atomic unit of placement. Each task group belongs to a job and may contain any number of tasks. A task group support running in many replicas using the same configuration..
func (*TaskGroup) Canonicalize ¶ added in v0.4.1
Canonicalize is used to canonicalize fields in the TaskGroup.
func (*TaskGroup) Diff ¶ added in v0.4.0
func (tg *TaskGroup) Diff(other *TaskGroup, contextual bool) (*TaskGroupDiff, error)
Diff returns a diff of two task groups. If contextual diff is enabled, objects' fields will be stored even if no diff occurred as long as one field changed.
func (*TaskGroup) LookupTask ¶
LookupTask finds a task by name
type TaskGroupDiff ¶ added in v0.4.0
type TaskGroupDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff Tasks []*TaskDiff Updates map[string]uint64 }
TaskGroupDiff contains the diff of two task groups.
func (*TaskGroupDiff) GoString ¶ added in v0.4.0
func (tg *TaskGroupDiff) GoString() string
type TaskGroupDiffs ¶ added in v0.4.0
type TaskGroupDiffs []*TaskGroupDiff
For sorting TaskGroupDiffs
func (TaskGroupDiffs) Len ¶ added in v0.4.0
func (tg TaskGroupDiffs) Len() int
func (TaskGroupDiffs) Less ¶ added in v0.4.0
func (tg TaskGroupDiffs) Less(i, j int) bool
func (TaskGroupDiffs) Swap ¶ added in v0.4.0
func (tg TaskGroupDiffs) Swap(i, j int)
type TaskGroupSummary ¶ added in v0.4.1
type TaskGroupSummary struct { Queued int Complete int Failed int Running int Starting int Lost int }
TaskGroup summarizes the state of all the allocations of a particular TaskGroup
type TaskState ¶ added in v0.2.0
type TaskState struct { // The current state of the task. State string // Failed marks a task as having failed Failed bool // Series of task events that transition the state of the task. Events []*TaskEvent }
TaskState tracks the current state of a task and events that caused state transitions.
func (*TaskState) Successful ¶ added in v0.4.0
Successful returns whether a task finished successfully.
type Template ¶ added in v0.5.0
type Template struct { // SourcePath is the path to the template to be rendered SourcePath string `mapstructure:"source"` // DestPath is the path to where the template should be rendered DestPath string `mapstructure:"destination"` // EmbeddedTmpl store the raw template. This is useful for smaller templates // where they are embedded in the job file rather than sent as an artificat EmbeddedTmpl string `mapstructure:"data"` // ChangeMode indicates what should be done if the template is re-rendered ChangeMode string `mapstructure:"change_mode"` // ChangeSignal is the signal that should be sent if the change mode // requires it. ChangeSignal string `mapstructure:"change_signal"` // Splay is used to avoid coordinated restarts of processes by applying a // random wait between 0 and the given splay value before signalling the // application of a change Splay time.Duration `mapstructure:"splay"` }
Template represents a template configuration to be rendered for a given task
func DefaultTemplate ¶ added in v0.5.0
func DefaultTemplate() *Template
DefaultTemplate returns a default template.
func (*Template) Canonicalize ¶ added in v0.5.0
func (t *Template) Canonicalize()
type UpdateStrategy ¶
type UpdateStrategy struct { // Stagger is the amount of time between the updates Stagger time.Duration // MaxParallel is how many updates can be done in parallel MaxParallel int `mapstructure:"max_parallel"` }
UpdateStrategy is used to modify how updates are done
func (*UpdateStrategy) Rolling ¶
func (u *UpdateStrategy) Rolling() bool
Rolling returns if a rolling strategy should be used
type Vault ¶ added in v0.5.0
type Vault struct { // Policies is the set of policies that the task needs access to Policies []string // Env marks whether the Vault Token should be exposed as an environment // variable Env bool // ChangeMode is used to configure the task's behavior when the Vault // token changes because the original token could not be renewed in time. ChangeMode string `mapstructure:"change_mode"` // ChangeSignal is the signal sent to the task when a new token is // retrieved. This is only valid when using the signal change mode. ChangeSignal string `mapstructure:"change_signal"` }
Vault stores the set of premissions a task needs access to from Vault.
func DefaultVaultBlock ¶ added in v0.5.0
func DefaultVaultBlock() *Vault
func (*Vault) Canonicalize ¶ added in v0.5.0
func (v *Vault) Canonicalize()
type VaultAccessor ¶ added in v0.5.0
type VaultAccessor struct { AllocID string Task string NodeID string Accessor string CreationTTL int // Raft Indexes CreateIndex uint64 }
VaultAccessor is a reference to a created Vault token on behalf of an allocation's task.
type VaultAccessorsRequest ¶ added in v0.5.0
type VaultAccessorsRequest struct {
Accessors []*VaultAccessor
}
VaultAccessorsRequest is used to operate on a set of Vault accessors
type VersionResponse ¶
VersionResponse is used for the Status.Version reseponse
type WriteMeta ¶
type WriteMeta struct { // This is the index associated with the write Index uint64 }
WriteMeta allows a write response to include potentially useful metadata about the write
type WriteRequest ¶
type WriteRequest struct { // The target region for this write Region string }
func (WriteRequest) AllowStaleRead ¶
func (w WriteRequest) AllowStaleRead() bool
func (WriteRequest) IsRead ¶
func (w WriteRequest) IsRead() bool
WriteRequest only applies to writes, always false
func (WriteRequest) RequestRegion ¶
func (w WriteRequest) RequestRegion() string