structs

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: MPL-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Prefix based errors that are used to check if the error is of a given
	// type. These errors should be created with the associated constructor.
	ErrUnknownAllocationPrefix = "Unknown allocation"
	ErrUnknownNodePrefix       = "Unknown node"
	ErrUnknownJobPrefix        = "Unknown job"
	ErrUnknownEvaluationPrefix = "Unknown evaluation"
	ErrUnknownDeploymentPrefix = "Unknown deployment"
)
View Source
const (
	// MinDynamicPort is the smallest dynamic port generated
	MinDynamicPort = 20000

	// MaxDynamicPort is the largest dynamic port generated
	MaxDynamicPort = 32000
)
View Source
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"

	GetterModeAny  = "any"
	GetterModeFile = "file"
	GetterModeDir  = "dir"

	// ACLClientToken and ACLManagementToken are the only types of tokens
	ACLClientToken     = "client"
	ACLManagementToken = "management"

	// DefaultNamespace is the default namespace.
	DefaultNamespace            = "default"
	DefaultNamespaceDescription = "Default shared namespace"

	// JitterFraction is a the limit to the amount of jitter we apply
	// to a user specified MaxQueryTime. We divide the specified time by
	// the fraction. So 16 == 6.25% limit of jitter. This jitter is also
	// applied to RPCHoldTimeout.
	JitterFraction = 16

	// MaxRetainedNodeEvents is the maximum number of node events that will be
	// retained for a single node
	MaxRetainedNodeEvents = 10

	// MaxRetainedNodeScores is the number of top scoring nodes for which we
	// retain scoring metadata
	MaxRetainedNodeScores = 5

	// Normalized scorer name
	NormScorerName = "normalized-score"
)
View Source
const (
	NodeEventSubsystemDrain     = "Drain"
	NodeEventSubsystemDriver    = "Driver"
	NodeEventSubsystemHeartbeat = "Heartbeat"
	NodeEventSubsystemCluster   = "Cluster"
)
View Source
const (
	NodeStatusInit  = "initializing"
	NodeStatusReady = "ready"
	NodeStatusDown  = "down"
)
View Source
const (
	// NodeSchedulingEligible and Ineligible marks the node as eligible or not,
	// respectively, for receiving allocations. This is orthoginal to the node
	// status being ready.
	NodeSchedulingEligible   = "eligible"
	NodeSchedulingIneligible = "ineligible"
)
View Source
const (
	// JobTypeNomad is reserved for internal system tasks and is
	// always handled by the CoreScheduler.
	JobTypeCore    = "_core"
	JobTypeService = "service"
	JobTypeBatch   = "batch"
	JobTypeSystem  = "system"
)
View Source
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
)
View Source
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

	// JobTrackedVersions is the number of historic job versions that are
	// kept.
	JobTrackedVersions = 6
)
View Source
const (
	// Checks uses any registered health check state in combination with task
	// states to determine if a allocation is healthy.
	UpdateStrategyHealthCheck_Checks = "checks"

	// TaskStates uses the task states of an allocation to determine if the
	// allocation is healthy.
	UpdateStrategyHealthCheck_TaskStates = "task_states"

	// Manual allows the operator to manually signal to Nomad when an
	// allocations is healthy. This allows more advanced health checking that is
	// outside of the scope of Nomad.
	UpdateStrategyHealthCheck_Manual = "manual"
)
View Source
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"
)
View Source
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-"
)
View Source
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"

	// RestartPolicyMinInterval is the minimum interval that is accepted for a
	// restart policy.
	RestartPolicyMinInterval = 5 * time.Second

	// ReasonWithinPolicy describes restart events that are within policy
	ReasonWithinPolicy = "Restart within policy"
)
View Source
const (
	MigrateStrategyHealthChecks = "checks"
	MigrateStrategyHealthStates = "task_states"
)
View Source
const (
	ServiceCheckHTTP   = "http"
	ServiceCheckTCP    = "tcp"
	ServiceCheckScript = "script"
	ServiceCheckGRPC   = "grpc"
)
View Source
const (
	AddressModeAuto   = "auto"
	AddressModeHost   = "host"
	AddressModeDriver = "driver"
)
View Source
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"
)
View Source
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.

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

	// TaskBuildingTaskDir indicates that the task directory/chroot is being
	// built.
	TaskBuildingTaskDir = "Building Task Directory"

	// TaskSetup indicates the task runner is setting up the task environment
	TaskSetup = "Task Setup"

	// 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"

	// TaskLeaderDead indicates that the leader task within the has finished.
	TaskLeaderDead = "Leader Task Dead"

	// TaskHookFailed indicates that one of the hooks for a task failed.
	TaskHookFailed = "Task hook failed"

	// TaskRestoreFailed indicates Nomad was unable to reattach to a
	// restored task.
	TaskRestoreFailed = "Failed Restoring Task"
)
View Source
const (
	ConstraintDistinctProperty  = "distinct_property"
	ConstraintDistinctHosts     = "distinct_hosts"
	ConstraintRegex             = "regexp"
	ConstraintVersion           = "version"
	ConstraintSetContains       = "set_contains"
	ConstraintSetContainsAll    = "set_contains_all"
	ConstraintSetContainsAny    = "set_contains_any"
	ConstraintAttributeIsSet    = "is_set"
	ConstraintAttributeIsNotSet = "is_not_set"
)
View Source
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"
)
View Source
const (
	// DeploymentStatuses are the various states a deployment can be be in
	DeploymentStatusRunning    = "running"
	DeploymentStatusPaused     = "paused"
	DeploymentStatusFailed     = "failed"
	DeploymentStatusSuccessful = "successful"
	DeploymentStatusCancelled  = "cancelled"

	// DeploymentStatusDescriptions are the various descriptions of the states a
	// deployment can be in.
	DeploymentStatusDescriptionRunning               = "Deployment is running"
	DeploymentStatusDescriptionRunningNeedsPromotion = "Deployment is running but requires manual promotion"
	DeploymentStatusDescriptionRunningAutoPromotion  = "Deployment is running pending automatic promotion"
	DeploymentStatusDescriptionPaused                = "Deployment is paused"
	DeploymentStatusDescriptionSuccessful            = "Deployment completed successfully"
	DeploymentStatusDescriptionStoppedJob            = "Cancelled because job is stopped"
	DeploymentStatusDescriptionNewerJob              = "Cancelled due to newer version of job"
	DeploymentStatusDescriptionFailedAllocations     = "Failed due to unhealthy allocations"
	DeploymentStatusDescriptionProgressDeadline      = "Failed due to progress deadline"
	DeploymentStatusDescriptionFailedByUser          = "Deployment marked as failed"
)
View Source
const (
	AllocDesiredStatusRun   = "run"   // Allocation should run
	AllocDesiredStatusStop  = "stop"  // Allocation should stop
	AllocDesiredStatusEvict = "evict" // Allocation should stop, and was evicted
)
View Source
const (
	AllocClientStatusPending  = "pending"
	AllocClientStatusRunning  = "running"
	AllocClientStatusComplete = "complete"
	AllocClientStatusFailed   = "failed"
	AllocClientStatusLost     = "lost"
)
View Source
const (
	EvalStatusBlocked   = "blocked"
	EvalStatusPending   = "pending"
	EvalStatusComplete  = "complete"
	EvalStatusFailed    = "failed"
	EvalStatusCancelled = "canceled"
)
View Source
const (
	EvalTriggerJobRegister       = "job-register"
	EvalTriggerJobDeregister     = "job-deregister"
	EvalTriggerPeriodicJob       = "periodic-job"
	EvalTriggerNodeDrain         = "node-drain"
	EvalTriggerNodeUpdate        = "node-update"
	EvalTriggerAllocStop         = "alloc-stop"
	EvalTriggerScheduled         = "scheduled"
	EvalTriggerRollingUpdate     = "rolling-update"
	EvalTriggerDeploymentWatcher = "deployment-watcher"
	EvalTriggerFailedFollowUp    = "failed-follow-up"
	EvalTriggerMaxPlans          = "max-plan-attempts"
	EvalTriggerRetryFailedAlloc  = "alloc-failure"
	EvalTriggerQueuedAllocs      = "queued-allocs"
	EvalTriggerPreemption        = "preemption"
)
View Source
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"

	// CoreJobDeploymentGC is used for the garbage collection of eligible
	// deployments. We periodically scan garbage collectible deployments and
	// check if they are terminal. If so, we delete these out of the system.
	CoreJobDeploymentGC = "deployment-gc"

	// CoreJobForceGC is used to force garbage collection of all GCable objects.
	CoreJobForceGC = "force-gc"
)
View Source
const (
	BytesInMegabyte = 1024 * 1024
)
View Source
const (
	// DefaultKillTimeout is the default timeout between signaling a task it
	// will be killed and killing it.
	DefaultKillTimeout = 5 * time.Second
)
View Source
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."
)
View Source
const (
	// PeriodicLaunchSuffix is the string appended to the periodic jobs ID
	// when launching derived instances of it.
	PeriodicLaunchSuffix = "/periodic-"
)
View Source
const ReschedulePolicyMinDelay = 5 * time.Second
View Source
const ReschedulePolicyMinInterval = 15 * time.Second

Variables

View Source
var (
	ErrNoLeader            = errors.New(errNoLeader)
	ErrNoRegionPath        = errors.New(errNoRegionPath)
	ErrTokenNotFound       = errors.New(errTokenNotFound)
	ErrPermissionDenied    = errors.New(errPermissionDenied)
	ErrNoNodeConn          = errors.New(errNoNodeConn)
	ErrUnknownMethod       = errors.New(errUnknownMethod)
	ErrUnknownNomadVersion = errors.New(errUnknownNomadVersion)
	ErrNodeLacksRpc        = errors.New(errNodeLacksRpc)
)
View Source
var (
	DefaultServiceJobRestartPolicy = RestartPolicy{
		Delay:    15 * time.Second,
		Attempts: 2,
		Interval: 30 * time.Minute,
		Mode:     RestartPolicyModeFail,
	}
	DefaultBatchJobRestartPolicy = RestartPolicy{
		Delay:    15 * time.Second,
		Attempts: 3,
		Interval: 24 * time.Hour,
		Mode:     RestartPolicyModeFail,
	}
)
View Source
var (
	DefaultServiceJobReschedulePolicy = ReschedulePolicy{
		Delay:         30 * time.Second,
		DelayFunction: "exponential",
		MaxDelay:      1 * time.Hour,
		Unlimited:     true,
	}
	DefaultBatchJobReschedulePolicy = ReschedulePolicy{
		Attempts:      1,
		Interval:      24 * time.Hour,
		Delay:         5 * time.Second,
		DelayFunction: "constant",
	}
)
View Source
var (
	// JsonHandle and JsonHandlePretty are the codec handles to JSON encode
	// structs. The pretty handle will add indents for easier human consumption.
	JsonHandle = &codec.JsonHandle{
		HTMLCharsAsIs: true,
	}
	JsonHandlePretty = &codec.JsonHandle{
		HTMLCharsAsIs: true,
		Indent:        4,
	}
)
View Source
var (
	// AnonymousACLToken is used no SecretID is provided, and the
	// request is made anonymously.
	AnonymousACLToken = &ACLToken{
		AccessorID: "anonymous",
		Name:       "Anonymous Token",
		Type:       ACLClientToken,
		Policies:   []string{"anonymous"},
		Global:     false,
	}
)
View Source
var (
	// DefaultUpdateStrategy provides a baseline that can be used to upgrade
	// jobs with the old policy or for populating field defaults.
	DefaultUpdateStrategy = &UpdateStrategy{
		Stagger:          30 * time.Second,
		MaxParallel:      1,
		HealthCheck:      UpdateStrategyHealthCheck_Checks,
		MinHealthyTime:   10 * time.Second,
		HealthyDeadline:  5 * time.Minute,
		ProgressDeadline: 10 * time.Minute,
		AutoRevert:       false,
		AutoPromote:      false,
		Canary:           0,
	}
)
View Source
var HashiMsgpackHandle = func() *hcodec.MsgpackHandle {
	h := &hcodec.MsgpackHandle{RawToString: true}

	h.MapType = reflect.TypeOf(map[string]interface{}(nil))
	return h
}()

TODO Figure out if we can remove this. This is our fork that is just way behind. I feel like its original purpose was to pin at a stable version but now we can accomplish this with vendoring.

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

View Source
var RescheduleDelayFunctions = [...]string{"constant", "exponential", "fibonacci"}
View Source
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")
)
View Source
var (
	// VaultUnrecoverableError matches unrecoverable errors returned by a Vault
	// server
	VaultUnrecoverableError = regexp.MustCompile(`Code:\s+40(0|3|4)`)
)

Functions

func ACLPolicyListHash added in v0.7.0

func ACLPolicyListHash(policies []*ACLPolicy) string

ACLPolicyListHash returns a consistent hash for a set of policies.

func AllocName added in v0.6.0

func AllocName(job, group string, idx uint) string

AllocName returns the name of the allocation given the input.

func Bridge added in v0.8.0

func Bridge(a, b io.ReadWriteCloser)

Bridge is used to just link two connections together and copy traffic

func CompareMigrateToken added in v0.8.0

func CompareMigrateToken(allocID, nodeSecretID, otherMigrateToken string) bool

CompareMigrateToken returns true if two migration tokens can be computed and are equal.

func CompileACLObject added in v0.7.0

func CompileACLObject(cache *lru.TwoQueueCache, policies []*ACLPolicy) (*acl.ACL, error)

CompileACLObject compiles a set of ACL policies into an ACL object with a cache

func CronParseNext added in v0.8.2

func CronParseNext(e *cronexpr.Expression, fromTime time.Time, spec string) (t time.Time, err error)

CronParseNext is a helper that parses the next time for the given expression but captures any panic that may occur in the underlying library.

func Decode

func Decode(buf []byte, out interface{}) error

Decode is used to decode a MsgPack encoded object

func DenormalizeAllocationJobs added in v0.6.0

func DenormalizeAllocationJobs(job *Job, allocs []*Allocation)

DenormalizeAllocationJobs is used to attach a job to all allocations that are non-terminal and do not have a job already. This is useful in cases where the job is normalized.

func DeploymentStatusDescriptionNoRollbackTarget added in v0.6.1

func DeploymentStatusDescriptionNoRollbackTarget(baseDescription string) string

DeploymentStatusDescriptionNoRollbackTarget is used to get the status description of a deployment when there is no target to rollback to but autorevert is desired.

func DeploymentStatusDescriptionRollback added in v0.6.0

func DeploymentStatusDescriptionRollback(baseDescription string, jobVersion uint64) string

DeploymentStatusDescriptionRollback is used to get the status description of a deployment when rolling back to an older job.

func DeploymentStatusDescriptionRollbackNoop added in v0.7.1

func DeploymentStatusDescriptionRollbackNoop(baseDescription string, jobVersion uint64) string

DeploymentStatusDescriptionRollbackNoop is used to get the status description of a deployment when rolling back is not possible because it has the same specification

func DevicesEquals added in v0.9.0

func DevicesEquals(d1, d2 []*NodeDeviceResource) bool

DevicesEquals returns true if the two device arrays are set equal

func DispatchedID added in v0.5.3

func DispatchedID(templateID string, t time.Time) string

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 GenerateMigrateToken added in v0.8.0

func GenerateMigrateToken(allocID, nodeSecretID string) (string, error)

GenerateMigrateToken will create a token for a client to access an authenticated volume of another client to migrate data for sticky volumes.

func IsErrNoLeader added in v0.8.0

func IsErrNoLeader(err error) bool

IsErrNoLeader returns whether the error is due to there being no leader.

func IsErrNoNodeConn added in v0.8.0

func IsErrNoNodeConn(err error) bool

IsErrNoNodeConn returns whether the error is due to there being no path to the given node.

func IsErrNoRegionPath added in v0.8.0

func IsErrNoRegionPath(err error) bool

IsErrNoRegionPath returns whether the error is due to there being no path to the given region.

func IsErrNodeLacksRpc added in v0.8.0

func IsErrNodeLacksRpc(err error) bool

IsErrNodeLacksRpc returns whether error is due to a Nomad server being unable to connect to a client node because the client is too old (pre-v0.8).

func IsErrPermissionDenied added in v0.8.0

func IsErrPermissionDenied(err error) bool

IsErrPermissionDenied returns whether the error is due to the operation not being allowed due to lack of permissions.

func IsErrTokenNotFound added in v0.8.0

func IsErrTokenNotFound(err error) bool

IsErrTokenNotFound returns whether the error is due to the passed token not being resolvable.

func IsErrUnknownAllocation added in v0.8.0

func IsErrUnknownAllocation(err error) bool

IsErrUnknownAllocation returns whether the error is due to an unknown allocation.

func IsErrUnknownDeployment added in v0.8.0

func IsErrUnknownDeployment(err error) bool

IsErrUnknownDeployment returns whether the error is due to an unknown deployment.

func IsErrUnknownEvaluation added in v0.8.0

func IsErrUnknownEvaluation(err error) bool

IsErrUnknownEvaluation returns whether the error is due to an unknown evaluation.

func IsErrUnknownJob added in v0.8.0

func IsErrUnknownJob(err error) bool

IsErrUnknownJob returns whether the error is due to an unknown job.

func IsErrUnknownMethod added in v0.8.0

func IsErrUnknownMethod(err error) bool

IsErrUnknownMethod returns whether the error is due to the operation not being allowed due to lack of permissions.

func IsErrUnknownNode added in v0.8.0

func IsErrUnknownNode(err error) bool

IsErrUnknownNode returns whether the error is due to an unknown node.

func IsErrUnknownNomadVersion added in v0.8.0

func IsErrUnknownNomadVersion(err error) bool

IsErrUnknownNomadVersion returns whether the error is due to Nomad being unable to determine the version of a node.

func IsRecoverable added in v0.5.3

func IsRecoverable(e error) bool

IsRecoverable returns true if error is a RecoverableError with Recoverable=true. Otherwise false is returned.

func IsServerSide added in v0.8.0

func IsServerSide(e error) bool

IsServerSide returns true if error is a wrapped server side error

func IsUniqueNamespace added in v0.3.0

func IsUniqueNamespace(key string) bool

IsUniqueNamespace returns whether the key is under the unique namespace.

func MergeMultierrorWarnings added in v0.6.0

func MergeMultierrorWarnings(warnings ...error) string

MergeMultierrorWarnings takes job warnings and canonicalize warnings and merges them into a returnable string. Both the errors may be nil.

func NewErrUnknownAllocation added in v0.8.0

func NewErrUnknownAllocation(allocID string) error

NewErrUnknownAllocation returns a new error caused by the allocation being unknown.

func NewErrUnknownDeployment added in v0.8.0

func NewErrUnknownDeployment(deploymentID string) error

NewErrUnknownDeployment returns a new error caused by the deployment being unknown.

func NewErrUnknownEvaluation added in v0.8.0

func NewErrUnknownEvaluation(evaluationID string) error

NewErrUnknownEvaluation returns a new error caused by the evaluation being unknown.

func NewErrUnknownJob added in v0.8.0

func NewErrUnknownJob(jobID string) error

NewErrUnknownJob returns a new error caused by the job being unknown.

func NewErrUnknownNode added in v0.8.0

func NewErrUnknownNode(nodeID string) error

NewErrUnknownNode returns a new error caused by the node being unknown.

func NewRecoverableError added in v0.5.0

func NewRecoverableError(e error, recoverable bool) error

NewRecoverableError is used to wrap an error and mark it as recoverable or not.

func NewWrappedServerError added in v0.8.0

func NewWrappedServerError(e error) error

NewWrappedServerError is used to create a wrapped server side error

func ParsePortRanges added in v0.9.0

func ParsePortRanges(spec string) ([]uint64, error)

ParsePortRanges parses the passed port range string and returns a list of the ports. The specification is a comma separated list of either port numbers or port ranges. A port number is a single integer and a port range is two integers separated by a hyphen. As an example the following spec would convert to: ParsePortRanges("10,12-14,16") -> []uint64{10, 12, 13, 14, 16}

func PathEscapesAllocDir added in v0.5.0

func PathEscapesAllocDir(prefix, path string) (bool, error)

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

func ScoreFit(node *Node, util *ComparableResources) float64

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

func ShouldDrainNode(status string) bool

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

func UniqueNamespace(key string) string

UniqueNamespace takes a key and returns the key marked under the unique namespace.

func ValidNodeStatus

func ValidNodeStatus(status string) bool

ValidNodeStatus is used to check if a node status is valid

func VaultPoliciesSet added in v0.5.0

func VaultPoliciesSet(policies map[string]map[string]*Vault) []string

VaultPoliciesSet takes the structure returned by VaultPolicies and returns the set of required policies

func WrapRecoverable added in v0.5.6

func WrapRecoverable(msg string, err error) error

WrapRecoverable wraps an existing error in a new RecoverableError with a new message. If the error was recoverable before the returned error is as well; otherwise it is unrecoverable.

Types

type ACLPolicy added in v0.7.0

type ACLPolicy struct {
	Name        string // Unique name
	Description string // Human readable
	Rules       string // HCL or JSON format
	Hash        []byte
	CreateIndex uint64
	ModifyIndex uint64
}

ACLPolicy is used to represent an ACL policy

func (*ACLPolicy) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicy) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicy) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicy) CodecEncodeSelf(e *codec1978.Encoder)

func (*ACLPolicy) SetHash added in v0.7.0

func (c *ACLPolicy) SetHash() []byte

SetHash is used to compute and set the hash of the ACL policy

func (*ACLPolicy) Stub added in v0.7.0

func (a *ACLPolicy) Stub() *ACLPolicyListStub

func (*ACLPolicy) Validate added in v0.7.0

func (a *ACLPolicy) Validate() error

type ACLPolicyDeleteRequest added in v0.7.0

type ACLPolicyDeleteRequest struct {
	Names []string
	WriteRequest
}

ACLPolicyDeleteRequest is used to delete a set of policies

func (*ACLPolicyDeleteRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicyDeleteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicyDeleteRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicyDeleteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicyListRequest added in v0.7.0

type ACLPolicyListRequest struct {
	QueryOptions
}

ACLPolicyListRequest is used to request a list of policies

func (*ACLPolicyListRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicyListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicyListRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicyListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicyListResponse added in v0.7.0

type ACLPolicyListResponse struct {
	Policies []*ACLPolicyListStub
	QueryMeta
}

ACLPolicyListResponse is used for a list request

func (*ACLPolicyListResponse) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicyListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicyListResponse) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicyListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicyListStub added in v0.7.0

type ACLPolicyListStub struct {
	Name        string
	Description string
	Hash        []byte
	CreateIndex uint64
	ModifyIndex uint64
}

ACLPolicyListStub is used to for listing ACL policies

func (*ACLPolicyListStub) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicyListStub) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicyListStub) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicyListStub) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicySetRequest added in v0.7.0

type ACLPolicySetRequest struct {
	Names []string
	QueryOptions
}

ACLPolicySetRequest is used to query a set of policies

func (*ACLPolicySetRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicySetRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicySetRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicySetRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicySetResponse added in v0.7.0

type ACLPolicySetResponse struct {
	Policies map[string]*ACLPolicy
	QueryMeta
}

ACLPolicySetResponse is used to return a set of policies

func (*ACLPolicySetResponse) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicySetResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicySetResponse) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicySetResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicySpecificRequest added in v0.7.0

type ACLPolicySpecificRequest struct {
	Name string
	QueryOptions
}

ACLPolicySpecificRequest is used to query a specific policy

func (*ACLPolicySpecificRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicySpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicySpecificRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicySpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLPolicyUpsertRequest added in v0.7.0

type ACLPolicyUpsertRequest struct {
	Policies []*ACLPolicy
	WriteRequest
}

ACLPolicyUpsertRequest is used to upsert a set of policies

func (*ACLPolicyUpsertRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLPolicyUpsertRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLPolicyUpsertRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLPolicyUpsertRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLToken added in v0.7.0

type ACLToken struct {
	AccessorID  string   // Public Accessor ID (UUID)
	SecretID    string   // Secret ID, private (UUID)
	Name        string   // Human friendly name
	Type        string   // Client or Management
	Policies    []string // Policies this token ties to
	Global      bool     // Global or Region local
	Hash        []byte
	CreateTime  time.Time // Time of creation
	CreateIndex uint64
	ModifyIndex uint64
}

ACLToken represents a client token which is used to Authenticate

func (*ACLToken) CodecDecodeSelf added in v0.7.0

func (x *ACLToken) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLToken) CodecEncodeSelf added in v0.7.0

func (x *ACLToken) CodecEncodeSelf(e *codec1978.Encoder)

func (*ACLToken) PolicySubset added in v0.7.0

func (a *ACLToken) PolicySubset(policies []string) bool

PolicySubset checks if a given set of policies is a subset of the token

func (*ACLToken) SetHash added in v0.7.0

func (a *ACLToken) SetHash() []byte

SetHash is used to compute and set the hash of the ACL token

func (*ACLToken) Stub added in v0.7.0

func (a *ACLToken) Stub() *ACLTokenListStub

func (*ACLToken) Validate added in v0.7.0

func (a *ACLToken) Validate() error

Validate is used to sanity check a token

type ACLTokenBootstrapRequest added in v0.7.0

type ACLTokenBootstrapRequest struct {
	Token      *ACLToken // Not client specifiable
	ResetIndex uint64    // Reset index is used to clear the bootstrap token
	WriteRequest
}

ACLTokenBootstrapRequest is used to bootstrap ACLs

func (*ACLTokenBootstrapRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenBootstrapRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenBootstrapRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenBootstrapRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenDeleteRequest added in v0.7.0

type ACLTokenDeleteRequest struct {
	AccessorIDs []string
	WriteRequest
}

ACLTokenDeleteRequest is used to delete a set of tokens

func (*ACLTokenDeleteRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenDeleteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenDeleteRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenDeleteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenListRequest added in v0.7.0

type ACLTokenListRequest struct {
	GlobalOnly bool
	QueryOptions
}

ACLTokenListRequest is used to request a list of tokens

func (*ACLTokenListRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenListRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenListResponse added in v0.7.0

type ACLTokenListResponse struct {
	Tokens []*ACLTokenListStub
	QueryMeta
}

ACLTokenListResponse is used for a list request

func (*ACLTokenListResponse) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenListResponse) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenListStub added in v0.7.0

type ACLTokenListStub struct {
	AccessorID  string
	Name        string
	Type        string
	Policies    []string
	Global      bool
	Hash        []byte
	CreateTime  time.Time
	CreateIndex uint64
	ModifyIndex uint64
}

func (*ACLTokenListStub) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenListStub) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenListStub) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenListStub) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenSetRequest added in v0.7.0

type ACLTokenSetRequest struct {
	AccessorIDS []string
	QueryOptions
}

ACLTokenSetRequest is used to query a set of tokens

func (*ACLTokenSetRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenSetRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenSetRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenSetRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenSetResponse added in v0.7.0

type ACLTokenSetResponse struct {
	Tokens map[string]*ACLToken // Keyed by Accessor ID
	QueryMeta
}

ACLTokenSetResponse is used to return a set of token

func (*ACLTokenSetResponse) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenSetResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenSetResponse) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenSetResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenSpecificRequest added in v0.7.0

type ACLTokenSpecificRequest struct {
	AccessorID string
	QueryOptions
}

ACLTokenSpecificRequest is used to query a specific token

func (*ACLTokenSpecificRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenSpecificRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenUpsertRequest added in v0.7.0

type ACLTokenUpsertRequest struct {
	Tokens []*ACLToken
	WriteRequest
}

ACLTokenUpsertRequest is used to upsert a set of tokens

func (*ACLTokenUpsertRequest) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenUpsertRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenUpsertRequest) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenUpsertRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ACLTokenUpsertResponse added in v0.7.0

type ACLTokenUpsertResponse struct {
	Tokens []*ACLToken
	WriteMeta
}

ACLTokenUpsertResponse is used to return from an ACLTokenUpsertRequest

func (*ACLTokenUpsertResponse) CodecDecodeSelf added in v0.7.0

func (x *ACLTokenUpsertResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ACLTokenUpsertResponse) CodecEncodeSelf added in v0.7.0

func (x *ACLTokenUpsertResponse) CodecEncodeSelf(e *codec1978.Encoder)

type Affinities added in v0.9.2

type Affinities []*Affinity

func (*Affinities) CodecDecodeSelf added in v0.9.2

func (x *Affinities) CodecDecodeSelf(d *codec1978.Decoder)

func (Affinities) CodecEncodeSelf added in v0.9.2

func (x Affinities) CodecEncodeSelf(e *codec1978.Encoder)

func (*Affinities) Equals added in v0.9.2

func (xs *Affinities) Equals(ys *Affinities) bool

Equals compares Affinities as a set

type Affinity added in v0.9.0

type Affinity struct {
	LTarget string // Left-hand target
	RTarget string // Right-hand target
	Operand string // Affinity operand (<=, <, =, !=, >, >=), set_contains_all, set_contains_any
	Weight  int8   // Weight applied to nodes that match the affinity. Can be negative
	// contains filtered or unexported fields
}

Affinity is used to score placement options based on a weight

func CopySliceAffinities added in v0.9.0

func CopySliceAffinities(s []*Affinity) []*Affinity

func (*Affinity) CodecDecodeSelf added in v0.9.2

func (x *Affinity) CodecDecodeSelf(d *codec1978.Decoder)

func (*Affinity) CodecEncodeSelf added in v0.9.2

func (x *Affinity) CodecEncodeSelf(e *codec1978.Encoder)

func (*Affinity) Copy added in v0.9.0

func (a *Affinity) Copy() *Affinity

func (*Affinity) Equal added in v0.9.0

func (a *Affinity) Equal(o *Affinity) bool

func (*Affinity) Equals added in v0.9.2

func (a *Affinity) Equals(o *Affinity) bool

Equal checks if two affinities are equal

func (*Affinity) String added in v0.9.0

func (a *Affinity) String() string

func (*Affinity) Validate added in v0.9.0

func (a *Affinity) Validate() error

type AllocDeploymentStatus added in v0.6.0

type AllocDeploymentStatus struct {
	// Healthy marks whether the allocation has been marked healthy or unhealthy
	// as part of a deployment. It can be unset if it has neither been marked
	// healthy or unhealthy.
	Healthy *bool

	// Timestamp is the time at which the health status was set.
	Timestamp time.Time

	// Canary marks whether the allocation is a canary or not. A canary that has
	// been promoted will have this field set to false.
	Canary bool

	// ModifyIndex is the raft index in which the deployment status was last
	// changed.
	ModifyIndex uint64
}

AllocDeploymentStatus captures the status of the allocation as part of the deployment. This can include things like if the allocation has been marked as healthy.

func (*AllocDeploymentStatus) CodecDecodeSelf added in v0.6.1

func (x *AllocDeploymentStatus) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocDeploymentStatus) CodecEncodeSelf added in v0.6.1

func (x *AllocDeploymentStatus) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocDeploymentStatus) Copy added in v0.6.0

func (*AllocDeploymentStatus) HasHealth added in v0.8.0

func (a *AllocDeploymentStatus) HasHealth() bool

HasHealth returns true if the allocation has its health set.

func (*AllocDeploymentStatus) IsCanary added in v0.8.4

func (a *AllocDeploymentStatus) IsCanary() bool

IsCanary returns if the allocation is marked as a canary

func (*AllocDeploymentStatus) IsHealthy added in v0.6.0

func (a *AllocDeploymentStatus) IsHealthy() bool

IsHealthy returns if the allocation is marked as healthy as part of a deployment

func (*AllocDeploymentStatus) IsUnhealthy added in v0.6.0

func (a *AllocDeploymentStatus) IsUnhealthy() bool

IsUnhealthy returns if the allocation is marked as unhealthy as part of a deployment

type AllocListRequest

type AllocListRequest struct {
	QueryOptions
}

AllocListRequest is used to request a list of allocations

func (*AllocListRequest) CodecDecodeSelf added in v0.6.1

func (x *AllocListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocListRequest) CodecEncodeSelf added in v0.6.1

func (x *AllocListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocListResponse

type AllocListResponse struct {
	Allocations []*AllocListStub
	QueryMeta
}

AllocListResponse is used for a list request

func (*AllocListResponse) CodecDecodeSelf added in v0.6.1

func (x *AllocListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocListResponse) CodecEncodeSelf added in v0.6.1

func (x *AllocListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type AllocListStub

type AllocListStub struct {
	ID                    string
	EvalID                string
	Name                  string
	Namespace             string
	NodeID                string
	NodeName              string
	JobID                 string
	JobType               string
	JobVersion            uint64
	TaskGroup             string
	DesiredStatus         string
	DesiredDescription    string
	ClientStatus          string
	ClientDescription     string
	DesiredTransition     DesiredTransition
	TaskStates            map[string]*TaskState
	DeploymentStatus      *AllocDeploymentStatus
	FollowupEvalID        string
	RescheduleTracker     *RescheduleTracker
	PreemptedAllocations  []string
	PreemptedByAllocation string
	CreateIndex           uint64
	ModifyIndex           uint64
	CreateTime            int64
	ModifyTime            int64
}

AllocListStub is used to return a subset of alloc information

func (*AllocListStub) CodecDecodeSelf added in v0.6.1

func (x *AllocListStub) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocListStub) CodecEncodeSelf added in v0.6.1

func (x *AllocListStub) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocListStub) SetEventDisplayMessages added in v0.7.1

func (a *AllocListStub) SetEventDisplayMessages()

SetEventDisplayMessage populates the display message if its not already set, a temporary fix to handle old allocations that don't have it. This method will be removed in a future release.

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

	// QuotaExhausted provides the exhausted dimensions
	QuotaExhausted []string

	// Scores is the scores of the final few nodes remaining
	// for placement. The top score is typically selected.
	// Deprecated: Replaced by ScoreMetaData in Nomad 0.9
	Scores map[string]float64

	// ScoreMetaData is a slice of top scoring nodes displayed in the CLI
	ScoreMetaData []*NodeScoreMeta

	// 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
	// contains filtered or unexported fields
}

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) CodecDecodeSelf added in v0.6.1

func (x *AllocMetric) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocMetric) CodecEncodeSelf added in v0.6.1

func (x *AllocMetric) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocMetric) Copy added in v0.3.0

func (a *AllocMetric) Copy() *AllocMetric

func (*AllocMetric) EvaluateNode

func (a *AllocMetric) EvaluateNode()

func (*AllocMetric) ExhaustQuota added in v0.7.0

func (a *AllocMetric) ExhaustQuota(dimensions []string)

func (*AllocMetric) ExhaustedNode

func (a *AllocMetric) ExhaustedNode(node *Node, dimension string)

func (*AllocMetric) FilterNode

func (a *AllocMetric) FilterNode(node *Node, constraint string)

func (*AllocMetric) PopulateScoreMetaData added in v0.9.0

func (a *AllocMetric) PopulateScoreMetaData()

PopulateScoreMetaData populates a map of scorer to scoring metadata The map is populated by popping elements from a heap of top K scores maintained per scorer

func (*AllocMetric) ScoreNode

func (a *AllocMetric) ScoreNode(node *Node, name string, score float64)

ScoreNode is used to gather top K scoring nodes in a heap

type AllocRestartRequest added in v0.9.2

type AllocRestartRequest struct {
	AllocID  string
	TaskName string

	QueryOptions
}

AllocRestartRequest is used to restart a specific allocations tasks.

func (*AllocRestartRequest) CodecDecodeSelf added in v0.9.2

func (x *AllocRestartRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocRestartRequest) CodecEncodeSelf added in v0.9.2

func (x *AllocRestartRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocSignalRequest added in v0.9.2

type AllocSignalRequest struct {
	AllocID string
	Task    string
	Signal  string
	QueryOptions
}

AllocSignalRequest is used to signal a specific allocation

func (*AllocSignalRequest) CodecDecodeSelf added in v0.9.2

func (x *AllocSignalRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocSignalRequest) CodecEncodeSelf added in v0.9.2

func (x *AllocSignalRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocSpecificRequest

type AllocSpecificRequest struct {
	AllocID string
	QueryOptions
}

AllocSpecificRequest is used to query a specific allocation

func (*AllocSpecificRequest) CodecDecodeSelf added in v0.6.1

func (x *AllocSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocSpecificRequest) CodecEncodeSelf added in v0.6.1

func (x *AllocSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocStopRequest added in v0.9.2

type AllocStopRequest struct {
	AllocID string

	WriteRequest
}

AllocStopRequest is used to stop and reschedule a running Allocation.

func (*AllocStopRequest) CodecDecodeSelf added in v0.9.2

func (x *AllocStopRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocStopRequest) CodecEncodeSelf added in v0.9.2

func (x *AllocStopRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocStopResponse added in v0.9.2

type AllocStopResponse struct {
	// EvalID is the id of the follow up evalution for the rescheduled alloc.
	EvalID string

	WriteMeta
}

AllocStopResponse is the response to an `AllocStopRequest`

func (*AllocStopResponse) CodecDecodeSelf added in v0.9.2

func (x *AllocStopResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocStopResponse) CodecEncodeSelf added in v0.9.2

func (x *AllocStopResponse) CodecEncodeSelf(e *codec1978.Encoder)

type AllocUpdateDesiredTransitionRequest added in v0.8.0

type AllocUpdateDesiredTransitionRequest struct {
	// Allocs is the mapping of allocation ids to their desired state
	// transition
	Allocs map[string]*DesiredTransition

	// Evals is the set of evaluations to create
	Evals []*Evaluation

	WriteRequest
}

AllocUpdateDesiredTransitionRequest is used to submit changes to allocations desired transition state.

func (*AllocUpdateDesiredTransitionRequest) CodecDecodeSelf added in v0.8.0

func (x *AllocUpdateDesiredTransitionRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocUpdateDesiredTransitionRequest) CodecEncodeSelf added in v0.8.0

func (x *AllocUpdateDesiredTransitionRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocUpdateRequest

type AllocUpdateRequest struct {
	// COMPAT 0.11
	// Alloc is the list of new allocations to assign
	// Deprecated: Replaced with two separate slices, one containing stopped allocations
	// and another containing updated allocations
	Alloc []*Allocation

	// Allocations to stop. Contains only the diff, not the entire allocation
	AllocsStopped []*AllocationDiff

	// New or updated allocations
	AllocsUpdated []*Allocation

	// Evals is the list of new evaluations to create
	// Evals are valid only when used in the Raft RPC
	Evals []*Evaluation

	// 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 allocations. Both can be done within a single transaction

func (*AllocUpdateRequest) CodecDecodeSelf added in v0.6.1

func (x *AllocUpdateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocUpdateRequest) CodecEncodeSelf added in v0.6.1

func (x *AllocUpdateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocatedCpuResources added in v0.9.0

type AllocatedCpuResources struct {
	CpuShares int64
}

AllocatedCpuResources captures the allocated CPU resources.

func (*AllocatedCpuResources) Add added in v0.9.0

func (*AllocatedCpuResources) CodecDecodeSelf added in v0.9.2

func (x *AllocatedCpuResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedCpuResources) CodecEncodeSelf added in v0.9.2

func (x *AllocatedCpuResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedCpuResources) Subtract added in v0.9.0

func (a *AllocatedCpuResources) Subtract(delta *AllocatedCpuResources)

type AllocatedDeviceResource added in v0.9.0

type AllocatedDeviceResource struct {
	// Vendor, Type, and Name are used to select the plugin to request the
	// device IDs from.
	Vendor string
	Type   string
	Name   string

	// DeviceIDs is the set of allocated devices
	DeviceIDs []string
}

AllocatedDeviceResource captures a set of allocated devices.

func (*AllocatedDeviceResource) Add added in v0.9.0

func (*AllocatedDeviceResource) CodecDecodeSelf added in v0.9.2

func (x *AllocatedDeviceResource) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedDeviceResource) CodecEncodeSelf added in v0.9.2

func (x *AllocatedDeviceResource) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedDeviceResource) Copy added in v0.9.0

func (*AllocatedDeviceResource) ID added in v0.9.0

type AllocatedDevices added in v0.9.0

type AllocatedDevices []*AllocatedDeviceResource

func (*AllocatedDevices) CodecDecodeSelf added in v0.9.2

func (x *AllocatedDevices) CodecDecodeSelf(d *codec1978.Decoder)

func (AllocatedDevices) CodecEncodeSelf added in v0.9.2

func (x AllocatedDevices) CodecEncodeSelf(e *codec1978.Encoder)

func (AllocatedDevices) Index added in v0.9.0

Index finds the matching index using the passed device. If not found, -1 is returned.

type AllocatedMemoryResources added in v0.9.0

type AllocatedMemoryResources struct {
	MemoryMB int64
}

AllocatedMemoryResources captures the allocated memory resources.

func (*AllocatedMemoryResources) Add added in v0.9.0

func (*AllocatedMemoryResources) CodecDecodeSelf added in v0.9.2

func (x *AllocatedMemoryResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedMemoryResources) CodecEncodeSelf added in v0.9.2

func (x *AllocatedMemoryResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedMemoryResources) Subtract added in v0.9.0

type AllocatedResources added in v0.9.0

type AllocatedResources struct {
	// Tasks is a mapping of task name to the resources for the task.
	Tasks map[string]*AllocatedTaskResources

	// Shared is the set of resource that are shared by all tasks in the group.
	Shared AllocatedSharedResources
}

AllocatedResources is the set of resources to be used by an allocation.

func NodeResourcesToAllocatedResources added in v0.9.0

func NodeResourcesToAllocatedResources(n *NodeResources) *AllocatedResources

NodeResourcesToAllocatedResources converts a node resources to an allocated resources. The task name used is "web" and network is omitted. This is useful when trying to make an allocation fill an entire node.

func (*AllocatedResources) CodecDecodeSelf added in v0.9.2

func (x *AllocatedResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedResources) CodecEncodeSelf added in v0.9.2

func (x *AllocatedResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedResources) Comparable added in v0.9.0

func (a *AllocatedResources) Comparable() *ComparableResources

Comparable returns a comparable version of the allocations allocated resources. This conversion can be lossy so care must be taken when using it.

func (*AllocatedResources) Copy added in v0.9.0

func (*AllocatedResources) OldTaskResources added in v0.9.0

func (a *AllocatedResources) OldTaskResources() map[string]*Resources

OldTaskResources returns the pre-0.9.0 map of task resources

type AllocatedSharedResources added in v0.9.0

type AllocatedSharedResources struct {
	DiskMB int64
}

AllocatedSharedResources are the set of resources allocated to a task group.

func (*AllocatedSharedResources) Add added in v0.9.0

func (*AllocatedSharedResources) CodecDecodeSelf added in v0.9.2

func (x *AllocatedSharedResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedSharedResources) CodecEncodeSelf added in v0.9.2

func (x *AllocatedSharedResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedSharedResources) Subtract added in v0.9.0

type AllocatedTaskResources added in v0.9.0

type AllocatedTaskResources struct {
	Cpu      AllocatedCpuResources
	Memory   AllocatedMemoryResources
	Networks Networks
	Devices  []*AllocatedDeviceResource
}

AllocatedTaskResources are the set of resources allocated to a task.

func (*AllocatedTaskResources) Add added in v0.9.0

func (*AllocatedTaskResources) CodecDecodeSelf added in v0.9.2

func (x *AllocatedTaskResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocatedTaskResources) CodecEncodeSelf added in v0.9.2

func (x *AllocatedTaskResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*AllocatedTaskResources) Comparable added in v0.9.0

Comparable turns AllocatedTaskResources into ComparableResources as a helper step in preemption

func (*AllocatedTaskResources) Copy added in v0.9.0

func (*AllocatedTaskResources) NetIndex added in v0.9.0

func (a *AllocatedTaskResources) NetIndex(n *NetworkResource) int

NetIndex finds the matching net index using device name

func (*AllocatedTaskResources) Subtract added in v0.9.0

func (a *AllocatedTaskResources) Subtract(delta *AllocatedTaskResources)

Subtract only subtracts CPU and Memory resources. Network utilization is managed separately in NetworkIndex

type Allocation

type Allocation struct {

	// ID of the allocation (UUID)
	ID string

	// Namespace is the namespace the allocation is created in
	Namespace 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

	// NodeName is the name of the node this is being placed on.
	NodeName 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

	// COMPAT(0.11): Remove in 0.11
	// Resources is the total set of resources allocated as part
	// of this allocation of the task group. Dynamic ports will be set by
	// the scheduler.
	Resources *Resources

	// COMPAT(0.11): Remove in 0.11
	// SharedResources are the resources that are shared by all the tasks in an
	// allocation
	SharedResources *Resources

	// COMPAT(0.11): Remove in 0.11
	// TaskResources is the set of resources allocated to each
	// task. These should sum to the total Resources. Dynamic ports will be
	// set by the scheduler.
	TaskResources map[string]*Resources

	// AllocatedResources is the total resources allocated for the task group.
	AllocatedResources *AllocatedResources

	// 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

	// DesiredTransition is used to indicate that a state transition
	// is desired for a given reason.
	DesiredTransition DesiredTransition

	// 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

	// NextAllocation is the allocation that this allocation is being replaced by
	NextAllocation string

	// DeploymentID identifies an allocation as being created from a
	// particular deployment
	DeploymentID string

	// DeploymentStatus captures the status of the allocation as part of the
	// given deployment
	DeploymentStatus *AllocDeploymentStatus

	// RescheduleTrackers captures details of previous reschedule attempts of the allocation
	RescheduleTracker *RescheduleTracker

	// FollowupEvalID captures a follow up evaluation created to handle a failed allocation
	// that can be rescheduled in the future
	FollowupEvalID string

	// PreemptedAllocations captures IDs of any allocations that were preempted
	// in order to place this allocation
	PreemptedAllocations []string

	// PreemptedByAllocation tracks the alloc ID of the allocation that caused this allocation
	// to stop running because it got preempted
	PreemptedByAllocation 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

	// ModifyTime is the time the allocation was last updated.
	ModifyTime int64
	// contains filtered or unexported fields
}

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 MockAlloc added in v0.9.0

func MockAlloc() *Allocation

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) AllocationDiff added in v0.9.2

func (a *Allocation) AllocationDiff() *AllocationDiff

AllocationDiff converts an Allocation type to an AllocationDiff type If at any time, modification are made to AllocationDiff so that an Allocation can no longer be safely converted to AllocationDiff, this method should be changed accordingly.

func (*Allocation) ClientTerminalStatus added in v0.8.0

func (a *Allocation) ClientTerminalStatus() bool

ClientTerminalStatus returns if the client status is terminal and will no longer transition

func (*Allocation) CodecDecodeSelf added in v0.6.1

func (x *Allocation) CodecDecodeSelf(d *codec1978.Decoder)

func (*Allocation) CodecEncodeSelf added in v0.6.1

func (x *Allocation) CodecEncodeSelf(e *codec1978.Encoder)

func (*Allocation) ComparableResources added in v0.9.0

func (a *Allocation) ComparableResources() *ComparableResources

COMPAT(0.11): Remove in 0.11 ComparableResources returns the resouces on the allocation handling upgrade paths. After 0.11 calls to this should be replaced with: alloc.AllocatedResources.Comparable()

func (*Allocation) Copy added in v0.3.0

func (a *Allocation) Copy() *Allocation

Copy provides a copy of the allocation and deep copies the job

func (*Allocation) CopySkipJob added in v0.6.0

func (a *Allocation) CopySkipJob() *Allocation

CopySkipJob provides a copy of the allocation but doesn't deep copy the job

func (*Allocation) Index added in v0.3.1

func (a *Allocation) Index() uint

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) LastEventTime added in v0.8.0

func (a *Allocation) LastEventTime() time.Time

LastEventTime is the time of the last task event in the allocation. It is used to determine allocation failure time. If the FinishedAt field is not set, the alloc's modify time is used

func (*Allocation) LookupTask added in v0.9.0

func (a *Allocation) LookupTask(name string) *Task

LookupTask by name from the Allocation. Returns nil if the Job is not set, the TaskGroup does not exist, or the task name cannot be found.

func (*Allocation) NextDelay added in v0.8.0

func (a *Allocation) NextDelay() time.Duration

NextDelay returns a duration after which the allocation can be rescheduled. It is calculated according to the delay function and previous reschedule attempts.

func (*Allocation) NextRescheduleTime added in v0.8.0

func (a *Allocation) NextRescheduleTime() (time.Time, bool)

NextRescheduleTime returns a time on or after which the allocation is eligible to be rescheduled, and whether the next reschedule time is within policy's interval if the policy doesn't allow unlimited reschedules

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. Critically this function returns whether the allocation has ran to completion and not just that the alloc has converged to its desired state. That is to say that a batch allocation must have finished with exit code 0 on all task groups. This doesn't really have meaning on a non-batch allocation because a service and system allocation should not finish.

func (*Allocation) RescheduleEligible added in v0.8.0

func (a *Allocation) RescheduleEligible(reschedulePolicy *ReschedulePolicy, failTime time.Time) bool

RescheduleEligible returns if the allocation is eligible to be rescheduled according to its ReschedulePolicy and the current state of its reschedule trackers

func (*Allocation) ReschedulePolicy added in v0.8.0

func (a *Allocation) ReschedulePolicy() *ReschedulePolicy

ReschedulePolicy returns the reschedule policy based on the task group

func (*Allocation) ServerTerminalStatus added in v0.9.0

func (a *Allocation) ServerTerminalStatus() bool

ServerTerminalStatus returns true if the desired state of the allocation is terminal

func (*Allocation) SetEventDisplayMessages added in v0.7.1

func (a *Allocation) SetEventDisplayMessages()

SetEventDisplayMessage populates the display message if its not already set, a temporary fix to handle old allocations that don't have it. This method will be removed in a future release.

func (*Allocation) ShouldMigrate added in v0.5.0

func (a *Allocation) ShouldMigrate() bool

ShouldMigrate returns if the allocation needs data migration

func (*Allocation) ShouldReschedule added in v0.8.0

func (a *Allocation) ShouldReschedule(reschedulePolicy *ReschedulePolicy, failTime time.Time) bool

ShouldReschedule returns if the allocation is eligible to be rescheduled according to its status and ReschedulePolicy given its failure time

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 AllocationDiff added in v0.9.2

type AllocationDiff Allocation

AllocationDiff is another named type for Allocation (to use the same fields), which is used to represent the delta for an Allocation. If you need a method defined on the al

func (*AllocationDiff) CodecDecodeSelf added in v0.9.2

func (x *AllocationDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocationDiff) CodecEncodeSelf added in v0.9.2

func (x *AllocationDiff) CodecEncodeSelf(e *codec1978.Encoder)

type AllocsGetRequest added in v0.3.0

type AllocsGetRequest struct {
	AllocIDs []string
	QueryOptions
}

AllocsGetRequest is used to query a set of allocations

func (*AllocsGetRequest) CodecDecodeSelf added in v0.6.1

func (x *AllocsGetRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocsGetRequest) CodecEncodeSelf added in v0.6.1

func (x *AllocsGetRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AllocsGetResponse added in v0.3.0

type AllocsGetResponse struct {
	Allocs []*Allocation
	QueryMeta
}

AllocsGetResponse is used to return a set of allocations

func (*AllocsGetResponse) CodecDecodeSelf added in v0.6.1

func (x *AllocsGetResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*AllocsGetResponse) CodecEncodeSelf added in v0.6.1

func (x *AllocsGetResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ApplyDeploymentAllocHealthRequest added in v0.6.0

type ApplyDeploymentAllocHealthRequest struct {
	DeploymentAllocHealthRequest

	// Timestamp is the timestamp to use when setting the allocations health.
	Timestamp time.Time

	// An optional field to update the status of a deployment
	DeploymentUpdate *DeploymentStatusUpdate

	// Job is used to optionally upsert a job. This is used when setting the
	// allocation health results in a deployment failure and the deployment
	// auto-reverts to the latest stable job.
	Job *Job

	// An optional evaluation to create after promoting the canaries
	Eval *Evaluation
}

ApplyDeploymentAllocHealthRequest is used to apply an alloc health request via Raft

func (*ApplyDeploymentAllocHealthRequest) CodecDecodeSelf added in v0.6.1

func (x *ApplyDeploymentAllocHealthRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ApplyDeploymentAllocHealthRequest) CodecEncodeSelf added in v0.6.1

func (x *ApplyDeploymentAllocHealthRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ApplyDeploymentPromoteRequest added in v0.6.0

type ApplyDeploymentPromoteRequest struct {
	DeploymentPromoteRequest

	// An optional evaluation to create after promoting the canaries
	Eval *Evaluation
}

ApplyDeploymentPromoteRequest is used to apply a promotion request via Raft

func (*ApplyDeploymentPromoteRequest) CodecDecodeSelf added in v0.6.1

func (x *ApplyDeploymentPromoteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ApplyDeploymentPromoteRequest) CodecEncodeSelf added in v0.6.1

func (x *ApplyDeploymentPromoteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ApplyPlanResultsRequest added in v0.6.0

type ApplyPlanResultsRequest struct {
	// AllocUpdateRequest holds the allocation updates to be made by the
	// scheduler.
	AllocUpdateRequest

	// Deployment is the deployment created or updated as a result of a
	// scheduling event.
	Deployment *Deployment

	// DeploymentUpdates is a set of status updates to apply to the given
	// deployments. This allows the scheduler to cancel any unneeded deployment
	// because the job is stopped or the update block is removed.
	DeploymentUpdates []*DeploymentStatusUpdate

	// EvalID is the eval ID of the plan being applied. The modify index of the
	// evaluation is updated as part of applying the plan to ensure that subsequent
	// scheduling events for the same job will wait for the index that last produced
	// state changes. This is necessary for blocked evaluations since they can be
	// processed many times, potentially making state updates, without the state of
	// the evaluation itself being updated.
	EvalID string

	// COMPAT 0.11
	// NodePreemptions is a slice of allocations from other lower priority jobs
	// that are preempted. Preempted allocations are marked as evicted.
	// Deprecated: Replaced with AllocsPreempted which contains only the diff
	NodePreemptions []*Allocation

	// AllocsPreempted is a slice of allocation diffs from other lower priority jobs
	// that are preempted. Preempted allocations are marked as evicted.
	AllocsPreempted []*AllocationDiff

	// PreemptionEvals is a slice of follow up evals for jobs whose allocations
	// have been preempted to place allocs in this plan
	PreemptionEvals []*Evaluation
}

ApplyPlanResultsRequest is used by the planner to apply a Raft transaction committing the result of a plan.

func (*ApplyPlanResultsRequest) CodecDecodeSelf added in v0.6.1

func (x *ApplyPlanResultsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ApplyPlanResultsRequest) CodecEncodeSelf added in v0.6.1

func (x *ApplyPlanResultsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type AutopilotConfig added in v0.8.0

type AutopilotConfig struct {
	// CleanupDeadServers controls whether to remove dead servers when a new
	// server is added to the Raft peers.
	CleanupDeadServers bool

	// ServerStabilizationTime is the minimum amount of time a server must be
	// in a stable, healthy state before it can be added to the cluster. Only
	// applicable with Raft protocol version 3 or higher.
	ServerStabilizationTime time.Duration

	// LastContactThreshold is the limit on the amount of time a server can go
	// without leader contact before being considered unhealthy.
	LastContactThreshold time.Duration

	// MaxTrailingLogs is the amount of entries in the Raft Log that a server can
	// be behind before being considered unhealthy.
	MaxTrailingLogs uint64

	// (Enterprise-only) EnableRedundancyZones specifies whether to enable redundancy zones.
	EnableRedundancyZones bool

	// (Enterprise-only) DisableUpgradeMigration will disable Autopilot's upgrade migration
	// strategy of waiting until enough newer-versioned servers have been added to the
	// cluster before promoting them to voters.
	DisableUpgradeMigration bool

	// (Enterprise-only) EnableCustomUpgrades specifies whether to enable using custom
	// upgrade versions when performing migrations.
	EnableCustomUpgrades bool

	// CreateIndex/ModifyIndex store the create/modify indexes of this configuration.
	CreateIndex uint64
	ModifyIndex uint64
}

AutopilotConfig is the internal config for the Autopilot mechanism.

func (*AutopilotConfig) CodecDecodeSelf added in v0.8.2

func (x *AutopilotConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*AutopilotConfig) CodecEncodeSelf added in v0.8.2

func (x *AutopilotConfig) CodecEncodeSelf(e *codec1978.Encoder)

type AutopilotSetConfigRequest added in v0.8.0

type AutopilotSetConfigRequest struct {
	// Datacenter is the target this request is intended for.
	Datacenter string

	// Config is the new Autopilot configuration to use.
	Config AutopilotConfig

	// CAS controls whether to use check-and-set semantics for this request.
	CAS bool

	// WriteRequest holds the ACL token to go along with this request.
	WriteRequest
}

AutopilotSetConfigRequest is used by the Operator endpoint to update the current Autopilot configuration of the cluster.

func (*AutopilotSetConfigRequest) CodecDecodeSelf added in v0.8.2

func (x *AutopilotSetConfigRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*AutopilotSetConfigRequest) CodecEncodeSelf added in v0.8.2

func (x *AutopilotSetConfigRequest) CodecEncodeSelf(e *codec1978.Encoder)

func (*AutopilotSetConfigRequest) RequestDatacenter added in v0.8.0

func (op *AutopilotSetConfigRequest) RequestDatacenter() string

RequestDatacenter returns the datacenter for a given request.

type BatchFuture added in v0.8.0

type BatchFuture struct {
	// contains filtered or unexported fields
}

BatchFuture is used to wait on a batch update to complete

func NewBatchFuture added in v0.8.0

func NewBatchFuture() *BatchFuture

NewBatchFuture creates a new batch future

func (*BatchFuture) CodecDecodeSelf added in v0.9.2

func (x *BatchFuture) CodecDecodeSelf(d *codec1978.Decoder)

func (*BatchFuture) CodecEncodeSelf added in v0.9.2

func (x *BatchFuture) CodecEncodeSelf(e *codec1978.Encoder)

func (*BatchFuture) Error added in v0.8.0

func (b *BatchFuture) Error() error

Error is used to return the error of the batch, only after Wait()

func (*BatchFuture) Index added in v0.8.0

func (b *BatchFuture) Index() uint64

Index is used to return the index of the batch, only after Wait()

func (*BatchFuture) Respond added in v0.8.0

func (b *BatchFuture) Respond(index uint64, err error)

Respond is used to unblock the future

func (*BatchFuture) Wait added in v0.8.0

func (b *BatchFuture) Wait() error

Wait is used to block for the future to complete and returns the error

func (*BatchFuture) WaitCh added in v0.8.0

func (b *BatchFuture) WaitCh() <-chan struct{}

WaitCh is used to block for the future to complete

type BatchNodeUpdateDrainRequest added in v0.8.0

type BatchNodeUpdateDrainRequest struct {
	// Updates is a mapping of nodes to their updated drain strategy
	Updates map[string]*DrainUpdate

	// NodeEvents is a mapping of the node to the event to add to the node
	NodeEvents map[string]*NodeEvent

	WriteRequest
}

BatchNodeUpdateDrainRequest is used for updating the drain strategy for a batch of nodes

func (*BatchNodeUpdateDrainRequest) CodecDecodeSelf added in v0.8.0

func (x *BatchNodeUpdateDrainRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*BatchNodeUpdateDrainRequest) CodecEncodeSelf added in v0.8.0

func (x *BatchNodeUpdateDrainRequest) CodecEncodeSelf(e *codec1978.Encoder)

type Bitmap added in v0.3.0

type Bitmap []byte

Bitmap is a simple uncompressed bitmap

func NewBitmap added in v0.3.0

func NewBitmap(size uint) (Bitmap, error)

NewBitmap returns a bitmap with up to size indexes

func (Bitmap) Check added in v0.3.0

func (b Bitmap) Check(idx uint) bool

Check is used to check the given index of the bitmap

func (Bitmap) Clear added in v0.3.0

func (b Bitmap) Clear()

Clear is used to efficiently clear the bitmap

func (*Bitmap) CodecDecodeSelf added in v0.8.2

func (x *Bitmap) CodecDecodeSelf(d *codec1978.Decoder)

func (Bitmap) CodecEncodeSelf added in v0.8.2

func (x Bitmap) CodecEncodeSelf(e *codec1978.Encoder)

func (Bitmap) Copy added in v0.4.1

func (b Bitmap) Copy() (Bitmap, error)

Copy returns a copy of the Bitmap

func (Bitmap) IndexesInRange added in v0.4.1

func (b Bitmap) IndexesInRange(set bool, from, to uint) []int

IndexesInRange returns the indexes in which the values are either set or unset based on the passed parameter in the passed range

func (Bitmap) Set added in v0.3.0

func (b Bitmap) Set(idx uint)

Set is used to set the given index of the bitmap

func (Bitmap) Size added in v0.4.1

func (b Bitmap) Size() uint

Size returns the size of the bitmap

func (Bitmap) Unset added in v0.6.0

func (b Bitmap) Unset(idx uint)

Unset is used to unset the given index of the bitmap

type CheckRestart added in v0.7.0

type CheckRestart struct {
	Limit          int           // Restart task after this many unhealthy intervals
	Grace          time.Duration // Grace time to give tasks after starting to get healthy
	IgnoreWarnings bool          // If true treat checks in `warning` as passing
}

CheckRestart describes if and when a task should be restarted based on failing health checks.

func (*CheckRestart) CodecDecodeSelf added in v0.7.0

func (x *CheckRestart) CodecDecodeSelf(d *codec1978.Decoder)

func (*CheckRestart) CodecEncodeSelf added in v0.7.0

func (x *CheckRestart) CodecEncodeSelf(e *codec1978.Encoder)

func (*CheckRestart) Copy added in v0.7.0

func (c *CheckRestart) Copy() *CheckRestart

func (*CheckRestart) Validate added in v0.7.0

func (c *CheckRestart) Validate() error

type ComparableResources added in v0.9.0

type ComparableResources struct {
	Flattened AllocatedTaskResources
	Shared    AllocatedSharedResources
}

ComparableResources is the set of resources allocated to a task group but not keyed by Task, making it easier to compare.

func AllocsFit

func AllocsFit(node *Node, allocs []*Allocation, netIdx *NetworkIndex, checkDevices bool) (bool, string, *ComparableResources, 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. If checkDevices is set to true, we check if there is a device oversubscription.

func (*ComparableResources) Add added in v0.9.0

func (*ComparableResources) CodecDecodeSelf added in v0.9.2

func (x *ComparableResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*ComparableResources) CodecEncodeSelf added in v0.9.2

func (x *ComparableResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*ComparableResources) Copy added in v0.9.0

func (*ComparableResources) NetIndex added in v0.9.0

func (c *ComparableResources) NetIndex(n *NetworkResource) int

allocated finds the matching net index using device name

func (*ComparableResources) Subtract added in v0.9.0

func (c *ComparableResources) Subtract(delta *ComparableResources)

func (*ComparableResources) Superset added in v0.9.0

func (c *ComparableResources) Superset(other *ComparableResources) (bool, string)

Superset checks if one set of resources is a superset of another. This ignores network resources, and the NetworkIndex should be used for that.

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) CodecDecodeSelf added in v0.6.1

func (x *Constraint) CodecDecodeSelf(d *codec1978.Decoder)

func (*Constraint) CodecEncodeSelf added in v0.6.1

func (x *Constraint) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*Constraint) Equals added in v0.9.2

func (c *Constraint) Equals(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 Constraints added in v0.9.2

type Constraints []*Constraint

func (*Constraints) CodecDecodeSelf added in v0.9.2

func (x *Constraints) CodecDecodeSelf(d *codec1978.Decoder)

func (Constraints) CodecEncodeSelf added in v0.9.2

func (x Constraints) CodecEncodeSelf(e *codec1978.Encoder)

func (*Constraints) Equals added in v0.9.2

func (xs *Constraints) Equals(ys *Constraints) bool

Equals compares Constraints as a set

type Context added in v0.6.1

type Context string

Context defines the scope in which a search for Nomad object operates, and is also used to query the matching index value for this context

const (
	Allocs      Context = "allocs"
	Deployments Context = "deployment"
	Evals       Context = "evals"
	Jobs        Context = "jobs"
	Nodes       Context = "nodes"
	Namespaces  Context = "namespaces"
	Quotas      Context = "quotas"
	All         Context = "all"
)

func (*Context) CodecDecodeSelf added in v0.6.1

func (x *Context) CodecDecodeSelf(d *codec1978.Decoder)

func (Context) CodecEncodeSelf added in v0.6.1

func (x Context) CodecEncodeSelf(e *codec1978.Encoder)

type Deployment added in v0.6.0

type Deployment struct {
	// ID is a generated UUID for the deployment
	ID string

	// Namespace is the namespace the deployment is created in
	Namespace string

	// JobID is the job the deployment is created for
	JobID string

	// JobVersion is the version of the job at which the deployment is tracking
	JobVersion uint64

	// JobModifyIndex is the ModifyIndex of the job which the deployment is
	// tracking.
	JobModifyIndex uint64

	// JobSpecModifyIndex is the JobModifyIndex of the job which the
	// deployment is tracking.
	JobSpecModifyIndex uint64

	// JobCreateIndex is the create index of the job which the deployment is
	// tracking. It is needed so that if the job gets stopped and reran we can
	// present the correct list of deployments for the job and not old ones.
	JobCreateIndex uint64

	// TaskGroups is the set of task groups effected by the deployment and their
	// current deployment status.
	TaskGroups map[string]*DeploymentState

	// The status of the deployment
	Status string

	// StatusDescription allows a human readable description of the deployment
	// status.
	StatusDescription string

	CreateIndex uint64
	ModifyIndex uint64
}

Deployment is the object that represents a job deployment which is used to transition a job between versions.

func NewDeployment added in v0.6.0

func NewDeployment(job *Job) *Deployment

NewDeployment creates a new deployment given the job.

func (*Deployment) Active added in v0.6.0

func (d *Deployment) Active() bool

Active returns whether the deployment is active or terminal.

func (*Deployment) CodecDecodeSelf added in v0.6.1

func (x *Deployment) CodecDecodeSelf(d *codec1978.Decoder)

func (*Deployment) CodecEncodeSelf added in v0.6.1

func (x *Deployment) CodecEncodeSelf(e *codec1978.Encoder)

func (*Deployment) Copy added in v0.6.0

func (d *Deployment) Copy() *Deployment

func (*Deployment) GetID added in v0.6.0

func (d *Deployment) GetID() string

GetID is a helper for getting the ID when the object may be nil

func (*Deployment) GoString added in v0.6.0

func (d *Deployment) GoString() string

func (*Deployment) HasAutoPromote added in v0.9.2

func (d *Deployment) HasAutoPromote() bool

HasAutoPromote determines if all taskgroups are marked auto_promote

func (*Deployment) HasPlacedCanaries added in v0.6.0

func (d *Deployment) HasPlacedCanaries() bool

HasPlacedCanaries returns whether the deployment has placed canaries

func (*Deployment) RequiresPromotion added in v0.6.0

func (d *Deployment) RequiresPromotion() bool

RequiresPromotion returns whether the deployment requires promotion to continue

type DeploymentAllocHealthRequest added in v0.6.0

type DeploymentAllocHealthRequest struct {
	DeploymentID string

	// Marks these allocations as healthy, allow further allocations
	// to be rolled.
	HealthyAllocationIDs []string

	// Any unhealthy allocations fail the deployment
	UnhealthyAllocationIDs []string

	WriteRequest
}

DeploymentAllocHealthRequest is used to set the health of a set of allocations as part of a deployment.

func (*DeploymentAllocHealthRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentAllocHealthRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentAllocHealthRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentAllocHealthRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentDeleteRequest added in v0.6.0

type DeploymentDeleteRequest struct {
	Deployments []string
	WriteRequest
}

DeploymentDeleteRequest is used for deleting deployments.

func (*DeploymentDeleteRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentDeleteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentDeleteRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentDeleteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentFailRequest added in v0.6.0

type DeploymentFailRequest struct {
	DeploymentID string
	WriteRequest
}

DeploymentFailRequest is used to fail a particular deployment

func (*DeploymentFailRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentFailRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentFailRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentFailRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentListRequest added in v0.6.0

type DeploymentListRequest struct {
	QueryOptions
}

DeploymentListRequest is used to list the deployments

func (*DeploymentListRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentListRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentListResponse added in v0.6.0

type DeploymentListResponse struct {
	Deployments []*Deployment
	QueryMeta
}

DeploymentListResponse is used for a list request

func (*DeploymentListResponse) CodecDecodeSelf added in v0.6.1

func (x *DeploymentListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentListResponse) CodecEncodeSelf added in v0.6.1

func (x *DeploymentListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentPauseRequest added in v0.6.0

type DeploymentPauseRequest struct {
	DeploymentID string

	// Pause sets the pause status
	Pause bool

	WriteRequest
}

DeploymentPauseRequest is used to pause a deployment

func (*DeploymentPauseRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentPauseRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentPauseRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentPauseRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentPromoteRequest added in v0.6.0

type DeploymentPromoteRequest struct {
	DeploymentID string

	// All is to promote all task groups
	All bool

	// Groups is used to set the promotion status per task group
	Groups []string

	WriteRequest
}

DeploymentPromoteRequest is used to promote task groups in a deployment

func (*DeploymentPromoteRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentPromoteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentPromoteRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentPromoteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentSpecificRequest added in v0.6.0

type DeploymentSpecificRequest struct {
	DeploymentID string
	QueryOptions
}

DeploymentSpecificRequest is used to make a request specific to a particular deployment

func (*DeploymentSpecificRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentSpecificRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentState added in v0.6.0

type DeploymentState struct {
	// AutoRevert marks whether the task group has indicated the job should be
	// reverted on failure
	AutoRevert bool

	// AutoPromote marks promotion triggered automatically by healthy canaries
	// copied from TaskGroup UpdateStrategy in scheduler.reconcile
	AutoPromote bool

	// ProgressDeadline is the deadline by which an allocation must transition
	// to healthy before the deployment is considered failed.
	ProgressDeadline time.Duration

	// RequireProgressBy is the time by which an allocation must transition
	// to healthy before the deployment is considered failed.
	RequireProgressBy time.Time

	// Promoted marks whether the canaries have been promoted
	Promoted bool

	// PlacedCanaries is the set of placed canary allocations
	PlacedCanaries []string

	// DesiredCanaries is the number of canaries that should be created.
	DesiredCanaries int

	// DesiredTotal is the total number of allocations that should be created as
	// part of the deployment.
	DesiredTotal int

	// PlacedAllocs is the number of allocations that have been placed
	PlacedAllocs int

	// HealthyAllocs is the number of allocations that have been marked healthy.
	HealthyAllocs int

	// UnhealthyAllocs are allocations that have been marked as unhealthy.
	UnhealthyAllocs int
}

DeploymentState tracks the state of a deployment for a given task group.

func (*DeploymentState) CodecDecodeSelf added in v0.6.1

func (x *DeploymentState) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentState) CodecEncodeSelf added in v0.6.1

func (x *DeploymentState) CodecEncodeSelf(e *codec1978.Encoder)

func (*DeploymentState) Copy added in v0.6.0

func (d *DeploymentState) Copy() *DeploymentState

func (*DeploymentState) GoString added in v0.6.0

func (d *DeploymentState) GoString() string

type DeploymentStatusUpdate added in v0.6.0

type DeploymentStatusUpdate struct {
	// DeploymentID is the ID of the deployment to update
	DeploymentID string

	// Status is the new status of the deployment.
	Status string

	// StatusDescription is the new status description of the deployment.
	StatusDescription string
}

DeploymentStatusUpdate is used to update the status of a given deployment

func (*DeploymentStatusUpdate) CodecDecodeSelf added in v0.6.1

func (x *DeploymentStatusUpdate) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentStatusUpdate) CodecEncodeSelf added in v0.6.1

func (x *DeploymentStatusUpdate) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentStatusUpdateRequest added in v0.6.0

type DeploymentStatusUpdateRequest struct {
	// Eval, if set, is used to create an evaluation at the same time as
	// updating the status of a deployment.
	Eval *Evaluation

	// DeploymentUpdate is a status update to apply to the given
	// deployment.
	DeploymentUpdate *DeploymentStatusUpdate

	// Job is used to optionally upsert a job. This is used when setting the
	// allocation health results in a deployment failure and the deployment
	// auto-reverts to the latest stable job.
	Job *Job
}

DeploymentStatusUpdateRequest is used to update the status of a deployment as well as optionally creating an evaluation atomically.

func (*DeploymentStatusUpdateRequest) CodecDecodeSelf added in v0.6.1

func (x *DeploymentStatusUpdateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentStatusUpdateRequest) CodecEncodeSelf added in v0.6.1

func (x *DeploymentStatusUpdateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type DeploymentUpdateResponse added in v0.6.0

type DeploymentUpdateResponse struct {
	EvalID                string
	EvalCreateIndex       uint64
	DeploymentModifyIndex uint64

	// RevertedJobVersion is the version the job was reverted to. If unset, the
	// job wasn't reverted
	RevertedJobVersion *uint64

	WriteMeta
}

DeploymentUpdateResponse is used to respond to a deployment change. The response will include the modify index of the deployment as well as details of any triggered evaluation.

func (*DeploymentUpdateResponse) CodecDecodeSelf added in v0.6.1

func (x *DeploymentUpdateResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeploymentUpdateResponse) CodecEncodeSelf added in v0.6.1

func (x *DeploymentUpdateResponse) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*DeriveVaultTokenRequest) CodecDecodeSelf added in v0.6.1

func (x *DeriveVaultTokenRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeriveVaultTokenRequest) CodecEncodeSelf added in v0.6.1

func (x *DeriveVaultTokenRequest) CodecEncodeSelf(e *codec1978.Encoder)

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 occurred. Errors are stored here so we can
	// communicate whether it is retriable
	Error *RecoverableError

	QueryMeta
}

DeriveVaultTokenResponse returns the wrapped tokens for each requested task

func (*DeriveVaultTokenResponse) CodecDecodeSelf added in v0.6.1

func (x *DeriveVaultTokenResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeriveVaultTokenResponse) CodecEncodeSelf added in v0.6.1

func (x *DeriveVaultTokenResponse) CodecEncodeSelf(e *codec1978.Encoder)

type DesiredTransition added in v0.8.0

type DesiredTransition struct {
	// Migrate is used to indicate that this allocation should be stopped and
	// migrated to another node.
	Migrate *bool

	// Reschedule is used to indicate that this allocation is eligible to be
	// rescheduled. Most allocations are automatically eligible for
	// rescheduling, so this field is only required when an allocation is not
	// automatically eligible. An example is an allocation that is part of a
	// deployment.
	Reschedule *bool

	// ForceReschedule is used to indicate that this allocation must be rescheduled.
	// This field is only used when operators want to force a placement even if
	// a failed allocation is not eligible to be rescheduled
	ForceReschedule *bool
}

DesiredTransition is used to mark an allocation as having a desired state transition. This information can be used by the scheduler to make the correct decision.

func (*DesiredTransition) CodecDecodeSelf added in v0.8.0

func (x *DesiredTransition) CodecDecodeSelf(d *codec1978.Decoder)

func (*DesiredTransition) CodecEncodeSelf added in v0.8.0

func (x *DesiredTransition) CodecEncodeSelf(e *codec1978.Encoder)

func (*DesiredTransition) Merge added in v0.8.0

func (d *DesiredTransition) Merge(o *DesiredTransition)

Merge merges the two desired transitions, preferring the values from the passed in object.

func (*DesiredTransition) ShouldForceReschedule added in v0.8.4

func (d *DesiredTransition) ShouldForceReschedule() bool

ShouldForceReschedule returns whether the transition object dictates a forced rescheduling.

func (*DesiredTransition) ShouldMigrate added in v0.8.0

func (d *DesiredTransition) ShouldMigrate() bool

ShouldMigrate returns whether the transition object dictates a migration.

func (*DesiredTransition) ShouldReschedule added in v0.8.4

func (d *DesiredTransition) ShouldReschedule() bool

ShouldReschedule returns whether the transition object dictates a rescheduling.

type DesiredUpdates added in v0.4.0

type DesiredUpdates struct {
	Ignore            uint64
	Place             uint64
	Migrate           uint64
	Stop              uint64
	InPlaceUpdate     uint64
	DestructiveUpdate uint64
	Canary            uint64
	Preemptions       uint64
}

DesiredUpdates is the set of changes the scheduler would like to make given sufficient resources and cluster capacity.

func (*DesiredUpdates) CodecDecodeSelf added in v0.6.1

func (x *DesiredUpdates) CodecDecodeSelf(d *codec1978.Decoder)

func (*DesiredUpdates) CodecEncodeSelf added in v0.6.1

func (x *DesiredUpdates) CodecEncodeSelf(e *codec1978.Encoder)

func (*DesiredUpdates) GoString added in v0.6.0

func (d *DesiredUpdates) GoString() string

type DeviceAccounter added in v0.9.0

type DeviceAccounter struct {
	// Devices maps a device group to its device accounter instance
	Devices map[DeviceIdTuple]*DeviceAccounterInstance
}

DeviceAccounter is used to account for device usage on a node. It can detect when a node is oversubscribed and can be used for deciding what devices are free

func NewDeviceAccounter added in v0.9.0

func NewDeviceAccounter(n *Node) *DeviceAccounter

NewDeviceAccounter returns a new device accounter. The node is used to populate the set of available devices based on what healthy device instances exist on the node.

func (*DeviceAccounter) AddAllocs added in v0.9.0

func (d *DeviceAccounter) AddAllocs(allocs []*Allocation) (collision bool)

AddAllocs takes a set of allocations and internally marks which devices are used. If a device is used more than once by the set of passed allocations, the collision will be returned as true.

func (*DeviceAccounter) AddReserved added in v0.9.0

func (d *DeviceAccounter) AddReserved(res *AllocatedDeviceResource) (collision bool)

AddReserved marks the device instances in the passed device reservation as used and returns if there is a collision.

func (*DeviceAccounter) CodecDecodeSelf added in v0.9.2

func (x *DeviceAccounter) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeviceAccounter) CodecEncodeSelf added in v0.9.2

func (x *DeviceAccounter) CodecEncodeSelf(e *codec1978.Encoder)

type DeviceAccounterInstance added in v0.9.0

type DeviceAccounterInstance struct {
	// Device is the device being wrapped
	Device *NodeDeviceResource

	// Instances is a mapping of the device IDs to their usage.
	// Only a value of 0 indicates that the instance is unused.
	Instances map[string]int
}

DeviceAccounterInstance wraps a device and adds tracking to the instances of the device to determine if they are free or not.

func (*DeviceAccounterInstance) CodecDecodeSelf added in v0.9.2

func (x *DeviceAccounterInstance) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeviceAccounterInstance) CodecEncodeSelf added in v0.9.2

func (x *DeviceAccounterInstance) CodecEncodeSelf(e *codec1978.Encoder)

func (*DeviceAccounterInstance) FreeCount added in v0.9.0

func (i *DeviceAccounterInstance) FreeCount() int

FreeCount returns the number of free device instances

type DeviceIdTuple added in v0.9.0

type DeviceIdTuple struct {
	Vendor string
	Type   string
	Name   string
}

DeviceIdTuple is the tuple that identifies a device

func (*DeviceIdTuple) CodecDecodeSelf added in v0.9.2

func (x *DeviceIdTuple) CodecDecodeSelf(d *codec1978.Decoder)

func (*DeviceIdTuple) CodecEncodeSelf added in v0.9.2

func (x *DeviceIdTuple) CodecEncodeSelf(e *codec1978.Encoder)

func (*DeviceIdTuple) Equals added in v0.9.0

func (id *DeviceIdTuple) Equals(o *DeviceIdTuple) bool

Equals returns if this Device ID is the same as the passed ID.

func (*DeviceIdTuple) Matches added in v0.9.0

func (id *DeviceIdTuple) Matches(other *DeviceIdTuple) bool

Matches returns if this Device ID is a superset of the passed ID.

func (*DeviceIdTuple) String added in v0.9.0

func (d *DeviceIdTuple) String() string

type DiffType added in v0.4.0

type DiffType string

DiffType denotes the type of a diff object.

var (
	DiffTypeNone    DiffType = "None"
	DiffTypeAdded   DiffType = "Added"
	DiffTypeDeleted DiffType = "Deleted"
	DiffTypeEdited  DiffType = "Edited"
)

func (*DiffType) CodecDecodeSelf added in v0.8.2

func (x *DiffType) CodecDecodeSelf(d *codec1978.Decoder)

func (DiffType) CodecEncodeSelf added in v0.8.2

func (x DiffType) CodecEncodeSelf(e *codec1978.Encoder)

func (DiffType) Less added in v0.4.0

func (d DiffType) Less(other DiffType) bool

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) CodecDecodeSelf added in v0.6.1

func (x *DispatchPayloadConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*DispatchPayloadConfig) CodecEncodeSelf added in v0.6.1

func (x *DispatchPayloadConfig) CodecEncodeSelf(e *codec1978.Encoder)

func (*DispatchPayloadConfig) Copy added in v0.5.3

func (*DispatchPayloadConfig) Validate added in v0.5.3

func (d *DispatchPayloadConfig) Validate() error

type DrainSpec added in v0.8.0

type DrainSpec struct {
	// Deadline is the duration after StartTime when the remaining
	// allocations on a draining Node should be told to stop.
	Deadline time.Duration

	// IgnoreSystemJobs allows systems jobs to remain on the node even though it
	// has been marked for draining.
	IgnoreSystemJobs bool
}

DrainSpec describes a Node's desired drain behavior.

func (*DrainSpec) CodecDecodeSelf added in v0.8.0

func (x *DrainSpec) CodecDecodeSelf(d *codec1978.Decoder)

func (*DrainSpec) CodecEncodeSelf added in v0.8.0

func (x *DrainSpec) CodecEncodeSelf(e *codec1978.Encoder)

type DrainStrategy added in v0.8.0

type DrainStrategy struct {
	// DrainSpec is the user declared drain specification
	DrainSpec

	// ForceDeadline is the deadline time for the drain after which drains will
	// be forced
	ForceDeadline time.Time
}

DrainStrategy describes a Node's drain behavior.

func (*DrainStrategy) CodecDecodeSelf added in v0.8.0

func (x *DrainStrategy) CodecDecodeSelf(d *codec1978.Decoder)

func (*DrainStrategy) CodecEncodeSelf added in v0.8.0

func (x *DrainStrategy) CodecEncodeSelf(e *codec1978.Encoder)

func (*DrainStrategy) Copy added in v0.8.0

func (d *DrainStrategy) Copy() *DrainStrategy

func (*DrainStrategy) DeadlineTime added in v0.8.0

func (d *DrainStrategy) DeadlineTime() (infinite bool, deadline time.Time)

DeadlineTime returns a boolean whether the drain strategy allows an infinite duration or otherwise the deadline time. The force drain is captured by the deadline time being in the past.

func (*DrainStrategy) Equal added in v0.8.0

func (d *DrainStrategy) Equal(o *DrainStrategy) bool

type DrainUpdate added in v0.8.0

type DrainUpdate struct {
	// DrainStrategy is the new strategy for the node
	DrainStrategy *DrainStrategy

	// MarkEligible marks the node as eligible if removing the drain strategy.
	MarkEligible bool
}

DrainUpdate is used to update the drain of a node

func (*DrainUpdate) CodecDecodeSelf added in v0.8.0

func (x *DrainUpdate) CodecDecodeSelf(d *codec1978.Decoder)

func (*DrainUpdate) CodecEncodeSelf added in v0.8.0

func (x *DrainUpdate) CodecEncodeSelf(e *codec1978.Encoder)

type DriverInfo added in v0.8.0

type DriverInfo struct {
	Attributes        map[string]string
	Detected          bool
	Healthy           bool
	HealthDescription string
	UpdateTime        time.Time
}

DriverInfo is the current state of a single driver. This is updated regularly as driver health changes on the node.

func (*DriverInfo) CodecDecodeSelf added in v0.9.2

func (x *DriverInfo) CodecDecodeSelf(d *codec1978.Decoder)

func (*DriverInfo) CodecEncodeSelf added in v0.9.2

func (x *DriverInfo) CodecEncodeSelf(e *codec1978.Encoder)

func (*DriverInfo) Copy added in v0.8.1

func (di *DriverInfo) Copy() *DriverInfo

func (*DriverInfo) HealthCheckEquals added in v0.8.0

func (di *DriverInfo) HealthCheckEquals(other *DriverInfo) bool

DriverInfo determines if two driver info objects are equal..As this is used in the process of health checking, we only check the fields that are computed by the health checker. In the future, this will be merged.

func (*DriverInfo) MergeFingerprintInfo added in v0.8.0

func (di *DriverInfo) MergeFingerprintInfo(other *DriverInfo)

MergeFingerprint merges information from fingerprinting a node for a driver into a node's driver info for that driver.

func (*DriverInfo) MergeHealthCheck added in v0.8.0

func (di *DriverInfo) MergeHealthCheck(other *DriverInfo)

MergeHealthCheck merges information from a health check for a drier into a node's driver info

type EmitNodeEventsRequest added in v0.8.0

type EmitNodeEventsRequest struct {
	// NodeEvents are a map where the key is a node id, and value is a list of
	// events for that node
	NodeEvents map[string][]*NodeEvent

	WriteRequest
}

EmitNodeEventsRequest is a request to update the node events source with a new client-side event

func (*EmitNodeEventsRequest) CodecDecodeSelf added in v0.8.0

func (x *EmitNodeEventsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EmitNodeEventsRequest) CodecEncodeSelf added in v0.8.0

func (x *EmitNodeEventsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EmitNodeEventsResponse added in v0.8.0

type EmitNodeEventsResponse struct {
	WriteMeta
}

EmitNodeEventsResponse is a response to the client about the status of the node event source update.

func (*EmitNodeEventsResponse) CodecDecodeSelf added in v0.8.0

func (x *EmitNodeEventsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*EmitNodeEventsResponse) CodecEncodeSelf added in v0.8.0

func (x *EmitNodeEventsResponse) CodecEncodeSelf(e *codec1978.Encoder)

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

	// 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) CodecDecodeSelf added in v0.6.1

func (x *EphemeralDisk) CodecDecodeSelf(d *codec1978.Decoder)

func (*EphemeralDisk) CodecEncodeSelf added in v0.6.1

func (x *EphemeralDisk) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*EvalAckRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalAckRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalAckRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalAckRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EvalAllocationsResponse

type EvalAllocationsResponse struct {
	Allocations []*AllocListStub
	QueryMeta
}

EvalAllocationsResponse is used to return the allocations for an evaluation

func (*EvalAllocationsResponse) CodecDecodeSelf added in v0.6.1

func (x *EvalAllocationsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalAllocationsResponse) CodecEncodeSelf added in v0.6.1

func (x *EvalAllocationsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type EvalDeleteRequest

type EvalDeleteRequest struct {
	Evals  []string
	Allocs []string
	WriteRequest
}

EvalDeleteRequest is used for deleting an evaluation.

func (*EvalDeleteRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalDeleteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalDeleteRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalDeleteRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EvalDequeueRequest

type EvalDequeueRequest struct {
	Schedulers       []string
	Timeout          time.Duration
	SchedulerVersion uint16
	WriteRequest
}

EvalDequeueRequest is used when we want to dequeue an evaluation

func (*EvalDequeueRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalDequeueRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalDequeueRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalDequeueRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EvalDequeueResponse

type EvalDequeueResponse struct {
	Eval  *Evaluation
	Token string

	// WaitIndex is the Raft index the worker should wait until invoking the
	// scheduler.
	WaitIndex uint64

	QueryMeta
}

EvalDequeueResponse is used to return from a dequeue

func (*EvalDequeueResponse) CodecDecodeSelf added in v0.6.1

func (x *EvalDequeueResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalDequeueResponse) CodecEncodeSelf added in v0.6.1

func (x *EvalDequeueResponse) CodecEncodeSelf(e *codec1978.Encoder)

func (*EvalDequeueResponse) GetWaitIndex added in v0.7.0

func (e *EvalDequeueResponse) GetWaitIndex() uint64

GetWaitIndex is used to retrieve the Raft index in which state should be at or beyond before invoking the scheduler.

type EvalListRequest

type EvalListRequest struct {
	QueryOptions
}

EvalListRequest is used to list the evaluations

func (*EvalListRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalListRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EvalListResponse

type EvalListResponse struct {
	Evaluations []*Evaluation
	QueryMeta
}

EvalListResponse is used for a list request

func (*EvalListResponse) CodecDecodeSelf added in v0.6.1

func (x *EvalListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalListResponse) CodecEncodeSelf added in v0.6.1

func (x *EvalListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type EvalOptions added in v0.8.4

type EvalOptions struct {
	ForceReschedule bool
}

EvalOptions is used to encapsulate options when forcing a job evaluation

func (*EvalOptions) CodecDecodeSelf added in v0.9.2

func (x *EvalOptions) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalOptions) CodecEncodeSelf added in v0.9.2

func (x *EvalOptions) CodecEncodeSelf(e *codec1978.Encoder)

type EvalSpecificRequest

type EvalSpecificRequest struct {
	EvalID string
	QueryOptions
}

EvalSpecificRequest is used when we just need to specify a target evaluation

func (*EvalSpecificRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalSpecificRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type EvalUpdateRequest

type EvalUpdateRequest struct {
	Evals     []*Evaluation
	EvalToken string
	WriteRequest
}

EvalUpdateRequest is used for upserting evaluations.

func (*EvalUpdateRequest) CodecDecodeSelf added in v0.6.1

func (x *EvalUpdateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*EvalUpdateRequest) CodecEncodeSelf added in v0.6.1

func (x *EvalUpdateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type Evaluation

type Evaluation struct {

	// ID is a randomly generated UUID used for this evaluation. This
	// is assigned upon the creation of the evaluation.
	ID string

	// Namespace is the namespace the evaluation is created in
	Namespace 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

	// DeploymentID is the ID of the deployment that triggered the evaluation.
	DeploymentID string

	// 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 in versions prior to 0.7.0
	// Deprecated
	Wait time.Duration

	// WaitUntil is the time when this eval should be run. This is used to
	// supported delayed rescheduling of failed allocations
	WaitUntil time.Time

	// NextEval is the evaluation ID for the eval created to do a followup.
	// This is used to support rolling upgrades and failed-follow-up evals, 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 and failed-follow-up evals, 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

	// QuotaLimitReached marks whether a quota limit was reached for the
	// evaluation.
	QuotaLimitReached string

	// 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

	// 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

	// LeaderACL provides the ACL token to when issuing RPCs back to the
	// leader. This will be a valid management token as long as the leader is
	// active. This should not ever be exposed via the API.
	LeaderACL string

	// SnapshotIndex is the Raft index of the snapshot used to process the
	// evaluation. The index will either be set when it has gone through the
	// scheduler or if a blocked evaluation is being created. The index is set
	// in this case so we can determine if an early unblocking is required since
	// capacity has changed since the evaluation was created. This can result in
	// the SnapshotIndex being less than the CreateIndex.
	SnapshotIndex uint64

	// Raft Indexes
	CreateIndex uint64
	ModifyIndex uint64
	// contains filtered or unexported fields
}

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) CodecDecodeSelf added in v0.6.1

func (x *Evaluation) CodecDecodeSelf(d *codec1978.Decoder)

func (*Evaluation) CodecEncodeSelf added in v0.6.1

func (x *Evaluation) CodecEncodeSelf(e *codec1978.Encoder)

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, quotaReached string) *Evaluation

CreateBlockedEval creates a blocked evaluation to followup this eval to place any failed allocations. It takes the classes marked explicitly eligible or ineligible, whether the job has escaped computed node classes and whether the quota limit was reached.

func (*Evaluation) CreateFailedFollowUpEval added in v0.6.0

func (e *Evaluation) CreateFailedFollowUpEval(wait time.Duration) *Evaluation

CreateFailedFollowUpEval creates a follow up evaluation when the current one has been marked as failed because it has hit the delivery limit and will not be retried by the eval_broker. Callers should copy the created eval's ID to into the old eval's NextEval field.

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 FieldDiff added in v0.4.0

type FieldDiff struct {
	Type        DiffType
	Name        string
	Old, New    string
	Annotations []string
}

func (*FieldDiff) CodecDecodeSelf added in v0.8.2

func (x *FieldDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*FieldDiff) CodecEncodeSelf added in v0.8.2

func (x *FieldDiff) CodecEncodeSelf(e *codec1978.Encoder)

func (*FieldDiff) GoString added in v0.4.0

func (f *FieldDiff) GoString() string

func (*FieldDiff) Less added in v0.4.0

func (f *FieldDiff) Less(other *FieldDiff) bool

type FieldDiffs added in v0.4.0

type FieldDiffs []*FieldDiff

For sorting FieldDiffs

func (*FieldDiffs) CodecDecodeSelf added in v0.8.2

func (x *FieldDiffs) CodecDecodeSelf(d *codec1978.Decoder)

func (FieldDiffs) CodecEncodeSelf added in v0.8.2

func (x FieldDiffs) CodecEncodeSelf(e *codec1978.Encoder)

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.

func (*GenericRequest) CodecDecodeSelf added in v0.6.1

func (x *GenericRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*GenericRequest) CodecEncodeSelf added in v0.6.1

func (x *GenericRequest) CodecEncodeSelf(e *codec1978.Encoder)

type GenericResponse

type GenericResponse struct {
	WriteMeta
}

GenericResponse is used to respond to a request where no specific response information is needed.

func (*GenericResponse) CodecDecodeSelf added in v0.6.1

func (x *GenericResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*GenericResponse) CodecEncodeSelf added in v0.6.1

func (x *GenericResponse) CodecEncodeSelf(e *codec1978.Encoder)

type InternalRpcInfo added in v0.8.0

type InternalRpcInfo struct {
	// Forwarded marks whether the RPC has been forwarded.
	Forwarded bool
}

InternalRpcInfo allows adding internal RPC metadata to an RPC. This struct should NOT be replicated in the API package as it is internal only.

func (*InternalRpcInfo) CodecDecodeSelf added in v0.8.0

func (x *InternalRpcInfo) CodecDecodeSelf(d *codec1978.Decoder)

func (*InternalRpcInfo) CodecEncodeSelf added in v0.8.0

func (x *InternalRpcInfo) CodecEncodeSelf(e *codec1978.Encoder)

func (*InternalRpcInfo) IsForwarded added in v0.8.0

func (i *InternalRpcInfo) IsForwarded() bool

IsForwarded returns whether the RPC is forwarded from another server.

func (*InternalRpcInfo) SetForwarded added in v0.8.0

func (i *InternalRpcInfo) SetForwarded()

SetForwarded marks that the RPC is being forwarded from another server.

type Job

type Job struct {
	// Stop marks whether the user has stopped the job. A stopped job will
	// have all created allocations stopped and acts as a way to stop a job
	// without purging it from the system. This allows existing allocs to be
	// queried and the job to be inspected as it is being killed.
	Stop bool

	// Region is the Nomad region that handles scheduling this job
	Region string

	// Namespace is the namespace the job is submitted into.
	Namespace 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

	// 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

	// Affinities can be specified at the job level to express
	// scheduling preferences that apply to all groups and tasks
	Affinities []*Affinity

	// Spread can be specified at the job level to express spreading
	// allocations across a desired attribute, such as datacenter
	Spreads []*Spread

	// 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

	// See agent.ApiJobToStructJob
	// Update provides defaults for the TaskGroup Update stanzas
	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

	// Dispatched is used to identify if the Job has been dispatched from a
	// parameterized job.
	Dispatched bool

	// 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

	// Job status
	Status string

	// StatusDescription is meant to provide more human useful information
	StatusDescription string

	// Stable marks a job as stable. Stability is only defined on "service" and
	// "system" jobs. The stability of a job will be set automatically as part
	// of a deployment and can be manually set via APIs.
	Stable bool

	// Version is a monotonically increasing version number that is incremented
	// on each job register.
	Version uint64

	// SubmitTime is the time at which the job was submitted as a UnixNano in
	// UTC
	SubmitTime int64

	// 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 MockJob added in v0.9.0

func MockJob() *Job

func (*Job) Canonicalize added in v0.4.1

func (j *Job) Canonicalize() (warnings error)

Canonicalize is used to canonicalize fields in the Job. This should be called when registering a Job. A set of warnings are returned if the job was changed in anyway that the user should be made aware of.

func (*Job) CodecDecodeSelf added in v0.6.1

func (x *Job) CodecDecodeSelf(d *codec1978.Decoder)

func (*Job) CodecEncodeSelf added in v0.6.1

func (x *Job) CodecEncodeSelf(e *codec1978.Encoder)

func (*Job) CombinedTaskMeta added in v0.5.3

func (j *Job) CombinedTaskMeta(groupName, taskName string) map[string]string

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

func (j *Job) Copy() *Job

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

func (j *Job) Diff(other *Job, contextual bool) (*JobDiff, error)

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) HasUpdateStrategy added in v0.6.0

func (j *Job) HasUpdateStrategy() bool

HasUpdateStrategy returns if any task group in the job has an update strategy

func (*Job) IsParameterized added in v0.5.3

func (j *Job) IsParameterized() bool

IsParameterized returns whether a job is parameterized job.

func (*Job) IsPeriodic added in v0.2.2

func (j *Job) IsPeriodic() bool

IsPeriodic returns whether a job is periodic.

func (*Job) IsPeriodicActive added in v0.7.1

func (j *Job) IsPeriodicActive() bool

IsPeriodicActive returns whether the job is an active periodic job that will create child jobs

func (*Job) LookupTaskGroup

func (j *Job) LookupTaskGroup(name string) *TaskGroup

LookupTaskGroup finds a task group by name

func (*Job) NamespacedID added in v0.8.2

func (j *Job) NamespacedID() *NamespacedID

NamespacedID returns the namespaced id useful for logging

func (*Job) RequiredSignals added in v0.5.0

func (j *Job) RequiredSignals() map[string]map[string][]string

RequiredSignals returns a mapping of task groups to tasks to their required set of signals

func (*Job) SetSubmitTime added in v0.6.0

func (j *Job) SetSubmitTime()

func (*Job) SpecChanged added in v0.6.0

func (j *Job) SpecChanged(new *Job) bool

SpecChanged determines if the functional specification has changed between two job versions.

func (*Job) Stopped added in v0.6.0

func (j *Job) Stopped() bool

Stopped returns if a job is stopped.

func (*Job) Stub

func (j *Job) Stub(summary *JobSummary) *JobListStub

Stub is used to return a summary of the job

func (*Job) Validate

func (j *Job) Validate() error

Validate is used to sanity check a job input

func (*Job) VaultPolicies added in v0.5.0

func (j *Job) VaultPolicies() map[string]map[string]*Vault

VaultPolicies returns the set of Vault policies per task group, per task

func (*Job) Warnings added in v0.6.0

func (j *Job) Warnings() error

Warnings returns a list of warnings that may be from dubious settings or deprecation warnings.

type JobAllocationsResponse

type JobAllocationsResponse struct {
	Allocations []*AllocListStub
	QueryMeta
}

JobAllocationsResponse is used to return the allocations for a job

func (*JobAllocationsResponse) CodecDecodeSelf added in v0.6.1

func (x *JobAllocationsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobAllocationsResponse) CodecEncodeSelf added in v0.6.1

func (x *JobAllocationsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobBatchDeregisterRequest added in v0.8.0

type JobBatchDeregisterRequest struct {
	// Jobs is the set of jobs to deregister
	Jobs map[NamespacedID]*JobDeregisterOptions

	// Evals is the set of evaluations to create.
	Evals []*Evaluation

	WriteRequest
}

JobBatchDeregisterRequest is used to batch deregister jobs and upsert evaluations.

func (*JobBatchDeregisterRequest) CodecDecodeSelf added in v0.8.0

func (x *JobBatchDeregisterRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobBatchDeregisterRequest) CodecEncodeSelf added in v0.8.0

func (x *JobBatchDeregisterRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobBatchDeregisterResponse added in v0.8.0

type JobBatchDeregisterResponse struct {
	// JobEvals maps the job to its created evaluation
	JobEvals map[NamespacedID]string
	QueryMeta
}

JobBatchDeregisterResponse is used to respond to a batch job deregistration

func (*JobBatchDeregisterResponse) CodecDecodeSelf added in v0.8.0

func (x *JobBatchDeregisterResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobBatchDeregisterResponse) CodecEncodeSelf added in v0.8.0

func (x *JobBatchDeregisterResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobChildrenSummary added in v0.5.3

type JobChildrenSummary struct {
	Pending int64
	Running int64
	Dead    int64
}

JobChildrenSummary contains the summary of children job statuses

func (*JobChildrenSummary) CodecDecodeSelf added in v0.6.1

func (x *JobChildrenSummary) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobChildrenSummary) CodecEncodeSelf added in v0.6.1

func (x *JobChildrenSummary) CodecEncodeSelf(e *codec1978.Encoder)

func (*JobChildrenSummary) Copy added in v0.5.3

Copy returns a new copy of a JobChildrenSummary

type JobDeregisterOptions added in v0.8.0

type JobDeregisterOptions struct {
	// Purge controls whether the deregister purges the job from the system or
	// whether the job is just marked as stopped and will be removed by the
	// garbage collector
	Purge bool
}

JobDeregisterOptions configures how a job is deregistered.

func (*JobDeregisterOptions) CodecDecodeSelf added in v0.8.0

func (x *JobDeregisterOptions) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDeregisterOptions) CodecEncodeSelf added in v0.8.0

func (x *JobDeregisterOptions) CodecEncodeSelf(e *codec1978.Encoder)

type JobDeregisterRequest

type JobDeregisterRequest struct {
	JobID string

	// Purge controls whether the deregister purges the job from the system or
	// whether the job is just marked as stopped and will be removed by the
	// garbage collector
	Purge bool

	WriteRequest
}

JobDeregisterRequest is used for Job.Deregister endpoint to deregister a job as being a schedulable entity.

func (*JobDeregisterRequest) CodecDecodeSelf added in v0.6.1

func (x *JobDeregisterRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDeregisterRequest) CodecEncodeSelf added in v0.6.1

func (x *JobDeregisterRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobDeregisterResponse

type JobDeregisterResponse struct {
	EvalID          string
	EvalCreateIndex uint64
	JobModifyIndex  uint64
	QueryMeta
}

JobDeregisterResponse is used to respond to a job deregistration

func (*JobDeregisterResponse) CodecDecodeSelf added in v0.6.1

func (x *JobDeregisterResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDeregisterResponse) CodecEncodeSelf added in v0.6.1

func (x *JobDeregisterResponse) CodecEncodeSelf(e *codec1978.Encoder)

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.

func (*JobDiff) CodecDecodeSelf added in v0.8.2

func (x *JobDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDiff) CodecEncodeSelf added in v0.8.2

func (x *JobDiff) CodecEncodeSelf(e *codec1978.Encoder)

func (*JobDiff) GoString added in v0.4.0

func (j *JobDiff) GoString() string

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

func (*JobDispatchRequest) CodecDecodeSelf added in v0.6.1

func (x *JobDispatchRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDispatchRequest) CodecEncodeSelf added in v0.6.1

func (x *JobDispatchRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobDispatchResponse added in v0.5.3

type JobDispatchResponse struct {
	DispatchedJobID string
	EvalID          string
	EvalCreateIndex uint64
	JobCreateIndex  uint64
	WriteMeta
}

func (*JobDispatchResponse) CodecDecodeSelf added in v0.6.1

func (x *JobDispatchResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobDispatchResponse) CodecEncodeSelf added in v0.6.1

func (x *JobDispatchResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobEvaluateRequest

type JobEvaluateRequest struct {
	JobID       string
	EvalOptions EvalOptions
	WriteRequest
}

JobEvaluateRequest is used when we just need to re-evaluate a target job

func (*JobEvaluateRequest) CodecDecodeSelf added in v0.6.1

func (x *JobEvaluateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobEvaluateRequest) CodecEncodeSelf added in v0.6.1

func (x *JobEvaluateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobEvaluationsResponse

type JobEvaluationsResponse struct {
	Evaluations []*Evaluation
	QueryMeta
}

JobEvaluationsResponse is used to return the evaluations for a job

func (*JobEvaluationsResponse) CodecDecodeSelf added in v0.6.1

func (x *JobEvaluationsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobEvaluationsResponse) CodecEncodeSelf added in v0.6.1

func (x *JobEvaluationsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobListRequest

type JobListRequest struct {
	QueryOptions
}

JobListRequest is used to parameterize a list request

func (*JobListRequest) CodecDecodeSelf added in v0.6.1

func (x *JobListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobListRequest) CodecEncodeSelf added in v0.6.1

func (x *JobListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobListResponse

type JobListResponse struct {
	Jobs []*JobListStub
	QueryMeta
}

JobListResponse is used for a list request

func (*JobListResponse) CodecDecodeSelf added in v0.6.1

func (x *JobListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobListResponse) CodecEncodeSelf added in v0.6.1

func (x *JobListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobListStub

type JobListStub struct {
	ID                string
	ParentID          string
	Name              string
	Datacenters       []string
	Type              string
	Priority          int
	Periodic          bool
	ParameterizedJob  bool
	Stop              bool
	Status            string
	StatusDescription string
	JobSummary        *JobSummary
	CreateIndex       uint64
	ModifyIndex       uint64
	JobModifyIndex    uint64
	SubmitTime        int64
}

JobListStub is used to return a subset of job information for the job list

func (*JobListStub) CodecDecodeSelf added in v0.6.1

func (x *JobListStub) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobListStub) CodecEncodeSelf added in v0.6.1

func (x *JobListStub) CodecEncodeSelf(e *codec1978.Encoder)

type JobPlanRequest added in v0.4.0

type JobPlanRequest struct {
	Job  *Job
	Diff bool // Toggles an annotated diff
	// PolicyOverride is set when the user is attempting to override any policies
	PolicyOverride bool
	WriteRequest
}

JobPlanRequest is used for the Job.Plan endpoint to trigger a dry-run evaluation of the Job.

func (*JobPlanRequest) CodecDecodeSelf added in v0.6.1

func (x *JobPlanRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobPlanRequest) CodecEncodeSelf added in v0.6.1

func (x *JobPlanRequest) CodecEncodeSelf(e *codec1978.Encoder)

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

	// Warnings contains any warnings about the given job. These may include
	// deprecation warnings.
	Warnings string

	WriteMeta
}

JobPlanResponse is used to respond to a job plan request

func (*JobPlanResponse) CodecDecodeSelf added in v0.6.1

func (x *JobPlanResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobPlanResponse) CodecEncodeSelf added in v0.6.1

func (x *JobPlanResponse) CodecEncodeSelf(e *codec1978.Encoder)

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

	// PolicyOverride is set when the user is attempting to override any policies
	PolicyOverride bool

	WriteRequest
}

JobRegisterRequest is used for Job.Register endpoint to register a job as being a schedulable entity.

func (*JobRegisterRequest) CodecDecodeSelf added in v0.6.1

func (x *JobRegisterRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobRegisterRequest) CodecEncodeSelf added in v0.6.1

func (x *JobRegisterRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobRegisterResponse

type JobRegisterResponse struct {
	EvalID          string
	EvalCreateIndex uint64
	JobModifyIndex  uint64

	// Warnings contains any warnings about the given job. These may include
	// deprecation warnings.
	Warnings string

	QueryMeta
}

JobRegisterResponse is used to respond to a job registration

func (*JobRegisterResponse) CodecDecodeSelf added in v0.6.1

func (x *JobRegisterResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobRegisterResponse) CodecEncodeSelf added in v0.6.1

func (x *JobRegisterResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobRevertRequest added in v0.6.0

type JobRevertRequest struct {
	// JobID is the ID of the job  being reverted
	JobID string

	// JobVersion the version to revert to.
	JobVersion uint64

	// EnforcePriorVersion if set will enforce that the job is at the given
	// version before reverting.
	EnforcePriorVersion *uint64

	// VaultToken is the Vault token that proves the submitter of the job revert
	// has access to any Vault policies specified in the targeted job version. This
	// field is only used to transfer the token and is not stored after the Job
	// revert.
	VaultToken string

	WriteRequest
}

JobRevertRequest is used to revert a job to a prior version.

func (*JobRevertRequest) CodecDecodeSelf added in v0.6.1

func (x *JobRevertRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobRevertRequest) CodecEncodeSelf added in v0.6.1

func (x *JobRevertRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobSpecificRequest

type JobSpecificRequest struct {
	JobID string
	All   bool
	QueryOptions
}

JobSpecificRequest is used when we just need to specify a target job

func (*JobSpecificRequest) CodecDecodeSelf added in v0.6.1

func (x *JobSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobSpecificRequest) CodecEncodeSelf added in v0.6.1

func (x *JobSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobStabilityRequest added in v0.6.0

type JobStabilityRequest struct {
	// Job to set the stability on
	JobID      string
	JobVersion uint64

	// Set the stability
	Stable bool
	WriteRequest
}

JobStabilityRequest is used to marked a job as stable.

func (*JobStabilityRequest) CodecDecodeSelf added in v0.6.1

func (x *JobStabilityRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobStabilityRequest) CodecEncodeSelf added in v0.6.1

func (x *JobStabilityRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobStabilityResponse added in v0.6.0

type JobStabilityResponse struct {
	WriteMeta
}

JobStabilityResponse is the response when marking a job as stable.

func (*JobStabilityResponse) CodecDecodeSelf added in v0.6.1

func (x *JobStabilityResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobStabilityResponse) CodecEncodeSelf added in v0.6.1

func (x *JobStabilityResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobSummary added in v0.4.1

type JobSummary struct {
	// JobID is the ID of the job the summary is for
	JobID string

	// Namespace is the namespace of the job and its summary
	Namespace string

	// Summary 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) CodecDecodeSelf added in v0.6.1

func (x *JobSummary) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobSummary) CodecEncodeSelf added in v0.6.1

func (x *JobSummary) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*JobSummaryRequest) CodecDecodeSelf added in v0.6.1

func (x *JobSummaryRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobSummaryRequest) CodecEncodeSelf added in v0.6.1

func (x *JobSummaryRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobSummaryResponse added in v0.4.1

type JobSummaryResponse struct {
	JobSummary *JobSummary
	QueryMeta
}

JobSummaryResponse is used to return a single job summary

func (*JobSummaryResponse) CodecDecodeSelf added in v0.6.1

func (x *JobSummaryResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobSummaryResponse) CodecEncodeSelf added in v0.6.1

func (x *JobSummaryResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobValidateRequest added in v0.5.5

type JobValidateRequest struct {
	Job *Job
	WriteRequest
}

JobValidateRequest is used to validate a job

func (*JobValidateRequest) CodecDecodeSelf added in v0.6.1

func (x *JobValidateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobValidateRequest) CodecEncodeSelf added in v0.6.1

func (x *JobValidateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobValidateResponse added in v0.5.5

type JobValidateResponse struct {
	// DriverConfigValidated indicates whether the agent validated the driver
	// config
	DriverConfigValidated bool

	// ValidationErrors is a list of validation errors
	ValidationErrors []string

	// Error is a string version of any error that may have occurred
	Error string

	// Warnings contains any warnings about the given job. These may include
	// deprecation warnings.
	Warnings string
}

JobValidateResponse is the response from validate request

func (*JobValidateResponse) CodecDecodeSelf added in v0.6.1

func (x *JobValidateResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobValidateResponse) CodecEncodeSelf added in v0.6.1

func (x *JobValidateResponse) CodecEncodeSelf(e *codec1978.Encoder)

type JobVersionsRequest added in v0.6.0

type JobVersionsRequest struct {
	JobID string
	Diffs bool
	QueryOptions
}

JobVersionsRequest is used to get a jobs versions

func (*JobVersionsRequest) CodecDecodeSelf added in v0.6.1

func (x *JobVersionsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobVersionsRequest) CodecEncodeSelf added in v0.6.1

func (x *JobVersionsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type JobVersionsResponse added in v0.6.0

type JobVersionsResponse struct {
	Versions []*Job
	Diffs    []*JobDiff
	QueryMeta
}

JobVersionsResponse is used for a job get versions request

func (*JobVersionsResponse) CodecDecodeSelf added in v0.6.1

func (x *JobVersionsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*JobVersionsResponse) CodecEncodeSelf added in v0.6.1

func (x *JobVersionsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type KeyringRequest added in v0.5.0

type KeyringRequest struct {
	Key string
}

KeyringRequest is request objects for serf key operations.

func (*KeyringRequest) CodecDecodeSelf added in v0.6.1

func (x *KeyringRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*KeyringRequest) CodecEncodeSelf added in v0.6.1

func (x *KeyringRequest) CodecEncodeSelf(e *codec1978.Encoder)

type KeyringResponse added in v0.5.0

type KeyringResponse struct {
	Messages map[string]string
	Keys     map[string]int
	NumNodes int
}

KeyringResponse is a unified key response and can be used for install, remove, use, as well as listing key queries.

func (*KeyringResponse) CodecDecodeSelf added in v0.6.1

func (x *KeyringResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*KeyringResponse) CodecEncodeSelf added in v0.6.1

func (x *KeyringResponse) CodecEncodeSelf(e *codec1978.Encoder)

type LogConfig added in v0.3.0

type LogConfig struct {
	MaxFiles      int
	MaxFileSizeMB int
}

LogConfig provides configuration for log rotation

func DefaultLogConfig added in v0.3.0

func DefaultLogConfig() *LogConfig

DefaultLogConfig returns the default LogConfig values.

func (*LogConfig) CodecDecodeSelf added in v0.6.1

func (x *LogConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*LogConfig) CodecEncodeSelf added in v0.6.1

func (x *LogConfig) CodecEncodeSelf(e *codec1978.Encoder)

func (*LogConfig) Validate added in v0.3.0

func (l *LogConfig) Validate() error

Validate returns an error if the log config specified are less than the minimum allowed.

type MessageType

type MessageType uint8
const (
	NodeRegisterRequestType MessageType = iota
	NodeDeregisterRequestType
	NodeUpdateStatusRequestType
	NodeUpdateDrainRequestType
	JobRegisterRequestType
	JobDeregisterRequestType
	EvalUpdateRequestType
	EvalDeleteRequestType
	AllocUpdateRequestType
	AllocClientUpdateRequestType
	ReconcileJobSummariesRequestType
	VaultAccessorRegisterRequestType
	VaultAccessorDeregisterRequestType
	ApplyPlanResultsRequestType
	DeploymentStatusUpdateRequestType
	DeploymentPromoteRequestType
	DeploymentAllocHealthRequestType
	DeploymentDeleteRequestType
	JobStabilityRequestType
	ACLPolicyUpsertRequestType
	ACLPolicyDeleteRequestType
	ACLTokenUpsertRequestType
	ACLTokenDeleteRequestType
	ACLTokenBootstrapRequestType
	AutopilotRequestType
	UpsertNodeEventsType
	JobBatchDeregisterRequestType
	AllocUpdateDesiredTransitionRequestType
	NodeUpdateEligibilityRequestType
	BatchNodeUpdateDrainRequestType
	SchedulerConfigRequestType
)

func (*MessageType) CodecDecodeSelf added in v0.6.1

func (x *MessageType) CodecDecodeSelf(d *codec1978.Decoder)

func (MessageType) CodecEncodeSelf added in v0.6.1

func (x MessageType) CodecEncodeSelf(e *codec1978.Encoder)

type MigrateStrategy added in v0.8.0

type MigrateStrategy struct {
	MaxParallel     int
	HealthCheck     string
	MinHealthyTime  time.Duration
	HealthyDeadline time.Duration
}

func DefaultMigrateStrategy added in v0.8.0

func DefaultMigrateStrategy() *MigrateStrategy

DefaultMigrateStrategy is used for backwards compat with pre-0.8 Allocations that lack an update strategy.

This function should match its counterpart in api/tasks.go

func (*MigrateStrategy) CodecDecodeSelf added in v0.8.0

func (x *MigrateStrategy) CodecDecodeSelf(d *codec1978.Decoder)

func (*MigrateStrategy) CodecEncodeSelf added in v0.8.0

func (x *MigrateStrategy) CodecEncodeSelf(e *codec1978.Encoder)

func (*MigrateStrategy) Validate added in v0.8.0

func (m *MigrateStrategy) Validate() error

type NamespacedID added in v0.7.0

type NamespacedID struct {
	ID        string
	Namespace string
}

NamespacedID is a tuple of an ID and a namespace

func NewNamespacedID added in v0.8.7

func NewNamespacedID(id, ns string) NamespacedID

NewNamespacedID returns a new namespaced ID given the ID and namespace

func (*NamespacedID) CodecDecodeSelf added in v0.7.0

func (x *NamespacedID) CodecDecodeSelf(d *codec1978.Decoder)

func (*NamespacedID) CodecEncodeSelf added in v0.7.0

func (x *NamespacedID) CodecEncodeSelf(e *codec1978.Encoder)

func (NamespacedID) String added in v0.8.0

func (n NamespacedID) String() string

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) AddReservedPortRange added in v0.9.0

func (idx *NetworkIndex) AddReservedPortRange(ports string) (collide bool)

AddReservedPortRange marks the ports given as reserved on all network interfaces. The port format is comma delimited, with spans given as n1-n2 (80,100-200,205)

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) CodecDecodeSelf added in v0.8.2

func (x *NetworkIndex) CodecDecodeSelf(d *codec1978.Decoder)

func (*NetworkIndex) CodecEncodeSelf added in v0.8.2

func (x *NetworkIndex) CodecEncodeSelf(e *codec1978.Encoder)

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 // Host IP address
	MBits         int    // Throughput
	ReservedPorts []Port // Host Reserved ports
	DynamicPorts  []Port // Host 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) CodecDecodeSelf added in v0.6.1

func (x *NetworkResource) CodecDecodeSelf(d *codec1978.Decoder)

func (*NetworkResource) CodecEncodeSelf added in v0.6.1

func (x *NetworkResource) CodecEncodeSelf(e *codec1978.Encoder)

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) Equals added in v0.8.0

func (nr *NetworkResource) Equals(other *NetworkResource) bool

func (*NetworkResource) GoString

func (n *NetworkResource) GoString() string

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.

func (*NetworkResource) PortLabels added in v0.6.0

func (n *NetworkResource) PortLabels() map[string]int

PortLabels returns a map of port labels to their assigned host ports.

type Networks added in v0.6.0

type Networks []*NetworkResource

Networks defined for a task on the Resources struct.

func (*Networks) CodecDecodeSelf added in v0.6.1

func (x *Networks) CodecDecodeSelf(d *codec1978.Decoder)

func (Networks) CodecEncodeSelf added in v0.6.1

func (x Networks) CodecEncodeSelf(e *codec1978.Encoder)

func (*Networks) Equals added in v0.9.2

func (n *Networks) Equals(o *Networks) bool

Equals equates Networks as a set

func (Networks) NetIndex added in v0.9.0

func (ns Networks) NetIndex(n *NetworkResource) int

func (Networks) Port added in v0.6.0

func (ns Networks) Port(label string) (string, int)

Port assignment and IP for the given label or empty values.

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 privileged 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

	// NodeResources captures the available resources on the client.
	NodeResources *NodeResources

	// ReservedResources captures the set resources on the client that are
	// reserved from scheduling.
	ReservedResources *NodeReservedResources

	// Resources is the available resources on the client.
	// For example 'cpu=2' 'memory=2048'
	// COMPAT(0.10): Remove in 0.10
	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

	// COMPAT: Remove in Nomad 0.9
	// 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. Superceded by DrainStrategy in Nomad
	// 0.8 but kept for backward compat.
	Drain bool

	// DrainStrategy determines the node's draining behavior. Will be nil
	// when Drain=false.
	DrainStrategy *DrainStrategy

	// SchedulingEligibility determines whether this node will receive new
	// placements.
	SchedulingEligibility string

	// 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

	// Events is the most recent set of events generated for the node,
	// retaining only MaxRetainedNodeEvents number at a time
	Events []*NodeEvent

	// Drivers is a map of driver names to current driver information
	Drivers map[string]*DriverInfo

	// Raft Indexes
	CreateIndex uint64
	ModifyIndex uint64
}

Node is a representation of a schedulable client node

func MockNode added in v0.9.0

func MockNode() *Node

func MockNvidiaNode added in v0.9.0

func MockNvidiaNode() *Node

NvidiaNode returns a node with two instances of an Nvidia GPU

func (*Node) Canonicalize added in v0.8.0

func (n *Node) Canonicalize()

func (*Node) CodecDecodeSelf added in v0.6.1

func (x *Node) CodecDecodeSelf(d *codec1978.Decoder)

func (*Node) CodecEncodeSelf added in v0.6.1

func (x *Node) CodecEncodeSelf(e *codec1978.Encoder)

func (*Node) ComparableReservedResources added in v0.9.0

func (n *Node) ComparableReservedResources() *ComparableResources

COMPAT(0.11): Remove in 0.11 ComparableReservedResources returns the reserved resouces on the node handling upgrade paths. Reserved networks must be handled separately. After 0.11 calls to this should be replaced with: node.ReservedResources.Comparable()

func (*Node) ComparableResources added in v0.9.0

func (n *Node) ComparableResources() *ComparableResources

COMPAT(0.11): Remove in 0.11 ComparableResources returns the resouces on the node handling upgrade paths. Networking must be handled separately. After 0.11 calls to this should be replaced with: node.NodeResources.Comparable()

func (*Node) ComputeClass added in v0.3.0

func (n *Node) ComputeClass() error

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 identifying fields.

func (*Node) Copy added in v0.3.0

func (n *Node) Copy() *Node

func (Node) HashInclude added in v0.3.0

func (n Node) HashInclude(field string, v interface{}) (bool, error)

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

func (n Node) HashIncludeMap(field string, k, v interface{}) (bool, error)

HashIncludeMap is used to blacklist uniquely identifying node map keys from being included in the computed node class.

func (*Node) Ready added in v0.5.0

func (n *Node) Ready() bool

Ready returns true if the node is ready for running allocations

func (*Node) Stub

func (n *Node) Stub() *NodeListStub

Stub returns a summarized version of the node

func (*Node) TerminalStatus

func (n *Node) TerminalStatus() bool

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

func (*NodeAllocsResponse) CodecDecodeSelf added in v0.6.1

func (x *NodeAllocsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeAllocsResponse) CodecEncodeSelf added in v0.6.1

func (x *NodeAllocsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeClientAllocsResponse added in v0.3.0

type NodeClientAllocsResponse struct {
	Allocs map[string]uint64

	// MigrateTokens are used when ACLs are enabled to allow cross node,
	// authenticated access to sticky volumes
	MigrateTokens map[string]string

	QueryMeta
}

NodeClientAllocsResponse is used to return allocs meta data for a single node

func (*NodeClientAllocsResponse) CodecDecodeSelf added in v0.6.1

func (x *NodeClientAllocsResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeClientAllocsResponse) CodecEncodeSelf added in v0.6.1

func (x *NodeClientAllocsResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeConnQueryResponse added in v0.8.0

type NodeConnQueryResponse struct {
	// Connected indicates whether a connection to the Client exists
	Connected bool

	// Established marks the time at which the connection was established
	Established time.Time

	QueryMeta
}

NodeConnQueryResponse is used to respond to a query of whether a server has a connection to a specific Node

func (*NodeConnQueryResponse) CodecDecodeSelf added in v0.8.0

func (x *NodeConnQueryResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeConnQueryResponse) CodecEncodeSelf added in v0.8.0

func (x *NodeConnQueryResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeCpuResources added in v0.9.0

type NodeCpuResources struct {
	// CpuShares is the CPU shares available. This is calculated by number of
	// cores multiplied by the core frequency.
	CpuShares int64
}

NodeCpuResources captures the CPU resources of the node.

func (*NodeCpuResources) CodecDecodeSelf added in v0.9.2

func (x *NodeCpuResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeCpuResources) CodecEncodeSelf added in v0.9.2

func (x *NodeCpuResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeCpuResources) Equals added in v0.9.0

func (n *NodeCpuResources) Equals(o *NodeCpuResources) bool

func (*NodeCpuResources) Merge added in v0.9.0

func (n *NodeCpuResources) Merge(o *NodeCpuResources)

type NodeDeregisterRequest

type NodeDeregisterRequest struct {
	NodeID string
	WriteRequest
}

NodeDeregisterRequest is used for Node.Deregister endpoint to deregister a node as being a schedulable entity.

func (*NodeDeregisterRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeDeregisterRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDeregisterRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeDeregisterRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeDevice added in v0.9.0

type NodeDevice struct {
	// ID is the ID of the device.
	ID string

	// Healthy captures whether the device is healthy.
	Healthy bool

	// HealthDescription is used to provide a human readable description of why
	// the device may be unhealthy.
	HealthDescription string

	// Locality stores HW locality information for the node to optionally be
	// used when making placement decisions.
	Locality *NodeDeviceLocality
}

NodeDevice is an instance of a particular device.

func (*NodeDevice) CodecDecodeSelf added in v0.9.2

func (x *NodeDevice) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDevice) CodecEncodeSelf added in v0.9.2

func (x *NodeDevice) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeDevice) Copy added in v0.9.0

func (n *NodeDevice) Copy() *NodeDevice

func (*NodeDevice) Equals added in v0.9.0

func (n *NodeDevice) Equals(o *NodeDevice) bool

type NodeDeviceLocality added in v0.9.0

type NodeDeviceLocality struct {
	// PciBusID is the PCI Bus ID for the device.
	PciBusID string
}

NodeDeviceLocality stores information about the devices hardware locality on the node.

func (*NodeDeviceLocality) CodecDecodeSelf added in v0.9.2

func (x *NodeDeviceLocality) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDeviceLocality) CodecEncodeSelf added in v0.9.2

func (x *NodeDeviceLocality) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeDeviceLocality) Copy added in v0.9.0

func (*NodeDeviceLocality) Equals added in v0.9.0

type NodeDeviceResource added in v0.9.0

type NodeDeviceResource struct {
	Vendor     string
	Type       string
	Name       string
	Instances  []*NodeDevice
	Attributes map[string]*psstructs.Attribute
}

NodeDeviceResource captures a set of devices sharing a common vendor/type/device_name tuple.

func (*NodeDeviceResource) CodecDecodeSelf added in v0.9.2

func (x *NodeDeviceResource) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDeviceResource) CodecEncodeSelf added in v0.9.2

func (x *NodeDeviceResource) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeDeviceResource) Copy added in v0.9.0

func (*NodeDeviceResource) Equals added in v0.9.0

func (NodeDeviceResource) HashInclude added in v0.9.0

func (n NodeDeviceResource) HashInclude(field string, v interface{}) (bool, error)

HashInclude is used to blacklist uniquely identifying node fields from being included in the computed node class.

func (NodeDeviceResource) HashIncludeMap added in v0.9.0

func (n NodeDeviceResource) HashIncludeMap(field string, k, v interface{}) (bool, error)

HashIncludeMap is used to blacklist uniquely identifying node map keys from being included in the computed node class.

func (*NodeDeviceResource) ID added in v0.9.0

type NodeDiskResources added in v0.9.0

type NodeDiskResources struct {
	// DiskMB is the total available disk space on the node
	DiskMB int64
}

NodeDiskResources captures the disk resources of the node

func (*NodeDiskResources) CodecDecodeSelf added in v0.9.2

func (x *NodeDiskResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDiskResources) CodecEncodeSelf added in v0.9.2

func (x *NodeDiskResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeDiskResources) Equals added in v0.9.0

func (*NodeDiskResources) Merge added in v0.9.0

func (n *NodeDiskResources) Merge(o *NodeDiskResources)

type NodeDrainUpdateResponse

type NodeDrainUpdateResponse struct {
	NodeModifyIndex uint64
	EvalIDs         []string
	EvalCreateIndex uint64
	WriteMeta
}

NodeDrainUpdateResponse is used to respond to a node drain update

func (*NodeDrainUpdateResponse) CodecDecodeSelf added in v0.6.1

func (x *NodeDrainUpdateResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeDrainUpdateResponse) CodecEncodeSelf added in v0.6.1

func (x *NodeDrainUpdateResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeEligibilityUpdateResponse added in v0.8.0

type NodeEligibilityUpdateResponse struct {
	NodeModifyIndex uint64
	EvalIDs         []string
	EvalCreateIndex uint64
	WriteMeta
}

NodeEligibilityUpdateResponse is used to respond to a node eligibility update

func (*NodeEligibilityUpdateResponse) CodecDecodeSelf added in v0.8.0

func (x *NodeEligibilityUpdateResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeEligibilityUpdateResponse) CodecEncodeSelf added in v0.8.0

func (x *NodeEligibilityUpdateResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeEvaluateRequest

type NodeEvaluateRequest struct {
	NodeID string
	WriteRequest
}

NodeEvaluateRequest is used to re-evaluate the node

func (*NodeEvaluateRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeEvaluateRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeEvaluateRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeEvaluateRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeEvent added in v0.8.0

type NodeEvent struct {
	Message     string
	Subsystem   string
	Details     map[string]string
	Timestamp   time.Time
	CreateIndex uint64
}

NodeEvent is a single unit representing a node’s state change

func NewNodeEvent added in v0.8.4

func NewNodeEvent() *NodeEvent

NewNodeEvent generates a new node event storing the current time as the timestamp

func (*NodeEvent) AddDetail added in v0.8.4

func (ne *NodeEvent) AddDetail(k, v string) *NodeEvent

AddDetail is used to add a detail to the node event

func (*NodeEvent) CodecDecodeSelf added in v0.8.0

func (x *NodeEvent) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeEvent) CodecEncodeSelf added in v0.8.0

func (x *NodeEvent) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeEvent) Copy added in v0.8.0

func (ne *NodeEvent) Copy() *NodeEvent

func (*NodeEvent) SetMessage added in v0.8.4

func (ne *NodeEvent) SetMessage(msg string) *NodeEvent

SetMessage is used to set the message on the node event

func (*NodeEvent) SetSubsystem added in v0.8.4

func (ne *NodeEvent) SetSubsystem(sys string) *NodeEvent

SetSubsystem is used to set the subsystem on the node event

func (*NodeEvent) SetTimestamp added in v0.8.4

func (ne *NodeEvent) SetTimestamp(ts time.Time) *NodeEvent

SetTimestamp is used to set the timestamp on the node event

func (*NodeEvent) String added in v0.8.0

func (ne *NodeEvent) String() string

type NodeListRequest

type NodeListRequest struct {
	QueryOptions
}

NodeListRequest is used to parameterize a list request

func (*NodeListRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeListRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeListRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeListRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeListResponse

type NodeListResponse struct {
	Nodes []*NodeListStub
	QueryMeta
}

NodeListResponse is used for a list request

func (*NodeListResponse) CodecDecodeSelf added in v0.6.1

func (x *NodeListResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeListResponse) CodecEncodeSelf added in v0.6.1

func (x *NodeListResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeListStub

type NodeListStub struct {
	Address               string
	ID                    string
	Datacenter            string
	Name                  string
	NodeClass             string
	Version               string
	Drain                 bool
	SchedulingEligibility string
	Status                string
	StatusDescription     string
	Drivers               map[string]*DriverInfo
	CreateIndex           uint64
	ModifyIndex           uint64
}

NodeListStub is used to return a subset of job information for the job list

func (*NodeListStub) CodecDecodeSelf added in v0.6.1

func (x *NodeListStub) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeListStub) CodecEncodeSelf added in v0.6.1

func (x *NodeListStub) CodecEncodeSelf(e *codec1978.Encoder)

type NodeMemoryResources added in v0.9.0

type NodeMemoryResources struct {
	// MemoryMB is the total available memory on the node
	MemoryMB int64
}

NodeMemoryResources captures the memory resources of the node

func (*NodeMemoryResources) CodecDecodeSelf added in v0.9.2

func (x *NodeMemoryResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeMemoryResources) CodecEncodeSelf added in v0.9.2

func (x *NodeMemoryResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeMemoryResources) Equals added in v0.9.0

func (*NodeMemoryResources) Merge added in v0.9.0

type NodeRegisterRequest

type NodeRegisterRequest struct {
	Node      *Node
	NodeEvent *NodeEvent
	WriteRequest
}

NodeRegisterRequest is used for Node.Register endpoint to register a node as being a schedulable entity.

func (*NodeRegisterRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeRegisterRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeRegisterRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeRegisterRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeReservedCpuResources added in v0.9.0

type NodeReservedCpuResources struct {
	CpuShares int64
}

NodeReservedCpuResources captures the reserved CPU resources of the node.

func (*NodeReservedCpuResources) CodecDecodeSelf added in v0.9.2

func (x *NodeReservedCpuResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeReservedCpuResources) CodecEncodeSelf added in v0.9.2

func (x *NodeReservedCpuResources) CodecEncodeSelf(e *codec1978.Encoder)

type NodeReservedDiskResources added in v0.9.0

type NodeReservedDiskResources struct {
	DiskMB int64
}

NodeReservedDiskResources captures the reserved disk resources of the node.

func (*NodeReservedDiskResources) CodecDecodeSelf added in v0.9.2

func (x *NodeReservedDiskResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeReservedDiskResources) CodecEncodeSelf added in v0.9.2

func (x *NodeReservedDiskResources) CodecEncodeSelf(e *codec1978.Encoder)

type NodeReservedMemoryResources added in v0.9.0

type NodeReservedMemoryResources struct {
	MemoryMB int64
}

NodeReservedMemoryResources captures the reserved memory resources of the node.

func (*NodeReservedMemoryResources) CodecDecodeSelf added in v0.9.2

func (x *NodeReservedMemoryResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeReservedMemoryResources) CodecEncodeSelf added in v0.9.2

func (x *NodeReservedMemoryResources) CodecEncodeSelf(e *codec1978.Encoder)

type NodeReservedNetworkResources added in v0.9.0

type NodeReservedNetworkResources struct {
	// ReservedHostPorts is the set of ports reserved on all host network
	// interfaces. Its format is a comma separate list of integers or integer
	// ranges. (80,443,1000-2000,2005)
	ReservedHostPorts string
}

NodeReservedNetworkResources captures the reserved network resources of the node.

func (*NodeReservedNetworkResources) CodecDecodeSelf added in v0.9.2

func (x *NodeReservedNetworkResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeReservedNetworkResources) CodecEncodeSelf added in v0.9.2

func (x *NodeReservedNetworkResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeReservedNetworkResources) ParseReservedHostPorts added in v0.9.0

func (n *NodeReservedNetworkResources) ParseReservedHostPorts() ([]uint64, error)

ParsePortHostPorts returns the reserved host ports.

type NodeReservedResources added in v0.9.0

NodeReservedResources is used to capture the resources on a client node that should be reserved and not made available to jobs.

func (*NodeReservedResources) CodecDecodeSelf added in v0.9.2

func (x *NodeReservedResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeReservedResources) CodecEncodeSelf added in v0.9.2

func (x *NodeReservedResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeReservedResources) Comparable added in v0.9.0

func (n *NodeReservedResources) Comparable() *ComparableResources

Comparable returns a comparable version of the node's reserved resources. The returned resources doesn't contain any network information. This conversion can be lossy so care must be taken when using it.

func (*NodeReservedResources) Copy added in v0.9.0

type NodeResources added in v0.9.0

type NodeResources struct {
	Cpu      NodeCpuResources
	Memory   NodeMemoryResources
	Disk     NodeDiskResources
	Networks Networks
	Devices  []*NodeDeviceResource
}

NodeResources is used to define the resources available on a client node.

func (*NodeResources) CodecDecodeSelf added in v0.9.2

func (x *NodeResources) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeResources) CodecEncodeSelf added in v0.9.2

func (x *NodeResources) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeResources) Comparable added in v0.9.0

func (n *NodeResources) Comparable() *ComparableResources

Comparable returns a comparable version of the nodes resources. This conversion can be lossy so care must be taken when using it.

func (*NodeResources) Copy added in v0.9.0

func (n *NodeResources) Copy() *NodeResources

func (*NodeResources) Equals added in v0.9.0

func (n *NodeResources) Equals(o *NodeResources) bool

func (NodeResources) HashInclude added in v0.9.0

func (n NodeResources) HashInclude(field string, v interface{}) (bool, error)

HashInclude is used to blacklist uniquely identifying node fields from being included in the computed node class.

func (*NodeResources) Merge added in v0.9.0

func (n *NodeResources) Merge(o *NodeResources)

type NodeScoreMeta added in v0.9.0

type NodeScoreMeta struct {
	NodeID    string
	Scores    map[string]float64
	NormScore float64
}

NodeScoreMeta captures scoring meta data derived from different scoring factors.

func CopySliceNodeScoreMeta added in v0.9.0

func CopySliceNodeScoreMeta(s []*NodeScoreMeta) []*NodeScoreMeta

func (*NodeScoreMeta) CodecDecodeSelf added in v0.9.2

func (x *NodeScoreMeta) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeScoreMeta) CodecEncodeSelf added in v0.9.2

func (x *NodeScoreMeta) CodecEncodeSelf(e *codec1978.Encoder)

func (*NodeScoreMeta) Copy added in v0.9.0

func (s *NodeScoreMeta) Copy() *NodeScoreMeta

func (*NodeScoreMeta) Data added in v0.9.0

func (s *NodeScoreMeta) Data() interface{}

func (*NodeScoreMeta) Score added in v0.9.0

func (s *NodeScoreMeta) Score() float64

func (*NodeScoreMeta) String added in v0.9.0

func (s *NodeScoreMeta) String() string

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.

func (*NodeServerInfo) CodecDecodeSelf added in v0.6.1

func (x *NodeServerInfo) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeServerInfo) CodecEncodeSelf added in v0.6.1

func (x *NodeServerInfo) CodecEncodeSelf(e *codec1978.Encoder)

type NodeSpecificRequest

type NodeSpecificRequest struct {
	NodeID   string
	SecretID string
	QueryOptions
}

NodeSpecificRequest is used when we just need to specify a target node

func (*NodeSpecificRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeSpecificRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeSpecificRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeSpecificRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeUpdateDrainRequest

type NodeUpdateDrainRequest struct {
	NodeID        string
	DrainStrategy *DrainStrategy

	// COMPAT Remove in version 0.10
	// As part of Nomad 0.8 we have deprecated the drain boolean in favor of a
	// drain strategy but we need to handle the upgrade path where the Raft log
	// contains drain updates with just the drain boolean being manipulated.
	Drain bool

	// MarkEligible marks the node as eligible if removing the drain strategy.
	MarkEligible bool

	// NodeEvent is the event added to the node
	NodeEvent *NodeEvent

	WriteRequest
}

NodeUpdateDrainRequest is used for updating the drain strategy

func (*NodeUpdateDrainRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeUpdateDrainRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeUpdateDrainRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeUpdateDrainRequest) CodecEncodeSelf(e *codec1978.Encoder)

type NodeUpdateEligibilityRequest added in v0.8.0

type NodeUpdateEligibilityRequest struct {
	NodeID      string
	Eligibility string

	// NodeEvent is the event added to the node
	NodeEvent *NodeEvent

	WriteRequest
}

NodeUpdateEligibilityRequest is used for updating the scheduling eligibility

func (*NodeUpdateEligibilityRequest) CodecDecodeSelf added in v0.8.0

func (x *NodeUpdateEligibilityRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeUpdateEligibilityRequest) CodecEncodeSelf added in v0.8.0

func (x *NodeUpdateEligibilityRequest) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*NodeUpdateResponse) CodecDecodeSelf added in v0.6.1

func (x *NodeUpdateResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeUpdateResponse) CodecEncodeSelf added in v0.6.1

func (x *NodeUpdateResponse) CodecEncodeSelf(e *codec1978.Encoder)

type NodeUpdateStatusRequest

type NodeUpdateStatusRequest struct {
	NodeID    string
	Status    string
	NodeEvent *NodeEvent
	WriteRequest
}

NodeUpdateStatusRequest is used for Node.UpdateStatus endpoint to update the status of a node.

func (*NodeUpdateStatusRequest) CodecDecodeSelf added in v0.6.1

func (x *NodeUpdateStatusRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*NodeUpdateStatusRequest) CodecEncodeSelf added in v0.6.1

func (x *NodeUpdateStatusRequest) CodecEncodeSelf(e *codec1978.Encoder)

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) CodecDecodeSelf added in v0.8.2

func (x *ObjectDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*ObjectDiff) CodecEncodeSelf added in v0.8.2

func (x *ObjectDiff) CodecEncodeSelf(e *codec1978.Encoder)

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) CodecDecodeSelf added in v0.8.2

func (x *ObjectDiffs) CodecDecodeSelf(d *codec1978.Decoder)

func (ObjectDiffs) CodecEncodeSelf added in v0.8.2

func (x ObjectDiffs) CodecEncodeSelf(e *codec1978.Encoder)

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

	// MetaOptional is metadata keys that may be specified by the dispatcher
	MetaOptional []string
}

ParameterizedJobConfig is used to configure the parameterized job

func (*ParameterizedJobConfig) Canonicalize added in v0.5.3

func (d *ParameterizedJobConfig) Canonicalize()

func (*ParameterizedJobConfig) CodecDecodeSelf added in v0.6.1

func (x *ParameterizedJobConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*ParameterizedJobConfig) CodecEncodeSelf added in v0.6.1

func (x *ParameterizedJobConfig) CodecEncodeSelf(e *codec1978.Encoder)

func (*ParameterizedJobConfig) Copy added in v0.5.3

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

	// TimeZone is the user specified string that determines the time zone to
	// launch against. The time zones must be specified from IANA Time Zone
	// database, such as "America/New_York".
	// Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
	// Reference: https://www.iana.org/time-zones
	TimeZone string
	// contains filtered or unexported fields
}

Periodic defines the interval a job should be run at.

func (*PeriodicConfig) Canonicalize added in v0.5.5

func (p *PeriodicConfig) Canonicalize()

func (*PeriodicConfig) CodecDecodeSelf added in v0.6.1

func (x *PeriodicConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*PeriodicConfig) CodecEncodeSelf added in v0.6.1

func (x *PeriodicConfig) CodecEncodeSelf(e *codec1978.Encoder)

func (*PeriodicConfig) Copy added in v0.3.0

func (p *PeriodicConfig) Copy() *PeriodicConfig

func (*PeriodicConfig) GetLocation added in v0.5.5

func (p *PeriodicConfig) GetLocation() *time.Location

GetLocation returns the location to use for determining the time zone to run the periodic job against.

func (*PeriodicConfig) Next added in v0.2.2

func (p *PeriodicConfig) Next(fromTime time.Time) (time.Time, error)

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
}

PeriodicForceRequest is used to force a specific periodic job.

func (*PeriodicForceRequest) CodecDecodeSelf added in v0.6.1

func (x *PeriodicForceRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*PeriodicForceRequest) CodecEncodeSelf added in v0.6.1

func (x *PeriodicForceRequest) CodecEncodeSelf(e *codec1978.Encoder)

type PeriodicForceResponse added in v0.3.0

type PeriodicForceResponse struct {
	EvalID          string
	EvalCreateIndex uint64
	WriteMeta
}

PeriodicForceResponse is used to respond to a periodic job force launch

func (*PeriodicForceResponse) CodecDecodeSelf added in v0.6.1

func (x *PeriodicForceResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*PeriodicForceResponse) CodecEncodeSelf added in v0.6.1

func (x *PeriodicForceResponse) CodecEncodeSelf(e *codec1978.Encoder)

type PeriodicLaunch added in v0.3.0

type PeriodicLaunch struct {
	ID        string    // ID of the periodic job.
	Namespace string    // Namespace 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.

func (*PeriodicLaunch) CodecDecodeSelf added in v0.6.1

func (x *PeriodicLaunch) CodecDecodeSelf(d *codec1978.Decoder)

func (*PeriodicLaunch) CodecEncodeSelf added in v0.6.1

func (x *PeriodicLaunch) CodecEncodeSelf(e *codec1978.Encoder)

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

	// Deployment is the deployment created or updated by the scheduler that
	// should be applied by the planner.
	Deployment *Deployment

	// DeploymentUpdates is a set of status updates to apply to the given
	// deployments. This allows the scheduler to cancel any unneeded deployment
	// because the job is stopped or the update block is removed.
	DeploymentUpdates []*DeploymentStatusUpdate

	// NodePreemptions is a map from node id to a set of allocations from other
	// lower priority jobs that are preempted. Preempted allocations are marked
	// as evicted.
	NodePreemptions map[string][]*Allocation
	// contains filtered or unexported fields
}

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 admitting the plan.

func (*Plan) AppendAlloc

func (p *Plan) AppendAlloc(alloc *Allocation)

func (*Plan) AppendPreemptedAlloc added in v0.9.0

func (p *Plan) AppendPreemptedAlloc(alloc *Allocation, preemptingAllocID string)

AppendPreemptedAlloc is used to append an allocation that's being preempted to the plan. To minimize the size of the plan, this only sets a minimal set of fields in the allocation

func (*Plan) AppendStoppedAlloc added in v0.9.2

func (p *Plan) AppendStoppedAlloc(alloc *Allocation, desiredDesc, clientStatus string)

AppendStoppedAlloc marks an allocation to be stopped. The clientStatus of the allocation may be optionally set by passing in a non-empty value.

func (*Plan) CodecDecodeSelf added in v0.6.1

func (x *Plan) CodecDecodeSelf(d *codec1978.Decoder)

func (*Plan) CodecEncodeSelf added in v0.6.1

func (x *Plan) CodecEncodeSelf(e *codec1978.Encoder)

func (*Plan) IsNoOp

func (p *Plan) IsNoOp() bool

IsNoOp checks if this plan would do nothing

func (*Plan) NormalizeAllocations added in v0.9.2

func (p *Plan) NormalizeAllocations()

NormalizeAllocations normalizes allocations to remove fields that can be fetched from the MemDB instead of sending over the wire

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

	// PreemptedAllocs is the set of allocations to be preempted to make the placement successful.
	PreemptedAllocs []*AllocListStub
}

PlanAnnotations holds annotations made by the scheduler to give further debug information to operators.

func (*PlanAnnotations) CodecDecodeSelf added in v0.6.1

func (x *PlanAnnotations) CodecDecodeSelf(d *codec1978.Decoder)

func (*PlanAnnotations) CodecEncodeSelf added in v0.6.1

func (x *PlanAnnotations) CodecEncodeSelf(e *codec1978.Encoder)

type PlanRequest

type PlanRequest struct {
	Plan *Plan
	WriteRequest
}

PlanRequest is used to submit an allocation plan to the leader

func (*PlanRequest) CodecDecodeSelf added in v0.6.1

func (x *PlanRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*PlanRequest) CodecEncodeSelf added in v0.6.1

func (x *PlanRequest) CodecEncodeSelf(e *codec1978.Encoder)

type PlanResponse

type PlanResponse struct {
	Result *PlanResult
	WriteMeta
}

PlanResponse is used to return from a PlanRequest

func (*PlanResponse) CodecDecodeSelf added in v0.6.1

func (x *PlanResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*PlanResponse) CodecEncodeSelf added in v0.6.1

func (x *PlanResponse) CodecEncodeSelf(e *codec1978.Encoder)

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

	// Deployment is the deployment that was committed.
	Deployment *Deployment

	// DeploymentUpdates is the set of deployment updates that were committed.
	DeploymentUpdates []*DeploymentStatusUpdate

	// NodePreemptions is a map from node id to a set of allocations from other
	// lower priority jobs that are preempted. Preempted allocations are marked
	// as stopped.
	NodePreemptions 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) CodecDecodeSelf added in v0.6.1

func (x *PlanResult) CodecDecodeSelf(d *codec1978.Decoder)

func (*PlanResult) CodecEncodeSelf added in v0.6.1

func (x *PlanResult) CodecEncodeSelf(e *codec1978.Encoder)

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 Port added in v0.2.0

type Port struct {
	Label string
	Value int
}

func (*Port) CodecDecodeSelf added in v0.6.1

func (x *Port) CodecDecodeSelf(d *codec1978.Decoder)

func (*Port) CodecEncodeSelf added in v0.6.1

func (x *Port) CodecEncodeSelf(e *codec1978.Encoder)

type PreemptionConfig added in v0.9.0

type PreemptionConfig struct {
	// SystemSchedulerEnabled specifies if preemption is enabled for system jobs
	SystemSchedulerEnabled bool

	// BatchSchedulerEnabled specifies if preemption is enabled for batch jobs
	BatchSchedulerEnabled bool

	// ServiceSchedulerEnabled specifies if preemption is enabled for service jobs
	ServiceSchedulerEnabled bool
}

PreemptionConfig specifies whether preemption is enabled based on scheduler type

func (*PreemptionConfig) CodecDecodeSelf added in v0.9.0

func (x *PreemptionConfig) CodecDecodeSelf(d *codec1978.Decoder)

func (*PreemptionConfig) CodecEncodeSelf added in v0.9.0

func (x *PreemptionConfig) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*QueryMeta) CodecDecodeSelf added in v0.6.1

func (x *QueryMeta) CodecDecodeSelf(d *codec1978.Decoder)

func (*QueryMeta) CodecEncodeSelf added in v0.6.1

func (x *QueryMeta) CodecEncodeSelf(e *codec1978.Encoder)

type QueryOptions

type QueryOptions struct {
	// The target region for this query
	Region string

	// Namespace is the target namespace for the query.
	Namespace 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

	// AuthToken is secret portion of the ACL token used for the request
	AuthToken string

	InternalRpcInfo
}

QueryOptions is used to specify various flags for read queries

func (QueryOptions) AllowStaleRead

func (q QueryOptions) AllowStaleRead() bool

func (*QueryOptions) CodecDecodeSelf added in v0.6.1

func (x *QueryOptions) CodecDecodeSelf(d *codec1978.Decoder)

func (*QueryOptions) CodecEncodeSelf added in v0.6.1

func (x *QueryOptions) CodecEncodeSelf(e *codec1978.Encoder)

func (QueryOptions) IsRead

func (q QueryOptions) IsRead() bool

QueryOption only applies to reads, so always true

func (QueryOptions) RequestNamespace added in v0.7.0

func (q QueryOptions) RequestNamespace() string

func (QueryOptions) RequestRegion

func (q QueryOptions) RequestRegion() string

type RPCInfo

type RPCInfo interface {
	RequestRegion() string
	IsRead() bool
	AllowStaleRead() bool
	IsForwarded() bool
	SetForwarded()
}

RPCInfo is used to describe common information about query

type RaftConfigurationResponse added in v0.5.5

type RaftConfigurationResponse struct {
	// Servers has the list of servers in the Raft configuration.
	Servers []*RaftServer

	// Index has the Raft index of this configuration.
	Index uint64
}

RaftConfigurationResponse is returned when querying for the current Raft configuration.

func (*RaftConfigurationResponse) CodecDecodeSelf added in v0.8.2

func (x *RaftConfigurationResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*RaftConfigurationResponse) CodecEncodeSelf added in v0.8.2

func (x *RaftConfigurationResponse) CodecEncodeSelf(e *codec1978.Encoder)

type RaftPeerByAddressRequest added in v0.5.5

type RaftPeerByAddressRequest struct {
	// Address is the peer to remove, in the form "IP:port".
	Address raft.ServerAddress

	// WriteRequest holds the Region for this request.
	WriteRequest
}

RaftPeerByAddressRequest is used by the Operator endpoint to apply a Raft operation on a specific Raft peer by address in the form of "IP:port".

func (*RaftPeerByAddressRequest) CodecDecodeSelf added in v0.8.2

func (x *RaftPeerByAddressRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*RaftPeerByAddressRequest) CodecEncodeSelf added in v0.8.2

func (x *RaftPeerByAddressRequest) CodecEncodeSelf(e *codec1978.Encoder)

type RaftPeerByIDRequest added in v0.8.0

type RaftPeerByIDRequest struct {
	// ID is the peer ID to remove.
	ID raft.ServerID

	// WriteRequest holds the Region for this request.
	WriteRequest
}

RaftPeerByIDRequest is used by the Operator endpoint to apply a Raft operation on a specific Raft peer by ID.

func (*RaftPeerByIDRequest) CodecDecodeSelf added in v0.8.2

func (x *RaftPeerByIDRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*RaftPeerByIDRequest) CodecEncodeSelf added in v0.8.2

func (x *RaftPeerByIDRequest) CodecEncodeSelf(e *codec1978.Encoder)

type RaftServer added in v0.5.5

type RaftServer struct {
	// ID is the unique ID for the server. These are currently the same
	// as the address, but they will be changed to a real GUID in a future
	// release of Nomad.
	ID raft.ServerID

	// Node is the node name of the server, as known by Nomad, or this
	// will be set to "(unknown)" otherwise.
	Node string

	// Address is the IP:port of the server, used for Raft communications.
	Address raft.ServerAddress

	// Leader is true if this server is the current cluster leader.
	Leader bool

	// Voter is true if this server has a vote in the cluster. This might
	// be false if the server is staging and still coming online, or if
	// it's a non-voting server, which will be added in a future release of
	// Nomad.
	Voter bool

	// RaftProtocol is the version of the Raft protocol spoken by this server.
	RaftProtocol string
}

RaftServer has information about a server in the Raft configuration.

func (*RaftServer) CodecDecodeSelf added in v0.8.2

func (x *RaftServer) CodecDecodeSelf(d *codec1978.Decoder)

func (*RaftServer) CodecEncodeSelf added in v0.8.2

func (x *RaftServer) CodecEncodeSelf(e *codec1978.Encoder)

type Recoverable added in v0.5.6

type Recoverable interface {
	error
	IsRecoverable() bool
}

Recoverable is an interface for errors to implement to indicate whether or not they are fatal or recoverable.

type RecoverableError added in v0.5.0

type RecoverableError struct {
	Err         string
	Recoverable bool
}

RecoverableError wraps an error and marks whether it is recoverable and could be retried or it is fatal.

func (*RecoverableError) CodecDecodeSelf added in v0.6.1

func (x *RecoverableError) CodecDecodeSelf(d *codec1978.Decoder)

func (*RecoverableError) CodecEncodeSelf added in v0.6.1

func (x *RecoverableError) CodecEncodeSelf(e *codec1978.Encoder)

func (*RecoverableError) Error added in v0.5.0

func (r *RecoverableError) Error() string

func (*RecoverableError) IsRecoverable added in v0.5.6

func (r *RecoverableError) IsRecoverable() bool

func (*RecoverableError) IsUnrecoverable added in v0.9.0

func (r *RecoverableError) IsUnrecoverable() bool

type RequestedDevice added in v0.9.0

type RequestedDevice struct {
	// Name is the request name. The possible values are as follows:
	// * <type>: A single value only specifies the type of request.
	// * <vendor>/<type>: A single slash delimiter assumes the vendor and type of device is specified.
	// * <vendor>/<type>/<name>: Two slash delimiters assume vendor, type and specific model are specified.
	//
	// Examples are as follows:
	// * "gpu"
	// * "nvidia/gpu"
	// * "nvidia/gpu/GTX2080Ti"
	Name string

	// Count is the number of requested devices
	Count uint64

	// Constraints are a set of constraints to apply when selecting the device
	// to use.
	Constraints Constraints

	// Affinities are a set of affinites to apply when selecting the device
	// to use.
	Affinities Affinities
}

RequestedDevice is used to request a device for a task.

func (*RequestedDevice) CodecDecodeSelf added in v0.9.2

func (x *RequestedDevice) CodecDecodeSelf(d *codec1978.Decoder)

func (*RequestedDevice) CodecEncodeSelf added in v0.9.2

func (x *RequestedDevice) CodecEncodeSelf(e *codec1978.Encoder)

func (*RequestedDevice) Copy added in v0.9.0

func (r *RequestedDevice) Copy() *RequestedDevice

func (*RequestedDevice) Diff added in v0.9.0

func (r *RequestedDevice) Diff(other *RequestedDevice, contextual bool) *ObjectDiff

Diff returns a diff of two requested devices. If contextual diff is enabled, non-changed fields will still be returned.

func (*RequestedDevice) Equals added in v0.9.2

func (r *RequestedDevice) Equals(o *RequestedDevice) bool

func (*RequestedDevice) ID added in v0.9.0

func (r *RequestedDevice) ID() *DeviceIdTuple

func (*RequestedDevice) Validate added in v0.9.0

func (r *RequestedDevice) Validate() error

type RescheduleEvent added in v0.8.0

type RescheduleEvent struct {
	// RescheduleTime is the timestamp of a reschedule attempt
	RescheduleTime int64

	// PrevAllocID is the ID of the previous allocation being restarted
	PrevAllocID string

	// PrevNodeID is the node ID of the previous allocation
	PrevNodeID string

	// Delay is the reschedule delay associated with the attempt
	Delay time.Duration
}

RescheduleEvent is used to keep track of previous attempts at rescheduling an allocation

func NewRescheduleEvent added in v0.8.0

func NewRescheduleEvent(rescheduleTime int64, prevAllocID string, prevNodeID string, delay time.Duration) *RescheduleEvent

func (*RescheduleEvent) CodecDecodeSelf added in v0.8.0

func (x *RescheduleEvent) CodecDecodeSelf(d *codec1978.Decoder)

func (*RescheduleEvent) CodecEncodeSelf added in v0.8.0

func (x *RescheduleEvent) CodecEncodeSelf(e *codec1978.Encoder)

func (*RescheduleEvent) Copy added in v0.8.0

func (re *RescheduleEvent) Copy() *RescheduleEvent

type ReschedulePolicy added in v0.8.0

type ReschedulePolicy struct {
	// Attempts limits the number of rescheduling attempts that can occur in an interval.
	Attempts int

	// Interval is a duration in which we can limit the number of reschedule attempts.
	Interval time.Duration

	// Delay is a minimum duration to wait between reschedule attempts.
	// The delay function determines how much subsequent reschedule attempts are delayed by.
	Delay time.Duration

	// DelayFunction determines how the delay progressively changes on subsequent reschedule
	// attempts. Valid values are "exponential", "constant", and "fibonacci".
	DelayFunction string

	// MaxDelay is an upper bound on the delay.
	MaxDelay time.Duration

	// Unlimited allows infinite rescheduling attempts. Only allowed when delay is set
	// between reschedule attempts.
	Unlimited bool
}

ReschedulePolicy configures how Tasks are rescheduled when they crash or fail.

func NewReschedulePolicy added in v0.8.0

func NewReschedulePolicy(jobType string) *ReschedulePolicy

func (*ReschedulePolicy) CodecDecodeSelf added in v0.8.0

func (x *ReschedulePolicy) CodecDecodeSelf(d *codec1978.Decoder)

func (*ReschedulePolicy) CodecEncodeSelf added in v0.8.0

func (x *ReschedulePolicy) CodecEncodeSelf(e *codec1978.Encoder)

func (*ReschedulePolicy) Copy added in v0.8.0

func (*ReschedulePolicy) Enabled added in v0.8.4

func (r *ReschedulePolicy) Enabled() bool

func (*ReschedulePolicy) Validate added in v0.8.0

func (r *ReschedulePolicy) Validate() error

Validate uses different criteria to validate the reschedule policy Delay must be a minimum of 5 seconds Delay Ceiling is ignored if Delay Function is "constant" Number of possible attempts is validated, given the interval, delay and delay function

type RescheduleTracker added in v0.8.0

type RescheduleTracker struct {
	Events []*RescheduleEvent
}

RescheduleTracker encapsulates previous reschedule events

func (*RescheduleTracker) CodecDecodeSelf added in v0.8.0

func (x *RescheduleTracker) CodecDecodeSelf(d *codec1978.Decoder)

func (*RescheduleTracker) CodecEncodeSelf added in v0.8.0

func (x *RescheduleTracker) CodecEncodeSelf(e *codec1978.Encoder)

func (*RescheduleTracker) Copy added in v0.8.0

type ResolveACLTokenRequest added in v0.7.0

type ResolveACLTokenRequest struct {
	SecretID string
	QueryOptions
}

ResolveACLTokenRequest is used to resolve a specific token

func (*ResolveACLTokenRequest) CodecDecodeSelf added in v0.7.0

func (x *ResolveACLTokenRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*ResolveACLTokenRequest) CodecEncodeSelf added in v0.7.0

func (x *ResolveACLTokenRequest) CodecEncodeSelf(e *codec1978.Encoder)

type ResolveACLTokenResponse added in v0.7.0

type ResolveACLTokenResponse struct {
	Token *ACLToken
	QueryMeta
}

ResolveACLTokenResponse is used to resolve a single token

func (*ResolveACLTokenResponse) CodecDecodeSelf added in v0.7.0

func (x *ResolveACLTokenResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ResolveACLTokenResponse) CodecEncodeSelf added in v0.7.0

func (x *ResolveACLTokenResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ResourceDevices added in v0.9.2

type ResourceDevices []*RequestedDevice

COMPAT(0.10): Remove in 0.10 ResourceDevices are part of Resources

func (*ResourceDevices) CodecDecodeSelf added in v0.9.2

func (x *ResourceDevices) CodecDecodeSelf(d *codec1978.Decoder)

func (ResourceDevices) CodecEncodeSelf added in v0.9.2

func (x ResourceDevices) CodecEncodeSelf(e *codec1978.Encoder)

func (*ResourceDevices) Equals added in v0.9.2

func (d *ResourceDevices) Equals(o *ResourceDevices) bool

COMPAT(0.10): Remove in 0.10 Equals ResourceDevices as set keyed by Name

type Resources

type Resources struct {
	CPU      int
	MemoryMB int
	DiskMB   int
	IOPS     int // COMPAT(0.10): Only being used to issue warnings
	Networks Networks
	Devices  ResourceDevices
}

Resources is used to define the resources available on a client

func DefaultResources added in v0.3.0

func DefaultResources() *Resources

DefaultResources is a small resources object that contains the default resources requests that we will provide to an object. --- THIS FUNCTION IS REPLICATED IN api/resources.go and should be kept in sync.

func MinResources added in v0.7.1

func MinResources() *Resources

MinResources is a small resources object that contains the absolute minimum resources that we will provide to an object. This should not be confused with the defaults which are provided in Canonicalize() --- THIS FUNCTION IS REPLICATED IN api/resources.go and should be kept in sync.

func (*Resources) Add

func (r *Resources) Add(delta *Resources) error

Add adds the resources of the delta to this, potentially returning an error if not possible. COMPAT(0.10): Remove in 0.10

func (*Resources) Canonicalize added in v0.4.1

func (r *Resources) Canonicalize()

COMPAT(0.10): Remove in 0.10

func (*Resources) CodecDecodeSelf added in v0.6.1

func (x *Resources) CodecDecodeSelf(d *codec1978.Decoder)

func (*Resources) CodecEncodeSelf added in v0.6.1

func (x *Resources) CodecEncodeSelf(e *codec1978.Encoder)

func (*Resources) Copy

func (r *Resources) Copy() *Resources

Copy returns a deep copy of the resources

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

func (r *Resources) DiskInBytes() int64

DiskInBytes returns the amount of disk resources in bytes.

func (*Resources) Equals added in v0.9.2

func (r *Resources) Equals(o *Resources) bool

COMPAT(0.10): Remove in 0.10

func (*Resources) GoString

func (r *Resources) GoString() string

COMPAT(0.10): Remove in 0.10

func (*Resources) MeetsMinResources added in v0.3.0

func (r *Resources) MeetsMinResources() error

MeetsMinResources returns an error if the resources specified are less than the minimum allowed. This is based on the minimums defined in the Resources type COMPAT(0.10): Remove in 0.10

func (*Resources) Merge added in v0.3.0

func (r *Resources) Merge(other *Resources)

Merge merges this resource with another resource. COMPAT(0.10): Remove in 0.10

func (*Resources) NetIndex

func (r *Resources) NetIndex(n *NetworkResource) int

NetIndex finds the matching net index using device name COMPAT(0.10): Remove in 0.10

func (*Resources) Superset

func (r *Resources) Superset(other *Resources) (bool, string)

Superset checks if one set of resources is a superset of another. This ignores network resources, and the NetworkIndex should be used for that. COMPAT(0.10): Remove in 0.10

func (*Resources) Validate added in v0.9.0

func (r *Resources) Validate() error

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) CodecDecodeSelf added in v0.6.1

func (x *RestartPolicy) CodecDecodeSelf(d *codec1978.Decoder)

func (*RestartPolicy) CodecEncodeSelf added in v0.6.1

func (x *RestartPolicy) CodecEncodeSelf(e *codec1978.Encoder)

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 SchedulerConfiguration added in v0.9.0

type SchedulerConfiguration struct {
	// PreemptionConfig specifies whether to enable eviction of lower
	// priority jobs to place higher priority jobs.
	PreemptionConfig PreemptionConfig

	// CreateIndex/ModifyIndex store the create/modify indexes of this configuration.
	CreateIndex uint64
	ModifyIndex uint64
}

SchedulerConfiguration is the config for controlling scheduler behavior

func (*SchedulerConfiguration) CodecDecodeSelf added in v0.9.0

func (x *SchedulerConfiguration) CodecDecodeSelf(d *codec1978.Decoder)

func (*SchedulerConfiguration) CodecEncodeSelf added in v0.9.0

func (x *SchedulerConfiguration) CodecEncodeSelf(e *codec1978.Encoder)

type SchedulerConfigurationResponse added in v0.9.0

type SchedulerConfigurationResponse struct {
	// SchedulerConfig contains scheduler config options
	SchedulerConfig *SchedulerConfiguration

	QueryMeta
}

SchedulerConfigurationResponse is the response object that wraps SchedulerConfiguration

func (*SchedulerConfigurationResponse) CodecDecodeSelf added in v0.9.0

func (x *SchedulerConfigurationResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SchedulerConfigurationResponse) CodecEncodeSelf added in v0.9.0

func (x *SchedulerConfigurationResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SchedulerSetConfigRequest added in v0.9.0

type SchedulerSetConfigRequest struct {
	// Config is the new Scheduler configuration to use.
	Config SchedulerConfiguration

	// CAS controls whether to use check-and-set semantics for this request.
	CAS bool

	// WriteRequest holds the ACL token to go along with this request.
	WriteRequest
}

SchedulerSetConfigRequest is used by the Operator endpoint to update the current Scheduler configuration of the cluster.

func (*SchedulerSetConfigRequest) CodecDecodeSelf added in v0.9.0

func (x *SchedulerSetConfigRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*SchedulerSetConfigRequest) CodecEncodeSelf added in v0.9.0

func (x *SchedulerSetConfigRequest) CodecEncodeSelf(e *codec1978.Encoder)

type SchedulerSetConfigurationResponse added in v0.9.0

type SchedulerSetConfigurationResponse struct {
	// Updated returns whether the config was actually updated
	// Only set when the request uses CAS
	Updated bool

	WriteMeta
}

SchedulerSetConfigurationResponse is the response object used when updating scheduler configuration

func (*SchedulerSetConfigurationResponse) CodecDecodeSelf added in v0.9.0

func (x *SchedulerSetConfigurationResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SchedulerSetConfigurationResponse) CodecEncodeSelf added in v0.9.0

func (x *SchedulerSetConfigurationResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SearchRequest added in v0.6.1

type SearchRequest struct {
	// Prefix is what ids are matched to. I.e, if the given prefix were
	// "a", potential matches might be "abcd" or "aabb"
	Prefix string

	// Context is the type that can be matched against. A context can be a job,
	// node, evaluation, allocation, or empty (indicated every context should be
	// matched)
	Context Context

	QueryOptions
}

SearchRequest is used to parameterize a request, and returns a list of matches made up of jobs, allocations, evaluations, and/or nodes, along with whether or not the information returned is truncated.

func (*SearchRequest) CodecDecodeSelf added in v0.6.1

func (x *SearchRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*SearchRequest) CodecEncodeSelf added in v0.6.1

func (x *SearchRequest) CodecEncodeSelf(e *codec1978.Encoder)

type SearchResponse added in v0.6.1

type SearchResponse struct {
	// Map of context types to ids which match a specified prefix
	Matches map[Context][]string

	// Truncations indicates whether the matches for a particular context have
	// been truncated
	Truncations map[Context]bool

	QueryMeta
}

SearchResponse is used to return matches and information about whether the match list is truncated specific to each type of context.

func (*SearchResponse) CodecDecodeSelf added in v0.6.1

func (x *SearchResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SearchResponse) CodecEncodeSelf added in v0.6.1

func (x *SearchResponse) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*ServerMember) CodecDecodeSelf added in v0.6.1

func (x *ServerMember) CodecDecodeSelf(d *codec1978.Decoder)

func (*ServerMember) CodecEncodeSelf added in v0.6.1

func (x *ServerMember) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*ServerMembersResponse) CodecDecodeSelf added in v0.6.1

func (x *ServerMembersResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*ServerMembersResponse) CodecEncodeSelf added in v0.6.1

func (x *ServerMembersResponse) CodecEncodeSelf(e *codec1978.Encoder)

type ServerSideError added in v0.8.0

type ServerSideError interface {
	error
	IsServerSide() bool
}

ServerSideError is an interface for errors to implement to indicate errors occurring after the request makes it to a server

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

	// AddressMode specifies whether or not to use the host ip:port for
	// this service.
	AddressMode string

	Tags       []string        // List of tags for the service
	CanaryTags []string        // List of tags for the service when it is a canary
	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

func (s *Service) Canonicalize(job string, taskGroup string, task string)

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) CodecDecodeSelf added in v0.6.1

func (x *Service) CodecDecodeSelf(d *codec1978.Decoder)

func (*Service) CodecEncodeSelf added in v0.6.1

func (x *Service) CodecEncodeSelf(e *codec1978.Encoder)

func (*Service) Copy added in v0.3.0

func (s *Service) Copy() *Service

func (*Service) Hash added in v0.2.1

func (s *Service) Hash(allocID, taskName string, canary bool) string

Hash returns a base32 encoded hash of a Service's contents excluding checks as they're hashed independently.

func (*Service) Validate added in v0.2.0

func (s *Service) Validate() error

Validate checks if the Check definition is valid

func (*Service) ValidateName added in v0.5.0

func (s *Service) ValidateName(name string) error

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 arguments 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              // The port to use for tcp/http checks
	AddressMode   string              // 'host' to use host ip:port or 'driver' to use driver's
	Interval      time.Duration       // Interval of the check
	Timeout       time.Duration       // Timeout of the response from the check before consul fails the check
	InitialStatus string              // Initial status of the check
	TLSSkipVerify bool                // Skip TLS verification when Protocol=https
	Method        string              // HTTP Method to use (GET by default)
	Header        map[string][]string // HTTP Headers for Consul to set when making HTTP checks
	CheckRestart  *CheckRestart       // If and when a task should be restarted based on checks
	GRPCService   string              // Service for GRPC checks
	GRPCUseTLS    bool                // Whether or not to use TLS for GRPC checks
}

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) CodecDecodeSelf added in v0.6.1

func (x *ServiceCheck) CodecDecodeSelf(d *codec1978.Decoder)

func (*ServiceCheck) CodecEncodeSelf added in v0.6.1

func (x *ServiceCheck) CodecEncodeSelf(e *codec1978.Encoder)

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

Hash all ServiceCheck fields and the check's corresponding service ID to create an identifier. The identifier is not guaranteed to be unique as if the PortLabel is blank, the Service's PortLabel will be used after Hash is called.

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.

func (*ServiceCheck) TriggersRestarts added in v0.7.0

func (sc *ServiceCheck) TriggersRestarts() bool

TriggersRestarts returns true if this check should be watched and trigger a restart on failure.

type SingleACLPolicyResponse added in v0.7.0

type SingleACLPolicyResponse struct {
	Policy *ACLPolicy
	QueryMeta
}

SingleACLPolicyResponse is used to return a single policy

func (*SingleACLPolicyResponse) CodecDecodeSelf added in v0.7.0

func (x *SingleACLPolicyResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleACLPolicyResponse) CodecEncodeSelf added in v0.7.0

func (x *SingleACLPolicyResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleACLTokenResponse added in v0.7.0

type SingleACLTokenResponse struct {
	Token *ACLToken
	QueryMeta
}

SingleACLTokenResponse is used to return a single token

func (*SingleACLTokenResponse) CodecDecodeSelf added in v0.7.0

func (x *SingleACLTokenResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleACLTokenResponse) CodecEncodeSelf added in v0.7.0

func (x *SingleACLTokenResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleAllocResponse

type SingleAllocResponse struct {
	Alloc *Allocation
	QueryMeta
}

SingleAllocResponse is used to return a single allocation

func (*SingleAllocResponse) CodecDecodeSelf added in v0.6.1

func (x *SingleAllocResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleAllocResponse) CodecEncodeSelf added in v0.6.1

func (x *SingleAllocResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleDeploymentResponse added in v0.6.0

type SingleDeploymentResponse struct {
	Deployment *Deployment
	QueryMeta
}

SingleDeploymentResponse is used to respond with a single deployment

func (*SingleDeploymentResponse) CodecDecodeSelf added in v0.6.1

func (x *SingleDeploymentResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleDeploymentResponse) CodecEncodeSelf added in v0.6.1

func (x *SingleDeploymentResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleEvalResponse

type SingleEvalResponse struct {
	Eval *Evaluation
	QueryMeta
}

SingleEvalResponse is used to return a single evaluation

func (*SingleEvalResponse) CodecDecodeSelf added in v0.6.1

func (x *SingleEvalResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleEvalResponse) CodecEncodeSelf added in v0.6.1

func (x *SingleEvalResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleJobResponse

type SingleJobResponse struct {
	Job *Job
	QueryMeta
}

SingleJobResponse is used to return a single job

func (*SingleJobResponse) CodecDecodeSelf added in v0.6.1

func (x *SingleJobResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleJobResponse) CodecEncodeSelf added in v0.6.1

func (x *SingleJobResponse) CodecEncodeSelf(e *codec1978.Encoder)

type SingleNodeResponse

type SingleNodeResponse struct {
	Node *Node
	QueryMeta
}

SingleNodeResponse is used to return a single node

func (*SingleNodeResponse) CodecDecodeSelf added in v0.6.1

func (x *SingleNodeResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*SingleNodeResponse) CodecEncodeSelf added in v0.6.1

func (x *SingleNodeResponse) CodecEncodeSelf(e *codec1978.Encoder)

type Spread added in v0.9.0

type Spread struct {
	// Attribute is the node attribute used as the spread criteria
	Attribute string

	// Weight is the relative weight of this spread, useful when there are multiple
	// spread and affinities
	Weight int8

	// SpreadTarget is used to describe desired percentages for each attribute value
	SpreadTarget []*SpreadTarget
	// contains filtered or unexported fields
}

Spread is used to specify desired distribution of allocations according to weight

func CopySliceSpreads added in v0.9.0

func CopySliceSpreads(s []*Spread) []*Spread

func (*Spread) CodecDecodeSelf added in v0.9.2

func (x *Spread) CodecDecodeSelf(d *codec1978.Decoder)

func (*Spread) CodecEncodeSelf added in v0.9.2

func (x *Spread) CodecEncodeSelf(e *codec1978.Encoder)

func (*Spread) Copy added in v0.9.0

func (s *Spread) Copy() *Spread

func (*Spread) String added in v0.9.0

func (s *Spread) String() string

func (*Spread) Validate added in v0.9.0

func (s *Spread) Validate() error

type SpreadTarget added in v0.9.0

type SpreadTarget struct {
	// Value is a single attribute value, like "dc1"
	Value string

	// Percent is the desired percentage of allocs
	Percent uint8
	// contains filtered or unexported fields
}

SpreadTarget is used to specify desired percentages for each attribute value

func CopySliceSpreadTarget added in v0.9.0

func CopySliceSpreadTarget(s []*SpreadTarget) []*SpreadTarget

func (*SpreadTarget) CodecDecodeSelf added in v0.9.2

func (x *SpreadTarget) CodecDecodeSelf(d *codec1978.Decoder)

func (*SpreadTarget) CodecEncodeSelf added in v0.9.2

func (x *SpreadTarget) CodecEncodeSelf(e *codec1978.Encoder)

func (*SpreadTarget) Copy added in v0.9.0

func (s *SpreadTarget) Copy() *SpreadTarget

func (*SpreadTarget) String added in v0.9.0

func (s *SpreadTarget) String() string

type StreamingRpcAck added in v0.8.0

type StreamingRpcAck struct {
	// Error is used to return whether an error occurred establishing the
	// streaming RPC. This error occurs before entering the RPC handler.
	Error string
}

StreamingRpcAck is used to acknowledge receiving the StreamingRpcHeader and routing to the requested handler.

func (*StreamingRpcAck) CodecDecodeSelf added in v0.8.2

func (x *StreamingRpcAck) CodecDecodeSelf(d *codec1978.Decoder)

func (*StreamingRpcAck) CodecEncodeSelf added in v0.8.2

func (x *StreamingRpcAck) CodecEncodeSelf(e *codec1978.Encoder)

type StreamingRpcHandler added in v0.8.0

type StreamingRpcHandler func(conn io.ReadWriteCloser)

StreamingRpcHandler defines the handler for a streaming RPC.

type StreamingRpcHeader added in v0.8.0

type StreamingRpcHeader struct {
	// Method is the name of the method to invoke.
	Method string
}

StreamingRpcHeader is the first struct serialized after entering the streaming RPC mode. The header is used to dispatch to the correct method.

func (*StreamingRpcHeader) CodecDecodeSelf added in v0.8.2

func (x *StreamingRpcHeader) CodecDecodeSelf(d *codec1978.Decoder)

func (*StreamingRpcHeader) CodecEncodeSelf added in v0.8.2

func (x *StreamingRpcHeader) CodecEncodeSelf(e *codec1978.Encoder)

type StreamingRpcRegistry added in v0.8.0

type StreamingRpcRegistry struct {
	// contains filtered or unexported fields
}

StreamingRpcRegistry is used to add and retrieve handlers

func NewStreamingRpcRegistry added in v0.8.0

func NewStreamingRpcRegistry() *StreamingRpcRegistry

NewStreamingRpcRegistry creates a new registry. All registrations of handlers should be done before retrieving handlers.

func (*StreamingRpcRegistry) CodecDecodeSelf added in v0.8.2

func (x *StreamingRpcRegistry) CodecDecodeSelf(d *codec1978.Decoder)

func (*StreamingRpcRegistry) CodecEncodeSelf added in v0.8.2

func (x *StreamingRpcRegistry) CodecEncodeSelf(e *codec1978.Encoder)

func (*StreamingRpcRegistry) GetHandler added in v0.8.0

func (s *StreamingRpcRegistry) GetHandler(method string) (StreamingRpcHandler, error)

GetHandler returns a handler for the given method or an error if it doesn't exist.

func (*StreamingRpcRegistry) Register added in v0.8.0

func (s *StreamingRpcRegistry) Register(method string, handler StreamingRpcHandler)

Register registers a new handler for the given method name

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

	// Affinities can be specified at the task level to express
	// scheduling preferences
	Affinities []*Affinity

	// 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

	// LogConfig provides configuration for log rotation
	LogConfig *LogConfig

	// Artifacts is a list of artifacts to download and extract before running
	// the task.
	Artifacts []*TaskArtifact

	// Leader marks the task as the leader within the group. When the leader
	// task exits, other tasks will be gracefully terminated.
	Leader bool

	// ShutdownDelay is the duration of the delay between deregistering a
	// task from Consul and sending it a signal to shutdown. See #2441
	ShutdownDelay time.Duration

	// KillSignal is the kill signal to use for the task. This is an optional
	// specification and defaults to SIGINT
	KillSignal string
}

Task is a single process typically that is executed as part of a task group.

func (*Task) Canonicalize added in v0.4.1

func (t *Task) Canonicalize(job *Job, tg *TaskGroup)

Canonicalize canonicalizes fields in the task.

func (*Task) CodecDecodeSelf added in v0.6.1

func (x *Task) CodecDecodeSelf(d *codec1978.Decoder)

func (*Task) CodecEncodeSelf added in v0.6.1

func (x *Task) CodecEncodeSelf(e *codec1978.Encoder)

func (*Task) Copy added in v0.3.0

func (t *Task) Copy() *Task

func (*Task) Diff added in v0.4.0

func (t *Task) Diff(other *Task, contextual bool) (*TaskDiff, error)

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

func (t *Task) GoString() string

func (*Task) Validate

func (t *Task) Validate(ephemeralDisk *EphemeralDisk, jobType string) error

Validate is used to sanity check a task

func (*Task) Warnings added in v0.9.0

func (t *Task) Warnings() error

type TaskArtifact added in v0.3.1

type TaskArtifact struct {
	// GetterSource is the source to download an artifact using go-getter
	GetterSource string

	// GetterOptions are options to use when downloading the artifact using
	// go-getter.
	GetterOptions map[string]string

	// GetterMode is the go-getter.ClientMode for fetching resources.
	// Defaults to "any" but can be set to "file" or "dir".
	GetterMode string

	// RelativeDest is the download destination given relative to the task's
	// directory.
	RelativeDest string
}

TaskArtifact is an artifact to download before running the task.

func (*TaskArtifact) CodecDecodeSelf added in v0.6.1

func (x *TaskArtifact) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskArtifact) CodecEncodeSelf added in v0.6.1

func (x *TaskArtifact) CodecEncodeSelf(e *codec1978.Encoder)

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) Hash added in v0.9.0

func (ta *TaskArtifact) Hash() string

Hash creates a unique identifier for a TaskArtifact as the same GetterSource may be specified multiple times with different destinations.

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

func (*TaskDiff) CodecDecodeSelf added in v0.8.2

func (x *TaskDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskDiff) CodecEncodeSelf added in v0.8.2

func (x *TaskDiff) CodecEncodeSelf(e *codec1978.Encoder)

func (*TaskDiff) GoString added in v0.4.0

func (t *TaskDiff) GoString() string

type TaskDiffs added in v0.4.0

type TaskDiffs []*TaskDiff

For sorting TaskDiffs

func (*TaskDiffs) CodecDecodeSelf added in v0.8.2

func (x *TaskDiffs) CodecDecodeSelf(d *codec1978.Decoder)

func (TaskDiffs) CodecEncodeSelf added in v0.8.2

func (x TaskDiffs) CodecEncodeSelf(e *codec1978.Encoder)

func (TaskDiffs) Len added in v0.4.0

func (t TaskDiffs) Len() int

func (TaskDiffs) Less added in v0.4.0

func (t TaskDiffs) Less(i, j int) bool

func (TaskDiffs) Swap added in v0.4.0

func (t TaskDiffs) Swap(i, j int)

type TaskEvent added in v0.2.0

type TaskEvent struct {
	Type string
	Time int64 // Unix Nanosecond timestamp

	Message string // A possible message explaining the termination of the task.

	// DisplayMessage is a human friendly message about the event
	DisplayMessage string

	// Details is a map with annotated info about the event
	Details map[string]string

	// FailsTask marks whether this event fails the task.
	// Deprecated, use Details["fails_task"] to access this.
	FailsTask bool

	// Restart fields.
	// Deprecated, use Details["restart_reason"] to access this.
	RestartReason string

	// Setup Failure fields.
	// Deprecated, use Details["setup_error"] to access this.
	SetupError string

	// Driver Failure fields.
	// Deprecated, use Details["driver_error"] to access this.
	DriverError string // A driver error occurred while starting the task.

	// Deprecated, use Details["exit_code"] to access this.
	ExitCode int // The exit code of the task.

	// Deprecated, use Details["signal"] to access this.
	Signal int // The signal that terminated the task.

	// Killing fields
	// Deprecated, use Details["kill_timeout"] to access this.
	KillTimeout time.Duration

	// Task Killed Fields.
	// Deprecated, use Details["kill_error"] to access this.
	KillError string // Error killing the task.

	// KillReason is the reason the task was killed
	// Deprecated, use Details["kill_reason"] to access this.
	KillReason string

	// TaskRestarting fields.
	// Deprecated, use Details["start_delay"] to access this.
	StartDelay int64 // The sleep period before restarting the task in unix nanoseconds.

	// Artifact Download fields
	// Deprecated, use Details["download_error"] to access this.
	DownloadError string // Error downloading artifacts

	// Validation fields
	// Deprecated, use Details["validation_error"] to access this.
	ValidationError string // Validation error

	// The maximum allowed task disk size.
	// Deprecated, use Details["disk_limit"] to access this.
	DiskLimit int64

	// Name of the sibling task that caused termination of the task that
	// the TaskEvent refers to.
	// Deprecated, use Details["failed_sibling"] to access this.
	FailedSibling string

	// VaultError is the error from token renewal
	// Deprecated, use Details["vault_renewal_error"] to access this.
	VaultError string

	// TaskSignalReason indicates the reason the task is being signalled.
	// Deprecated, use Details["task_signal_reason"] to access this.
	TaskSignalReason string

	// TaskSignal is the signal that was sent to the task
	// Deprecated, use Details["task_signal"] to access this.
	TaskSignal string

	// DriverMessage indicates a driver action being taken.
	// Deprecated, use Details["driver_message"] to access this.
	DriverMessage string

	// GenericSource is the source of a message.
	// Deprecated, is redundant with event type.
	GenericSource 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 NewTaskEvent(event string) *TaskEvent

func (*TaskEvent) CodecDecodeSelf added in v0.6.1

func (x *TaskEvent) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskEvent) CodecEncodeSelf added in v0.6.1

func (x *TaskEvent) CodecEncodeSelf(e *codec1978.Encoder)

func (*TaskEvent) Copy added in v0.3.0

func (te *TaskEvent) Copy() *TaskEvent

func (*TaskEvent) GoString added in v0.3.1

func (te *TaskEvent) GoString() string

func (*TaskEvent) PopulateEventDisplayMessage added in v0.7.1

func (event *TaskEvent) PopulateEventDisplayMessage()

func (*TaskEvent) SetDiskLimit added in v0.5.0

func (e *TaskEvent) SetDiskLimit(limit int64) *TaskEvent

func (*TaskEvent) SetDisplayMessage added in v0.9.0

func (te *TaskEvent) SetDisplayMessage(msg string) *TaskEvent

SetDisplayMessage sets the display message of TaskEvent

func (*TaskEvent) SetDownloadError added in v0.3.1

func (e *TaskEvent) SetDownloadError(err error) *TaskEvent

func (*TaskEvent) SetDriverError added in v0.2.0

func (e *TaskEvent) SetDriverError(err error) *TaskEvent

func (*TaskEvent) SetDriverMessage added in v0.5.2

func (e *TaskEvent) SetDriverMessage(m string) *TaskEvent

func (*TaskEvent) SetExitCode added in v0.2.0

func (e *TaskEvent) SetExitCode(c int) *TaskEvent

func (*TaskEvent) SetExitMessage added in v0.2.0

func (e *TaskEvent) SetExitMessage(err error) *TaskEvent

func (*TaskEvent) SetFailedSibling added in v0.5.0

func (e *TaskEvent) SetFailedSibling(sibling string) *TaskEvent

func (*TaskEvent) SetFailsTask added in v0.5.0

func (e *TaskEvent) SetFailsTask() *TaskEvent

func (*TaskEvent) SetKillError added in v0.2.0

func (e *TaskEvent) SetKillError(err error) *TaskEvent

func (*TaskEvent) SetKillReason added in v0.5.0

func (e *TaskEvent) SetKillReason(r string) *TaskEvent

func (*TaskEvent) SetKillTimeout added in v0.4.1

func (e *TaskEvent) SetKillTimeout(timeout time.Duration) *TaskEvent

func (*TaskEvent) SetMessage added in v0.5.5

func (te *TaskEvent) SetMessage(msg string) *TaskEvent

SetMessage sets the message of TaskEvent

func (*TaskEvent) SetOOMKilled added in v0.9.0

func (e *TaskEvent) SetOOMKilled(oom bool) *TaskEvent

func (*TaskEvent) SetRestartDelay added in v0.3.1

func (e *TaskEvent) SetRestartDelay(delay time.Duration) *TaskEvent

func (*TaskEvent) SetRestartReason added in v0.3.2

func (e *TaskEvent) SetRestartReason(reason string) *TaskEvent

func (*TaskEvent) SetSetupError added in v0.5.0

func (e *TaskEvent) SetSetupError(err error) *TaskEvent

SetSetupError is used to store an error that occurred while setting up the task

func (*TaskEvent) SetSignal added in v0.2.0

func (e *TaskEvent) SetSignal(s int) *TaskEvent

func (*TaskEvent) SetSignalText added in v0.9.2

func (e *TaskEvent) SetSignalText(s string) *TaskEvent

func (*TaskEvent) SetTaskSignal added in v0.5.0

func (e *TaskEvent) SetTaskSignal(s os.Signal) *TaskEvent

func (*TaskEvent) SetTaskSignalReason added in v0.5.0

func (e *TaskEvent) SetTaskSignalReason(r string) *TaskEvent

func (*TaskEvent) SetValidationError added in v0.3.2

func (e *TaskEvent) SetValidationError(err error) *TaskEvent

func (*TaskEvent) SetVaultRenewalError added in v0.5.0

func (e *TaskEvent) SetVaultRenewalError(err error) *TaskEvent

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

	// Update is used to control the update strategy for this task group
	Update *UpdateStrategy

	// Migrate is used to control the migration strategy for this task group
	Migrate *MigrateStrategy

	// 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

	// ReschedulePolicy is used to configure how the scheduler should
	// retry failed allocations.
	ReschedulePolicy *ReschedulePolicy

	// Affinities can be specified at the task group level to express
	// scheduling preferences.
	Affinities []*Affinity

	// Spread can be specified at the task group level to express spreading
	// allocations across a desired attribute, such as datacenter
	Spreads []*Spread
}

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

func (tg *TaskGroup) Canonicalize(job *Job)

Canonicalize is used to canonicalize fields in the TaskGroup.

func (*TaskGroup) CodecDecodeSelf added in v0.6.1

func (x *TaskGroup) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskGroup) CodecEncodeSelf added in v0.6.1

func (x *TaskGroup) CodecEncodeSelf(e *codec1978.Encoder)

func (*TaskGroup) Copy added in v0.3.0

func (tg *TaskGroup) Copy() *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) GoString

func (tg *TaskGroup) GoString() string

func (*TaskGroup) LookupTask

func (tg *TaskGroup) LookupTask(name string) *Task

LookupTask finds a task by name

func (*TaskGroup) Validate

func (tg *TaskGroup) Validate(j *Job) error

Validate is used to sanity check a task group

func (*TaskGroup) Warnings added in v0.6.0

func (tg *TaskGroup) Warnings(j *Job) error

Warnings returns a list of warnings that may be from dubious settings or deprecation warnings.

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) CodecDecodeSelf added in v0.8.2

func (x *TaskGroupDiff) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskGroupDiff) CodecEncodeSelf added in v0.8.2

func (x *TaskGroupDiff) CodecEncodeSelf(e *codec1978.Encoder)

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) CodecDecodeSelf added in v0.8.2

func (x *TaskGroupDiffs) CodecDecodeSelf(d *codec1978.Decoder)

func (TaskGroupDiffs) CodecEncodeSelf added in v0.8.2

func (x TaskGroupDiffs) CodecEncodeSelf(e *codec1978.Encoder)

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

func (*TaskGroupSummary) CodecDecodeSelf added in v0.6.1

func (x *TaskGroupSummary) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskGroupSummary) CodecEncodeSelf added in v0.6.1

func (x *TaskGroupSummary) CodecEncodeSelf(e *codec1978.Encoder)

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

	// Restarts is the number of times the task has restarted
	Restarts uint64

	// LastRestart is the time the task last restarted. It is updated each time the
	// task restarts
	LastRestart time.Time

	// StartedAt is the time the task is started. It is updated each time the
	// task starts
	StartedAt time.Time

	// FinishedAt is the time at which the task transitioned to dead and will
	// not be started again.
	FinishedAt time.Time

	// 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 NewTaskState added in v0.9.0

func NewTaskState() *TaskState

NewTaskState returns a TaskState initialized in the Pending state.

func (*TaskState) Canonicalize added in v0.9.0

func (ts *TaskState) Canonicalize()

Canonicalize ensures the TaskState has a State set. It should default to Pending.

func (*TaskState) CodecDecodeSelf added in v0.6.1

func (x *TaskState) CodecDecodeSelf(d *codec1978.Decoder)

func (*TaskState) CodecEncodeSelf added in v0.6.1

func (x *TaskState) CodecEncodeSelf(e *codec1978.Encoder)

func (*TaskState) Copy added in v0.3.0

func (ts *TaskState) Copy() *TaskState

func (*TaskState) Successful added in v0.4.0

func (ts *TaskState) Successful() bool

Successful returns whether a task finished successfully. This doesn't really have meaning on a non-batch allocation because a service and system allocation should not finish.

type Template added in v0.5.0

type Template struct {
	// SourcePath is the path to the template to be rendered
	SourcePath string

	// DestPath is the path to where the template should be rendered
	DestPath string

	// EmbeddedTmpl store the raw template. This is useful for smaller templates
	// where they are embedded in the job file rather than sent as an artifact
	EmbeddedTmpl string

	// ChangeMode indicates what should be done if the template is re-rendered
	ChangeMode string

	// ChangeSignal is the signal that should be sent if the change mode
	// requires it.
	ChangeSignal string

	// 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

	// Perms is the permission the file should be written out with.
	Perms string

	// LeftDelim and RightDelim are optional configurations to control what
	// delimiter is utilized when parsing the template.
	LeftDelim  string
	RightDelim string

	// Envvars enables exposing the template as environment variables
	// instead of as a file. The template must be of the form:
	//
	//	VAR_NAME_1={{ key service/my-key }}
	//	VAR_NAME_2=raw string and {{ env "attr.kernel.name" }}
	//
	// Lines will be split on the initial "=" with the first part being the
	// key name and the second part the value.
	// Empty lines and lines starting with # will be ignored, but to avoid
	// escaping issues #s within lines will not be treated as comments.
	Envvars bool

	// VaultGrace is the grace duration between lease renewal and reacquiring a
	// secret. If the lease of a secret is less than the grace, a new secret is
	// acquired.
	VaultGrace time.Duration
}

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

func (*Template) CodecDecodeSelf added in v0.6.1

func (x *Template) CodecDecodeSelf(d *codec1978.Decoder)

func (*Template) CodecEncodeSelf added in v0.6.1

func (x *Template) CodecEncodeSelf(e *codec1978.Encoder)

func (*Template) Copy added in v0.5.0

func (t *Template) Copy() *Template

func (*Template) Validate added in v0.5.0

func (t *Template) Validate() error

type UpdateStrategy

type UpdateStrategy struct {
	// Stagger is used to determine the rate at which allocations are migrated
	// due to down or draining nodes.
	Stagger time.Duration

	// MaxParallel is how many updates can be done in parallel
	MaxParallel int

	// HealthCheck specifies the mechanism in which allocations are marked
	// healthy or unhealthy as part of a deployment.
	HealthCheck string

	// MinHealthyTime is the minimum time an allocation must be in the healthy
	// state before it is marked as healthy, unblocking more allocations to be
	// rolled.
	MinHealthyTime time.Duration

	// HealthyDeadline is the time in which an allocation must be marked as
	// healthy before it is automatically transitioned to unhealthy. This time
	// period doesn't count against the MinHealthyTime.
	HealthyDeadline time.Duration

	// ProgressDeadline is the time in which an allocation as part of the
	// deployment must transition to healthy. If no allocation becomes healthy
	// after the deadline, the deployment is marked as failed. If the deadline
	// is zero, the first failure causes the deployment to fail.
	ProgressDeadline time.Duration

	// AutoRevert declares that if a deployment fails because of unhealthy
	// allocations, there should be an attempt to auto-revert the job to a
	// stable version.
	AutoRevert bool

	// AutoPromote declares that the deployment should be promoted when all canaries are
	// healthy
	AutoPromote bool

	// Canary is the number of canaries to deploy when a change to the task
	// group is detected.
	Canary int
}

UpdateStrategy is used to modify how updates are done

func (*UpdateStrategy) CodecDecodeSelf added in v0.6.1

func (x *UpdateStrategy) CodecDecodeSelf(d *codec1978.Decoder)

func (*UpdateStrategy) CodecEncodeSelf added in v0.6.1

func (x *UpdateStrategy) CodecEncodeSelf(e *codec1978.Encoder)

func (*UpdateStrategy) Copy added in v0.6.0

func (u *UpdateStrategy) Copy() *UpdateStrategy

func (*UpdateStrategy) Rolling

func (u *UpdateStrategy) Rolling() bool

TODO(alexdadgar): Remove once no longer used by the scheduler. Rolling returns if a rolling strategy should be used

func (*UpdateStrategy) Validate added in v0.6.0

func (u *UpdateStrategy) Validate() error

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

	// 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
}

Vault stores the set of permissions 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()

func (*Vault) CodecDecodeSelf added in v0.6.1

func (x *Vault) CodecDecodeSelf(d *codec1978.Decoder)

func (*Vault) CodecEncodeSelf added in v0.6.1

func (x *Vault) CodecEncodeSelf(e *codec1978.Encoder)

func (*Vault) Copy added in v0.5.0

func (v *Vault) Copy() *Vault

Copy returns a copy of this Vault block.

func (*Vault) Validate added in v0.5.0

func (v *Vault) Validate() error

Validate returns if the Vault block is valid.

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.

func (*VaultAccessor) CodecDecodeSelf added in v0.6.1

func (x *VaultAccessor) CodecDecodeSelf(d *codec1978.Decoder)

func (*VaultAccessor) CodecEncodeSelf added in v0.6.1

func (x *VaultAccessor) CodecEncodeSelf(e *codec1978.Encoder)

type VaultAccessorsRequest added in v0.5.0

type VaultAccessorsRequest struct {
	Accessors []*VaultAccessor
}

VaultAccessorsRequest is used to operate on a set of Vault accessors

func (*VaultAccessorsRequest) CodecDecodeSelf added in v0.6.1

func (x *VaultAccessorsRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*VaultAccessorsRequest) CodecEncodeSelf added in v0.6.1

func (x *VaultAccessorsRequest) CodecEncodeSelf(e *codec1978.Encoder)

type VersionResponse

type VersionResponse struct {
	Build    string
	Versions map[string]int
	QueryMeta
}

VersionResponse is used for the Status.Version response

func (*VersionResponse) CodecDecodeSelf added in v0.6.1

func (x *VersionResponse) CodecDecodeSelf(d *codec1978.Decoder)

func (*VersionResponse) CodecEncodeSelf added in v0.6.1

func (x *VersionResponse) CodecEncodeSelf(e *codec1978.Encoder)

type WrappedServerError added in v0.8.0

type WrappedServerError struct {
	Err error
}

WrappedServerError wraps an error and satisfies both the Recoverable and the ServerSideError interfaces

func (*WrappedServerError) CodecDecodeSelf added in v0.8.0

func (x *WrappedServerError) CodecDecodeSelf(d *codec1978.Decoder)

func (*WrappedServerError) CodecEncodeSelf added in v0.8.0

func (x *WrappedServerError) CodecEncodeSelf(e *codec1978.Encoder)

func (*WrappedServerError) Error added in v0.8.0

func (r *WrappedServerError) Error() string

func (*WrappedServerError) IsRecoverable added in v0.8.0

func (r *WrappedServerError) IsRecoverable() bool

func (*WrappedServerError) IsServerSide added in v0.8.0

func (r *WrappedServerError) IsServerSide() bool

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

func (*WriteMeta) CodecDecodeSelf added in v0.6.1

func (x *WriteMeta) CodecDecodeSelf(d *codec1978.Decoder)

func (*WriteMeta) CodecEncodeSelf added in v0.6.1

func (x *WriteMeta) CodecEncodeSelf(e *codec1978.Encoder)

type WriteRequest

type WriteRequest struct {
	// The target region for this write
	Region string

	// Namespace is the target namespace for the write.
	Namespace string

	// AuthToken is secret portion of the ACL token used for the request
	AuthToken string

	InternalRpcInfo
}

func (WriteRequest) AllowStaleRead

func (w WriteRequest) AllowStaleRead() bool

func (*WriteRequest) CodecDecodeSelf added in v0.6.1

func (x *WriteRequest) CodecDecodeSelf(d *codec1978.Decoder)

func (*WriteRequest) CodecEncodeSelf added in v0.6.1

func (x *WriteRequest) CodecEncodeSelf(e *codec1978.Encoder)

func (WriteRequest) IsRead

func (w WriteRequest) IsRead() bool

WriteRequest only applies to writes, always false

func (WriteRequest) RequestNamespace added in v0.7.0

func (w WriteRequest) RequestNamespace() string

func (WriteRequest) RequestRegion

func (w WriteRequest) RequestRegion() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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