structs

package
Version: v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MPL-2.0 Imports: 51 Imported by: 2,179

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 (
	TopicDeployment Topic = "Deployment"
	TopicEvaluation Topic = "Evaluation"
	TopicAllocation Topic = "Allocation"
	TopicJob        Topic = "Job"
	TopicNode       Topic = "Node"
	TopicACLPolicy  Topic = "ACLPolicy"
	TopicACLToken   Topic = "ACLToken"
	TopicAll        Topic = "*"

	TypeNodeRegistration              = "NodeRegistration"
	TypeNodeDeregistration            = "NodeDeregistration"
	TypeNodeEligibilityUpdate         = "NodeEligibility"
	TypeNodeDrain                     = "NodeDrain"
	TypeNodeEvent                     = "NodeStreamEvent"
	TypeDeploymentUpdate              = "DeploymentStatusUpdate"
	TypeDeploymentPromotion           = "DeploymentPromotion"
	TypeDeploymentAllocHealth         = "DeploymentAllocHealth"
	TypeAllocationCreated             = "AllocationCreated"
	TypeAllocationUpdated             = "AllocationUpdated"
	TypeAllocationUpdateDesiredStatus = "AllocationUpdateDesiredStatus"
	TypeEvalUpdated                   = "EvaluationUpdated"
	TypeJobRegistered                 = "JobRegistered"
	TypeJobDeregistered               = "JobDeregistered"
	TypeJobBatchDeregistered          = "JobBatchDeregistered"
	TypePlanResult                    = "PlanResult"
	TypeACLTokenDeleted               = "ACLTokenDeleted"
	TypeACLTokenUpserted              = "ACLTokenUpserted"
	TypeACLPolicyDeleted              = "ACLPolicyDeleted"
	TypeACLPolicyUpserted             = "ACLPolicyUpserted"
)
View Source
const (
	// MinDynamicPort is the smallest dynamic port generated
	MinDynamicPort = 20000

	// MaxDynamicPort is the largest dynamic port generated
	MaxDynamicPort = 32000
)
View Source
const (
	EnvoyBootstrapPath = "${NOMAD_SECRETS_DIR}/envoy_bootstrap.json"

	ServiceCheckHTTP   = "http"
	ServiceCheckTCP    = "tcp"
	ServiceCheckScript = "script"
	ServiceCheckGRPC   = "grpc"
)
View Source
const (
	AddressModeAuto   = "auto"
	AddressModeHost   = "host"
	AddressModeDriver = "driver"
	AddressModeAlloc  = "alloc"
)
View Source
const (
	OnUpdateRequireHealthy = "require_healthy"
	OnUpdateIgnoreWarn     = "ignore_warnings"
	OnUpdateIgnore         = "ignore"
)
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

	// MsgTypeTestSetup is used during testing when calling state store
	// methods directly that require an FSM MessageType
	MsgTypeTestSetup MessageType = IgnoreUnknownTypeFlag

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

	// AllNamespacesSentinel is the value used as a namespace RPC value
	// to indicate that endpoints must search in all namespaces
	AllNamespacesSentinel = "*"

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

	// MaxBlockingRPCQueryTime is used to bound the limit of a blocking query
	MaxBlockingRPCQueryTime = 300 * time.Second

	// DefaultBlockingRPCQueryTime is the amount of time we block waiting for a change
	// if no time is specified. Previously we would wait the MaxBlockingRPCQueryTime.
	DefaultBlockingRPCQueryTime = 300 * time.Second
)
View Source
const (
	NodeEventSubsystemDrain     = "Drain"
	NodeEventSubsystemDriver    = "Driver"
	NodeEventSubsystemHeartbeat = "Heartbeat"
	NodeEventSubsystemCluster   = "Cluster"
	NodeEventSubsystemStorage   = "Storage"
)
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

	// JobTrackedScalingEvents is the number of scaling events that are
	// kept for a single task group.
	JobTrackedScalingEvents = 20
)
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 (
	TaskLifecycleHookPrestart  = "prestart"
	TaskLifecycleHookPoststart = "poststart"
	TaskLifecycleHookPoststop  = "poststop"
)
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 (
	ScalingTargetNamespace = "Namespace"
	ScalingTargetJob       = "Job"
	ScalingTargetGroup     = "Group"
	ScalingTargetTask      = "Task"

	ScalingPolicyTypeHorizontal = "horizontal"
)
View Source
const (
	MigrateStrategyHealthChecks = "checks"
	MigrateStrategyHealthStates = "task_states"
)
View Source
const (
	// ConnectProxyPrefix is the prefix used for fields referencing a Consul Connect
	// Proxy
	ConnectProxyPrefix = "connect-proxy"

	// ConnectNativePrefix is the prefix used for fields referencing a Connect
	// Native Task
	ConnectNativePrefix = "connect-native"

	// ConnectIngressPrefix is the prefix used for fields referencing a Consul
	// Connect Ingress Gateway Proxy.
	ConnectIngressPrefix = "connect-ingress"

	// ConnectTerminatingPrefix is the prefix used for fields referencing a Consul
	// Connect Terminating Gateway Proxy.
	ConnectTerminatingPrefix = "connect-terminating"

	// ConnectMeshPrefix is the prefix used for fields referencing a Consul Connect
	// Mesh Gateway Proxy.
	ConnectMeshPrefix = "connect-mesh"
)
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 is considered Recoverable.
	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 is not considered Recoverable.
	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"

	// TaskMainDead indicates that the main tasks have dead
	TaskMainDead = "Main Tasks 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"

	// TaskPluginUnhealthy indicates that a plugin managed by Nomad became unhealthy
	TaskPluginUnhealthy = "Plugin became unhealthy"

	// TaskPluginHealthy indicates that a plugin managed by Nomad became healthy
	TaskPluginHealthy = "Plugin became healthy"
)
View Source
const (
	ConstraintDistinctProperty  = "distinct_property"
	ConstraintDistinctHosts     = "distinct_hosts"
	ConstraintRegex             = "regexp"
	ConstraintVersion           = "version"
	ConstraintSemver            = "semver"
	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"
	DeploymentStatusPending    = "pending"
	DeploymentStatusBlocked    = "blocked"
	DeploymentStatusUnblocking = "unblocking"

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

	// used only in multiregion deployments
	DeploymentStatusDescriptionFailedByPeer   = "Failed because of an error in peer region"
	DeploymentStatusDescriptionBlocked        = "Deployment is complete but waiting for peer region"
	DeploymentStatusDescriptionUnblocking     = "Deployment is unblocking remaining regions"
	DeploymentStatusDescriptionPendingForPeer = "Deployment is pending, waiting for peer region"
)
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"
	EvalTriggerScaling           = "job-scaling"
)
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"

	// CoreJobCSIVolumeClaimGC is use for the garbage collection of CSI
	// volume claims. We periodically scan volumes to see if no allocs are
	// claiming them. If so, we unclaim the volume.
	CoreJobCSIVolumeClaimGC = "csi-volume-claim-gc"

	// CoreJobCSIPluginGC is use for the garbage collection of CSI plugins.
	// We periodically scan plugins to see if they have no associated volumes
	// or allocs running them. If so, we delete the plugin.
	CoreJobCSIPluginGC = "csi-plugin-gc"

	// CoreJobOneTimeTokenGC is use for the garbage collection of one-time
	// tokens. We periodically scan for expired tokens and delete them.
	CoreJobOneTimeTokenGC = "one-time-token-gc"

	// CoreJobForceGC is used to force garbage collection of all GCable objects.
	CoreJobForceGC = "force-gc"
)
View Source
const (
	VolumeMountPropagationPrivate       = "private"
	VolumeMountPropagationHostToTask    = "host-to-task"
	VolumeMountPropagationBidirectional = "bidirectional"
)
View Source
const (
	BytesInMegabyte = 1024 * 1024
)
View Source
const CSIIntermediaryDirname = "volumes"

CSIIntermediaryDirname is the name of the directory inside the PluginMountDir where Nomad will expect plugins to create intermediary mounts for volumes.

View Source
const CSISocketName = "csi.sock"

CSISocketName is the filename that Nomad expects plugins to create inside the PluginMountDir.

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
View Source
const VolumeTypeCSI = "csi"

VolumeTypeCSI is the type in the volume stanza of a TaskGroup

View Source
const (
	VolumeTypeHost = "host"
)

Variables

View Source
var (
	ErrNoLeader                   = errors.New(errNoLeader)
	ErrNotReadyForConsistentReads = errors.New(errNotReadyForConsistentReads)
	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)
	ErrMissingAllocID             = errors.New(errMissingAllocID)

	ErrUnknownNode = errors.New(ErrUnknownNodePrefix)

	ErrDeploymentTerminalNoCancel    = errors.New(errDeploymentTerminalNoCancel)
	ErrDeploymentTerminalNoFail      = errors.New(errDeploymentTerminalNoFail)
	ErrDeploymentTerminalNoPause     = errors.New(errDeploymentTerminalNoPause)
	ErrDeploymentTerminalNoPromote   = errors.New(errDeploymentTerminalNoPromote)
	ErrDeploymentTerminalNoResume    = errors.New(errDeploymentTerminalNoResume)
	ErrDeploymentTerminalNoUnblock   = errors.New(errDeploymentTerminalNoUnblock)
	ErrDeploymentTerminalNoRun       = errors.New(errDeploymentTerminalNoRun)
	ErrDeploymentTerminalNoSetHealth = errors.New(errDeploymentTerminalNoSetHealth)
	ErrDeploymentRunningNoUnblock    = errors.New(errDeploymentRunningNoUnblock)

	ErrCSIClientRPCIgnorable = errors.New("CSI client error (ignorable)")
	ErrCSIClientRPCRetryable = errors.New("CSI client error (retryable)")
)
View Source
var (
	// JsonHandle and JsonHandlePretty are the codec handles to JSON encode
	// structs. The pretty handle will add indents for easier human consumption.
	// JsonHandleWithExtensions and JsonHandlePretty include extensions for
	// encoding structs objects with API-specific fields
	JsonHandle = &codec.JsonHandle{
		HTMLCharsAsIs: true,
	}
	JsonHandleWithExtensions = NomadJsonEncodingExtensions(&codec.JsonHandle{
		HTMLCharsAsIs: true,
	})
	JsonHandlePretty = NomadJsonEncodingExtensions(&codec.JsonHandle{
		HTMLCharsAsIs: true,
		Indent:        4,
	})
)
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 (
	// 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 MsgpackHandle = func() *codec.MsgpackHandle {
	h := &codec.MsgpackHandle{}
	h.RawToString = true

	h.BasicHandle.TimeNotBuiltin = true

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

	h.TypeInfos = codec.NewTypeInfos([]string{"codec"})

	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 AllocSuffix added in v1.1.0

func AllocSuffix(name string) string

AllocSuffix returns the alloc index suffix that was added by the AllocName function above.

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 CSIPluginTypeIsValid added in v0.11.0

func CSIPluginTypeIsValid(pt CSIPluginType) bool

CSIPluginTypeIsValid validates the given CSIPluginType string and returns true only when a correct plugin type is specified.

func CodeFromRPCCodedErr added in v0.10.2

func CodeFromRPCCodedErr(err error) (code int, msg string, ok bool)

CodeFromRPCCodedErr returns the code and message of error if it's an RPC error created through NewErrRPCCoded function. Returns `ok` false if error is not an rpc error

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 CopyMapStringClientHostVolumeConfig added in v0.10.0

func CopyMapStringClientHostVolumeConfig(m map[string]*ClientHostVolumeConfig) map[string]*ClientHostVolumeConfig

func CopyMapVolumeRequest added in v0.10.0

func CopyMapVolumeRequest(s map[string]*VolumeRequest) map[string]*VolumeRequest

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 IsErrRPCCoded added in v0.10.4

func IsErrRPCCoded(err error) bool

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(errs ...error) string

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

func MountPropagationModeIsValid added in v0.10.2

func MountPropagationModeIsValid(propagationMode string) bool

func NewErrRPCCoded added in v0.10.2

func NewErrRPCCoded(code int, msg string) error

NewErrRPCCoded wraps an RPC error with a code to be converted to HTTP status code

func NewErrRPCCodedf added in v0.10.2

func NewErrRPCCodedf(code int, format string, args ...interface{}) error

NewErrRPCCoded wraps an RPC error with a code to be converted to HTTP status code

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 NodeNetworksEquals added in v0.12.0

func NodeNetworksEquals(n1, n2 []*NodeNetworkResource) bool

func NomadJsonEncodingExtensions added in v1.1.0

func NomadJsonEncodingExtensions(h *codec.JsonHandle) *codec.JsonHandle

NomadJsonEncodingExtensions registers all extension functions against the provided JsonHandle. It should be called on any JsonHandle which is used by the API HTTP server.

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 is to joined to the path (e.g. "task/local"), and this function checks if path escapes the alloc dir, NOT the prefix directory within the alloc dir. With prefix="task/local", it will return false for "../secret", but true for "../../../../../../root" path; only the latter escapes the alloc dir

func ScoreFitBinPack added in v0.11.2

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

ScoreFitBinPack computes a fit score to achieve pinbacking behavior. Score is in [0, 18]

It's the BestFit v3 on the Google work published here: http://www.columbia.edu/~cs2035/courses/ieor4405.S13/datacenter_scheduling.ppt

func ScoreFitSpread added in v0.11.2

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

ScoreFitSpread computes a fit score to achieve spread behavior. Score is in [0, 18]

This is equivalent to Worst Fit of http://www.columbia.edu/~cs2035/courses/ieor4405.S13/datacenter_scheduling.ppt

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 ValidCSIVolumeAccessMode added in v0.11.0

func ValidCSIVolumeAccessMode(accessMode CSIVolumeAccessMode) bool

ValidCSIVolumeAccessMode checks to see that the provided access mode is a valid, non-empty access mode.

func ValidCSIVolumeAttachmentMode added in v0.11.0

func ValidCSIVolumeAttachmentMode(attachmentMode CSIVolumeAttachmentMode) bool

func ValidCSIVolumeWriteAccessMode added in v0.11.0

func ValidCSIVolumeWriteAccessMode(accessMode CSIVolumeAccessMode) bool

ValidCSIVolumeAccessMode checks for a writable access mode

func ValidNodeStatus

func ValidNodeStatus(status string) bool

ValidNodeStatus is used to check if a node status is valid

func ValidateConnectProxyService added in v0.10.0

func ValidateConnectProxyService(serviceName string, tgServices []*Service) error

ValidateConnectProxyService checks that the service that is being proxied by this task exists in the task group and contains valid Connect config.

func VaultNamespaceSet added in v0.12.2

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

VaultNaVaultNamespaceSet takes the structure returned by VaultPolicies and returns a set of required namespaces

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
	RulesJSON   *acl.Policy // Generated from Rules on read
	Hash        []byte
	CreateIndex uint64
	ModifyIndex uint64
}

ACLPolicy is used to represent an ACL policy

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

type ACLPolicyEvent added in v1.0.0

type ACLPolicyEvent struct {
	ACLPolicy *ACLPolicy
}

type ACLPolicyListRequest added in v0.7.0

type ACLPolicyListRequest struct {
	QueryOptions
}

ACLPolicyListRequest is used to request a list of policies

type ACLPolicyListResponse added in v0.7.0

type ACLPolicyListResponse struct {
	Policies []*ACLPolicyListStub
	QueryMeta
}

ACLPolicyListResponse is used for a list request

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

type ACLPolicySetRequest added in v0.7.0

type ACLPolicySetRequest struct {
	Names []string
	QueryOptions
}

ACLPolicySetRequest is used to query a set of policies

type ACLPolicySetResponse added in v0.7.0

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

ACLPolicySetResponse is used to return a set of policies

type ACLPolicySpecificRequest added in v0.7.0

type ACLPolicySpecificRequest struct {
	Name string
	QueryOptions
}

ACLPolicySpecificRequest is used to query a specific policy

type ACLPolicyUpsertRequest added in v0.7.0

type ACLPolicyUpsertRequest struct {
	Policies []*ACLPolicy
	WriteRequest
}

ACLPolicyUpsertRequest is used to upsert a set of policies

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) Copy added in v1.0.1

func (a *ACLToken) Copy() *ACLToken

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 check a token for reasonableness

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

type ACLTokenDeleteRequest added in v0.7.0

type ACLTokenDeleteRequest struct {
	AccessorIDs []string
	WriteRequest
}

ACLTokenDeleteRequest is used to delete a set of tokens

type ACLTokenEvent added in v1.0.0

type ACLTokenEvent struct {
	ACLToken *ACLToken
	// contains filtered or unexported fields
}

func NewACLTokenEvent added in v1.0.1

func NewACLTokenEvent(token *ACLToken) *ACLTokenEvent

NewACLTokenEvent takes a token and creates a new ACLTokenEvent. It creates a copy of the passed in ACLToken and empties out the copied tokens SecretID

func (*ACLTokenEvent) SecretID added in v1.0.1

func (a *ACLTokenEvent) SecretID() string

type ACLTokenListRequest added in v0.7.0

type ACLTokenListRequest struct {
	GlobalOnly bool
	QueryOptions
}

ACLTokenListRequest is used to request a list of tokens

type ACLTokenListResponse added in v0.7.0

type ACLTokenListResponse struct {
	Tokens []*ACLTokenListStub
	QueryMeta
}

ACLTokenListResponse is used for a list request

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
}

type ACLTokenSetRequest added in v0.7.0

type ACLTokenSetRequest struct {
	AccessorIDS []string
	QueryOptions
}

ACLTokenSetRequest is used to query a set of tokens

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

type ACLTokenSpecificRequest added in v0.7.0

type ACLTokenSpecificRequest struct {
	AccessorID string
	QueryOptions
}

ACLTokenSpecificRequest is used to query a specific token

type ACLTokenUpsertRequest added in v0.7.0

type ACLTokenUpsertRequest struct {
	Tokens []*ACLToken
	WriteRequest
}

ACLTokenUpsertRequest is used to upsert a set of tokens

type ACLTokenUpsertResponse added in v0.7.0

type ACLTokenUpsertResponse struct {
	Tokens []*ACLToken
	WriteMeta
}

ACLTokenUpsertResponse is used to return from an ACLTokenUpsertRequest

type Affinities added in v0.9.2

type Affinities []*Affinity

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
}

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

Equals 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 AgentPprofRequest added in v0.10.4

type AgentPprofRequest struct {
	// ReqType specifies the profile to use
	ReqType pprof.ReqType

	// Profile specifies the runtime/pprof profile to lookup and generate.
	Profile string

	// Seconds is the number of seconds to capture a profile
	Seconds int

	// Debug specifies if pprof profile should inclue debug output
	Debug int

	// GC specifies if the profile should call runtime.GC() before
	// running its profile. This is only used for "heap" profiles
	GC int

	// NodeID is the node we want to track the logs of
	NodeID string

	// ServerID is the server we want to track the logs of
	ServerID string

	QueryOptions
}

AgentPprofRequest is used to request a pprof report for a given node.

type AgentPprofResponse added in v0.10.4

type AgentPprofResponse struct {
	// ID of the agent that fulfilled the request
	AgentID string

	// Payload is the generated pprof profile
	Payload []byte

	// HTTPHeaders are a set of key value pairs to be applied as
	// HTTP headers for a specific runtime profile
	HTTPHeaders map[string]string
}

AgentPprofResponse is used to return a generated pprof profile

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

	Fields *AllocStubFields
}

AllocListRequest is used to request a list of allocations

type AllocListResponse

type AllocListResponse struct {
	Allocations []*AllocListStub
	QueryMeta
}

AllocListResponse is used for a list request

type AllocListStub

type AllocListStub struct {
	ID                    string
	EvalID                string
	Name                  string
	Namespace             string
	NodeID                string
	NodeName              string
	JobID                 string
	JobType               string
	JobVersion            uint64
	TaskGroup             string
	AllocatedResources    *AllocatedResources `json:",omitempty"`
	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) 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

	// ResourcesExhausted provides the amount of resources exhausted by task
	// during the allocation placement
	ResourcesExhausted map[string]*Resources

	// 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) 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) ExhaustResources added in v1.1.0

func (a *AllocMetric) ExhaustResources(tg *TaskGroup)

ExhaustResources updates the amount of resources exhausted for the allocation because of the given task group.

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 AllocNetworkStatus added in v1.0.0

type AllocNetworkStatus struct {
	InterfaceName string
	Address       string
	DNS           *DNSConfig
}

AllocNetworkStatus captures the status of an allocation's network during runtime. Depending on the network mode, an allocation's address may need to be known to other systems in Nomad such as service registration.

func (*AllocNetworkStatus) Copy added in v1.0.0

type AllocRestartRequest added in v0.9.2

type AllocRestartRequest struct {
	AllocID  string
	TaskName string

	QueryOptions
}

AllocRestartRequest is used to restart a specific allocations tasks.

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

type AllocSpecificRequest

type AllocSpecificRequest struct {
	AllocID string
	QueryOptions
}

AllocSpecificRequest is used to query a specific allocation

type AllocState added in v0.11.2

type AllocState struct {
	Field AllocStateField
	Value string
	Time  time.Time
}

type AllocStateField added in v0.11.2

type AllocStateField uint8

AllocState records a single event that changes the state of the whole allocation

const (
	AllocStateFieldClientStatus AllocStateField = iota
)

type AllocStopRequest added in v0.9.2

type AllocStopRequest struct {
	AllocID string

	WriteRequest
}

AllocStopRequest is used to stop and reschedule a running Allocation.

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`

type AllocStubFields added in v1.0.0

type AllocStubFields struct {
	// Resources includes resource-related fields if true.
	Resources bool

	// TaskStates removes the TaskStates field if false (default is to
	// include TaskStates).
	TaskStates bool
}

AllocStubFields defines which fields are included in the AllocListStub.

func NewAllocStubFields added in v1.0.0

func NewAllocStubFields() *AllocStubFields

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.

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

type AllocatedCpuResources added in v0.9.0

type AllocatedCpuResources struct {
	CpuShares     int64
	ReservedCores []uint16
}

AllocatedCpuResources captures the allocated CPU resources.

func (*AllocatedCpuResources) Add added in v0.9.0

func (*AllocatedCpuResources) Max added in v0.11.0

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) 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) 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
	MemoryMaxMB int64
}

AllocatedMemoryResources captures the allocated memory resources.

func (*AllocatedMemoryResources) Add added in v0.9.0

func (*AllocatedMemoryResources) Max added in v0.11.0

func (*AllocatedMemoryResources) Subtract added in v0.9.0

type AllocatedPortMapping added in v0.12.0

type AllocatedPortMapping struct {
	Label  string
	Value  int
	To     int
	HostIP string
}

type AllocatedPorts added in v0.12.0

type AllocatedPorts []AllocatedPortMapping

func (AllocatedPorts) Get added in v0.12.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
	TaskLifecycles map[string]*TaskLifecycleConfig

	// 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) Canonicalize added in v1.0.0

func (a *AllocatedResources) Canonicalize()

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 {
	Networks Networks
	DiskMB   int64
	Ports    AllocatedPorts
}

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

func (*AllocatedSharedResources) Add added in v0.9.0

func (*AllocatedSharedResources) Canonicalize added in v0.12.4

func (a *AllocatedSharedResources) Canonicalize()

func (AllocatedSharedResources) Copy added in v0.10.0

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) 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) Max added in v0.11.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

	// SharedResources are the resources that are shared by all the tasks in an
	// allocation
	// Deprecated: use AllocatedResources.Shared instead.
	// Keep field to allow us to handle upgrade paths from old versions
	SharedResources *Resources

	// 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.
	// Deprecated: use AllocatedResources.Tasks instead.
	// Keep field to allow us to handle upgrade paths from old versions
	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

	// AllocStates track meta data associated with changes to the state of the whole allocation, like becoming lost
	AllocStates []*AllocState

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

	// NetworkStatus captures networking details of an allocation known at runtime
	NetworkStatus *AllocNetworkStatus

	// 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) AppendState added in v0.11.2

func (a *Allocation) AppendState(field AllocStateField, value string)

AppendState creates and appends an AllocState entry recording the time of the state transition. Used to mark the transition to lost

func (*Allocation) Canonicalize added in v0.10.4

func (a *Allocation) Canonicalize()

Canonicalize Allocation to ensure fields are initialized to the expectations of this version of Nomad. Should be called when restoring persisted Allocations or receiving Allocations from Nomad agents potentially on an older version of Nomad.

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

func (a *Allocation) ComparableResources() *ComparableResources

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

func (*Allocation) ConsulNamespace added in v1.1.0

func (a *Allocation) ConsulNamespace() string

ConsulNamespace returns the Consul namespace of the task group associated with this allocation.

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) JobNamespacedID added in v1.0.6

func (a *Allocation) JobNamespacedID() NamespacedID

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) MigrateStrategy added in v1.0.0

func (a *Allocation) MigrateStrategy() *MigrateStrategy

MigrateStrategy returns the migrate strategy based on the task group

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) SetStop added in v0.11.2

func (a *Allocation) SetStop(clientStatus, clientDesc string)

SetStopped updates the allocation in place to a DesiredStatus stop, with the ClientStatus

func (*Allocation) ShouldClientStop added in v0.11.2

func (a *Allocation) ShouldClientStop() bool

ShouldClientStop tests an alloc for StopAfterClientDisconnect configuration

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(fields *AllocStubFields) *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.

func (*Allocation) WaitClientStop added in v0.11.2

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

WaitClientStop uses the reschedule delay mechanism to block rescheduling until StopAfterClientDisconnect's block interval passes

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

type AllocationEvent added in v1.0.0

type AllocationEvent struct {
	Allocation *Allocation
}

AllocationEvent holds a newly updated Allocation. The Allocs embedded Job has been removed to reduce size.

type AllocsGetRequest added in v0.3.0

type AllocsGetRequest struct {
	AllocIDs []string
	QueryOptions
}

AllocsGetRequest is used to query a set of allocations

type AllocsGetResponse added in v0.3.0

type AllocsGetResponse struct {
	Allocs []*Allocation
	QueryMeta
}

AllocsGetResponse is used to return a set of allocations

type 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

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

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.

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

	// MinQuorum sets the minimum number of servers required in a cluster
	// before autopilot can prune dead servers.
	MinQuorum uint

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

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

	// UpdatedAt represents server time of receiving request
	UpdatedAt int64

	WriteRequest
}

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

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) 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 CSIControllerCapability added in v1.1.0

type CSIControllerCapability byte
const (
	// CSIControllerSupportsCreateDelete indicates plugin support for
	// CREATE_DELETE_VOLUME
	CSIControllerSupportsCreateDelete CSIControllerCapability = 0

	// CSIControllerSupportsAttachDetach is true when the controller
	// implements the methods required to attach and detach volumes. If this
	// is false Nomad should skip the controller attachment flow.
	CSIControllerSupportsAttachDetach CSIControllerCapability = 1

	// CSIControllerSupportsListVolumes is true when the controller implements
	// the ListVolumes RPC. NOTE: This does not guarantee that attached nodes
	// will be returned unless SupportsListVolumesAttachedNodes is also true.
	CSIControllerSupportsListVolumes CSIControllerCapability = 2

	// CSIControllerSupportsGetCapacity indicates plugin support for
	// GET_CAPACITY
	CSIControllerSupportsGetCapacity CSIControllerCapability = 3

	// CSIControllerSupportsCreateDeleteSnapshot indicates plugin support for
	// CREATE_DELETE_SNAPSHOT
	CSIControllerSupportsCreateDeleteSnapshot CSIControllerCapability = 4

	// CSIControllerSupportsListSnapshots indicates plugin support for
	// LIST_SNAPSHOTS
	CSIControllerSupportsListSnapshots CSIControllerCapability = 5

	// CSIControllerSupportsClone indicates plugin support for CLONE_VOLUME
	CSIControllerSupportsClone CSIControllerCapability = 6

	// CSIControllerSupportsReadOnlyAttach is set to true when the controller
	// returns the ATTACH_READONLY capability.
	CSIControllerSupportsReadOnlyAttach CSIControllerCapability = 7

	// CSIControllerSupportsExpand indicates plugin support for EXPAND_VOLUME
	CSIControllerSupportsExpand CSIControllerCapability = 8

	// CSIControllerSupportsListVolumesAttachedNodes indicates whether the
	// plugin will return attached nodes data when making ListVolume RPCs
	// (plugin support for LIST_VOLUMES_PUBLISHED_NODES)
	CSIControllerSupportsListVolumesAttachedNodes CSIControllerCapability = 9

	// CSIControllerSupportsCondition indicates plugin support for
	// VOLUME_CONDITION
	CSIControllerSupportsCondition CSIControllerCapability = 10

	// CSIControllerSupportsGet indicates plugin support for GET_VOLUME
	CSIControllerSupportsGet CSIControllerCapability = 11
)

type CSIControllerInfo added in v0.11.0

type CSIControllerInfo struct {

	// SupportsCreateDelete indicates plugin support for CREATE_DELETE_VOLUME
	SupportsCreateDelete bool

	// SupportsPublishVolume is true when the controller implements the
	// methods required to attach and detach volumes. If this is false Nomad
	// should skip the controller attachment flow.
	SupportsAttachDetach bool

	// SupportsListVolumes is true when the controller implements the
	// ListVolumes RPC. NOTE: This does not guarantee that attached nodes will
	// be returned unless SupportsListVolumesAttachedNodes is also true.
	SupportsListVolumes bool

	// SupportsGetCapacity indicates plugin support for GET_CAPACITY
	SupportsGetCapacity bool

	// SupportsCreateDeleteSnapshot indicates plugin support for
	// CREATE_DELETE_SNAPSHOT
	SupportsCreateDeleteSnapshot bool

	// SupportsListSnapshots indicates plugin support for LIST_SNAPSHOTS
	SupportsListSnapshots bool

	// SupportsClone indicates plugin support for CLONE_VOLUME
	SupportsClone bool

	// SupportsReadOnlyAttach is set to true when the controller returns the
	// ATTACH_READONLY capability.
	SupportsReadOnlyAttach bool

	// SupportsExpand indicates plugin support for EXPAND_VOLUME
	SupportsExpand bool

	// SupportsListVolumesAttachedNodes indicates whether the plugin will
	// return attached nodes data when making ListVolume RPCs (plugin support
	// for LIST_VOLUMES_PUBLISHED_NODES)
	SupportsListVolumesAttachedNodes bool

	// SupportsCondition indicates plugin support for VOLUME_CONDITION
	SupportsCondition bool

	// SupportsGet indicates plugin support for GET_VOLUME
	SupportsGet bool
}

CSIControllerInfo is the fingerprinted data from a CSI Plugin that is specific to the Controller API.

func (*CSIControllerInfo) Copy added in v0.11.0

type CSIInfo added in v0.11.0

type CSIInfo struct {
	PluginID          string
	AllocID           string
	Healthy           bool
	HealthDescription string
	UpdateTime        time.Time

	Provider        string // vendor name from CSI GetPluginInfoResponse
	ProviderVersion string // vendor version from CSI GetPluginInfoResponse

	// RequiresControllerPlugin is set when the CSI Plugin returns the
	// CONTROLLER_SERVICE capability. When this is true, the volumes should not be
	// scheduled on this client until a matching controller plugin is available.
	RequiresControllerPlugin bool

	// RequiresTopologies is set when the CSI Plugin returns the
	// VOLUME_ACCESSIBLE_CONSTRAINTS capability. When this is true, we must
	// respect the Volume and Node Topology information.
	RequiresTopologies bool

	// CSI Specific metadata
	ControllerInfo *CSIControllerInfo `json:",omitempty"`
	NodeInfo       *CSINodeInfo       `json:",omitempty"`
}

CSIInfo is the current state of a single CSI Plugin. This is updated regularly as plugin health changes on the node.

func (*CSIInfo) Copy added in v0.11.0

func (c *CSIInfo) Copy() *CSIInfo

func (*CSIInfo) Equal added in v0.11.0

func (c *CSIInfo) Equal(o *CSIInfo) bool

func (*CSIInfo) IsController added in v0.11.0

func (c *CSIInfo) IsController() bool

func (*CSIInfo) IsNode added in v0.11.0

func (c *CSIInfo) IsNode() bool

func (*CSIInfo) SetHealthy added in v0.11.0

func (c *CSIInfo) SetHealthy(hs bool)

type CSIMountOptions added in v0.11.0

type CSIMountOptions struct {
	// FSType is an optional field that allows an operator to specify the type
	// of the filesystem.
	FSType string

	// MountFlags contains additional options that may be used when mounting the
	// volume by the plugin. This may contain sensitive data and should not be
	// leaked.
	MountFlags []string
}

CSIMountOptions contain optional additional configuration that can be used when specifying that a Volume should be used with VolumeAccessTypeMount.

func (*CSIMountOptions) Copy added in v0.11.0

func (o *CSIMountOptions) Copy() *CSIMountOptions

func (*CSIMountOptions) GoString added in v0.11.0

func (v *CSIMountOptions) GoString() string

func (*CSIMountOptions) Merge added in v0.11.0

func (o *CSIMountOptions) Merge(p *CSIMountOptions)

func (*CSIMountOptions) String added in v0.11.0

func (v *CSIMountOptions) String() string

type CSINodeCapability added in v1.1.0

type CSINodeCapability byte
const (

	// CSINodeSupportsStageVolume indicates whether the client should
	// Stage/Unstage volumes on this node.
	CSINodeSupportsStageVolume CSINodeCapability = 0

	// CSINodeSupportsStats indicates plugin support for GET_VOLUME_STATS
	CSINodeSupportsStats CSINodeCapability = 1

	// CSINodeSupportsExpand indicates plugin support for EXPAND_VOLUME
	CSINodeSupportsExpand CSINodeCapability = 2

	// CSINodeSupportsCondition indicates plugin support for VOLUME_CONDITION
	CSINodeSupportsCondition CSINodeCapability = 3
)

type CSINodeInfo added in v0.11.0

type CSINodeInfo struct {
	// ID is the identity of a given nomad client as observed by the storage
	// provider.
	ID string

	// MaxVolumes is the maximum number of volumes that can be attached to the
	// current host via this provider.
	// If 0 then unlimited volumes may be attached.
	MaxVolumes int64

	// AccessibleTopology specifies where (regions, zones, racks, etc.) the node is
	// accessible from within the storage provider.
	//
	// A plugin that returns this field MUST also set the `RequiresTopologies`
	// property.
	//
	// This field is OPTIONAL. If it is not specified, then we assume that the
	// the node is not subject to any topological constraint, and MAY
	// schedule workloads that reference any volume V, such that there are
	// no topological constraints declared for V.
	//
	// Example 1:
	//   accessible_topology =
	//     {"region": "R1", "zone": "Z2"}
	// Indicates the node exists within the "region" "R1" and the "zone"
	// "Z2" within the storage provider.
	AccessibleTopology *CSITopology

	// RequiresNodeStageVolume indicates whether the client should Stage/Unstage
	// volumes on this node.
	RequiresNodeStageVolume bool

	// SupportsStats indicates plugin support for GET_VOLUME_STATS
	SupportsStats bool

	// SupportsExpand indicates plugin support for EXPAND_VOLUME
	SupportsExpand bool

	// SupportsCondition indicates plugin support for VOLUME_CONDITION
	SupportsCondition bool
}

CSINodeInfo is the fingerprinted data from a CSI Plugin that is specific to the Node API.

func (*CSINodeInfo) Copy added in v0.11.0

func (n *CSINodeInfo) Copy() *CSINodeInfo

type CSIPlugin added in v0.11.0

type CSIPlugin struct {
	ID                 string
	Provider           string // the vendor name from CSI GetPluginInfoResponse
	Version            string // the vendor verson from  CSI GetPluginInfoResponse
	ControllerRequired bool

	// Map Node.IDs to fingerprint results, split by type. Monolith type plugins have
	// both sets of fingerprinting results.
	Controllers map[string]*CSIInfo
	Nodes       map[string]*CSIInfo

	// Allocations are populated by denormalize to show running allocations
	Allocations []*AllocListStub

	// Jobs are populated to by job update to support expected counts and the UI
	ControllerJobs JobDescriptions
	NodeJobs       JobDescriptions

	// Cache the count of healthy plugins
	ControllersHealthy  int
	ControllersExpected int
	NodesHealthy        int
	NodesExpected       int

	CreateIndex uint64
	ModifyIndex uint64
}

CSIPlugin collects fingerprint info context for the plugin for clients

func NewCSIPlugin added in v0.11.0

func NewCSIPlugin(id string, index uint64) *CSIPlugin

NewCSIPlugin creates the plugin struct. No side-effects

func (*CSIPlugin) AddJob added in v0.12.4

func (p *CSIPlugin) AddJob(job *Job, summary *JobSummary)

AddJob adds a job to the plugin and increments expected

func (*CSIPlugin) AddPlugin added in v0.11.0

func (p *CSIPlugin) AddPlugin(nodeID string, info *CSIInfo) error

AddPlugin adds a single plugin running on the node. Called from state.NodeUpdate in a transaction

func (*CSIPlugin) Copy added in v0.11.0

func (p *CSIPlugin) Copy() *CSIPlugin

func (*CSIPlugin) DeleteAlloc added in v0.11.0

func (p *CSIPlugin) DeleteAlloc(allocID, nodeID string) error

DeleteAlloc removes the fingerprint info for the allocation

func (*CSIPlugin) DeleteJob added in v0.12.4

func (p *CSIPlugin) DeleteJob(job *Job, summary *JobSummary)

DeleteJob removes the job from the plugin and decrements expected

func (*CSIPlugin) DeleteNode added in v0.11.0

func (p *CSIPlugin) DeleteNode(nodeID string) error

DeleteNode removes all plugins from the node. Called from state.DeleteNode in a transaction

func (*CSIPlugin) DeleteNodeForType added in v0.11.0

func (p *CSIPlugin) DeleteNodeForType(nodeID string, pluginType CSIPluginType) error

DeleteNodeForType deletes a client node from the list of controllers or node instance of a plugin. Called from deleteJobFromPlugin during job deregistration, in a transaction

func (*CSIPlugin) HasControllerCapability added in v1.1.0

func (p *CSIPlugin) HasControllerCapability(cap CSIControllerCapability) bool

func (*CSIPlugin) HasNodeCapability added in v1.1.0

func (p *CSIPlugin) HasNodeCapability(cap CSINodeCapability) bool

func (*CSIPlugin) IsEmpty added in v0.11.0

func (p *CSIPlugin) IsEmpty() bool

func (*CSIPlugin) Stub added in v0.11.0

func (p *CSIPlugin) Stub() *CSIPluginListStub

func (*CSIPlugin) UpdateExpectedWithJob added in v0.12.4

func (p *CSIPlugin) UpdateExpectedWithJob(job *Job, summary *JobSummary, terminal bool)

UpdateExpectedWithJob maintains the expected instance count we use the summary to add non-allocation expected counts

type CSIPluginDeleteRequest added in v0.11.2

type CSIPluginDeleteRequest struct {
	ID string
	QueryOptions
}

type CSIPluginDeleteResponse added in v0.11.2

type CSIPluginDeleteResponse struct {
	QueryMeta
}

type CSIPluginGetRequest added in v0.11.0

type CSIPluginGetRequest struct {
	ID string
	QueryOptions
}

type CSIPluginGetResponse added in v0.11.0

type CSIPluginGetResponse struct {
	Plugin *CSIPlugin
	QueryMeta
}

type CSIPluginListRequest added in v0.11.0

type CSIPluginListRequest struct {
	QueryOptions
}

type CSIPluginListResponse added in v0.11.0

type CSIPluginListResponse struct {
	Plugins []*CSIPluginListStub
	QueryMeta
}

type CSIPluginListStub added in v0.11.0

type CSIPluginListStub struct {
	ID                  string
	Provider            string
	ControllerRequired  bool
	ControllersHealthy  int
	ControllersExpected int
	NodesHealthy        int
	NodesExpected       int
	CreateIndex         uint64
	ModifyIndex         uint64
}

type CSIPluginType added in v0.11.0

type CSIPluginType string

CSIPluginType is an enum string that encapsulates the valid options for a CSIPlugin stanza's Type. These modes will allow the plugin to be used in different ways by the client.

const (
	// CSIPluginTypeNode indicates that Nomad should only use the plugin for
	// performing Node RPCs against the provided plugin.
	CSIPluginTypeNode CSIPluginType = "node"

	// CSIPluginTypeController indicates that Nomad should only use the plugin for
	// performing Controller RPCs against the provided plugin.
	CSIPluginTypeController CSIPluginType = "controller"

	// CSIPluginTypeMonolith indicates that Nomad can use the provided plugin for
	// both controller and node rpcs.
	CSIPluginTypeMonolith CSIPluginType = "monolith"
)

type CSISecrets added in v0.11.2

type CSISecrets map[string]string

CSISecrets contain optional additional configuration that can be used when specifying that a Volume should be used with VolumeAccessTypeMount.

func (*CSISecrets) GoString added in v0.11.2

func (s *CSISecrets) GoString() string

func (*CSISecrets) String added in v0.11.2

func (s *CSISecrets) String() string

type CSISnapshot added in v1.1.0

type CSISnapshot struct {
	// These fields map to those returned by the storage provider plugin
	ID                     string // storage provider's ID
	ExternalSourceVolumeID string // storage provider's ID for volume
	SizeBytes              int64
	CreateTime             int64
	IsReady                bool

	// These fields are controlled by Nomad
	SourceVolumeID string
	PluginID       string

	// These field are only used during snapshot creation and will not be
	// populated when the snapshot is returned
	Name       string
	Secrets    CSISecrets
	Parameters map[string]string
}

CSISnapshot is the storage provider's view of a volume snapshot

type CSISnapshotCreateRequest added in v1.1.0

type CSISnapshotCreateRequest struct {
	Snapshots []*CSISnapshot
	WriteRequest
}

type CSISnapshotCreateResponse added in v1.1.0

type CSISnapshotCreateResponse struct {
	Snapshots []*CSISnapshot
	QueryMeta
}

type CSISnapshotDeleteRequest added in v1.1.0

type CSISnapshotDeleteRequest struct {
	Snapshots []*CSISnapshot
	WriteRequest
}

type CSISnapshotDeleteResponse added in v1.1.0

type CSISnapshotDeleteResponse struct {
	QueryMeta
}

type CSISnapshotListRequest added in v1.1.0

type CSISnapshotListRequest struct {
	PluginID string
	Secrets  CSISecrets
	QueryOptions
}

CSISnapshotListRequest is a request to a controller plugin to list all the snapshot known to the the storage provider. This request is paginated by the plugin and accepts the QueryOptions.PerPage and QueryOptions.NextToken fields

type CSISnapshotListResponse added in v1.1.0

type CSISnapshotListResponse struct {
	Snapshots []*CSISnapshot
	NextToken string
	QueryMeta
}

type CSITopology added in v0.11.0

type CSITopology struct {
	Segments map[string]string
}

CSITopology is a map of topological domains to topological segments. A topological domain is a sub-division of a cluster, like "region", "zone", "rack", etc.

According to CSI, there are a few requirements for the keys within this map: - Valid keys have two segments: an OPTIONAL prefix and name, separated

by a slash (/), for example: "com.company.example/zone".

- The key name segment is REQUIRED. The prefix is OPTIONAL. - The key name MUST be 63 characters or less, begin and end with an

alphanumeric character ([a-z0-9A-Z]), and contain only dashes (-),
underscores (_), dots (.), or alphanumerics in between, for example
"zone".

- The key prefix MUST be 63 characters or less, begin and end with a

lower-case alphanumeric character ([a-z0-9]), contain only
dashes (-), dots (.), or lower-case alphanumerics in between, and
follow domain name notation format
(https://tools.ietf.org/html/rfc1035#section-2.3.1).

- The key prefix SHOULD include the plugin's host company name and/or

the plugin name, to minimize the possibility of collisions with keys
from other plugins.

- If a key prefix is specified, it MUST be identical across all

topology keys returned by the SP (across all RPCs).

- Keys MUST be case-insensitive. Meaning the keys "Zone" and "zone"

MUST not both exist.

- Each value (topological segment) MUST contain 1 or more strings. - Each string MUST be 63 characters or less and begin and end with an

alphanumeric character with '-', '_', '.', or alphanumerics in
between.

However, Nomad applies lighter restrictions to these, as they are already only referenced by plugin within the scheduler and as such collisions and related concerns are less of an issue. We may implement these restrictions in the future.

func (*CSITopology) Copy added in v0.11.0

func (t *CSITopology) Copy() *CSITopology

func (*CSITopology) Equal added in v0.11.0

func (t *CSITopology) Equal(o *CSITopology) bool

type CSIVolListStub added in v0.11.0

type CSIVolListStub struct {
	ID                  string
	Namespace           string
	Name                string
	ExternalID          string
	Topologies          []*CSITopology
	AccessMode          CSIVolumeAccessMode
	AttachmentMode      CSIVolumeAttachmentMode
	CurrentReaders      int
	CurrentWriters      int
	Schedulable         bool
	PluginID            string
	Provider            string
	ControllersHealthy  int
	ControllersExpected int
	NodesHealthy        int
	NodesExpected       int
	CreateIndex         uint64
	ModifyIndex         uint64
}

CSIVolListStub is partial representation of a CSI Volume for inclusion in lists

type CSIVolume added in v0.11.0

type CSIVolume struct {
	// ID is a namespace unique URL safe identifier for the volume
	ID string
	// Name is a display name for the volume, not required to be unique
	Name string
	// ExternalID identifies the volume for the CSI interface, may be URL unsafe
	ExternalID     string
	Namespace      string
	Topologies     []*CSITopology
	AccessMode     CSIVolumeAccessMode     // *current* access mode
	AttachmentMode CSIVolumeAttachmentMode // *current* attachment mode
	MountOptions   *CSIMountOptions

	Secrets    CSISecrets
	Parameters map[string]string
	Context    map[string]string
	Capacity   int64 // bytes

	// These values are used only on volume creation but we record them
	// so that we can diff the volume later
	RequestedCapacityMin  int64 // bytes
	RequestedCapacityMax  int64 // bytes
	RequestedCapabilities []*CSIVolumeCapability
	CloneID               string
	SnapshotID            string

	// Allocations, tracking claim status
	ReadAllocs  map[string]*Allocation // AllocID -> Allocation
	WriteAllocs map[string]*Allocation // AllocID -> Allocation

	ReadClaims  map[string]*CSIVolumeClaim // AllocID -> claim
	WriteClaims map[string]*CSIVolumeClaim // AllocID -> claim
	PastClaims  map[string]*CSIVolumeClaim // AllocID -> claim

	// Schedulable is true if all the denormalized plugin health fields are true, and the
	// volume has not been marked for garbage collection
	Schedulable         bool
	PluginID            string
	Provider            string
	ProviderVersion     string
	ControllerRequired  bool
	ControllersHealthy  int
	ControllersExpected int
	NodesHealthy        int
	NodesExpected       int
	ResourceExhausted   time.Time

	CreateIndex uint64
	ModifyIndex uint64
}

CSIVolume is the full representation of a CSI Volume

func NewCSIVolume added in v0.11.0

func NewCSIVolume(volumeID string, index uint64) *CSIVolume

NewCSIVolume creates the volume struct. No side-effects

func (*CSIVolume) Claim added in v0.11.0

func (v *CSIVolume) Claim(claim *CSIVolumeClaim, alloc *Allocation) error

Claim updates the allocations and changes the volume state

func (*CSIVolume) Copy added in v0.11.0

func (v *CSIVolume) Copy() *CSIVolume

Copy returns a copy of the volume, which shares only the Topologies slice

func (*CSIVolume) Equal added in v0.11.0

func (v *CSIVolume) Equal(o *CSIVolume) bool

Equality by value

func (*CSIVolume) InUse added in v0.11.0

func (v *CSIVolume) InUse() bool

InUse tests whether any allocations are actively using the volume

func (*CSIVolume) ReadSchedulable added in v0.11.0

func (v *CSIVolume) ReadSchedulable() bool

func (*CSIVolume) RemoteID added in v0.11.0

func (v *CSIVolume) RemoteID() string

func (*CSIVolume) Stub added in v0.11.0

func (v *CSIVolume) Stub() *CSIVolListStub

func (*CSIVolume) Validate added in v0.11.0

func (v *CSIVolume) Validate() error

Validate validates the volume struct, returning all validation errors at once

func (*CSIVolume) WriteFreeClaims added in v0.11.0

func (v *CSIVolume) WriteFreeClaims() bool

WriteFreeClaims determines if there are any free write claims available

func (*CSIVolume) WriteSchedulable added in v0.11.0

func (v *CSIVolume) WriteSchedulable() bool

WriteSchedulable determines if the volume is schedulable for writes, considering only volume capabilities and plugin health

type CSIVolumeAccessMode added in v0.11.0

type CSIVolumeAccessMode string

CSIVolumeAccessMode indicates how a volume should be used in a storage topology e.g whether the provider should make the volume available concurrently.

const (
	CSIVolumeAccessModeUnknown CSIVolumeAccessMode = ""

	CSIVolumeAccessModeSingleNodeReader CSIVolumeAccessMode = "single-node-reader-only"
	CSIVolumeAccessModeSingleNodeWriter CSIVolumeAccessMode = "single-node-writer"

	CSIVolumeAccessModeMultiNodeReader       CSIVolumeAccessMode = "multi-node-reader-only"
	CSIVolumeAccessModeMultiNodeSingleWriter CSIVolumeAccessMode = "multi-node-single-writer"
	CSIVolumeAccessModeMultiNodeMultiWriter  CSIVolumeAccessMode = "multi-node-multi-writer"
)

type CSIVolumeAttachmentMode added in v0.11.0

type CSIVolumeAttachmentMode string

CSIVolumeAttachmentMode chooses the type of storage api that will be used to interact with the device.

const (
	CSIVolumeAttachmentModeUnknown     CSIVolumeAttachmentMode = ""
	CSIVolumeAttachmentModeBlockDevice CSIVolumeAttachmentMode = "block-device"
	CSIVolumeAttachmentModeFilesystem  CSIVolumeAttachmentMode = "file-system"
)

type CSIVolumeCapability added in v1.1.0

type CSIVolumeCapability struct {
	AttachmentMode CSIVolumeAttachmentMode
	AccessMode     CSIVolumeAccessMode
}

CSIVolumeCapability is the requested attachment and access mode for a volume

type CSIVolumeClaim added in v0.11.2

type CSIVolumeClaim struct {
	AllocationID   string
	NodeID         string
	ExternalNodeID string
	Mode           CSIVolumeClaimMode
	AccessMode     CSIVolumeAccessMode
	AttachmentMode CSIVolumeAttachmentMode
	State          CSIVolumeClaimState
}

type CSIVolumeClaimBatchRequest added in v0.11.2

type CSIVolumeClaimBatchRequest struct {
	Claims []CSIVolumeClaimRequest
}

type CSIVolumeClaimMode added in v0.11.0

type CSIVolumeClaimMode int
const (
	CSIVolumeClaimRead CSIVolumeClaimMode = iota
	CSIVolumeClaimWrite

	// for GC we don't have a specific claim to set the state on, so instead we
	// create a new claim for GC in order to bump the ModifyIndex and trigger
	// volumewatcher
	CSIVolumeClaimGC
)

type CSIVolumeClaimRequest added in v0.11.0

type CSIVolumeClaimRequest struct {
	VolumeID       string
	AllocationID   string
	NodeID         string
	ExternalNodeID string
	Claim          CSIVolumeClaimMode
	AccessMode     CSIVolumeAccessMode
	AttachmentMode CSIVolumeAttachmentMode
	State          CSIVolumeClaimState
	WriteRequest
}

func (*CSIVolumeClaimRequest) ToClaim added in v0.11.2

func (req *CSIVolumeClaimRequest) ToClaim() *CSIVolumeClaim

type CSIVolumeClaimResponse added in v0.11.0

type CSIVolumeClaimResponse struct {
	// Opaque static publish properties of the volume. SP MAY use this
	// field to ensure subsequent `NodeStageVolume` or `NodePublishVolume`
	// calls calls have contextual information.
	// The contents of this field SHALL be opaque to nomad.
	// The contents of this field SHALL NOT be mutable.
	// The contents of this field SHALL be safe for the nomad to cache.
	// The contents of this field SHOULD NOT contain sensitive
	// information.
	// The contents of this field SHOULD NOT be used for uniquely
	// identifying a volume. The `volume_id` alone SHOULD be sufficient to
	// identify the volume.
	// This field is OPTIONAL and when present MUST be passed to
	// `NodeStageVolume` or `NodePublishVolume` calls on the client
	PublishContext map[string]string

	// Volume contains the expanded CSIVolume for use on the client after a Claim
	// has completed.
	Volume *CSIVolume

	QueryMeta
}

type CSIVolumeClaimState added in v0.11.2

type CSIVolumeClaimState int
const (
	CSIVolumeClaimStateTaken CSIVolumeClaimState = iota
	CSIVolumeClaimStateNodeDetached
	CSIVolumeClaimStateControllerDetached
	CSIVolumeClaimStateReadyToFree
	CSIVolumeClaimStateUnpublishing
)

type CSIVolumeCreateRequest added in v1.1.0

type CSIVolumeCreateRequest struct {
	Volumes []*CSIVolume
	WriteRequest
}

type CSIVolumeCreateResponse added in v1.1.0

type CSIVolumeCreateResponse struct {
	Volumes []*CSIVolume
	QueryMeta
}

type CSIVolumeDeleteRequest added in v1.1.0

type CSIVolumeDeleteRequest struct {
	VolumeIDs []string
	WriteRequest
}

type CSIVolumeDeleteResponse added in v1.1.0

type CSIVolumeDeleteResponse struct {
	QueryMeta
}

type CSIVolumeDeregisterRequest added in v0.11.0

type CSIVolumeDeregisterRequest struct {
	VolumeIDs []string
	Force     bool
	WriteRequest
}

type CSIVolumeDeregisterResponse added in v0.11.0

type CSIVolumeDeregisterResponse struct {
	QueryMeta
}

type CSIVolumeExternalListRequest added in v1.1.0

type CSIVolumeExternalListRequest struct {
	PluginID string
	QueryOptions
}

CSIVolumeExternalListRequest is a request to a controller plugin to list all the volumes known to the the storage provider. This request is paginated by the plugin and accepts the QueryOptions.PerPage and QueryOptions.NextToken fields

type CSIVolumeExternalListResponse added in v1.1.0

type CSIVolumeExternalListResponse struct {
	Volumes   []*CSIVolumeExternalStub
	NextToken string
	QueryMeta
}

type CSIVolumeExternalStub added in v1.1.0

type CSIVolumeExternalStub struct {
	ExternalID    string
	CapacityBytes int64
	VolumeContext map[string]string
	CloneID       string
	SnapshotID    string

	PublishedExternalNodeIDs []string
	IsAbnormal               bool
	Status                   string
}

CSIVolumeExternalStub is the storage provider's view of a volume, as returned from the controller plugin; all IDs are for external resources

type CSIVolumeGetRequest added in v0.11.0

type CSIVolumeGetRequest struct {
	ID string
	QueryOptions
}

type CSIVolumeGetResponse added in v0.11.0

type CSIVolumeGetResponse struct {
	Volume *CSIVolume
	QueryMeta
}

type CSIVolumeListRequest added in v0.11.0

type CSIVolumeListRequest struct {
	PluginID string
	NodeID   string
	QueryOptions
}

type CSIVolumeListResponse added in v0.11.0

type CSIVolumeListResponse struct {
	Volumes []*CSIVolListStub
	QueryMeta
}

type CSIVolumeRegisterRequest added in v0.11.0

type CSIVolumeRegisterRequest struct {
	Volumes []*CSIVolume
	WriteRequest
}

Request and response wrappers

type CSIVolumeRegisterResponse added in v0.11.0

type CSIVolumeRegisterResponse struct {
	QueryMeta
}

type CSIVolumeUnpublishRequest added in v0.12.2

type CSIVolumeUnpublishRequest struct {
	VolumeID string
	Claim    *CSIVolumeClaim
	WriteRequest
}

type CSIVolumeUnpublishResponse added in v0.12.2

type CSIVolumeUnpublishResponse struct {
	QueryMeta
}

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) Copy added in v0.7.0

func (c *CheckRestart) Copy() *CheckRestart

func (*CheckRestart) Equals added in v0.10.0

func (c *CheckRestart) Equals(o *CheckRestart) bool

func (*CheckRestart) Validate added in v0.7.0

func (c *CheckRestart) Validate() error

type ClientHostNetworkConfig added in v0.12.0

type ClientHostNetworkConfig struct {
	Name          string `hcl:",key"`
	CIDR          string `hcl:"cidr"`
	Interface     string `hcl:"interface"`
	ReservedPorts string `hcl:"reserved_ports"`
}

type ClientHostVolumeConfig added in v0.10.0

type ClientHostVolumeConfig struct {
	Name     string `hcl:",key"`
	Path     string `hcl:"path"`
	ReadOnly bool   `hcl:"read_only"`
}

ClientHostVolumeConfig is used to configure access to host paths on a Nomad Client

func CopySliceClientHostVolumeConfig added in v0.10.0

func CopySliceClientHostVolumeConfig(s []*ClientHostVolumeConfig) []*ClientHostVolumeConfig

func HostVolumeSliceMerge added in v0.10.0

func HostVolumeSliceMerge(a, b []*ClientHostVolumeConfig) []*ClientHostVolumeConfig

func (*ClientHostVolumeConfig) Copy added in v0.10.0

type ClusterMetadata added in v0.10.4

type ClusterMetadata struct {
	ClusterID  string
	CreateTime int64
}

ClusterMetadata is used to store per-cluster metadata.

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

A Constraint is used to restrict placement options.

func CopySliceConstraints added in v0.3.0

func CopySliceConstraints(s []*Constraint) []*Constraint

func EscapedConstraints added in v0.3.0

func EscapedConstraints(constraints []*Constraint) []*Constraint

EscapedConstraints takes a set of constraints and returns the set that escapes computed node classes.

func (*Constraint) Copy added in v0.3.0

func (c *Constraint) Copy() *Constraint

func (*Constraint) Equal added in v0.5.0

func (c *Constraint) Equal(o *Constraint) bool

Equal is like Equals but with one less s.

func (*Constraint) Equals added in v0.9.2

func (c *Constraint) Equals(o *Constraint) bool

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

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

Equals compares Constraints as a set

type Consul added in v1.1.0

type Consul struct {
	// Namespace in which to operate in Consul.
	Namespace string
}

Consul represents optional per-group consul configuration.

func (*Consul) Copy added in v1.1.0

func (c *Consul) Copy() *Consul

Copy the Consul block.

func (*Consul) Equals added in v1.1.0

func (c *Consul) Equals(o *Consul) bool

Equals returns whether c and o are the same.

func (*Consul) GetNamespace added in v1.1.0

func (c *Consul) GetNamespace() string

func (*Consul) Validate added in v1.1.0

func (c *Consul) Validate() error

Validate returns whether c is valid.

type ConsulConfigEntries added in v1.0.4

type ConsulConfigEntries struct {
	Ingress     map[string]*ConsulIngressConfigEntry
	Terminating map[string]*ConsulTerminatingConfigEntry
}

ConsulConfigEntries represents Consul ConfigEntry definitions from a job for a single Consul namespace.

type ConsulConnect added in v0.10.0

type ConsulConnect struct {
	// Native indicates whether the service is Consul Connect Native enabled.
	Native bool

	// SidecarService is non-nil if a service requires a sidecar.
	SidecarService *ConsulSidecarService

	// SidecarTask is non-nil if sidecar overrides are set
	SidecarTask *SidecarTask

	// Gateway is a Consul Connect Gateway Proxy.
	Gateway *ConsulGateway
}

ConsulConnect represents a Consul Connect jobspec stanza.

func (*ConsulConnect) Copy added in v0.10.0

func (c *ConsulConnect) Copy() *ConsulConnect

Copy the stanza recursively. Returns nil if nil.

func (*ConsulConnect) Equals added in v0.10.0

func (c *ConsulConnect) Equals(o *ConsulConnect) bool

Equals returns true if the connect blocks are deeply equal.

func (*ConsulConnect) HasSidecar added in v0.10.0

func (c *ConsulConnect) HasSidecar() bool

HasSidecar checks if a sidecar task is configured.

func (*ConsulConnect) IsGateway added in v0.12.4

func (c *ConsulConnect) IsGateway() bool

IsGateway checks if the service is any type of connect gateway.

func (*ConsulConnect) IsIngress added in v1.0.4

func (c *ConsulConnect) IsIngress() bool

IsIngress checks if the service is an ingress gateway.

func (*ConsulConnect) IsMesh added in v1.1.1

func (c *ConsulConnect) IsMesh() bool

func (*ConsulConnect) IsNative added in v0.12.0

func (c *ConsulConnect) IsNative() bool

IsNative checks if the service is connect native.

func (*ConsulConnect) IsTerminating added in v1.0.4

func (c *ConsulConnect) IsTerminating() bool

IsTerminating checks if the service is a terminating gateway.

func (*ConsulConnect) Validate added in v0.10.0

func (c *ConsulConnect) Validate() error

Validate that the Connect block represents exactly one of: - Connect non-native service sidecar proxy - Connect native service - Connect gateway (any type)

type ConsulExposeConfig added in v0.11.0

type ConsulExposeConfig struct {
	// Use json tag to match with field name in api/
	Paths []ConsulExposePath `json:"Path"`
}

ConsulExposeConfig represents a Consul Connect expose jobspec stanza.

func (*ConsulExposeConfig) Copy added in v0.11.0

Copy the stanza. Returns nil if e is nil.

func (*ConsulExposeConfig) Equals added in v0.11.0

Equals returns true if the structs are recursively equal.

type ConsulExposePath added in v0.11.0

type ConsulExposePath struct {
	Path          string
	Protocol      string
	LocalPathPort int
	ListenerPort  string
}

type ConsulGateway added in v0.12.4

type ConsulGateway struct {
	// Proxy is used to configure the Envoy instance acting as the gateway.
	Proxy *ConsulGatewayProxy

	// Ingress represents the Consul Configuration Entry for an Ingress Gateway.
	Ingress *ConsulIngressConfigEntry

	// Terminating represents the Consul Configuration Entry for a Terminating Gateway.
	Terminating *ConsulTerminatingConfigEntry

	// Mesh indicates the Consul service should be a Mesh Gateway.
	Mesh *ConsulMeshConfigEntry
}

ConsulGateway is used to configure one of the Consul Connect Gateway types.

func (*ConsulGateway) Copy added in v0.12.4

func (g *ConsulGateway) Copy() *ConsulGateway

func (*ConsulGateway) Equals added in v0.12.4

func (g *ConsulGateway) Equals(o *ConsulGateway) bool

func (*ConsulGateway) Prefix added in v1.0.4

func (g *ConsulGateway) Prefix() string

func (*ConsulGateway) Validate added in v0.12.4

func (g *ConsulGateway) Validate() error

type ConsulGatewayBindAddress added in v0.12.4

type ConsulGatewayBindAddress struct {
	Address string
	Port    int
}

ConsulGatewayBindAddress is equivalent to Consul's api/catalog.go ServiceAddress struct, as this is used to encode values to pass along to Envoy (i.e. via JSON encoding).

func (*ConsulGatewayBindAddress) Copy added in v0.12.4

func (*ConsulGatewayBindAddress) Equals added in v0.12.4

func (*ConsulGatewayBindAddress) Validate added in v0.12.4

func (a *ConsulGatewayBindAddress) Validate() error

type ConsulGatewayProxy added in v0.12.4

type ConsulGatewayProxy struct {
	ConnectTimeout                  *time.Duration
	EnvoyGatewayBindTaggedAddresses bool
	EnvoyGatewayBindAddresses       map[string]*ConsulGatewayBindAddress
	EnvoyGatewayNoDefaultBind       bool
	EnvoyDNSDiscoveryType           string
	Config                          map[string]interface{}
}

ConsulGatewayProxy is used to tune parameters of the proxy instance acting as one of the forms of Connect gateways that Consul supports.

https://www.consul.io/docs/connect/proxies/envoy#gateway-options

func (*ConsulGatewayProxy) Copy added in v0.12.4

func (*ConsulGatewayProxy) Equals added in v0.12.4

func (*ConsulGatewayProxy) Validate added in v0.12.4

func (p *ConsulGatewayProxy) Validate() error

type ConsulGatewayTLSConfig added in v0.12.4

type ConsulGatewayTLSConfig struct {
	Enabled bool
}

ConsulGatewayTLSConfig is used to configure TLS for a gateway.

func (*ConsulGatewayTLSConfig) Copy added in v0.12.4

func (*ConsulGatewayTLSConfig) Equals added in v0.12.4

type ConsulIngressConfigEntry added in v0.12.4

type ConsulIngressConfigEntry struct {
	TLS       *ConsulGatewayTLSConfig
	Listeners []*ConsulIngressListener
}

ConsulIngressConfigEntry represents the Consul Configuration Entry type for an Ingress Gateway.

https://www.consul.io/docs/agent/config-entries/ingress-gateway#available-fields

func (*ConsulIngressConfigEntry) Copy added in v0.12.4

func (*ConsulIngressConfigEntry) Equals added in v0.12.4

func (*ConsulIngressConfigEntry) Validate added in v0.12.4

func (e *ConsulIngressConfigEntry) Validate() error

type ConsulIngressListener added in v0.12.4

type ConsulIngressListener struct {
	Port     int
	Protocol string
	Services []*ConsulIngressService
}

ConsulIngressListener is used to configure a listener on a Consul Ingress Gateway.

func (*ConsulIngressListener) Copy added in v0.12.4

func (*ConsulIngressListener) Equals added in v0.12.4

func (*ConsulIngressListener) Validate added in v0.12.4

func (l *ConsulIngressListener) Validate() error

type ConsulIngressService added in v0.12.4

type ConsulIngressService struct {
	Name  string
	Hosts []string
}

ConsulIngressService is used to configure a service fronted by the ingress gateway.

func (*ConsulIngressService) Copy added in v0.12.4

func (*ConsulIngressService) Equals added in v0.12.4

func (*ConsulIngressService) Validate added in v0.12.4

func (s *ConsulIngressService) Validate(isHTTP bool) error

type ConsulLinkedService added in v1.0.4

type ConsulLinkedService struct {
	Name     string
	CAFile   string
	CertFile string
	KeyFile  string
	SNI      string
}

func (*ConsulLinkedService) Copy added in v1.0.4

func (*ConsulLinkedService) Equals added in v1.0.4

func (*ConsulLinkedService) Validate added in v1.0.4

func (s *ConsulLinkedService) Validate() error

type ConsulMeshConfigEntry added in v1.1.1

type ConsulMeshConfigEntry struct {
}

ConsulMeshConfigEntry is a stub used to represent that the gateway service type should be for a Mesh Gateway. Unlike Ingress and Terminating, there is no dedicated Consul Config Entry type for "mesh-gateway", for now. We still create a type for future proofing, and to keep underlying job-spec marshaling consistent with the other types.

func (*ConsulMeshConfigEntry) Copy added in v1.1.1

func (*ConsulMeshConfigEntry) Equals added in v1.1.1

func (*ConsulMeshConfigEntry) Validate added in v1.1.1

func (e *ConsulMeshConfigEntry) Validate() error

type ConsulMeshGateway added in v1.1.1

type ConsulMeshGateway struct {
	// Mode configures how an upstream should be accessed with regard to using
	// mesh gateways.
	//
	// local - the connect proxy makes outbound connections through mesh gateway
	// originating in the same datacenter.
	//
	// remote - the connect proxy makes outbound connections to a mesh gateway
	// in the destination datacenter.
	//
	// none (default) - no mesh gateway is used, the proxy makes outbound connections
	// directly to destination services.
	//
	// https://www.consul.io/docs/connect/gateways/mesh-gateway#modes-of-operation
	Mode string
}

ConsulMeshGateway is used to configure mesh gateway usage when connecting to a connect upstream in another datacenter.

func (*ConsulMeshGateway) Copy added in v1.1.1

func (*ConsulMeshGateway) Equals added in v1.1.1

func (*ConsulMeshGateway) Validate added in v1.1.1

func (c *ConsulMeshGateway) Validate() error

type ConsulProxy added in v0.10.0

type ConsulProxy struct {

	// LocalServiceAddress is the address the local service binds to.
	// Usually 127.0.0.1 it is useful to customize in clusters with mixed
	// Connect and non-Connect services.
	LocalServiceAddress string

	// LocalServicePort is the port the local service binds to. Usually
	// the same as the parent service's port, it is useful to customize
	// in clusters with mixed Connect and non-Connect services
	LocalServicePort int

	// Upstreams configures the upstream services this service intends to
	// connect to.
	Upstreams []ConsulUpstream

	// Expose configures the consul proxy.expose stanza to "open up" endpoints
	// used by task-group level service checks using HTTP or gRPC protocols.
	//
	// Use json tag to match with field name in api/
	Expose *ConsulExposeConfig `json:"ExposeConfig"`

	// Config is a proxy configuration. It is opaque to Nomad and passed
	// directly to Consul.
	Config map[string]interface{}
}

ConsulProxy represents a Consul Connect sidecar proxy jobspec stanza.

func (*ConsulProxy) Copy added in v0.10.0

func (p *ConsulProxy) Copy() *ConsulProxy

Copy the stanza recursively. Returns nil if nil.

func (*ConsulP