Documentation ¶
Index ¶
- Constants
- Variables
- func ACLPolicyListHash(policies []*ACLPolicy) string
- func AllocName(job, group string, idx uint) string
- func AllocSubset(allocs []*Allocation, subset []*Allocation) bool
- func AllocSuffix(name string) string
- func Bridge(a, b io.ReadWriteCloser)
- func CSIPluginTypeIsValid(pt CSIPluginType) bool
- func CodeFromRPCCodedErr(err error) (code int, msg string, ok bool)
- func CompareMigrateToken(allocID, nodeSecretID, otherMigrateToken string) bool
- func CompileACLObject(cache *lru.TwoQueueCache, policies []*ACLPolicy) (*acl.ACL, error)
- func CopyMapStringClientHostVolumeConfig(m map[string]*ClientHostVolumeConfig) map[string]*ClientHostVolumeConfig
- func CopyMapVolumeRequest(s map[string]*VolumeRequest) map[string]*VolumeRequest
- func CronParseNext(e *cronexpr.Expression, fromTime time.Time, spec string) (t time.Time, err error)
- func Decode(buf []byte, out interface{}) error
- func DecodeVaultSecretData(s *vapi.Secret, out interface{}) error
- func DenormalizeAllocationJobs(job *Job, allocs []*Allocation)
- func DeploymentStatusDescriptionNoRollbackTarget(baseDescription string) string
- func DeploymentStatusDescriptionRollback(baseDescription string, jobVersion uint64) string
- func DeploymentStatusDescriptionRollbackNoop(baseDescription string, jobVersion uint64) string
- func DevicesEquals(d1, d2 []*NodeDeviceResource) bool
- func DispatchedID(templateID, idPrefixTemplate string, t time.Time) string
- func Encode(t MessageType, msg interface{}) ([]byte, error)
- func GenerateMigrateToken(allocID, nodeSecretID string) (string, error)
- func IsErrNoLeader(err error) bool
- func IsErrNoNodeConn(err error) bool
- func IsErrNoRegionPath(err error) bool
- func IsErrNoSuchFileOrDirectory(err error) bool
- func IsErrNodeLacksRpc(err error) bool
- func IsErrPermissionDenied(err error) bool
- func IsErrRPCCoded(err error) bool
- func IsErrTokenNotFound(err error) bool
- func IsErrUnknownAllocation(err error) bool
- func IsErrUnknownDeployment(err error) bool
- func IsErrUnknownEvaluation(err error) bool
- func IsErrUnknownJob(err error) bool
- func IsErrUnknownMethod(err error) bool
- func IsErrUnknownNode(err error) bool
- func IsErrUnknownNomadVersion(err error) bool
- func IsRecoverable(e error) bool
- func IsServerSide(e error) bool
- func IsUniqueNamespace(key string) bool
- func MergeMultierrorWarnings(errs ...error) string
- func MountPropagationModeIsValid(propagationMode string) bool
- func NewErrRPCCoded(code int, msg string) error
- func NewErrRPCCodedf(code int, format string, args ...interface{}) error
- func NewErrUnknownAllocation(allocID string) error
- func NewErrUnknownDeployment(deploymentID string) error
- func NewErrUnknownEvaluation(evaluationID string) error
- func NewErrUnknownJob(jobID string) error
- func NewErrUnknownNode(nodeID string) error
- func NewRecoverableError(e error, recoverable bool) error
- func NewWrappedServerError(e error) error
- func NodeNetworksEquals(n1, n2 []*NodeNetworkResource) bool
- func NomadJsonEncodingExtensions(h *codec.JsonHandle) *codec.JsonHandle
- func ParsePortRanges(spec string) ([]uint64, error)
- func ScoreFitBinPack(node *Node, util *ComparableResources) float64
- func ScoreFitSpread(node *Node, util *ComparableResources) float64
- func ShouldDrainNode(status string) bool
- func SplitTerminalAllocs(allocs []*Allocation) ([]*Allocation, TerminalByNodeByName)
- func UniqueNamespace(key string) string
- func ValidCSIVolumeAccessMode(accessMode CSIVolumeAccessMode) bool
- func ValidCSIVolumeAttachmentMode(attachmentMode CSIVolumeAttachmentMode) bool
- func ValidCSIVolumeWriteAccessMode(accessMode CSIVolumeAccessMode) bool
- func ValidNodeStatus(status string) bool
- func ValidateConnectProxyService(serviceName string, tgServices []*Service) error
- func VaultNamespaceSet(policies map[string]map[string]*Vault) []string
- func VaultPoliciesSet(policies map[string]map[string]*Vault) []string
- func WrapRecoverable(msg string, err error) error
- type ACLPolicy
- type ACLPolicyDeleteRequest
- type ACLPolicyEvent
- type ACLPolicyListRequest
- type ACLPolicyListResponse
- type ACLPolicyListStub
- type ACLPolicySetRequest
- type ACLPolicySetResponse
- type ACLPolicySpecificRequest
- type ACLPolicyUpsertRequest
- type ACLRole
- type ACLRoleByIDRequest
- type ACLRoleByIDResponse
- type ACLRoleByNameRequest
- type ACLRoleByNameResponse
- type ACLRoleListStub
- type ACLRolePolicyLink
- type ACLRoleStreamEvent
- type ACLRolesByIDRequest
- type ACLRolesByIDResponse
- type ACLRolesDeleteByIDRequest
- type ACLRolesDeleteByIDResponse
- type ACLRolesListRequest
- type ACLRolesListResponse
- type ACLRolesUpsertRequest
- type ACLRolesUpsertResponse
- type ACLToken
- func (a *ACLToken) Canonicalize()
- func (a *ACLToken) Copy() *ACLToken
- func (a *ACLToken) GetCreateIndex() uint64
- func (a *ACLToken) GetID() string
- func (a *ACLToken) HasExpirationTime() bool
- func (a *ACLToken) HasRoles(roleIDs []string) bool
- func (a *ACLToken) IsExpired(t time.Time) bool
- func (a *ACLToken) MarshalJSON() ([]byte, error)
- func (a *ACLToken) SetHash() []byte
- func (a *ACLToken) Stub() *ACLTokenListStub
- func (a *ACLToken) UnmarshalJSON(data []byte) (err error)
- func (a *ACLToken) Validate(minTTL, maxTTL time.Duration, existing *ACLToken) error
- type ACLTokenBootstrapRequest
- type ACLTokenDeleteRequest
- type ACLTokenEvent
- type ACLTokenListRequest
- type ACLTokenListResponse
- type ACLTokenListStub
- type ACLTokenRoleLink
- type ACLTokenSetRequest
- type ACLTokenSetResponse
- type ACLTokenSpecificRequest
- type ACLTokenUpsertRequest
- type ACLTokenUpsertResponse
- type Affinities
- type Affinity
- type AgentPprofRequest
- type AgentPprofResponse
- type AllocDeploymentStatus
- type AllocInfo
- type AllocListRequest
- type AllocListResponse
- type AllocListStub
- type AllocMetric
- func (a *AllocMetric) Copy() *AllocMetric
- func (a *AllocMetric) EvaluateNode()
- func (a *AllocMetric) ExhaustQuota(dimensions []string)
- func (a *AllocMetric) ExhaustResources(tg *TaskGroup)
- func (a *AllocMetric) ExhaustedNode(node *Node, dimension string)
- func (a *AllocMetric) FilterNode(node *Node, constraint string)
- func (a *AllocMetric) MaxNormScore() *NodeScoreMeta
- func (a *AllocMetric) PopulateScoreMetaData()
- func (a *AllocMetric) ScoreNode(node *Node, name string, score float64)
- type AllocNetworkStatus
- type AllocRestartRequest
- type AllocServiceRegistrationsRequest
- type AllocServiceRegistrationsResponse
- type AllocSignalRequest
- type AllocSpecificRequest
- type AllocState
- type AllocStateField
- type AllocStopRequest
- type AllocStopResponse
- type AllocStubFields
- type AllocUpdateDesiredTransitionRequest
- type AllocUpdateRequest
- type AllocatedCpuResources
- type AllocatedDeviceResource
- type AllocatedDevices
- type AllocatedMemoryResources
- type AllocatedPortMapping
- type AllocatedPorts
- type AllocatedResources
- type AllocatedSharedResources
- type AllocatedTaskResources
- func (a *AllocatedTaskResources) Add(delta *AllocatedTaskResources)
- func (a *AllocatedTaskResources) Comparable() *ComparableResources
- func (a *AllocatedTaskResources) Copy() *AllocatedTaskResources
- func (a *AllocatedTaskResources) Max(other *AllocatedTaskResources)
- func (a *AllocatedTaskResources) NetIndex(n *NetworkResource) int
- func (a *AllocatedTaskResources) Subtract(delta *AllocatedTaskResources)
- type Allocation
- func (a *Allocation) AllocationDiff() *AllocationDiff
- func (a *Allocation) AppendState(field AllocStateField, value string)
- func (a *Allocation) Canonicalize()
- func (a *Allocation) ClientTerminalStatus() bool
- func (a *Allocation) ComparableResources() *ComparableResources
- func (a *Allocation) ConsulNamespace() string
- func (a *Allocation) Copy() *Allocation
- func (a *Allocation) CopySkipJob() *Allocation
- func (a *Allocation) DisconnectTimeout(now time.Time) time.Time
- func (a *Allocation) Expired(now time.Time) bool
- func (a *Allocation) GetCreateIndex() uint64
- func (a *Allocation) GetID() string
- func (a *Allocation) GetNamespace() string
- func (a *Allocation) Index() uint
- func (a *Allocation) JobNamespacedID() NamespacedID
- func (a *Allocation) LastEventTime() time.Time
- func (a *Allocation) LastUnknown() time.Time
- func (a *Allocation) LookupTask(name string) *Task
- func (a *Allocation) MigrateStrategy() *MigrateStrategy
- func (a *Allocation) NeedsToReconnect() bool
- func (a *Allocation) NextDelay() time.Duration
- func (a *Allocation) NextRescheduleTime() (time.Time, bool)
- func (a *Allocation) NextRescheduleTimeByFailTime(failTime time.Time) (time.Time, bool)
- func (a *Allocation) RanSuccessfully() bool
- func (a *Allocation) RescheduleEligible(reschedulePolicy *ReschedulePolicy, failTime time.Time) bool
- func (a *Allocation) RescheduleInfo() (int, int)
- func (a *Allocation) ReschedulePolicy() *ReschedulePolicy
- func (a *Allocation) ServerTerminalStatus() bool
- func (a *Allocation) ServiceProviderNamespace() string
- func (a *Allocation) SetEventDisplayMessages()
- func (a *Allocation) SetStop(clientStatus, clientDesc string)
- func (a *Allocation) ShouldClientStop() bool
- func (a *Allocation) ShouldMigrate() bool
- func (a *Allocation) ShouldReschedule(reschedulePolicy *ReschedulePolicy, failTime time.Time) bool
- func (a *Allocation) Stub(fields *AllocStubFields) *AllocListStub
- func (a *Allocation) SupportsDisconnectedClients(serverSupportsDisconnectedClients bool) bool
- func (a *Allocation) TerminalStatus() bool
- func (a *Allocation) Terminated() bool
- func (a *Allocation) ToIdentityClaims(job *Job) *IdentityClaims
- func (a *Allocation) ToTaskIdentityClaims(job *Job, taskName string) *IdentityClaims
- func (a *Allocation) WaitClientStop() time.Time
- type AllocationDiff
- type AllocationEvent
- type AllocsGetRequest
- type AllocsGetResponse
- type ApplyDeploymentAllocHealthRequest
- type ApplyDeploymentPromoteRequest
- type ApplyPlanResultsRequest
- type AutopilotConfig
- type AutopilotSetConfigRequest
- type BatchFuture
- type BatchNodeUpdateDrainRequest
- type Bitmap
- func (b Bitmap) Check(idx uint) bool
- func (b Bitmap) Clear()
- func (b Bitmap) Copy() (Bitmap, error)
- func (b Bitmap) IndexesInRange(set bool, from, to uint) []int
- func (b Bitmap) IndexesInRangeFiltered(set bool, from, to uint, filter []int) []int
- func (b Bitmap) Set(idx uint)
- func (b Bitmap) Size() uint
- func (b Bitmap) String() string
- func (b Bitmap) Unset(idx uint)
- type CSIControllerCapability
- type CSIControllerInfo
- type CSIInfo
- type CSIMountOptions
- type CSINodeCapability
- type CSINodeInfo
- type CSIPlugin
- func (p *CSIPlugin) AddJob(job *Job, summary *JobSummary)
- func (p *CSIPlugin) AddPlugin(nodeID string, info *CSIInfo) error
- func (p *CSIPlugin) Copy() *CSIPlugin
- func (p *CSIPlugin) DeleteAlloc(allocID, nodeID string) error
- func (p *CSIPlugin) DeleteJob(job *Job, summary *JobSummary)
- func (p *CSIPlugin) DeleteNode(nodeID string) error
- func (p *CSIPlugin) DeleteNodeForType(nodeID string, pluginType CSIPluginType) error
- func (p *CSIPlugin) HasControllerCapability(cap CSIControllerCapability) bool
- func (p *CSIPlugin) HasNodeCapability(cap CSINodeCapability) bool
- func (p *CSIPlugin) IsEmpty() bool
- func (p *CSIPlugin) Stub() *CSIPluginListStub
- func (p *CSIPlugin) UpdateExpectedWithJob(job *Job, summary *JobSummary, terminal bool)
- type CSIPluginDeleteRequest
- type CSIPluginDeleteResponse
- type CSIPluginGetRequest
- type CSIPluginGetResponse
- type CSIPluginListRequest
- type CSIPluginListResponse
- type CSIPluginListStub
- type CSIPluginType
- type CSISecrets
- type CSISnapshot
- type CSISnapshotCreateRequest
- type CSISnapshotCreateResponse
- type CSISnapshotDeleteRequest
- type CSISnapshotDeleteResponse
- type CSISnapshotListRequest
- type CSISnapshotListResponse
- type CSITopology
- type CSITopologyRequest
- type CSIVolListStub
- type CSIVolume
- func (v *CSIVolume) Claim(claim *CSIVolumeClaim, alloc *Allocation) error
- func (v *CSIVolume) Copy() *CSIVolume
- func (v *CSIVolume) Equal(o *CSIVolume) bool
- func (v *CSIVolume) GetCreateIndex() uint64
- func (v *CSIVolume) GetID() string
- func (v *CSIVolume) GetNamespace() string
- func (v *CSIVolume) HasFreeReadClaims() bool
- func (v *CSIVolume) HasFreeWriteClaims() bool
- func (v *CSIVolume) InUse() bool
- func (v *CSIVolume) Merge(other *CSIVolume) error
- func (v *CSIVolume) ReadSchedulable() bool
- func (v *CSIVolume) RemoteID() string
- func (v *CSIVolume) Stub() *CSIVolListStub
- func (v *CSIVolume) Validate() error
- func (v *CSIVolume) WriteSchedulable() bool
- type CSIVolumeAccessMode
- type CSIVolumeAttachmentMode
- type CSIVolumeCapability
- type CSIVolumeClaim
- type CSIVolumeClaimBatchRequest
- type CSIVolumeClaimMode
- type CSIVolumeClaimRequest
- type CSIVolumeClaimResponse
- type CSIVolumeClaimState
- type CSIVolumeCreateRequest
- type CSIVolumeCreateResponse
- type CSIVolumeDeleteRequest
- type CSIVolumeDeleteResponse
- type CSIVolumeDeregisterRequest
- type CSIVolumeDeregisterResponse
- type CSIVolumeExternalListRequest
- type CSIVolumeExternalListResponse
- type CSIVolumeExternalStub
- type CSIVolumeGetRequest
- type CSIVolumeGetResponse
- type CSIVolumeListRequest
- type CSIVolumeListResponse
- type CSIVolumeRegisterRequest
- type CSIVolumeRegisterResponse
- type CSIVolumeUnpublishRequest
- type CSIVolumeUnpublishResponse
- type ChangeScript
- type CheckID
- type CheckMode
- type CheckQueryResult
- type CheckRestart
- type CheckStatus
- type ClientHostNetworkConfig
- type ClientHostVolumeConfig
- type ClusterMetadata
- type ComparableResources
- func (c *ComparableResources) Add(delta *ComparableResources)
- func (c *ComparableResources) Copy() *ComparableResources
- func (c *ComparableResources) NetIndex(n *NetworkResource) int
- func (c *ComparableResources) Subtract(delta *ComparableResources)
- func (c *ComparableResources) Superset(other *ComparableResources) (bool, string)
- type Constraint
- type Constraints
- type Consul
- type ConsulConfigEntries
- type ConsulConnect
- func (c *ConsulConnect) Copy() *ConsulConnect
- func (c *ConsulConnect) Equals(o *ConsulConnect) bool
- func (c *ConsulConnect) HasSidecar() bool
- func (c *ConsulConnect) IsCustomizedTLS() bool
- func (c *ConsulConnect) IsGateway() bool
- func (c *ConsulConnect) IsIngress() bool
- func (c *ConsulConnect) IsMesh() bool
- func (c *ConsulConnect) IsNative() bool
- func (c *ConsulConnect) IsTerminating() bool
- func (c *ConsulConnect) Validate() error
- type ConsulExposeConfig
- type ConsulExposePath
- type ConsulGateway
- type ConsulGatewayBindAddress
- type ConsulGatewayProxy
- type ConsulGatewayTLSConfig
- type ConsulIngressConfigEntry
- type ConsulIngressListener
- type ConsulIngressService
- type ConsulLinkedService
- type ConsulMeshConfigEntry
- type ConsulMeshGateway
- type ConsulProxy
- type ConsulSidecarService
- type ConsulTerminatingConfigEntry
- type ConsulUpstream
- type ConsulUsage
- type Context
- type DNSConfig
- type Deployment
- func (d *Deployment) Active() bool
- func (d *Deployment) Copy() *Deployment
- func (d *Deployment) GetCreateIndex() uint64
- func (d *Deployment) GetID() string
- func (d *Deployment) GoString() string
- func (d *Deployment) HasAutoPromote() bool
- func (d *Deployment) HasPlacedCanaries() bool
- func (d *Deployment) RequiresPromotion() bool
- type DeploymentAllocHealthRequest
- type DeploymentCancelRequest
- type DeploymentDeleteRequest
- type DeploymentEvent
- type DeploymentFailRequest
- type DeploymentListRequest
- type DeploymentListResponse
- type DeploymentPauseRequest
- type DeploymentPromoteRequest
- type DeploymentRunRequest
- type DeploymentSpecificRequest
- type DeploymentState
- type DeploymentStatusUpdate
- type DeploymentStatusUpdateRequest
- type DeploymentUnblockRequest
- type DeploymentUpdateResponse
- type DeriveSITokenRequest
- type DeriveSITokenResponse
- type DeriveVaultTokenRequest
- type DeriveVaultTokenResponse
- type DesiredTransition
- type DesiredUpdates
- type DeviceAccounter
- type DeviceAccounterInstance
- type DeviceIdTuple
- type DiffType
- type DiffableWithID
- type DispatchPayloadConfig
- type DrainMetadata
- type DrainSpec
- type DrainStatus
- type DrainStrategy
- type DrainUpdate
- type DriverInfo
- type EmitNodeEventsRequest
- type EmitNodeEventsResponse
- type EncryptionAlgorithm
- type EphemeralDisk
- type EvalAckRequest
- type EvalAllocationsResponse
- type EvalCountRequest
- type EvalCountResponse
- type EvalDeleteRequest
- type EvalDeleteResponse
- type EvalDequeueRequest
- type EvalDequeueResponse
- type EvalListRequest
- type EvalListResponse
- type EvalOptions
- type EvalReapRequest
- type EvalSpecificRequest
- type EvalUpdateRequest
- type Evaluation
- func (e *Evaluation) Copy() *Evaluation
- func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool, escaped bool, quotaReached string, ...) *Evaluation
- func (e *Evaluation) CreateFailedFollowUpEval(wait time.Duration) *Evaluation
- func (e *Evaluation) GetCreateIndex() uint64
- func (e *Evaluation) GetID() string
- func (e *Evaluation) GetNamespace() string
- func (e *Evaluation) GoString() string
- func (e *Evaluation) MakePlan(j *Job) *Plan
- func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation
- func (e *Evaluation) RelatedIDs() []string
- func (e *Evaluation) ShouldBlock() bool
- func (e *Evaluation) ShouldEnqueue() bool
- func (e *Evaluation) Stub() *EvaluationStub
- func (e *Evaluation) TerminalStatus() bool
- func (e *Evaluation) UpdateModifyTime()
- type EvaluationEvent
- type EvaluationStub
- type Event
- type EventJson
- type EventStreamRequest
- type EventStreamWrapper
- type Events
- type FieldDiff
- type FieldDiffs
- type FuzzyMatch
- type FuzzySearchRequest
- type FuzzySearchResponse
- type GenericRequest
- type GenericResponse
- type HostDataRequest
- type HostDataResponse
- type IdentityClaims
- type InternalRpcInfo
- type Job
- func (j *Job) Canonicalize()
- func (j *Job) CombinedTaskMeta(groupName, taskName string) map[string]string
- func (j *Job) ConfigEntries() map[string]*ConsulConfigEntries
- func (j *Job) ConnectTasks() []TaskKind
- func (j *Job) ConsulUsages() map[string]*ConsulUsage
- func (j *Job) Copy() *Job
- func (j *Job) Diff(other *Job, contextual bool) (*JobDiff, error)
- func (j *Job) GetCreateIndex() uint64
- func (j *Job) GetEntScalingPolicies() []*ScalingPolicy
- func (j *Job) GetID() string
- func (j *Job) GetNamespace() string
- func (j *Job) GetScalingPolicies() []*ScalingPolicy
- func (j *Job) HasUpdateStrategy() bool
- func (j *Job) IsMultiregion() bool
- func (j *Job) IsParameterized() bool
- func (j *Job) IsPeriodic() bool
- func (j *Job) IsPeriodicActive() bool
- func (j *Job) IsPlugin() bool
- func (j *Job) LookupTaskGroup(name string) *TaskGroup
- func (j *Job) NamespacedID() NamespacedID
- func (j *Job) RequiredConsulServiceDiscovery() map[string]bool
- func (j *Job) RequiredNativeServiceDiscovery() *NativeServiceDiscoveryUsage
- func (j *Job) RequiredSignals() map[string]map[string][]string
- func (j *Job) SetSubmitTime()
- func (j *Job) SpecChanged(new *Job) bool
- func (j *Job) Stopped() bool
- func (j *Job) Stub(summary *JobSummary, fields *JobStubFields) *JobListStub
- func (j *Job) UsesDeployments() bool
- func (j *Job) Validate() error
- func (j *Job) Vault() map[string]map[string]*Vault
- func (j *Job) Warnings() error
- type JobACL
- type JobAllocationsResponse
- type JobBatchDeregisterRequest
- type JobBatchDeregisterResponse
- type JobChildrenSummary
- type JobDeregisterOptions
- type JobDeregisterRequest
- type JobDeregisterResponse
- type JobDescription
- type JobDescriptions
- type JobDiff
- type JobDispatchRequest
- type JobDispatchResponse
- type JobEvaluateRequest
- type JobEvaluationsResponse
- type JobEvent
- type JobListRequest
- type JobListResponse
- type JobListStub
- type JobNamespacedDescriptions
- type JobPlanRequest
- type JobPlanResponse
- type JobRegisterRequest
- type JobRegisterResponse
- type JobRevertRequest
- type JobScaleRequest
- type JobScaleStatus
- type JobScaleStatusRequest
- type JobScaleStatusResponse
- type JobScalingEvents
- type JobServiceRegistrationsRequest
- type JobServiceRegistrationsResponse
- type JobSpecificRequest
- type JobStabilityRequest
- type JobStabilityResponse
- type JobStubFields
- type JobSummary
- type JobSummaryRequest
- type JobSummaryResponse
- type JobValidateRequest
- type JobValidateResponse
- type JobVersionsRequest
- type JobVersionsResponse
- type KeyEncryptionKeyWrapper
- type KeyringDeleteRootKeyRequest
- type KeyringDeleteRootKeyResponse
- type KeyringGetRootKeyRequest
- type KeyringGetRootKeyResponse
- type KeyringListRootKeyMetaRequest
- type KeyringListRootKeyMetaResponse
- type KeyringRequest
- type KeyringResponse
- type KeyringRotateRootKeyRequest
- type KeyringRotateRootKeyResponse
- type KeyringUpdateRootKeyMetaRequest
- type KeyringUpdateRootKeyMetaResponse
- type KeyringUpdateRootKeyRequest
- type KeyringUpdateRootKeyResponse
- type LogConfig
- type MessageType
- type MigrateStrategy
- type Multiregion
- type MultiregionRegion
- type MultiregionStrategy
- type Namespace
- type NamespaceCapabilities
- type NamespaceDeleteRequest
- type NamespaceListRequest
- type NamespaceListResponse
- type NamespaceSetRequest
- type NamespaceSetResponse
- type NamespaceSpecificRequest
- type NamespaceUpsertRequest
- type NamespacedID
- type NativeServiceDiscoveryUsage
- type NetworkIndex
- func (idx *NetworkIndex) AddAllocs(allocs []*Allocation) (collide bool, reason string)
- func (idx *NetworkIndex) AddReserved(n *NetworkResource) (collide bool, reasons []string)
- func (idx *NetworkIndex) AddReservedPorts(ports AllocatedPorts) (collide bool, reasons []string)
- func (idx *NetworkIndex) AddReservedPortsForIP(ports []uint64, ip string) (collide bool, reasons []string)
- func (idx *NetworkIndex) AssignPorts(ask *NetworkResource) (AllocatedPorts, error)
- func (idx *NetworkIndex) AssignTaskNetwork(ask *NetworkResource) (out *NetworkResource, err error)
- func (idx *NetworkIndex) Copy() *NetworkIndex
- func (idx *NetworkIndex) Overcommitted() bool
- func (idx *NetworkIndex) Release()
- func (idx *NetworkIndex) SetNode(node *Node) error
- type NetworkResource
- func (n *NetworkResource) Add(delta *NetworkResource)
- func (n *NetworkResource) Canonicalize()
- func (n *NetworkResource) Copy() *NetworkResource
- func (n *NetworkResource) Diff(other *NetworkResource, contextual bool) *ObjectDiff
- func (n *NetworkResource) Equals(other *NetworkResource) bool
- func (n *NetworkResource) GoString() string
- func (n *NetworkResource) Hash() uint32
- func (n *NetworkResource) PortLabels() map[string]int
- type NetworkStatus
- type Networks
- type Node
- func (n *Node) Canonicalize()
- func (n *Node) ComparableReservedResources() *ComparableResources
- func (n *Node) ComparableResources() *ComparableResources
- func (n *Node) ComputeClass() error
- func (n *Node) Copy() *Node
- func (n *Node) GetID() string
- func (n Node) HashInclude(field string, v interface{}) (bool, error)
- func (n Node) HashIncludeMap(field string, k, v interface{}) (bool, error)
- func (n *Node) Ready() bool
- func (n *Node) Sanitize() *Node
- func (n *Node) Stub(fields *NodeStubFields) *NodeListStub
- func (n *Node) TerminalStatus() bool
- func (n *Node) UnresponsiveStatus() bool
- type NodeAllocsResponse
- type NodeBatchDeregisterRequest
- type NodeClientAllocsResponse
- type NodeConnQueryResponse
- type NodeCpuResources
- type NodeDeregisterRequest
- type NodeDevice
- type NodeDeviceLocality
- type NodeDeviceResource
- func (n *NodeDeviceResource) Copy() *NodeDeviceResource
- func (n *NodeDeviceResource) Equals(o *NodeDeviceResource) bool
- func (n NodeDeviceResource) HashInclude(field string, v interface{}) (bool, error)
- func (n NodeDeviceResource) HashIncludeMap(field string, k, v interface{}) (bool, error)
- func (n *NodeDeviceResource) ID() *DeviceIdTuple
- type NodeDiskResources
- type NodeDrainUpdateResponse
- type NodeEligibilityUpdateResponse
- type NodeEvaluateRequest
- type NodeEvent
- func (ne *NodeEvent) AddDetail(k, v string) *NodeEvent
- func (ne *NodeEvent) Copy() *NodeEvent
- func (ne *NodeEvent) SetMessage(msg string) *NodeEvent
- func (ne *NodeEvent) SetSubsystem(sys string) *NodeEvent
- func (ne *NodeEvent) SetTimestamp(ts time.Time) *NodeEvent
- func (ne *NodeEvent) String() string
- type NodeListRequest
- type NodeListResponse
- type NodeListStub
- type NodeMemoryResources
- type NodeNetworkAF
- type NodeNetworkAddress
- type NodeNetworkResource
- type NodeRegisterRequest
- type NodeReservedCpuResources
- type NodeReservedDiskResources
- type NodeReservedMemoryResources
- type NodeReservedNetworkResources
- type NodeReservedResources
- type NodeResources
- type NodeScoreMeta
- type NodeServerInfo
- type NodeSpecificRequest
- type NodeStreamEvent
- type NodeStubFields
- type NodeUpdateDrainRequest
- type NodeUpdateEligibilityRequest
- type NodeUpdateResponse
- type NodeUpdateStatusRequest
- type ObjectDiff
- type ObjectDiffs
- type OneTimeToken
- type OneTimeTokenDeleteRequest
- type OneTimeTokenExchangeRequest
- type OneTimeTokenExchangeResponse
- type OneTimeTokenExpireRequest
- type OneTimeTokenUpsertRequest
- type OneTimeTokenUpsertResponse
- type OperatorHealthReply
- type ParameterizedJobConfig
- type PeriodicConfig
- type PeriodicForceRequest
- type PeriodicForceResponse
- type PeriodicLaunch
- type Plan
- func (p *Plan) AppendAlloc(alloc *Allocation, job *Job)
- func (p *Plan) AppendPreemptedAlloc(alloc *Allocation, preemptingAllocID string)
- func (p *Plan) AppendStoppedAlloc(alloc *Allocation, desiredDesc, clientStatus, followupEvalID string)
- func (p *Plan) AppendUnknownAlloc(alloc *Allocation)
- func (p *Plan) GoString() string
- func (p *Plan) IsNoOp() bool
- func (p *Plan) NormalizeAllocations()
- func (p *Plan) PopUpdate(alloc *Allocation)
- type PlanAnnotations
- type PlanRequest
- type PlanResponse
- type PlanResult
- type Port
- type PreemptionConfig
- type QueryMeta
- type QueryOptions
- type RPCInfo
- type RaftConfigurationResponse
- type RaftPeerByAddressRequest
- type RaftPeerByIDRequest
- type RaftServer
- type RaftStats
- type Recoverable
- type RecoverableError
- type RequestedDevice
- type RescheduleEvent
- type ReschedulePolicy
- type RescheduleTracker
- type ResolveACLTokenRequest
- type ResolveACLTokenResponse
- type ResourceDevices
- type Resources
- func (r *Resources) Add(delta *Resources)
- func (r *Resources) Canonicalize()
- func (r *Resources) Copy() *Resources
- func (r *Resources) Diff(other *Resources, contextual bool) *ObjectDiff
- func (r *Resources) DiskInBytes() int64
- func (r *Resources) Equals(o *Resources) bool
- func (r *Resources) GoString() string
- func (r *Resources) MeetsMinResources() error
- func (r *Resources) Merge(other *Resources)
- func (r *Resources) NetIndex(n *NetworkResource) int
- func (r *Resources) Validate() error
- type RestartPolicy
- type RootKey
- type RootKeyMeta
- func (rkm *RootKeyMeta) Active() bool
- func (rkm *RootKeyMeta) Copy() *RootKeyMeta
- func (rkm *RootKeyMeta) Inactive() bool
- func (rkm *RootKeyMeta) Rekeying() bool
- func (rkm *RootKeyMeta) SetActive()
- func (rkm *RootKeyMeta) SetInactive()
- func (rkm *RootKeyMeta) SetRekeying()
- func (rkm *RootKeyMeta) Stub() *RootKeyMetaStub
- func (rkm *RootKeyMeta) Validate() error
- type RootKeyMetaStub
- type RootKeyState
- type RpcError
- type SIToken
- type SITokenAccessor
- type SITokenAccessorsRequest
- type ScalingEvent
- type ScalingEventRequest
- type ScalingPolicy
- func (p *ScalingPolicy) Canonicalize()
- func (p *ScalingPolicy) Copy() *ScalingPolicy
- func (p *ScalingPolicy) Diff(p2 *ScalingPolicy) bool
- func (p *ScalingPolicy) JobKey() string
- func (p *ScalingPolicy) Stub() *ScalingPolicyListStub
- func (p *ScalingPolicy) TargetTask(job *Job, tg *TaskGroup, task *Task) *ScalingPolicy
- func (p *ScalingPolicy) TargetTaskGroup(job *Job, tg *TaskGroup) *ScalingPolicy
- func (p *ScalingPolicy) Validate() error
- type ScalingPolicyListRequest
- type ScalingPolicyListResponse
- type ScalingPolicyListStub
- type ScalingPolicySpecificRequest
- type SchedulerAlgorithm
- type SchedulerConfiguration
- type SchedulerConfigurationResponse
- type SchedulerSetConfigRequest
- type SchedulerSetConfigurationResponse
- type SearchConfig
- type SearchRequest
- type SearchResponse
- type ServerHealth
- type ServerMember
- type ServerMembersResponse
- type ServerSideError
- type Service
- func (s *Service) Canonicalize(job, taskGroup, task, jobNamespace string)
- func (s *Service) Copy() *Service
- func (s *Service) Equals(o *Service) bool
- func (s *Service) Hash(allocID, taskName string, canary bool) string
- func (s *Service) Validate() error
- func (s *Service) ValidateName(name string) error
- type ServiceCheck
- func (sc *ServiceCheck) Canonicalize(serviceName, taskName string)
- func (sc *ServiceCheck) Copy() *ServiceCheck
- func (sc *ServiceCheck) Equals(o *ServiceCheck) bool
- func (sc *ServiceCheck) Hash(serviceID string) string
- func (sc *ServiceCheck) IsReadiness() bool
- func (sc *ServiceCheck) RequiresPort() bool
- func (sc *ServiceCheck) TriggersRestarts() bool
- type ServiceRegistration
- func (s *ServiceRegistration) Copy() *ServiceRegistration
- func (s *ServiceRegistration) Equals(o *ServiceRegistration) bool
- func (s *ServiceRegistration) GetID() string
- func (s *ServiceRegistration) GetNamespace() string
- func (s *ServiceRegistration) HashWith(key string) string
- func (s *ServiceRegistration) Validate() error
- type ServiceRegistrationByNameRequest
- type ServiceRegistrationByNameResponse
- type ServiceRegistrationDeleteByIDRequest
- type ServiceRegistrationDeleteByIDResponse
- type ServiceRegistrationDeleteByNodeIDRequest
- type ServiceRegistrationDeleteByNodeIDResponse
- type ServiceRegistrationListRequest
- type ServiceRegistrationListResponse
- type ServiceRegistrationListStub
- type ServiceRegistrationStreamEvent
- type ServiceRegistrationStub
- type ServiceRegistrationUpsertRequest
- type ServiceRegistrationUpsertResponse
- type SidecarTask
- type SingleACLPolicyResponse
- type SingleACLTokenResponse
- type SingleAllocResponse
- type SingleDeploymentResponse
- type SingleEvalResponse
- type SingleJobResponse
- type SingleNamespaceResponse
- type SingleNodeResponse
- type SingleScalingPolicyResponse
- type SnapshotRestoreRequest
- type SnapshotRestoreResponse
- type SnapshotSaveRequest
- type SnapshotSaveResponse
- type Spread
- type SpreadTarget
- type StreamingRpcAck
- type StreamingRpcHandler
- type StreamingRpcHeader
- type StreamingRpcRegistry
- type Task
- func (t *Task) Canonicalize(job *Job, tg *TaskGroup)
- func (t *Task) Copy() *Task
- func (t *Task) Diff(other *Task, contextual bool) (*TaskDiff, error)
- func (t *Task) GoString() string
- func (t *Task) IsMain() bool
- func (t *Task) IsPoststart() bool
- func (t *Task) IsPoststop() bool
- func (t *Task) IsPrestart() bool
- func (t *Task) UsesConnect() bool
- func (t *Task) UsesConnectSidecar() bool
- func (t *Task) Validate(ephemeralDisk *EphemeralDisk, jobType string, tgServices []*Service, ...) error
- func (t *Task) Warnings() error
- type TaskArtifact
- type TaskCSIPluginConfig
- type TaskDiff
- type TaskDiffs
- type TaskEvent
- func (e *TaskEvent) Copy() *TaskEvent
- func (e *TaskEvent) GoString() string
- func (e *TaskEvent) PopulateEventDisplayMessage()
- func (e *TaskEvent) SetDiskLimit(limit int64) *TaskEvent
- func (e *TaskEvent) SetDisplayMessage(msg string) *TaskEvent
- func (e *TaskEvent) SetDownloadError(err error) *TaskEvent
- func (e *TaskEvent) SetDriverError(err error) *TaskEvent
- func (e *TaskEvent) SetDriverMessage(m string) *TaskEvent
- func (e *TaskEvent) SetExitCode(c int) *TaskEvent
- func (e *TaskEvent) SetExitMessage(err error) *TaskEvent
- func (e *TaskEvent) SetFailedSibling(sibling string) *TaskEvent
- func (e *TaskEvent) SetFailsTask() *TaskEvent
- func (e *TaskEvent) SetKillError(err error) *TaskEvent
- func (e *TaskEvent) SetKillReason(r string) *TaskEvent
- func (e *TaskEvent) SetKillTimeout(timeout, maxTimeout time.Duration) *TaskEvent
- func (e *TaskEvent) SetMessage(msg string) *TaskEvent
- func (e *TaskEvent) SetOOMKilled(oom bool) *TaskEvent
- func (e *TaskEvent) SetRestartDelay(delay time.Duration) *TaskEvent
- func (e *TaskEvent) SetRestartReason(reason string) *TaskEvent
- func (e *TaskEvent) SetSetupError(err error) *TaskEvent
- func (e *TaskEvent) SetSignal(s int) *TaskEvent
- func (e *TaskEvent) SetSignalText(s string) *TaskEvent
- func (e *TaskEvent) SetTaskSignal(s os.Signal) *TaskEvent
- func (e *TaskEvent) SetTaskSignalReason(r string) *TaskEvent
- func (e *TaskEvent) SetValidationError(err error) *TaskEvent
- func (e *TaskEvent) SetVaultRenewalError(err error) *TaskEvent
- type TaskGroup
- func (tg *TaskGroup) Canonicalize(job *Job)
- func (tg *TaskGroup) ConsulServices() []*Service
- func (tg *TaskGroup) Copy() *TaskGroup
- func (tg *TaskGroup) Diff(other *TaskGroup, contextual bool) (*TaskGroupDiff, error)
- func (tg *TaskGroup) GoString() string
- func (tg *TaskGroup) LookupTask(name string) *Task
- func (tg *TaskGroup) NomadServices() []*Service
- func (tg *TaskGroup) UsesConnect() bool
- func (tg *TaskGroup) UsesConnectGateway() bool
- func (tg *TaskGroup) Validate(j *Job) error
- func (tg *TaskGroup) Warnings(j *Job) error
- type TaskGroupDiff
- type TaskGroupDiffs
- type TaskGroupScaleStatus
- type TaskGroupSummary
- type TaskHandle
- type TaskKind
- func (k TaskKind) IsAnyConnectGateway() bool
- func (k TaskKind) IsConnectIngress() bool
- func (k TaskKind) IsConnectMesh() bool
- func (k TaskKind) IsConnectNative() bool
- func (k TaskKind) IsConnectProxy() bool
- func (k TaskKind) IsConnectTerminating() bool
- func (k TaskKind) Name() string
- func (k TaskKind) Value() string
- type TaskLifecycleConfig
- type TaskState
- type Template
- type TerminalByNodeByName
- type Topic
- type UpdateStrategy
- type VarApplyStateRequest
- func (r *VarApplyStateRequest) ConflictResponse(raftIndex uint64, cv *VariableEncrypted) *VarApplyStateResponse
- func (r *VarApplyStateRequest) ErrorResponse(raftIndex uint64, err error) *VarApplyStateResponse
- func (r *VarApplyStateRequest) SuccessResponse(raftIndex uint64, meta *VariableMetadata) *VarApplyStateResponse
- type VarApplyStateResponse
- type VarOp
- type VarOpResult
- type VariableData
- type VariableDecrypted
- type VariableEncrypted
- type VariableItems
- type VariableMetadata
- type VariablesApplyRequest
- type VariablesApplyResponse
- type VariablesListRequest
- type VariablesListResponse
- type VariablesQuota
- type VariablesReadRequest
- type VariablesReadResponse
- type Vault
- type VaultAccessor
- type VaultAccessorsRequest
- type VaultTokenData
- type VaultTokenRoleData
- type VersionResponse
- type VolumeMount
- type VolumeRequest
- type WaitConfig
- type WrappedServerError
- type WriteMeta
- type WriteRequest
Constants ¶
const ( // ACLUpsertPoliciesRPCMethod is the RPC method for batch creating or // modifying ACL policies. // // Args: ACLPolicyUpsertRequest // Reply: GenericResponse ACLUpsertPoliciesRPCMethod = "ACL.UpsertPolicies" // ACLUpsertTokensRPCMethod is the RPC method for batch creating or // modifying ACL tokens. // // Args: ACLTokenUpsertRequest // Reply: ACLTokenUpsertResponse ACLUpsertTokensRPCMethod = "ACL.UpsertTokens" // ACLDeleteTokensRPCMethod is the RPC method for batch deleting ACL // tokens. // // Args: ACLTokenDeleteRequest // Reply: GenericResponse ACLDeleteTokensRPCMethod = "ACL.DeleteTokens" // ACLUpsertRolesRPCMethod is the RPC method for batch creating or // modifying ACL roles. // // Args: ACLRolesUpsertRequest // Reply: ACLRolesUpsertResponse ACLUpsertRolesRPCMethod = "ACL.UpsertRoles" // ACLDeleteRolesByIDRPCMethod the RPC method for batch deleting ACL // roles by their ID. // // Args: ACLRolesDeleteByIDRequest // Reply: ACLRolesDeleteByIDResponse ACLDeleteRolesByIDRPCMethod = "ACL.DeleteRolesByID" // ACLListRolesRPCMethod is the RPC method for listing ACL roles. // // Args: ACLRolesListRequest // Reply: ACLRolesListResponse ACLListRolesRPCMethod = "ACL.ListRoles" // ACLGetRolesByIDRPCMethod is the RPC method for detailing a number of ACL // roles using their ID. This is an internal only RPC endpoint and used by // the ACL Role replication process. // // Args: ACLRolesByIDRequest // Reply: ACLRolesByIDResponse ACLGetRolesByIDRPCMethod = "ACL.GetRolesByID" // ACLGetRoleByIDRPCMethod is the RPC method for detailing an individual // ACL role using its ID. // // Args: ACLRoleByIDRequest // Reply: ACLRoleByIDResponse ACLGetRoleByIDRPCMethod = "ACL.GetRoleByID" // ACLGetRoleByNameRPCMethod is the RPC method for detailing an individual // ACL role using its name. // // Args: ACLRoleByNameRequest // Reply: ACLRoleByNameResponse ACLGetRoleByNameRPCMethod = "ACL.GetRoleByName" )
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" )
const ( TopicDeployment Topic = "Deployment" TopicEvaluation Topic = "Evaluation" TopicAllocation Topic = "Allocation" TopicJob Topic = "Job" TopicNode Topic = "Node" TopicACLPolicy Topic = "ACLPolicy" TopicACLToken Topic = "ACLToken" TopicACLRole Topic = "ACLRole" TopicService Topic = "Service" 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" TypeACLRoleDeleted = "ACLRoleDeleted" TypeACLRoleUpserted = "ACLRoleUpserted" TypeServiceRegistration = "ServiceRegistration" TypeServiceDeregistration = "ServiceDeregistration" )
const ( RootKeyStateInactive RootKeyState = "inactive" RootKeyStateActive = "active" RootKeyStateRekeying = "rekeying" // RootKeyStateDeprecated is, itself, deprecated and is no longer in // use. For backwards compatibility, any existing keys with this state will // be treated as RootKeyStateInactive RootKeyStateDeprecated = "deprecated" )
const ( // DefaultMinDynamicPort is the smallest dynamic port generated by // default DefaultMinDynamicPort = 20000 // DefaultMaxDynamicPort is the largest dynamic port generated by // default DefaultMaxDynamicPort = 32000 // MaxValidPort is the max valid port number MaxValidPort = 65536 )
const ( // ServiceRegistrationUpsertRPCMethod is the RPC method for upserting // service registrations into Nomad state. // // Args: ServiceRegistrationUpsertRequest // Reply: ServiceRegistrationUpsertResponse ServiceRegistrationUpsertRPCMethod = "ServiceRegistration.Upsert" // ServiceRegistrationDeleteByIDRPCMethod is the RPC method for deleting // a service registration by its ID. // // Args: ServiceRegistrationDeleteByIDRequest // Reply: ServiceRegistrationDeleteByIDResponse ServiceRegistrationDeleteByIDRPCMethod = "ServiceRegistration.DeleteByID" // ServiceRegistrationListRPCMethod is the RPC method for listing service // registrations within Nomad. // // Args: ServiceRegistrationListRequest // Reply: ServiceRegistrationListResponse ServiceRegistrationListRPCMethod = "ServiceRegistration.List" // ServiceRegistrationGetServiceRPCMethod is the RPC method for detailing a // service and its registrations according to its name. // // Args: ServiceRegistrationByNameRequest // Reply: ServiceRegistrationByNameResponse ServiceRegistrationGetServiceRPCMethod = "ServiceRegistration.GetService" )
const ( EnvoyBootstrapPath = "${NOMAD_SECRETS_DIR}/envoy_bootstrap.json" ServiceCheckHTTP = "http" ServiceCheckTCP = "tcp" ServiceCheckScript = "script" ServiceCheckGRPC = "grpc" OnUpdateRequireHealthy = "require_healthy" OnUpdateIgnoreWarn = "ignore_warnings" OnUpdateIgnore = "ignore" )
const ( AddressModeAuto = "auto" AddressModeHost = "host" AddressModeDriver = "driver" AddressModeAlloc = "alloc" // ServiceProviderConsul is the default service provider and the way Nomad // worked before native service discovery. ServiceProviderConsul = "consul" // ServiceProviderNomad is the native service discovery provider. At the // time of writing, there are a number of restrictions around its // functionality and use. ServiceProviderNomad = "nomad" )
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 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 // // Also defined in acl/acl.go to avoid circular dependencies. If modified // it should be updated there as well. 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 )
const ( NodeEventSubsystemDrain = "Drain" NodeEventSubsystemDriver = "Driver" NodeEventSubsystemHeartbeat = "Heartbeat" NodeEventSubsystemCluster = "Cluster" NodeEventSubsystemScheduler = "Scheduler" NodeEventSubsystemStorage = "Storage" )
const ( NodeStatusInit = "initializing" NodeStatusReady = "ready" NodeStatusDown = "down" NodeStatusDisconnected = "disconnected" )
const ( // NodeSchedulingEligible and Ineligible marks the node as eligible or not, // respectively, for receiving allocations. This is orthogonal to the node // status being ready. NodeSchedulingEligible = "eligible" NodeSchedulingIneligible = "ineligible" )
const ( // JobTypeCore is reserved for internal system tasks and is // always handled by the CoreScheduler. JobTypeCore = "_core" JobTypeService = "service" JobTypeBatch = "batch" JobTypeSystem = "system" JobTypeSysBatch = "sysbatch" )
const ( JobStatusPending = "pending" // Pending means the job is waiting on scheduling JobStatusRunning = "running" // Running means the job has non-terminal allocations JobStatusDead = "dead" // Dead means all evaluation's and allocations are terminal )
const ( // JobMinPriority is the minimum allowed priority JobMinPriority = 1 // JobDefaultPriority is the default priority if not // not specified. JobDefaultPriority = 50 // JobMaxPriority is the maximum allowed priority JobMaxPriority = 100 // CoreJobPriority should be 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 )
const ( // Checks uses any registered health check state in combination with task // states to determine if an 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" )
const ( // PeriodicSpecCron is used for a cron spec. PeriodicSpecCron = "cron" // PeriodicSpecTest is only used by unit tests. It is a sorted, comma // separated list of unix timestamps at which to launch. PeriodicSpecTest = "_internal_test" )
const ( DispatchPayloadForbidden = "forbidden" DispatchPayloadOptional = "optional" DispatchPayloadRequired = "required" // DispatchLaunchSuffix is the string appended to the parameterized job's ID // when dispatching instances of it. DispatchLaunchSuffix = "/dispatch-" )
const ( TaskLifecycleHookPrestart = "prestart" TaskLifecycleHookPoststart = "poststart" TaskLifecycleHookPoststop = "poststop" )
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" )
const ( ScalingTargetNamespace = "Namespace" ScalingTargetJob = "Job" ScalingTargetGroup = "Group" ScalingTargetTask = "Task" ScalingPolicyTypeHorizontal = "horizontal" )
const ( MigrateStrategyHealthChecks = "checks" MigrateStrategyHealthStates = "task_states" )
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" )
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" // TemplateChangeModeScript marks that the task should trigger a script if // the template is re-rendered TemplateChangeModeScript = "script" )
const ( TaskStatePending = "pending" // The task is waiting to be run. TaskStateRunning = "running" // The task is currently running. TaskStateDead = "dead" // Terminal state of task. )
Set of possible states for a task.
const ( // TaskSetupFailure indicates that the task could not be started due to a // a setup failure. TaskSetupFailure = "Setup Failure" // TaskDriveFailure indicates that the task could not be started due to a // failure in the driver. TaskDriverFailure 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 signaled 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" // TaskHookMessage indicates that one of the hooks for a task emitted a // message. TaskHookMessage = "Task hook message" // 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" // TaskClientReconnected indicates that the client running the task disconnected. TaskClientReconnected = "Reconnected" )
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" )
const ( // VaultChangeModeNoop takes no action when a new token is retrieved. VaultChangeModeNoop = "noop" // VaultChangeModeSignal signals the task when a new token is retrieved. VaultChangeModeSignal = "signal" // VaultChangeModeRestart restarts the task when a new token is retrieved. VaultChangeModeRestart = "restart" )
const ( // DeploymentStatuses are the various states a deployment can be be in DeploymentStatusRunning = "running" DeploymentStatusPaused = "paused" DeploymentStatusFailed = "failed" DeploymentStatusSuccessful = "successful" DeploymentStatusCancelled = "cancelled" DeploymentStatusInitializing = "initializing" 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" )
const ( AllocDesiredStatusRun = "run" // Allocation should run AllocDesiredStatusStop = "stop" // Allocation should stop AllocDesiredStatusEvict = "evict" // Allocation should stop, and was evicted )
const ( AllocClientStatusPending = "pending" AllocClientStatusRunning = "running" AllocClientStatusComplete = "complete" AllocClientStatusFailed = "failed" AllocClientStatusLost = "lost" AllocClientStatusUnknown = "unknown" )
const ( EvalStatusBlocked = "blocked" EvalStatusPending = "pending" EvalStatusComplete = "complete" EvalStatusFailed = "failed" EvalStatusCancelled = "canceled" )
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" EvalTriggerMaxDisconnectTimeout = "max-disconnect-timeout" EvalTriggerReconnect = "reconnect" )
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" // CoreJobLocalTokenExpiredGC is used for the garbage collection of // expired local ACL tokens. We periodically scan for expired tokens and // delete them. CoreJobLocalTokenExpiredGC = "local-token-expired-gc" // CoreJobGlobalTokenExpiredGC is used for the garbage collection of // expired global ACL tokens. We periodically scan for expired tokens and // delete them. CoreJobGlobalTokenExpiredGC = "global-token-expired-gc" // CoreJobRootKeyRotateGC is used for periodic key rotation and // garbage collection of unused encryption keys. CoreJobRootKeyRotateOrGC = "root-key-rotate-gc" // CoreJobVariablesRekey is used to fully rotate the encryption keys for // variables by decrypting all variables and re-encrypting them with the // active key CoreJobVariablesRekey = "variables-rekey" // CoreJobForceGC is used to force garbage collection of all GCable objects. CoreJobForceGC = "force-gc" )
const ( // VariablesApplyRPCMethod is the RPC method for upserting or deleting a // variable by its namespace and path, with optional conflict detection. // // Args: VariablesApplyRequest // Reply: VariablesApplyResponse VariablesApplyRPCMethod = "Variables.Apply" // VariablesListRPCMethod is the RPC method for listing variables within // Nomad. // // Args: VariablesListRequest // Reply: VariablesListResponse VariablesListRPCMethod = "Variables.List" // VariablesGetServiceRPCMethod is the RPC method for fetching a variable // according to its namepace and path. // // Args: VariablesByNameRequest // Reply: VariablesByNameResponse VariablesReadRPCMethod = "Variables.Read" )
const ( VolumeMountPropagationPrivate = "private" VolumeMountPropagationHostToTask = "host-to-task" VolumeMountPropagationBidirectional = "bidirectional" )
const ( // ACLMaxExpiredBatchSize is the maximum number of expired ACL tokens that // will be garbage collected in a single trigger. This number helps limit // the replication pressure due to expired token deletion. If there are a // large number of expired tokens pending garbage collection, this value is // a potential limiting factor. ACLMaxExpiredBatchSize = 4096 )
const ( // AllocServiceRegistrationsRPCMethod is the RPC method for listing all // service registrations assigned to a specific allocation. // // Args: AllocServiceRegistrationsRequest // Reply: AllocServiceRegistrationsResponse AllocServiceRegistrationsRPCMethod = "Alloc.GetServiceRegistrations" )
const (
BytesInMegabyte = 1024 * 1024
)
const CSIIntermediaryDirname = "volumes"
CSIIntermediaryDirname is the name of the directory inside the PluginMountDir where Nomad will expect plugins to create intermediary mounts for volumes.
const CSISocketName = "csi.sock"
CSISocketName is the filename that Nomad expects plugins to create inside the PluginMountDir.
const ( // DefaultKillTimeout is the default timeout between signaling a task it // will be killed and killing it. DefaultKillTimeout = 5 * time.Second )
const ( // EvalDeleteRPCMethod is the RPC method for batch deleting evaluations // using their IDs. // // Args: EvalDeleteRequest // Reply: EvalDeleteResponse EvalDeleteRPCMethod = "Eval.Delete" )
const ( // JobServiceRegistrationsRPCMethod is the RPC method for listing all // service registrations assigned to a specific namespaced job. // // Args: JobServiceRegistrationsRequest // Reply: JobServiceRegistrationsResponse JobServiceRegistrationsRPCMethod = "Job.GetServiceRegistrations" )
const MaxUUIDsPerWriteRequest = 7281 // (1024 * 256) / 36
MaxUUIDsPerWriteRequest is the maximum number of UUIDs that can be included within a single write request. This is to ensure that the Raft message does not become too large. The resulting value corresponds to 0.25MB of IDs or 7281 UUID strings.
const ( // NodeUniqueNamespace is a prefix that can be appended to node meta or // attribute keys to mark them for exclusion in computed node class. NodeUniqueNamespace = "unique." )
const ( // PeriodicLaunchSuffix is the string appended to the periodic jobs ID // when launching derived instances of it. PeriodicLaunchSuffix = "/periodic-" )
const ReschedulePolicyMinDelay = 5 * time.Second
const ReschedulePolicyMinInterval = 15 * time.Second
const VolumeTypeCSI = "csi"
VolumeTypeCSI is the type in the volume block of a TaskGroup
const (
VolumeTypeHost = "host"
)
Variables ¶
var ( ErrNoLeader = errors.New(errNoLeader) ErrNotReadyForConsistentReads = errors.New(errNotReadyForConsistentReads) ErrNoRegionPath = errors.New(errNoRegionPath) ErrTokenNotFound = errors.New(errTokenNotFound) ErrTokenExpired = errors.New(errTokenExpired) ErrPermissionDenied = errors.New(errPermissionDenied) ErrJobRegistrationDisabled = errors.New(errJobRegistrationDisabled) ErrNoNodeConn = errors.New(errNoNodeConn) ErrUnknownMethod = errors.New(errUnknownMethod) ErrUnknownNomadVersion = errors.New(errUnknownNomadVersion) ErrNodeLacksRpc = errors.New(errNodeLacksRpc) ErrMissingAllocID = errors.New(errMissingAllocID) ErrIncompatibleFiltering = errors.New(errIncompatibleFiltering) ErrMalformedChooseParameter = errors.New(errMalformedChooseParameter) 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)") ErrCSIVolumeMaxClaims = errors.New("volume max claims reached") ErrCSIVolumeUnschedulable = errors.New("volume is currently unschedulable") )
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, }) )
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, } )
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", } )
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, } )
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, } )
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
var RescheduleDelayFunctions = [...]string{"constant", "exponential", "fibonacci"}
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, script, restart") )
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
ACLPolicyListHash returns a consistent hash for a set of policies.
func AllocSubset ¶ added in v1.1.13
func AllocSubset(allocs []*Allocation, subset []*Allocation) bool
func AllocSuffix ¶ added in v1.1.0
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
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
CompareMigrateToken returns true if two migration tokens can be computed and are equal.
func CompileACLObject ¶ added in v0.7.0
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 DecodeVaultSecretData ¶ added in v1.3.0
DecodeVaultSecretData decodes a Vault sercret Data map into a struct.
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
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
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
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
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
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
IsErrNoLeader returns whether the error is due to there being no leader.
func IsErrNoNodeConn ¶ added in v0.8.0
IsErrNoNodeConn returns whether the error is due to there being no path to the given node.
func IsErrNoRegionPath ¶ added in v0.8.0
IsErrNoRegionPath returns whether the error is due to there being no path to the given region.
func IsErrNoSuchFileOrDirectory ¶ added in v1.2.4
func IsErrNodeLacksRpc ¶ added in v0.8.0
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
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 IsErrTokenNotFound ¶ added in v0.8.0
IsErrTokenNotFound returns whether the error is due to the passed token not being resolvable.
func IsErrUnknownAllocation ¶ added in v0.8.0
IsErrUnknownAllocation returns whether the error is due to an unknown allocation.
func IsErrUnknownDeployment ¶ added in v0.8.0
IsErrUnknownDeployment returns whether the error is due to an unknown deployment.
func IsErrUnknownEvaluation ¶ added in v0.8.0
IsErrUnknownEvaluation returns whether the error is due to an unknown evaluation.
func IsErrUnknownJob ¶ added in v0.8.0
IsErrUnknownJob returns whether the error is due to an unknown job.
func IsErrUnknownMethod ¶ added in v0.8.0
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
IsErrUnknownNode returns whether the error is due to an unknown node.
func IsErrUnknownNomadVersion ¶ added in v0.8.0
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
IsRecoverable returns true if error is a RecoverableError with Recoverable=true. Otherwise false is returned.
func IsServerSide ¶ added in v0.8.0
IsServerSide returns true if error is a wrapped server side error
func IsUniqueNamespace ¶ added in v0.3.0
IsUniqueNamespace returns whether the key is under the unique namespace.
func MergeMultierrorWarnings ¶ added in v0.6.0
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 NewErrRPCCoded ¶ added in v0.10.2
NewErrRPCCoded wraps an RPC error with a code to be converted to HTTP status code
func NewErrRPCCodedf ¶ added in v0.10.2
NewErrRPCCodedf wraps an RPC error with a code to be converted to HTTP status code.
func NewErrUnknownAllocation ¶ added in v0.8.0
NewErrUnknownAllocation returns a new error caused by the allocation being unknown.
func NewErrUnknownDeployment ¶ added in v0.8.0
NewErrUnknownDeployment returns a new error caused by the deployment being unknown.
func NewErrUnknownEvaluation ¶ added in v0.8.0
NewErrUnknownEvaluation returns a new error caused by the evaluation being unknown.
func NewErrUnknownJob ¶ added in v0.8.0
NewErrUnknownJob returns a new error caused by the job being unknown.
func NewErrUnknownNode ¶ added in v0.8.0
NewErrUnknownNode returns a new error caused by the node being unknown.
func NewRecoverableError ¶ added in v0.5.0
NewRecoverableError is used to wrap an error and mark it as recoverable or not.
func NewWrappedServerError ¶ added in v0.8.0
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
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 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 ¶
ShouldDrainNode checks if a given node status should trigger an evaluation. Some states don't require any further action.
func SplitTerminalAllocs ¶ added in v1.2.0
func SplitTerminalAllocs(allocs []*Allocation) ([]*Allocation, TerminalByNodeByName)
SplitTerminalAllocs splits allocs into non-terminal and terminal allocs, with the terminal allocs indexed by node->alloc.name.
func UniqueNamespace ¶ added in v0.3.0
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
ValidCSIVolumeWriteAccessMode checks for a writable access mode.
func ValidNodeStatus ¶
ValidNodeStatus is used to check if a node status is valid
func ValidateConnectProxyService ¶ added in v0.10.0
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
VaultNamespaceSet takes the structure returned by VaultPolicies and returns a set of required namespaces
func VaultPoliciesSet ¶ added in v0.5.0
VaultPoliciesSet takes the structure returned by VaultPolicies and returns the set of required policies
func WrapRecoverable ¶ added in v0.5.6
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 JobACL *JobACL Hash []byte CreateIndex uint64 ModifyIndex uint64 }
ACLPolicy is used to represent an ACL policy
func (*ACLPolicy) SetHash ¶ added in v0.7.0
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
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
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 ACLRole ¶ added in v1.4.0
type ACLRole struct { // ID is an internally generated UUID for this role and is controlled by // Nomad. ID string // Name is unique across the entire set of federated clusters and is // supplied by the operator on role creation. The name can be modified by // updating the role and including the Nomad generated ID. This update will // not affect tokens created and linked to this role. This is a required // field. Name string // Description is a human-readable, operator set description that can // provide additional context about the role. This is an operational field. Description string // Policies is an array of ACL policy links. Although currently policies // can only be linked using their name, in the future we will want to add // IDs also and thus allow operators to specify either a name, an ID, or // both. Policies []*ACLRolePolicyLink // Hash is the hashed value of the role and is generated using all fields // above this point. Hash []byte CreateIndex uint64 ModifyIndex uint64 }
ACLRole is an abstraction for the ACL system which allows the grouping of ACL policies into a single object. ACL tokens can be created and linked to a role; the token then inherits all the permissions granted by the policies.
func (*ACLRole) Canonicalize ¶ added in v1.4.0
func (a *ACLRole) Canonicalize()
Canonicalize performs basic canonicalization on the ACL role object. It is important for callers to understand certain fields such as ID are set if it is empty, so copies should be taken if needed before calling this function.
func (*ACLRole) Copy ¶ added in v1.4.0
Copy creates a deep copy of the ACL role. This copy can then be safely modified. It handles nil objects.
func (*ACLRole) Equals ¶ added in v1.4.0
Equals performs an equality check on the two service registrations. It handles nil objects.
func (*ACLRole) SetHash ¶ added in v1.4.0
SetHash is used to compute and set the hash of the ACL role. This should be called every and each time a user specified field on the role is changed before updating the Nomad state store.
func (*ACLRole) Stub ¶ added in v1.4.0
func (a *ACLRole) Stub() *ACLRoleListStub
Stub converts the ACLRole object into a ACLRoleListStub object.
type ACLRoleByIDRequest ¶ added in v1.4.0
type ACLRoleByIDRequest struct { RoleID string QueryOptions }
ACLRoleByIDRequest is the request object to perform a lookup of an ACL role using a specific ID.
type ACLRoleByIDResponse ¶ added in v1.4.0
ACLRoleByIDResponse is the response object when performing a lookup of an ACL role matching a specific ID.
type ACLRoleByNameRequest ¶ added in v1.4.0
type ACLRoleByNameRequest struct { RoleName string QueryOptions }
ACLRoleByNameRequest is the request object to perform a lookup of an ACL role using a specific name.
type ACLRoleByNameResponse ¶ added in v1.4.0
ACLRoleByNameResponse is the response object when performing a lookup of an ACL role matching a specific name.
type ACLRoleListStub ¶ added in v1.4.0
type ACLRoleListStub struct { // ID is an internally generated UUID for this role and is controlled by // Nomad. ID string // Name is unique across the entire set of federated clusters and is // supplied by the operator on role creation. The name can be modified by // updating the role and including the Nomad generated ID. This update will // not affect tokens created and linked to this role. This is a required // field. Name string // Description is a human-readable, operator set description that can // provide additional context about the role. This is an operational field. Description string // Policies is an array of ACL policy links. Although currently policies // can only be linked using their name, in the future we will want to add // IDs also and thus allow operators to specify either a name, an ID, or // both. Policies []*ACLRolePolicyLink // Hash is the hashed value of the role and is generated using all fields // above this point. Hash []byte CreateIndex uint64 ModifyIndex uint64 }
ACLRoleListStub is the stub object returned when performing a listing of ACL roles. While it might not currently be different to the full response object, it allows us to future-proof the RPC in the event the ACLRole object grows over time.
type ACLRolePolicyLink ¶ added in v1.4.0
type ACLRolePolicyLink struct { // Name is the ACLPolicy.Name value which will be linked to the ACL role. Name string }
ACLRolePolicyLink is used to link a policy to an ACL role. We use a struct rather than a list of strings as in the future we will want to add IDs to policies and then link via these.
type ACLRoleStreamEvent ¶ added in v1.4.2
type ACLRoleStreamEvent struct {
ACLRole *ACLRole
}
ACLRoleStreamEvent holds a newly updated or delete ACL role to be used as an event within the event stream.
type ACLRolesByIDRequest ¶ added in v1.4.0
type ACLRolesByIDRequest struct { ACLRoleIDs []string QueryOptions }
ACLRolesByIDRequest is the request object when performing a lookup of multiple roles by the ID.
type ACLRolesByIDResponse ¶ added in v1.4.0
ACLRolesByIDResponse is the response object when performing a lookup of multiple roles by their IDs.
type ACLRolesDeleteByIDRequest ¶ added in v1.4.0
type ACLRolesDeleteByIDRequest struct { ACLRoleIDs []string WriteRequest }
ACLRolesDeleteByIDRequest is the request object to delete one or more ACL roles using the role ID.
type ACLRolesDeleteByIDResponse ¶ added in v1.4.0
type ACLRolesDeleteByIDResponse struct {
WriteMeta
}
ACLRolesDeleteByIDResponse is the response object when performing a deletion of one or more ACL roles using the role ID.
type ACLRolesListRequest ¶ added in v1.4.0
type ACLRolesListRequest struct {
QueryOptions
}
ACLRolesListRequest is the request object when performing ACL role listings.
type ACLRolesListResponse ¶ added in v1.4.0
type ACLRolesListResponse struct { ACLRoles []*ACLRoleListStub QueryMeta }
ACLRolesListResponse is the response object when performing ACL role listings.
type ACLRolesUpsertRequest ¶ added in v1.4.0
type ACLRolesUpsertRequest struct { ACLRoles []*ACLRole // AllowMissingPolicies skips the ACL Role policy link verification and is // used by the replication process. The replication cannot ensure policies // are present before ACL Roles are replicated. AllowMissingPolicies bool WriteRequest }
ACLRolesUpsertRequest is the request object used to upsert one or more ACL roles.
type ACLRolesUpsertResponse ¶ added in v1.4.0
ACLRolesUpsertResponse is the response object when one or more ACL roles have been successfully upserted into state.
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 // Roles represents the ACL roles that this token is tied to. The token // will inherit the permissions of all policies detailed within the role. Roles []*ACLTokenRoleLink Global bool // Global or Region local Hash []byte CreateTime time.Time // Time of creation // ExpirationTime represents the point after which a token should be // considered revoked and is eligible for destruction. This time should // always use UTC to account for multi-region global tokens. It is a // pointer, so we can store nil, rather than the zero value of time.Time. ExpirationTime *time.Time // ExpirationTTL is a convenience field for helping set ExpirationTime to a // value of CreateTime+ExpirationTTL. This can only be set during token // creation. This is a string version of a time.Duration like "2m". ExpirationTTL time.Duration CreateIndex uint64 ModifyIndex uint64 }
ACLToken represents a client token which is used to Authenticate
func (*ACLToken) Canonicalize ¶ added in v1.4.0
func (a *ACLToken) Canonicalize()
Canonicalize performs basic canonicalization on the ACL token object. It is important for callers to understand certain fields such as AccessorID are set if it is empty, so copies should be taken if needed before calling this function.
func (*ACLToken) GetCreateIndex ¶ added in v1.3.0
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*ACLToken) GetID ¶ added in v1.3.0
GetID implements the IDGetter interface, required for pagination.
func (*ACLToken) HasExpirationTime ¶ added in v1.4.0
HasExpirationTime checks whether the ACL token has an expiration time value set.
func (*ACLToken) HasRoles ¶ added in v1.4.2
HasRoles checks if a given set of role IDs are assigned to the ACL token. It does not account for management tokens, therefore it is the responsibility of the caller to perform this check, if required.
func (*ACLToken) IsExpired ¶ added in v1.4.0
IsExpired compares the ACLToken.ExpirationTime against the passed t to identify whether the token is considered expired. The function can be called without checking whether the ACL token has an expiry time.
func (*ACLToken) MarshalJSON ¶ added in v1.4.5
MarshalJSON implements the json.Marshaler interface and allows ACLToken.ExpirationTTL to be marshaled correctly.
func (*ACLToken) SetHash ¶ added in v0.7.0
SetHash is used to compute and set the hash of the ACL token. It only hashes fields which can be updated, and as such, does not hash fields such as ExpirationTime.
func (*ACLToken) Stub ¶ added in v0.7.0
func (a *ACLToken) Stub() *ACLTokenListStub
func (*ACLToken) UnmarshalJSON ¶ added in v1.4.5
UnmarshalJSON implements the json.Unmarshaler interface and allows ACLToken.ExpirationTTL to be unmarshalled correctly.
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 BootstrapSecret string 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 ACLTokenRoleLink ¶ added in v1.4.0
type ACLTokenRoleLink struct { // ID is the ACLRole.ID UUID. This field is immutable and represents the // absolute truth for the link. ID string // Name is the human friendly identifier for the ACL role and is a // convenience field for operators. This field is always resolved to the // ID and discarded before the token is stored in state. This is because // operators can change the name of an ACL role. Name string }
ACLTokenRoleLink is used to link an ACL token to an ACL role. The ACL token can therefore inherit all the ACL policy permissions that the ACL role contains.
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
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
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
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 (a *AllocDeploymentStatus) Copy() *AllocDeploymentStatus
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 AllocInfo ¶ added in v1.4.0
type AllocInfo struct { AllocID string // Group in which the service belongs for a group-level service, or the // group in which task belongs for a task-level service. Group string // Task in which the service belongs for task-level service. Will be empty // for a group-level service. Task string // JobID provides additional context for providers regarding which job // caused this registration. JobID string // NomadNamespace provides additional context for providers regarding which // nomad namespace caused this registration. Namespace string }
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()
SetEventDisplayMessages 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) MaxNormScore ¶ added in v1.3.0
func (a *AllocMetric) MaxNormScore() *NodeScoreMeta
MaxNormScore returns the ScoreMetaData entry with the highest normalized score.
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
type AllocNetworkStatus ¶ added in v1.0.0
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
func (a *AllocNetworkStatus) Copy() *AllocNetworkStatus
type AllocRestartRequest ¶ added in v0.9.2
type AllocRestartRequest struct { AllocID string TaskName string AllTasks bool QueryOptions }
AllocRestartRequest is used to restart a specific allocations tasks.
type AllocServiceRegistrationsRequest ¶ added in v1.3.0
type AllocServiceRegistrationsRequest struct { AllocID string QueryOptions }
AllocServiceRegistrationsRequest is the request object used to list all service registrations belonging to the specified Allocation.ID.
type AllocServiceRegistrationsResponse ¶ added in v1.3.0
type AllocServiceRegistrationsResponse struct { Services []*ServiceRegistration QueryMeta }
AllocServiceRegistrationsResponse is the response object when performing a listing of services belonging to an allocation.
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
AllocStateField 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 NoShutdownDelay bool 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 { ReservedCores []uint16 }
AllocatedCpuResources captures the allocated CPU resources.
func (*AllocatedCpuResources) Add ¶ added in v0.9.0
func (a *AllocatedCpuResources) Add(delta *AllocatedCpuResources)
func (*AllocatedCpuResources) Max ¶ added in v0.11.0
func (a *AllocatedCpuResources) Max(other *AllocatedCpuResources)
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 (a *AllocatedDeviceResource) Add(delta *AllocatedDeviceResource)
func (*AllocatedDeviceResource) Copy ¶ added in v0.9.0
func (a *AllocatedDeviceResource) Copy() *AllocatedDeviceResource
func (*AllocatedDeviceResource) ID ¶ added in v0.9.0
func (a *AllocatedDeviceResource) ID() *DeviceIdTuple
type AllocatedDevices ¶ added in v0.9.0
type AllocatedDevices []*AllocatedDeviceResource
func (AllocatedDevices) Index ¶ added in v0.9.0
func (a AllocatedDevices) Index(d *AllocatedDeviceResource) int
Index finds the matching index using the passed device. If not found, -1 is returned.
type AllocatedMemoryResources ¶ added in v0.9.0
AllocatedMemoryResources captures the allocated memory resources.
func (*AllocatedMemoryResources) Add ¶ added in v0.9.0
func (a *AllocatedMemoryResources) Add(delta *AllocatedMemoryResources)
func (*AllocatedMemoryResources) Max ¶ added in v0.11.0
func (a *AllocatedMemoryResources) Max(other *AllocatedMemoryResources)
func (*AllocatedMemoryResources) Subtract ¶ added in v0.9.0
func (a *AllocatedMemoryResources) Subtract(delta *AllocatedMemoryResources)
type AllocatedPortMapping ¶ added in v0.12.0
type AllocatedPorts ¶ added in v0.12.0
type AllocatedPorts []AllocatedPortMapping
func (AllocatedPorts) Get ¶ added in v0.12.0
func (p AllocatedPorts) Get(label string) (AllocatedPortMapping, bool)
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 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 (a *AllocatedResources) Copy() *AllocatedResources
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 {}
AllocatedSharedResources are the set of resources allocated to a task group.
func (*AllocatedSharedResources) Add ¶ added in v0.9.0
func (a *AllocatedSharedResources) Add(delta *AllocatedSharedResources)
func (*AllocatedSharedResources) Canonicalize ¶ added in v0.12.4
func (a *AllocatedSharedResources) Canonicalize()
func (AllocatedSharedResources) Copy ¶ added in v0.10.0
func (a AllocatedSharedResources) Copy() AllocatedSharedResources
func (*AllocatedSharedResources) Subtract ¶ added in v0.9.0
func (a *AllocatedSharedResources) Subtract(delta *AllocatedSharedResources)
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 (a *AllocatedTaskResources) Add(delta *AllocatedTaskResources)
func (*AllocatedTaskResources) Comparable ¶ added in v0.9.0
func (a *AllocatedTaskResources) Comparable() *ComparableResources
Comparable turns AllocatedTaskResources into ComparableResources as a helper step in preemption
func (*AllocatedTaskResources) Copy ¶ added in v0.9.0
func (a *AllocatedTaskResources) Copy() *AllocatedTaskResources
func (*AllocatedTaskResources) Max ¶ added in v0.11.0
func (a *AllocatedTaskResources) Max(other *AllocatedTaskResources)
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 // 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 // SignedIdentities is a map of task names to signed identity/capability // claim tokens for those tasks. If needed, it is populated in the plan // applier. SignedIdentities map[string]string `json:"-"` // SigningKeyID is the key used to sign the SignedIdentities field. SigningKeyID 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(allocs []*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
ComparableResources returns the resources on the allocation handling upgrade paths. After 0.11 calls to this should be replaced with: alloc.AllocatedResources.Comparable()
COMPAT(0.11): Remove in 0.11
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) DisconnectTimeout ¶ added in v1.3.0
func (a *Allocation) DisconnectTimeout(now time.Time) time.Time
DisconnectTimeout uses the MaxClientDisconnect to compute when the allocation should transition to lost.
func (*Allocation) Expired ¶ added in v1.3.0
func (a *Allocation) Expired(now time.Time) bool
Expired determines whether an allocation has exceeded its MaxClientDisonnect duration relative to the passed time stamp.
func (*Allocation) GetCreateIndex ¶ added in v1.3.0
func (a *Allocation) GetCreateIndex() uint64
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*Allocation) GetID ¶ added in v1.3.0
func (a *Allocation) GetID() string
GetID implements the IDGetter interface, required for pagination.
func (*Allocation) GetNamespace ¶ added in v1.3.0
func (a *Allocation) GetNamespace() string
GetNamespace implements the NamespaceGetter interface, required for pagination and filtering namespaces in endpoints that support glob namespace requests using tokens with limited access.
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) LastUnknown ¶ added in v1.3.0
func (a *Allocation) LastUnknown() time.Time
LastUnknown returns the timestamp for the last time the allocation transitioned into the unknown client status.
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) NeedsToReconnect ¶ added in v1.3.8
func (a *Allocation) NeedsToReconnect() bool
NeedsToReconnect returns true if the last known ClientStatus value is "unknown" and so the allocation did not reconnect yet.
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) NextRescheduleTimeByFailTime ¶ added in v1.3.0
NextRescheduleTimeByFailTime works like NextRescheduleTime but allows callers specify a failure time. Useful for things like determining whether to reschedule an alloc on a disconnected node.
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) RescheduleInfo ¶ added in v1.2.4
func (a *Allocation) RescheduleInfo() (int, int)
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) ServiceProviderNamespace ¶ added in v1.3.0
func (a *Allocation) ServiceProviderNamespace() string
ServiceProviderNamespace returns the namespace within which the allocations services should be registered. This takes into account the different providers that can provide service registrations. In the event no services are found, the function will return the Consul namespace which allows hooks to work as they did before this feature.
It currently assumes that all services within an allocation use the same provider and therefore the same namespace.
func (*Allocation) SetEventDisplayMessages ¶ added in v0.7.1
func (a *Allocation) SetEventDisplayMessages()
SetEventDisplayMessages 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)
SetStop 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) SupportsDisconnectedClients ¶ added in v1.3.0
func (a *Allocation) SupportsDisconnectedClients(serverSupportsDisconnectedClients bool) bool
SupportsDisconnectedClients determines whether both the server and the task group are configured to allow the allocation to reconnect after network connectivity has been lost and then restored.
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) ToIdentityClaims ¶ added in v1.4.0
func (a *Allocation) ToIdentityClaims(job *Job) *IdentityClaims
func (*Allocation) ToTaskIdentityClaims ¶ added in v1.4.0
func (a *Allocation) ToTaskIdentityClaims(job *Job, taskName string) *IdentityClaims
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 // IneligibleNodes are nodes the plan applier has repeatedly rejected // placements for and should therefore be considered ineligible by workers // to avoid retrying them repeatedly. IneligibleNodes []string // UpdatedAt represents server time of receiving request. UpdatedAt int64 }
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.
func (*AutopilotConfig) Copy ¶ added in v1.2.13
func (a *AutopilotConfig) Copy() *AutopilotConfig
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 (Bitmap) Clear ¶ added in v0.3.0
func (b Bitmap) Clear()
Clear is used to efficiently clear the bitmap
func (Bitmap) IndexesInRange ¶ added in v0.4.1
IndexesInRange returns the indexes in which the values are either set or unset based on the passed parameter in the passed range
func (Bitmap) IndexesInRangeFiltered ¶ added in v1.3.11
IndexesInRangeFiltered returns the indexes in which the values are either set or unset based on the passed parameter in the passed range, and do not appear in the filter slice
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
func (c *CSIControllerInfo) Copy() *CSIControllerInfo
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) IsController ¶ added in v0.11.0
func (*CSIInfo) SetHealthy ¶ added in v0.11.0
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) Equal ¶ added in v1.3.0
func (o *CSIMountOptions) Equal(p *CSIMountOptions) bool
func (*CSIMountOptions) GoString ¶ added in v0.11.0
func (o *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 (o *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
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
AddPlugin adds a single plugin running on the node. Called from state.NodeUpdate in a transaction
func (*CSIPlugin) DeleteAlloc ¶ added in v0.11.0
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
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) 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 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 CSIPluginType ¶ added in v0.11.0
type CSIPluginType string
CSIPluginType is an enum string that encapsulates the valid options for a CSIPlugin block'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
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
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
func (*CSITopology) MatchFound ¶ added in v1.3.0
func (t *CSITopology) MatchFound(o []*CSITopology) bool
type CSITopologyRequest ¶ added in v1.3.0
type CSITopologyRequest struct { Required []*CSITopology Preferred []*CSITopology }
CSITopologyRequest are the topologies submitted as options to the storage provider at the time the volume was created. The storage provider will return a single topology.
func (*CSITopologyRequest) Equal ¶ added in v1.3.0
func (tr *CSITopologyRequest) Equal(o *CSITopologyRequest) 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 ControllerRequired bool ControllersHealthy int ControllersExpected int NodesHealthy int NodesExpected int ResourceExhausted time.Time 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 // RequestedTopologies are the topologies submitted as options to // the storage provider at the time the volume was created. After // volumes are created, this field is ignored. RequestedTopologies *CSITopologyRequest // Topologies are the topologies returned by the storage provider, // based on the RequestedTopologies and what the storage provider // could support. This value cannot be set by the user. 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 `json:"-"` // AllocID -> claim WriteClaims map[string]*CSIVolumeClaim `json:"-"` // AllocID -> claim PastClaims map[string]*CSIVolumeClaim `json:"-"` // 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
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
Copy returns a copy of the volume, which shares only the Topologies slice
func (*CSIVolume) GetCreateIndex ¶ added in v1.3.0
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*CSIVolume) GetID ¶ added in v1.3.0
GetID implements the IDGetter interface, required for pagination.
func (*CSIVolume) GetNamespace ¶ added in v1.3.0
GetNamespace implements the NamespaceGetter interface, required for pagination.
func (*CSIVolume) HasFreeReadClaims ¶ added in v1.1.13
HasFreeReadClaims determines if there are any free read claims available
func (*CSIVolume) HasFreeWriteClaims ¶ added in v1.1.13
HasFreeWriteClaims determines if there are any free write claims available
func (*CSIVolume) InUse ¶ added in v0.11.0
InUse tests whether any allocations are actively using the volume
func (*CSIVolume) Merge ¶ added in v1.3.0
Merge updates the mutable fields of a volume with those from another volume. CSIVolume has many user-defined fields which are immutable once set, and many fields that are not user-settable. Merge will return an error if we try to mutate the user-defined immutable fields after they're set, but silently ignore fields that are controlled by Nomad.
func (*CSIVolume) ReadSchedulable ¶ added in v0.11.0
ReadSchedulable determines if the volume is potentially schedulable for reads, considering only the volume capabilities and plugin health
func (*CSIVolume) Stub ¶ added in v0.11.0
func (v *CSIVolume) Stub() *CSIVolListStub
func (*CSIVolume) Validate ¶ added in v0.11.0
Validate validates the volume struct, returning all validation errors at once
func (*CSIVolume) WriteSchedulable ¶ added in v0.11.0
WriteSchedulable determines if the volume is potentially 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 CSIVolumeDeleteRequest ¶ added in v1.1.0
type CSIVolumeDeleteRequest struct { VolumeIDs []string Secrets CSISecrets 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 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 ChangeScript ¶ added in v1.3.4
type ChangeScript struct { // Command is the full path to the script Command string // Args is a slice of arguments passed to the script Args []string // Timeout is the amount of seconds we wait for the script to finish Timeout time.Duration // FailOnError indicates whether a task should fail in case script execution // fails or log script failure and don't interrupt the task FailOnError bool }
ChangeScript holds the configuration for the script that is executed if change mode is set to script
func (*ChangeScript) Copy ¶ added in v1.3.5
func (cs *ChangeScript) Copy() *ChangeScript
func (*ChangeScript) Validate ¶ added in v1.3.5
func (cs *ChangeScript) Validate() error
Validate makes sure all the required fields of ChangeScript are present
type CheckID ¶ added in v1.4.0
type CheckID string
An CheckID is unique to a check.
func NomadCheckID ¶ added in v1.4.0
func NomadCheckID(allocID, group string, c *ServiceCheck) CheckID
NomadCheckID returns an ID unique to the nomad service check.
Checks of group-level services have no task.
type CheckMode ¶ added in v1.4.0
type CheckMode string
The CheckMode of a Nomad check is either Healthiness or Readiness.
const ( // A Healthiness check is useful in the context of ensuring a service // is capable of performing its duties. This is an indicator that a check's // on_update configuration is set to "check_result", implying that Deployments // will not move forward while the check is failing. Healthiness CheckMode = "healthiness" // A Readiness check is useful in the context of ensuring a service // should be performing its duties (regardless of healthiness). This is an // indicator that the check's on_update configuration is set to "ignore", // implying that Deployments will move forward regardless if the check is // failing. Readiness CheckMode = "readiness" )
func GetCheckMode ¶ added in v1.4.0
func GetCheckMode(c *ServiceCheck) CheckMode
GetCheckMode determines whether the check is readiness or healthiness.
type CheckQueryResult ¶ added in v1.4.0
type CheckQueryResult struct { ID CheckID Mode CheckMode Status CheckStatus StatusCode int `json:",omitempty"` Output string Timestamp int64 // check coordinates Group string Task string `json:",omitempty"` Service string Check string }
A CheckQueryResult represents the outcome of a single execution of a Nomad service check. It records the result, the output, and when the execution took place. Advanced check math (e.g. success_before_passing) are left to the calling context.
func (*CheckQueryResult) String ¶ added in v1.4.0
func (r *CheckQueryResult) String() string
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 CheckStatus ¶ added in v1.4.0
type CheckStatus string
A CheckStatus is the result of executing a check. The status of a query is ternary - success, failure, or pending (not yet executed). Deployments treat pending and failure as the same - a deployment does not continue until a check is passing (unless on_update=ignore).
const ( CheckSuccess CheckStatus = "success" CheckFailure CheckStatus = "failure" CheckPending CheckStatus = "pending" )
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"` }
func (*ClientHostNetworkConfig) Copy ¶ added in v1.2.0
func (p *ClientHostNetworkConfig) Copy() *ClientHostNetworkConfig
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
func (p *ClientHostVolumeConfig) Copy() *ClientHostVolumeConfig
type ClusterMetadata ¶ added in v0.10.4
ClusterMetadata is used to store per-cluster metadata.
type ComparableResources ¶ added in v0.9.0
type ComparableResources struct { Flattened AllocatedTaskResources }
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 (c *ComparableResources) Add(delta *ComparableResources)
func (*ComparableResources) Copy ¶ added in v0.9.0
func (c *ComparableResources) Copy() *ComparableResources
func (*ComparableResources) NetIndex ¶ added in v0.9.0
func (c *ComparableResources) NetIndex(n *NetworkResource) int
NetIndex 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) GetNamespace ¶ added in v1.1.0
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 block.
func (*ConsulConnect) Copy ¶ added in v0.10.0
func (c *ConsulConnect) Copy() *ConsulConnect
Copy the block 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) IsCustomizedTLS ¶ added in v1.3.2
func (c *ConsulConnect) IsCustomizedTLS() bool
IsCustomizedTLS checks if the service customizes ingress tls config.
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 {
Paths []ConsulExposePath
}
ConsulExposeConfig represents a Consul Connect expose jobspec block.
func (*ConsulExposeConfig) Copy ¶ added in v0.11.0
func (e *ConsulExposeConfig) Copy() *ConsulExposeConfig
Copy the block. Returns nil if e is nil.
func (*ConsulExposeConfig) Equals ¶ added in v0.11.0
func (e *ConsulExposeConfig) Equals(o *ConsulExposeConfig) bool
Equals returns true if the structs are recursively equal.
type ConsulExposePath ¶ added in v0.11.0
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
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 (a *ConsulGatewayBindAddress) Copy() *ConsulGatewayBindAddress
func (*ConsulGatewayBindAddress) Equals ¶ added in v0.12.4
func (a *ConsulGatewayBindAddress) Equals(o *ConsulGatewayBindAddress) bool
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 (p *ConsulGatewayProxy) Copy() *ConsulGatewayProxy
func (*ConsulGatewayProxy) Equals ¶ added in v0.12.4
func (p *ConsulGatewayProxy) Equals(o *ConsulGatewayProxy) bool
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 TLSMinVersion string TLSMaxVersion string CipherSuites []string }
ConsulGatewayTLSConfig is used to configure TLS for a gateway.
func (*ConsulGatewayTLSConfig) Copy ¶ added in v0.12.4
func (c *ConsulGatewayTLSConfig) Copy() *ConsulGatewayTLSConfig
func (*ConsulGatewayTLSConfig) Equals ¶ added in v0.12.4
func (c *ConsulGatewayTLSConfig) Equals(o *ConsulGatewayTLSConfig) bool
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 (e *ConsulIngressConfigEntry) Copy() *ConsulIngressConfigEntry
func (*ConsulIngressConfigEntry) Equals ¶ added in v0.12.4
func (e *ConsulIngressConfigEntry) Equals(o *ConsulIngressConfigEntry) bool
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 (l *ConsulIngressListener) Copy() *ConsulIngressListener
func (*ConsulIngressListener) Equals ¶ added in v0.12.4
func (l *ConsulIngressListener) Equals(o *ConsulIngressListener) bool
func (*ConsulIngressListener) Validate ¶ added in v0.12.4
func (l *ConsulIngressListener) Validate() error
type ConsulIngressService ¶ added in v0.12.4
ConsulIngressService is used to configure a service fronted by the ingress gateway.
func (*ConsulIngressService) Copy ¶ added in v0.12.4
func (s *ConsulIngressService) Copy() *ConsulIngressService
func (*ConsulIngressService) Equals ¶ added in v0.12.4
func (s *ConsulIngressService) Equals(o *ConsulIngressService) bool
func (*ConsulIngressService) Validate ¶ added in v0.12.4
func (s *ConsulIngressService) Validate(protocol string) 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 (s *ConsulLinkedService) Copy() *ConsulLinkedService
func (*ConsulLinkedService) Equals ¶ added in v1.0.4
func (s *ConsulLinkedService) Equals(o *ConsulLinkedService) bool
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 (e *ConsulMeshConfigEntry) Copy() *ConsulMeshConfigEntry
func (*ConsulMeshConfigEntry) Equals ¶ added in v1.1.1
func (e *ConsulMeshConfigEntry) Equals(o *ConsulMeshConfigEntry) bool
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 (c *ConsulMeshGateway) Copy() ConsulMeshGateway
func (*ConsulMeshGateway) Equals ¶ added in v1.1.1
func (c *ConsulMeshGateway) Equals(o ConsulMeshGateway) bool
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 block to "open up" endpoints // used by task-group level service checks using HTTP or gRPC protocols. Expose *ConsulExposeConfig // 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 block.
func (*ConsulProxy) Copy ¶ added in v0.10.0
func (p *ConsulProxy) Copy() *ConsulProxy
Copy the block recursively. Returns nil if nil.
func (*ConsulProxy) Equals ¶ added in v0.10.0
func (p *ConsulProxy) Equals(o *ConsulProxy) bool
Equals returns true if the structs are recursively equal.
type ConsulSidecarService ¶ added in v0.10.0
type ConsulSidecarService struct { // Tags are optional service tags that get registered with the sidecar service // in Consul. If unset, the sidecar service inherits the parent service tags. Tags []string // Port is the service's port that the sidecar will connect to. May be // a port label or a literal port number. Port string // Proxy block defining the sidecar proxy configuration. Proxy *ConsulProxy // DisableDefaultTCPCheck, if true, instructs Nomad to avoid setting a // default TCP check for the sidecar service. DisableDefaultTCPCheck bool }
ConsulSidecarService represents a Consul Connect SidecarService jobspec block.
func (*ConsulSidecarService) Copy ¶ added in v0.10.0
func (s *ConsulSidecarService) Copy() *ConsulSidecarService
Copy the block recursively. Returns nil if nil.
func (*ConsulSidecarService) Equals ¶ added in v0.10.0
func (s *ConsulSidecarService) Equals(o *ConsulSidecarService) bool
Equals returns true if the structs are recursively equal.
func (*ConsulSidecarService) HasUpstreams ¶ added in v0.10.0
func (s *ConsulSidecarService) HasUpstreams() bool
HasUpstreams checks if the sidecar service has any upstreams configured
type ConsulTerminatingConfigEntry ¶ added in v1.0.4
type ConsulTerminatingConfigEntry struct {
Services []*ConsulLinkedService
}
func (*ConsulTerminatingConfigEntry) Copy ¶ added in v1.0.4
func (e *ConsulTerminatingConfigEntry) Copy() *ConsulTerminatingConfigEntry
func (*ConsulTerminatingConfigEntry) Equals ¶ added in v1.0.4
func (e *ConsulTerminatingConfigEntry) Equals(o *ConsulTerminatingConfigEntry) bool
func (*ConsulTerminatingConfigEntry) Validate ¶ added in v1.0.4
func (e *ConsulTerminatingConfigEntry) Validate() error
type ConsulUpstream ¶ added in v0.10.0
type ConsulUpstream struct { // DestinationName is the name of the upstream service. DestinationName string // DestinationNamespace is the namespace of the upstream service. DestinationNamespace string // LocalBindPort is the port the proxy will receive connections for the // upstream on. LocalBindPort int // Datacenter is the datacenter in which to issue the discovery query to. Datacenter string // LocalBindAddress is the address the proxy will receive connections for the // upstream on. LocalBindAddress string // MeshGateway is the optional configuration of the mesh gateway for this // upstream to use. MeshGateway ConsulMeshGateway }
ConsulUpstream represents a Consul Connect upstream jobspec block.
func (*ConsulUpstream) Equals ¶ added in v0.10.0
func (u *ConsulUpstream) Equals(o *ConsulUpstream) bool
Equals returns true if the structs are recursively equal.
type ConsulUsage ¶ added in v1.1.0
ConsulUsage is provides meta information about how Consul is used by a job, noting which connect services and normal services will be registered, and whether the keystore will be read via template.
func (*ConsulUsage) Used ¶ added in v1.1.0
func (cu *ConsulUsage) Used() bool
Used returns true if Consul is used for registering services or reading from the keystore.
type Context ¶ added in v0.6.1
type Context string
Context defines the scope in which a search for Nomad object operates, and is also used to query the matching index value for this context.
const ( // Individual context types. Allocs Context = "allocs" Deployments Context = "deployment" Evals Context = "evals" Jobs Context = "jobs" Nodes Context = "nodes" Namespaces Context = "namespaces" Quotas Context = "quotas" Recommendations Context = "recommendations" ScalingPolicies Context = "scaling_policy" Plugins Context = "plugins" Variables Context = "vars" Volumes Context = "volumes" // Subtypes used in fuzzy matching. Groups Context = "groups" Services Context = "services" Tasks Context = "tasks" Images Context = "images" Commands Context = "commands" Classes Context = "classes" // Union context types. All Context = "all" )
type Deployment ¶ added in v0.6.0
type Deployment struct { // ID is a generated UUID for the deployment ID string // Namespace is the namespace the deployment is created in Namespace string // JobID is the job the deployment is created for JobID string // JobVersion is the version of the job at which the deployment is tracking JobVersion uint64 // JobModifyIndex is the ModifyIndex of the job which the deployment is // tracking. JobModifyIndex uint64 // JobSpecModifyIndex is the JobModifyIndex of the job which the // deployment is tracking. JobSpecModifyIndex uint64 // JobCreateIndex is the create index of the job which the deployment is // tracking. It is needed so that if the job gets stopped and reran we can // present the correct list of deployments for the job and not old ones. JobCreateIndex uint64 // Multiregion specifies if deployment is part of multiregion deployment IsMultiregion bool // TaskGroups is the set of task groups effected by the deployment and their // current deployment status. TaskGroups map[string]*DeploymentState // The status of the deployment Status string // StatusDescription allows a human readable description of the deployment // status. StatusDescription string // EvalPriority tracks the priority of the evaluation which lead to the // creation of this Deployment object. Any additional evaluations created // as a result of this deployment can therefore inherit this value, which // is not guaranteed to be that of the job priority parameter. EvalPriority int CreateIndex uint64 ModifyIndex uint64 }
Deployment is the object that represents a job deployment which is used to transition a job between versions.
func NewDeployment ¶ added in v0.6.0
func NewDeployment(job *Job, evalPriority int) *Deployment
NewDeployment creates a new deployment given the job.
func (*Deployment) Active ¶ added in v0.6.0
func (d *Deployment) Active() bool
Active returns whether the deployment is active or terminal.
func (*Deployment) Copy ¶ added in v0.6.0
func (d *Deployment) Copy() *Deployment
func (*Deployment) GetCreateIndex ¶ added in v1.3.0
func (d *Deployment) GetCreateIndex() uint64
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*Deployment) GetID ¶ added in v0.6.0
func (d *Deployment) GetID() string
GetID is a helper for getting the ID when the object may be nil
func (*Deployment) GoString ¶ added in v0.6.0
func (d *Deployment) GoString() string
func (*Deployment) HasAutoPromote ¶ added in v0.9.2
func (d *Deployment) HasAutoPromote() bool
HasAutoPromote determines if all taskgroups are marked auto_promote
func (*Deployment) HasPlacedCanaries ¶ added in v0.6.0
func (d *Deployment) HasPlacedCanaries() bool
HasPlacedCanaries returns whether the deployment has placed canaries
func (*Deployment) RequiresPromotion ¶ added in v0.6.0
func (d *Deployment) RequiresPromotion() bool
RequiresPromotion returns whether the deployment requires promotion to continue
type DeploymentAllocHealthRequest ¶ added in v0.6.0
type DeploymentAllocHealthRequest struct { DeploymentID string // Marks these allocations as healthy, allow further allocations // to be rolled. HealthyAllocationIDs []string // Any unhealthy allocations fail the deployment UnhealthyAllocationIDs []string WriteRequest }
DeploymentAllocHealthRequest is used to set the health of a set of allocations as part of a deployment.
type DeploymentCancelRequest ¶ added in v0.12.0
type DeploymentCancelRequest struct { DeploymentID string WriteRequest }
DeploymentCancelRequest is used to remotely cancel a deployment. Used only for multiregion deployments.
type DeploymentDeleteRequest ¶ added in v0.6.0
type DeploymentDeleteRequest struct { Deployments []string WriteRequest }
DeploymentDeleteRequest is used for deleting deployments.
type DeploymentEvent ¶ added in v1.0.0
type DeploymentEvent struct {
Deployment *Deployment
}
DeploymentEvent holds a newly updated Deployment.
type DeploymentFailRequest ¶ added in v0.6.0
type DeploymentFailRequest struct { DeploymentID string WriteRequest }
DeploymentFailRequest is used to fail a particular deployment
type DeploymentListRequest ¶ added in v0.6.0
type DeploymentListRequest struct {
QueryOptions
}
DeploymentListRequest is used to list the deployments
type DeploymentListResponse ¶ added in v0.6.0
type DeploymentListResponse struct { Deployments []*Deployment QueryMeta }
DeploymentListResponse is used for a list request
type DeploymentPauseRequest ¶ added in v0.6.0
type DeploymentPauseRequest struct { DeploymentID string // Pause sets the pause status Pause bool WriteRequest }
DeploymentPauseRequest is used to pause a deployment
type DeploymentPromoteRequest ¶ added in v0.6.0
type DeploymentPromoteRequest struct { DeploymentID string // All is to promote all task groups All bool // Groups is used to set the promotion status per task group Groups []string WriteRequest }
DeploymentPromoteRequest is used to promote task groups in a deployment
type DeploymentRunRequest ¶ added in v0.12.0
type DeploymentRunRequest struct { DeploymentID string WriteRequest }
DeploymentRunRequest is used to remotely start a pending deployment. Used only for multiregion deployments.
type DeploymentSpecificRequest ¶ added in v0.6.0
type DeploymentSpecificRequest struct { DeploymentID string QueryOptions }
DeploymentSpecificRequest is used to make a request specific to a particular deployment
type DeploymentState ¶ added in v0.6.0
type DeploymentState struct { // AutoRevert marks whether the task group has indicated the job should be // reverted on failure AutoRevert bool // AutoPromote marks promotion triggered automatically by healthy canaries // copied from TaskGroup UpdateStrategy in scheduler.reconcile AutoPromote bool // ProgressDeadline is the deadline by which an allocation must transition // to healthy before the deployment is considered failed. This value is set // by the jobspec `update.progress_deadline` field. ProgressDeadline time.Duration // RequireProgressBy is the time by which an allocation must transition to // healthy before the deployment is considered failed. This value is reset // to "now" + ProgressDeadline when an allocation updates the deployment. RequireProgressBy time.Time // Promoted marks whether the canaries have been promoted Promoted bool // PlacedCanaries is the set of placed canary allocations PlacedCanaries []string // DesiredCanaries is the number of canaries that should be created. DesiredCanaries int // DesiredTotal is the total number of allocations that should be created as // part of the deployment. DesiredTotal int // PlacedAllocs is the number of allocations that have been placed PlacedAllocs int // HealthyAllocs is the number of allocations that have been marked healthy. HealthyAllocs int // UnhealthyAllocs are allocations that have been marked as unhealthy. UnhealthyAllocs int }
DeploymentState tracks the state of a deployment for a given task group.
func (*DeploymentState) Copy ¶ added in v0.6.0
func (d *DeploymentState) Copy() *DeploymentState
func (*DeploymentState) GoString ¶ added in v0.6.0
func (d *DeploymentState) GoString() string
type DeploymentStatusUpdate ¶ added in v0.6.0
type DeploymentStatusUpdate struct { // DeploymentID is the ID of the deployment to update DeploymentID string // Status is the new status of the deployment. Status string // StatusDescription is the new status description of the deployment. StatusDescription string }
DeploymentStatusUpdate is used to update the status of a given deployment
type DeploymentStatusUpdateRequest ¶ added in v0.6.0
type DeploymentStatusUpdateRequest struct { // Eval, if set, is used to create an evaluation at the same time as // updating the status of a deployment. Eval *Evaluation // DeploymentUpdate is a status update to apply to the given // deployment. DeploymentUpdate *DeploymentStatusUpdate // Job is used to optionally upsert a job. This is used when setting the // allocation health results in a deployment failure and the deployment // auto-reverts to the latest stable job. Job *Job }
DeploymentStatusUpdateRequest is used to update the status of a deployment as well as optionally creating an evaluation atomically.
type DeploymentUnblockRequest ¶ added in v0.12.0
type DeploymentUnblockRequest struct { DeploymentID string WriteRequest }
DeploymentUnblockRequest is used to remotely unblock a deployment. Used only for multiregion deployments.
type DeploymentUpdateResponse ¶ added in v0.6.0
type DeploymentUpdateResponse struct { EvalID string EvalCreateIndex uint64 DeploymentModifyIndex uint64 // RevertedJobVersion is the version the job was reverted to. If unset, the // job wasn't reverted RevertedJobVersion *uint64 WriteMeta }
DeploymentUpdateResponse is used to respond to a deployment change. The response will include the modify index of the deployment as well as details of any triggered evaluation.
type DeriveSITokenRequest ¶ added in v0.10.4
type DeriveSITokenRequest struct { NodeID string SecretID string AllocID string Tasks []string QueryOptions }
DeriveSITokenRequest is used to request Consul Service Identity tokens from the Nomad Server for the named tasks in the given allocation.
func (*DeriveSITokenRequest) Validate ¶ added in v0.10.4
func (r *DeriveSITokenRequest) Validate() error
type DeriveSITokenResponse ¶ added in v0.10.4
type DeriveSITokenResponse struct { // Tokens maps from Task Name to its associated SI token Tokens map[string]string // Error stores any error that occurred. Errors are stored here so we can // communicate whether it is retryable Error *RecoverableError QueryMeta }
type DeriveVaultTokenRequest ¶ added in v0.5.0
type DeriveVaultTokenRequest struct { NodeID string SecretID string AllocID string Tasks []string QueryOptions }
DeriveVaultTokenRequest is used to request wrapped Vault tokens for the following tasks in the given allocation
type DeriveVaultTokenResponse ¶ added in v0.5.0
type DeriveVaultTokenResponse struct { // Tasks is a mapping between the task name and the wrapped token Tasks map[string]string // Error stores any error that occurred. Errors are stored here so we can // communicate whether it is retryable Error *RecoverableError QueryMeta }
DeriveVaultTokenResponse returns the wrapped tokens for each requested task
type DesiredTransition ¶ added in v0.8.0
type DesiredTransition struct { // Migrate is used to indicate that this allocation should be stopped and // migrated to another node. Migrate *bool // Reschedule is used to indicate that this allocation is eligible to be // rescheduled. Most allocations are automatically eligible for // rescheduling, so this field is only required when an allocation is not // automatically eligible. An example is an allocation that is part of a // deployment. Reschedule *bool // ForceReschedule is used to indicate that this allocation must be rescheduled. // This field is only used when operators want to force a placement even if // a failed allocation is not eligible to be rescheduled ForceReschedule *bool // NoShutdownDelay, if set to true, will override the group and // task shutdown_delay configuration and ignore the delay for any // allocations stopped as a result of this Deregister call. NoShutdownDelay *bool }
DesiredTransition is used to mark an allocation as having a desired state transition. This information can be used by the scheduler to make the correct decision.
func (*DesiredTransition) Merge ¶ added in v0.8.0
func (d *DesiredTransition) Merge(o *DesiredTransition)
Merge merges the two desired transitions, preferring the values from the passed in object.
func (*DesiredTransition) ShouldForceReschedule ¶ added in v0.8.4
func (d *DesiredTransition) ShouldForceReschedule() bool
ShouldForceReschedule returns whether the transition object dictates a forced rescheduling.
func (*DesiredTransition) ShouldIgnoreShutdownDelay ¶ added in v1.2.4
func (d *DesiredTransition) ShouldIgnoreShutdownDelay() bool
ShouldIgnoreShutdownDelay returns whether the transition object dictates that shutdown skip any shutdown delays.
func (*DesiredTransition) ShouldMigrate ¶ added in v0.8.0
func (d *DesiredTransition) ShouldMigrate() bool
ShouldMigrate returns whether the transition object dictates a migration.
func (*DesiredTransition) ShouldReschedule ¶ added in v0.8.4
func (d *DesiredTransition) ShouldReschedule() bool
ShouldReschedule returns whether the transition object dictates a rescheduling.
type DesiredUpdates ¶ added in v0.4.0
type DesiredUpdates struct { Ignore uint64 Place uint64 Migrate uint64 Stop uint64 InPlaceUpdate uint64 DestructiveUpdate uint64 Canary uint64 Preemptions uint64 }
DesiredUpdates is the set of changes the scheduler would like to make given sufficient resources and cluster capacity.
func (*DesiredUpdates) GoString ¶ added in v0.6.0
func (d *DesiredUpdates) GoString() string
type DeviceAccounter ¶ added in v0.9.0
type DeviceAccounter struct { // Devices maps a device group to its device accounter instance Devices map[DeviceIdTuple]*DeviceAccounterInstance }
DeviceAccounter is used to account for device usage on a node. It can detect when a node is oversubscribed and can be used for deciding what devices are free
func NewDeviceAccounter ¶ added in v0.9.0
func NewDeviceAccounter(n *Node) *DeviceAccounter
NewDeviceAccounter returns a new device accounter. The node is used to populate the set of available devices based on what healthy device instances exist on the node.
func (*DeviceAccounter) AddAllocs ¶ added in v0.9.0
func (d *DeviceAccounter) AddAllocs(allocs []*Allocation) (collision bool)
AddAllocs takes a set of allocations and internally marks which devices are used. If a device is used more than once by the set of passed allocations, the collision will be returned as true.
func (*DeviceAccounter) AddReserved ¶ added in v0.9.0
func (d *DeviceAccounter) AddReserved(res *AllocatedDeviceResource) (collision bool)
AddReserved marks the device instances in the passed device reservation as used and returns if there is a collision.
type DeviceAccounterInstance ¶ added in v0.9.0
type DeviceAccounterInstance struct { // Device is the device being wrapped Device *NodeDeviceResource // Instances is a mapping of the device IDs to their usage. // Only a value of 0 indicates that the instance is unused. Instances map[string]int }
DeviceAccounterInstance wraps a device and adds tracking to the instances of the device to determine if they are free or not.
func (*DeviceAccounterInstance) FreeCount ¶ added in v0.9.0
func (i *DeviceAccounterInstance) FreeCount() int
FreeCount returns the number of free device instances
type DeviceIdTuple ¶ added in v0.9.0
DeviceIdTuple is the tuple that identifies a device
func (*DeviceIdTuple) Equals ¶ added in v0.9.0
func (id *DeviceIdTuple) Equals(o *DeviceIdTuple) bool
Equals returns if this Device ID is the same as the passed ID.
func (*DeviceIdTuple) Matches ¶ added in v0.9.0
func (id *DeviceIdTuple) Matches(other *DeviceIdTuple) bool
Matches returns if this Device ID is a superset of the passed ID.
func (*DeviceIdTuple) String ¶ added in v0.9.0
func (id *DeviceIdTuple) String() string
type DiffableWithID ¶ added in v1.2.0
type DiffableWithID interface { // DiffID returns the value to use to match entities between the old and // the new input. DiffID() string }
DiffableWithID defines an object that has a unique and stable value that can be used as an identifier when generating a diff.
type DispatchPayloadConfig ¶ added in v0.5.3
type DispatchPayloadConfig struct { // File specifies a relative path to where the input data should be written File string }
DispatchPayloadConfig configures how a task gets its input from a job dispatch
func (*DispatchPayloadConfig) Copy ¶ added in v0.5.3
func (d *DispatchPayloadConfig) Copy() *DispatchPayloadConfig
func (*DispatchPayloadConfig) Validate ¶ added in v0.5.3
func (d *DispatchPayloadConfig) Validate() error
type DrainMetadata ¶ added in v1.1.0
type DrainMetadata struct { // StartedAt is the time that the drain operation started. This is equal to Node.DrainStrategy.StartedAt, // if it exists StartedAt time.Time // UpdatedAt is the time that that this struct was most recently updated, either via API action // or drain completion UpdatedAt time.Time // Status reflects the status of the drain operation. Status DrainStatus // AccessorID is the accessor ID of the ACL token used in the most recent API operation against this drain AccessorID string // Meta includes the operator-submitted metadata about this drain operation Meta map[string]string }
DrainMetadata contains information about the most recent drain operation for a given Node.
func (*DrainMetadata) Copy ¶ added in v1.1.0
func (m *DrainMetadata) Copy() *DrainMetadata
type DrainSpec ¶ added in v0.8.0
type DrainSpec struct { // Deadline is the duration after StartTime when the remaining // allocations on a draining Node should be told to stop. Deadline time.Duration // IgnoreSystemJobs allows systems jobs to remain on the node even though it // has been marked for draining. IgnoreSystemJobs bool }
DrainSpec describes a Node's desired drain behavior.
type DrainStatus ¶ added in v1.1.0
type DrainStatus string
const ( // DrainStatuses are the various states a drain can be in, as reflect in DrainMetadata DrainStatusDraining DrainStatus = "draining" DrainStatusComplete DrainStatus = "complete" DrainStatusCanceled DrainStatus = "canceled" )
type DrainStrategy ¶ added in v0.8.0
type DrainStrategy struct { // DrainSpec is the user declared drain specification DrainSpec // ForceDeadline is the deadline time for the drain after which drains will // be forced ForceDeadline time.Time // StartedAt is the time the drain process started StartedAt time.Time }
DrainStrategy describes a Node's drain behavior.
func (*DrainStrategy) Copy ¶ added in v0.8.0
func (d *DrainStrategy) Copy() *DrainStrategy
func (*DrainStrategy) DeadlineTime ¶ added in v0.8.0
func (d *DrainStrategy) DeadlineTime() (infinite bool, deadline time.Time)
DeadlineTime returns a boolean whether the drain strategy allows an infinite duration or otherwise the deadline time. The force drain is captured by the deadline time being in the past.
func (*DrainStrategy) Equal ¶ added in v0.8.0
func (d *DrainStrategy) Equal(o *DrainStrategy) bool
type DrainUpdate ¶ added in v0.8.0
type DrainUpdate struct { // DrainStrategy is the new strategy for the node DrainStrategy *DrainStrategy // MarkEligible marks the node as eligible if removing the drain strategy. MarkEligible bool }
DrainUpdate is used to update the drain of a node
type DriverInfo ¶ added in v0.8.0
type DriverInfo struct { Attributes map[string]string Detected bool Healthy bool HealthDescription string UpdateTime time.Time }
DriverInfo is the current state of a single driver. This is updated regularly as driver health changes on the node.
func (*DriverInfo) Copy ¶ added in v0.8.1
func (di *DriverInfo) Copy() *DriverInfo
func (*DriverInfo) HealthCheckEquals ¶ added in v0.8.0
func (di *DriverInfo) HealthCheckEquals(other *DriverInfo) bool
HealthCheckEquals determines if two driver info objects are equal. As this is used in the process of health checking, we only check the fields that are computed by the health checker. In the future, this will be merged.
func (*DriverInfo) MergeFingerprintInfo ¶ added in v0.8.0
func (di *DriverInfo) MergeFingerprintInfo(other *DriverInfo)
MergeFingerprintInfo merges information from fingerprinting a node for a driver into a node's driver info for that driver.
func (*DriverInfo) MergeHealthCheck ¶ added in v0.8.0
func (di *DriverInfo) MergeHealthCheck(other *DriverInfo)
MergeHealthCheck merges information from a health check for a drier into a node's driver info
type EmitNodeEventsRequest ¶ added in v0.8.0
type EmitNodeEventsRequest struct { // NodeEvents are a map where the key is a node id, and value is a list of // events for that node NodeEvents map[string][]*NodeEvent WriteRequest }
EmitNodeEventsRequest is a request to update the node events source with a new client-side event
type EmitNodeEventsResponse ¶ added in v0.8.0
type EmitNodeEventsResponse struct {
WriteMeta
}
EmitNodeEventsResponse is a response to the client about the status of the node event source update.
type EncryptionAlgorithm ¶ added in v1.4.0
type EncryptionAlgorithm string
EncryptionAlgorithm chooses which algorithm is used for encrypting / decrypting entries with this key
const (
EncryptionAlgorithmAES256GCM EncryptionAlgorithm = "aes256-gcm"
)
type EphemeralDisk ¶ added in v0.5.0
type EphemeralDisk struct { // Sticky indicates whether the allocation is sticky to a node Sticky bool // SizeMB is the size of the local disk SizeMB int // Migrate determines if Nomad client should migrate the allocation dir for // sticky allocations Migrate bool }
EphemeralDisk is an ephemeral disk object
func DefaultEphemeralDisk ¶ added in v0.5.0
func DefaultEphemeralDisk() *EphemeralDisk
DefaultEphemeralDisk returns a EphemeralDisk with default configurations
func (*EphemeralDisk) Copy ¶ added in v0.5.0
func (d *EphemeralDisk) Copy() *EphemeralDisk
Copy copies the EphemeralDisk struct and returns a new one
func (*EphemeralDisk) Validate ¶ added in v0.5.0
func (d *EphemeralDisk) Validate() error
Validate validates EphemeralDisk
type EvalAckRequest ¶
type EvalAckRequest struct { EvalID string Token string WriteRequest }
EvalAckRequest is used to Ack/Nack a specific evaluation
type EvalAllocationsResponse ¶
type EvalAllocationsResponse struct { Allocations []*AllocListStub QueryMeta }
EvalAllocationsResponse is used to return the allocations for an evaluation
type EvalCountRequest ¶ added in v1.4.3
type EvalCountRequest struct {
QueryOptions
}
EvalCountRequest is used to count evaluations
type EvalCountResponse ¶ added in v1.4.3
EvalCountResponse is used for a count request
type EvalDeleteRequest ¶
type EvalDeleteRequest struct { EvalIDs []string // Filter specifies the go-bexpr filter expression to be used for deleting a // set of evaluations that matches the filter Filter string WriteRequest }
EvalDeleteRequest is the request object used when operators are manually deleting evaluations. The number of evaluation IDs within the request must not be greater than MaxEvalIDsPerDeleteRequest.
type EvalDeleteResponse ¶ added in v1.3.2
type EvalDeleteResponse struct { Count int // how many Evaluations were safe to delete and/or matched the filter WriteMeta }
EvalDeleteResponse is the response object when one or more evaluation are deleted manually by an operator.
type EvalDequeueRequest ¶
type EvalDequeueRequest struct { Schedulers []string Timeout time.Duration SchedulerVersion uint16 WriteRequest }
EvalDequeueRequest is used when we want to dequeue an evaluation
type EvalDequeueResponse ¶
type EvalDequeueResponse struct { Eval *Evaluation Token string // WaitIndex is the Raft index the worker should wait until invoking the // scheduler. WaitIndex uint64 QueryMeta }
EvalDequeueResponse is used to return from a dequeue
func (*EvalDequeueResponse) GetWaitIndex ¶ added in v0.7.0
func (e *EvalDequeueResponse) GetWaitIndex() uint64
GetWaitIndex is used to retrieve the Raft index in which state should be at or beyond before invoking the scheduler.
type EvalListRequest ¶
type EvalListRequest struct { FilterJobID string FilterEvalStatus string QueryOptions }
EvalListRequest is used to list the evaluations
func (*EvalListRequest) ShouldBeFiltered ¶ added in v1.2.4
func (req *EvalListRequest) ShouldBeFiltered(e *Evaluation) bool
ShouldBeFiltered indicates that the eval should be filtered (that is, removed) from the results
type EvalListResponse ¶
type EvalListResponse struct { Evaluations []*Evaluation QueryMeta }
EvalListResponse is used for a list request
type EvalOptions ¶ added in v0.8.4
type EvalOptions struct {
ForceReschedule bool
}
EvalOptions is used to encapsulate options when forcing a job evaluation
type EvalReapRequest ¶ added in v1.3.2
type EvalReapRequest struct { Evals []string // slice of Evaluation IDs Allocs []string // slice of Allocation IDs // Filter specifies the go-bexpr filter expression to be used for // filtering the data prior to returning a response Filter string PerPage int32 NextToken string // UserInitiated tracks whether this reap request is the result of an // operator request. If this is true, the FSM needs to ensure the eval // broker is paused as the request can include non-terminal allocations. UserInitiated bool WriteRequest }
EvalReapRequest is used for reaping evaluations and allocation. This struct is used by the Eval.Reap RPC endpoint as a request argument, and also when performing eval reap or deletes via Raft. This is because Eval.Reap and Eval.Delete use the same Raft message when performing deletes so we do not need more Raft message types.
type EvalSpecificRequest ¶
type EvalSpecificRequest struct { EvalID string IncludeRelated bool QueryOptions }
EvalSpecificRequest is used when we just need to specify a target evaluation
type EvalUpdateRequest ¶
type EvalUpdateRequest struct { Evals []*Evaluation EvalToken string WriteRequest }
EvalUpdateRequest is used for upserting evaluations.
type Evaluation ¶
type Evaluation struct { // ID is a randomly generated UUID used for this evaluation. This // is assigned upon the creation of the evaluation. ID string // Namespace is the namespace the evaluation is created in Namespace string // Priority is used to control scheduling importance and if this job // can preempt other jobs. Priority int // Type is used to control which schedulers are available to handle // this evaluation. Type string // TriggeredBy is used to give some insight into why this Eval // was created. (Job change, node failure, alloc failure, etc). TriggeredBy string // JobID is the job this evaluation is scoped to. Evaluations cannot // be run in parallel for a given JobID, so we serialize on this. JobID string // JobModifyIndex is the modify index of the job at the time // the evaluation was created JobModifyIndex uint64 // NodeID is the node that was affected triggering the evaluation. NodeID string // NodeModifyIndex is the modify index of the node at the time // the evaluation was created NodeModifyIndex uint64 // DeploymentID is the ID of the deployment that triggered the evaluation. DeploymentID string // Status of the evaluation Status string // StatusDescription is meant to provide more human useful information StatusDescription string // Wait is a minimum wait time for running the eval. This is used to // support a rolling upgrade in versions prior to 0.7.0 // Deprecated Wait time.Duration // WaitUntil is the time when this eval should be run. This is used to // supported delayed rescheduling of failed allocations, and delayed // stopping of allocations that are configured with max_client_disconnect. WaitUntil time.Time // NextEval is the evaluation ID for the eval created to do a followup. // This is used to support rolling upgrades and failed-follow-up evals, where // we need a chain of evaluations. NextEval string // PreviousEval is the evaluation ID for the eval creating this one to do a followup. // This is used to support rolling upgrades and failed-follow-up evals, where // we need a chain of evaluations. PreviousEval string // BlockedEval is the evaluation ID for a created blocked eval. A // blocked eval will be created if all allocations could not be placed due // to constraints or lacking resources. BlockedEval string // RelatedEvals is a list of all the evaluations that are related (next, // previous, or blocked) to this one. It may be nil if not requested. RelatedEvals []*EvaluationStub // FailedTGAllocs are task groups which have allocations that could not be // made, but the metrics are persisted so that the user can use the feedback // to determine the cause. FailedTGAllocs map[string]*AllocMetric // ClassEligibility tracks computed node classes that have been explicitly // marked as eligible or ineligible. ClassEligibility map[string]bool // QuotaLimitReached marks whether a quota limit was reached for the // evaluation. QuotaLimitReached string // EscapedComputedClass marks whether the job has constraints that are not // captured by computed node classes. EscapedComputedClass bool // AnnotatePlan triggers the scheduler to provide additional annotations // during the evaluation. This should not be set during normal operations. AnnotatePlan bool // QueuedAllocations is the number of unplaced allocations at the time the // evaluation was processed. The map is keyed by Task Group names. QueuedAllocations map[string]int // LeaderACL provides the ACL token to when issuing RPCs back to the // leader. This will be a valid management token as long as the leader is // active. This should not ever be exposed via the API. LeaderACL string // SnapshotIndex is the Raft index of the snapshot used to process the // evaluation. The index will either be set when it has gone through the // scheduler or if a blocked evaluation is being created. The index is set // in this case so we can determine if an early unblocking is required since // capacity has changed since the evaluation was created. This can result in // the SnapshotIndex being less than the CreateIndex. SnapshotIndex uint64 // Raft Indexes CreateIndex uint64 ModifyIndex uint64 CreateTime int64 ModifyTime int64 // contains filtered or unexported fields }
Evaluation is used anytime we need to apply business logic as a result of a change to our desired state (job specification) or the emergent state (registered nodes). When the inputs change, we need to "evaluate" them, potentially taking action (allocation of work) or doing nothing if the state of the world does not require it.
func (*Evaluation) Copy ¶
func (e *Evaluation) Copy() *Evaluation
func (*Evaluation) CreateBlockedEval ¶ added in v0.4.0
func (e *Evaluation) CreateBlockedEval(classEligibility map[string]bool, escaped bool, quotaReached string, failedTGAllocs map[string]*AllocMetric) *Evaluation
CreateBlockedEval creates a blocked evaluation to followup this eval to place any failed allocations. It takes the classes marked explicitly eligible or ineligible, whether the job has escaped computed node classes and whether the quota limit was reached.
func (*Evaluation) CreateFailedFollowUpEval ¶ added in v0.6.0
func (e *Evaluation) CreateFailedFollowUpEval(wait time.Duration) *Evaluation
CreateFailedFollowUpEval creates a follow up evaluation when the current one has been marked as failed because it has hit the delivery limit and will not be retried by the eval_broker. Callers should copy the created eval's ID to into the old eval's NextEval field.
func (*Evaluation) GetCreateIndex ¶ added in v1.3.0
func (e *Evaluation) GetCreateIndex() uint64
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*Evaluation) GetID ¶ added in v1.2.4
func (e *Evaluation) GetID() string
GetID implements the IDGetter interface, required for pagination.
func (*Evaluation) GetNamespace ¶ added in v1.3.2
func (e *Evaluation) GetNamespace() string
GetNamespace implements the NamespaceGetter interface, required for pagination.
func (*Evaluation) GoString ¶
func (e *Evaluation) GoString() string
func (*Evaluation) MakePlan ¶
func (e *Evaluation) MakePlan(j *Job) *Plan
MakePlan is used to make a plan from the given evaluation for a given Job
func (*Evaluation) NextRollingEval ¶
func (e *Evaluation) NextRollingEval(wait time.Duration) *Evaluation
NextRollingEval creates an evaluation to followup this eval for rolling updates
func (*Evaluation) RelatedIDs ¶ added in v1.3.0
func (e *Evaluation) RelatedIDs() []string
func (*Evaluation) ShouldBlock ¶ added in v0.3.0
func (e *Evaluation) ShouldBlock() bool
ShouldBlock checks if a given evaluation should be entered into the blocked eval tracker.
func (*Evaluation) ShouldEnqueue ¶
func (e *Evaluation) ShouldEnqueue() bool
ShouldEnqueue checks if a given evaluation should be enqueued into the eval_broker
func (*Evaluation) Stub ¶ added in v1.3.0
func (e *Evaluation) Stub() *EvaluationStub
func (*Evaluation) TerminalStatus ¶
func (e *Evaluation) TerminalStatus() bool
TerminalStatus returns if the current status is terminal and will no longer transition.
func (*Evaluation) UpdateModifyTime ¶ added in v0.9.5
func (e *Evaluation) UpdateModifyTime()
UpdateModifyTime takes into account that clocks on different servers may be slightly out of sync. Even in case of a leader change, this method will guarantee that ModifyTime will always be after CreateTime.
type EvaluationEvent ¶ added in v1.0.0
type EvaluationEvent struct {
Evaluation *Evaluation
}
EvaluationEvent holds a newly updated Eval.
type EvaluationStub ¶ added in v1.3.0
type EvaluationStub struct { ID string Namespace string Priority int Type string TriggeredBy string JobID string NodeID string DeploymentID string Status string StatusDescription string WaitUntil time.Time NextEval string PreviousEval string BlockedEval string CreateIndex uint64 ModifyIndex uint64 CreateTime int64 ModifyTime int64 }
type Event ¶ added in v1.0.0
type Event struct { // Topic represents the primary object for the event Topic Topic // Type is a short string representing the reason for the event Type string // Key is the primary identifier of the Event, The involved objects ID Key string // Namespace is the namespace of the object, If the object is not namespace // aware (Node) it is left blank Namespace string // FilterKeys are a set of additional related keys that are used to include // events during filtering. FilterKeys []string // Index is the raft index that corresponds to the event Index uint64 // Payload is the Event itself see state/events.go for a list of events Payload interface{} }
Event represents a change in Nomads state.
type EventJson ¶ added in v1.0.0
type EventJson struct {
Data []byte
}
EventJson is a wrapper for a JSON object
type EventStreamRequest ¶ added in v1.0.0
type EventStreamRequest struct { Topics map[Topic][]string Index int QueryOptions }
EventStreamRequest is used to stream events from a servers EventBroker
type EventStreamWrapper ¶ added in v1.0.0
type FieldDiffs ¶ added in v0.4.0
type FieldDiffs []*FieldDiff
For sorting FieldDiffs
func (FieldDiffs) Len ¶ added in v0.4.0
func (f FieldDiffs) Len() int
func (FieldDiffs) Less ¶ added in v0.4.0
func (f FieldDiffs) Less(i, j int) bool
func (FieldDiffs) Swap ¶ added in v0.4.0
func (f FieldDiffs) Swap(i, j int)
type FuzzyMatch ¶ added in v1.1.0
type FuzzyMatch struct { ID string // ID is UUID or Name of object Scope []string `json:",omitempty"` // IDs of parent objects }
FuzzyMatch is used to describe the ID of an object which may be a machine readable UUID or a human readable Name. If the object is a component of a Job, the Scope is a list of IDs starting from Namespace down to the parent object of ID.
e.g. A Task-level service would have scope like,
["<namespace>", "<job>", "<group>", "<task>"]
type FuzzySearchRequest ¶ added in v1.1.0
type FuzzySearchRequest struct { // Text is what names are fuzzy-matched to. E.g. if the given text were // "py", potential matches might be "python", "mypy", etc. of jobs, nodes, // allocs, groups, services, commands, images, classes. Text string // Context is the type that can be matched against. A Context of "all" indicates // all Contexts types are queried for matching. Context Context QueryOptions }
FuzzySearchRequest is used to parameterize a fuzzy search request, and returns a list of matches made up of jobs, allocations, evaluations, and/or nodes, along with whether or not the information returned is truncated.
type FuzzySearchResponse ¶ added in v1.1.0
type FuzzySearchResponse struct { // Matches is a map of Context types to IDs which fuzzy match a specified query. Matches map[Context][]FuzzyMatch // Truncations indicates whether the matches for a particular Context have // been truncated. Truncations map[Context]bool QueryMeta }
FuzzySearchResponse is used to return fuzzy matches and information about whether the match list is truncated specific to each type of searchable Context.
type GenericRequest ¶
type GenericRequest struct {
QueryOptions
}
GenericRequest is used to request where no specific information is needed.
type GenericResponse ¶
type GenericResponse struct {
WriteMeta
}
GenericResponse is used to respond to a request where no specific response information is needed.
type HostDataRequest ¶ added in v0.12.0
type HostDataRequest struct { ServerID string NodeID string QueryOptions }
HostDataRequest is used by /agent/host to retrieve data about the agent's host system. If ServerID or NodeID is specified, the request is forwarded to the remote agent
type HostDataResponse ¶ added in v0.12.0
HostDataResponse contains the HostData content
type IdentityClaims ¶ added in v1.4.0
type IdentityClaims struct { Namespace string `json:"nomad_namespace"` JobID string `json:"nomad_job_id"` AllocationID string `json:"nomad_allocation_id"` TaskName string `json:"nomad_task"` jwt.RegisteredClaims }
IdentityClaims are the input to a JWT identifying a workload. It should never be serialized to msgpack unsigned.
type InternalRpcInfo ¶ added in v0.8.0
type InternalRpcInfo struct { // Forwarded marks whether the RPC has been forwarded. Forwarded bool }
InternalRpcInfo allows adding internal RPC metadata to an RPC. This struct should NOT be replicated in the API package as it is internal only.
func (*InternalRpcInfo) IsForwarded ¶ added in v0.8.0
func (i *InternalRpcInfo) IsForwarded() bool
IsForwarded returns whether the RPC is forwarded from another server.
func (*InternalRpcInfo) SetForwarded ¶ added in v0.8.0
func (i *InternalRpcInfo) SetForwarded()
SetForwarded marks that the RPC is being forwarded from another server.
type Job ¶
type Job struct { // Stop marks whether the user has stopped the job. A stopped job will // have all created allocations stopped and acts as a way to stop a job // without purging it from the system. This allows existing allocs to be // queried and the job to be inspected as it is being killed. Stop bool // Region is the Nomad region that handles scheduling this job Region string // Namespace is the namespace the job is submitted into. Namespace string // ID is a unique identifier for the job per region. It can be // specified hierarchically like LineOfBiz/OrgName/Team/Project ID string // ParentID is the unique identifier of the job that spawned this job. ParentID string // Name is the logical name of the job used to refer to it. This is unique // per region, but not unique globally. Name string // Type is used to control various behaviors about the job. Most jobs // are service jobs, meaning they are expected to be long lived. // Some jobs are batch oriented meaning they run and then terminate. // This can be extended in the future to support custom schedulers. Type string // Priority is used to control scheduling importance and if this job // can preempt other jobs. Priority int // AllAtOnce is used to control if incremental scheduling of task groups // is allowed or if we must do a gang scheduling of the entire job. This // can slow down larger jobs if resources are not available. AllAtOnce bool // Datacenters contains all the datacenters this job is allowed to span Datacenters []string // Constraints can be specified at a job level and apply to // all the task groups and tasks. Constraints []*Constraint // Affinities can be specified at the job level to express // scheduling preferences that apply to all groups and tasks Affinities []*Affinity // Spread can be specified at the job level to express spreading // allocations across a desired attribute, such as datacenter Spreads []*Spread // TaskGroups are the collections of task groups that this job needs // to run. Each task group is an atomic unit of scheduling and placement. TaskGroups []*TaskGroup // See agent.ApiJobToStructJob // Update provides defaults for the TaskGroup Update blocks Update UpdateStrategy Multiregion *Multiregion // Periodic is used to define the interval the job is run at. Periodic *PeriodicConfig // ParameterizedJob is used to specify the job as a parameterized job // for dispatching. ParameterizedJob *ParameterizedJobConfig // Dispatched is used to identify if the Job has been dispatched from a // parameterized job. Dispatched bool // DispatchIdempotencyToken is optionally used to ensure that a dispatched job does not have any // non-terminal siblings which have the same token value. DispatchIdempotencyToken string // Payload is the payload supplied when the job was dispatched. Payload []byte // Meta is used to associate arbitrary metadata with this // job. This is opaque to Nomad. Meta map[string]string // ConsulToken is the Consul token that proves the submitter of the job has // access to the Service Identity policies associated with the job's // Consul Connect enabled services. This field is only used to transfer the // token and is not stored after Job submission. ConsulToken string // ConsulNamespace is the Consul namespace ConsulNamespace string // VaultToken is the Vault token that proves the submitter of the job has // access to the specified Vault policies. This field is only used to // transfer the token and is not stored after Job submission. VaultToken string // VaultNamespace is the Vault namespace VaultNamespace string // NomadTokenID is the Accessor ID of the ACL token (if any) // used to register this version of the job. Used by deploymentwatcher. NomadTokenID string // Job status Status string // StatusDescription is meant to provide more human useful information StatusDescription string // Stable marks a job as stable. Stability is only defined on "service" and // "system" jobs. The stability of a job will be set automatically as part // of a deployment and can be manually set via APIs. This field is updated // when the status of a corresponding deployment transitions to Failed // or Successful. This field is not meaningful for jobs that don't have an // update block. Stable bool // Version is a monotonically increasing version number that is incremented // on each job register. Version uint64 // SubmitTime is the time at which the job was submitted as a UnixNano in // UTC SubmitTime int64 // Raft Indexes CreateIndex uint64 ModifyIndex uint64 JobModifyIndex uint64 }
Job is the scope of a scheduling request to Nomad. It is the largest scoped object, and is a named collection of task groups. Each task group is further composed of tasks. A task group (TG) is the unit of scheduling however.
func (*Job) Canonicalize ¶ added in v0.4.1
func (j *Job) Canonicalize()
Canonicalize is used to canonicalize fields in the Job. This should be called when registering a Job.
func (*Job) CombinedTaskMeta ¶ added in v0.5.3
CombinedTaskMeta takes a TaskGroup and Task name and returns the combined meta data for the task. When joining Job, Group and Task Meta, the precedence is by deepest scope (Task > Group > Job).
func (*Job) ConfigEntries ¶ added in v0.12.4
func (j *Job) ConfigEntries() map[string]*ConsulConfigEntries
ConfigEntries accumulates the Consul Configuration Entries defined in task groups of j, organized by Consul namespace.
func (*Job) ConnectTasks ¶ added in v0.10.4
ConnectTasks returns the set of Consul Connect enabled tasks defined on the job that will require a Service Identity token in the case that Consul ACLs are enabled. The TaskKind.Value is the name of the Consul service.
This method is meaningful only after the Job has passed through the job submission Mutator functions.
func (*Job) ConsulUsages ¶ added in v1.1.0
func (j *Job) ConsulUsages() map[string]*ConsulUsage
ConsulUsages returns a map from Consul namespace to things that will use Consul, including ConsulConnect TaskKinds, Consul Services from groups and tasks, and a boolean indicating if Consul KV is in use.
func (*Job) Copy ¶ added in v0.3.0
Copy returns a deep copy of the Job. It is expected that callers use recover. This job can panic if the deep copy failed as it uses reflection.
func (*Job) Diff ¶ added in v0.4.0
Diff returns a diff of two jobs and a potential error if the Jobs are not diffable. If contextual diff is enabled, objects within the job will contain field information even if unchanged.
func (*Job) GetCreateIndex ¶ added in v1.3.0
GetCreateIndex implements the CreateIndexGetter interface, required for pagination.
func (*Job) GetEntScalingPolicies ¶ added in v1.0.0
func (j *Job) GetEntScalingPolicies() []*ScalingPolicy
func (*Job) GetID ¶ added in v1.3.0
GetID implements the IDGetter interface, required for pagination.
func (*Job) GetNamespace ¶ added in v1.3.0
GetNamespace implements the NamespaceGetter interface, required for pagination and filtering namespaces in endpoints that support glob namespace requests using tokens with limited access.
func (*Job) GetScalingPolicies ¶ added in v0.11.0
func (j *Job) GetScalingPolicies() []*ScalingPolicy
GetScalingPolicies returns a slice of all scaling scaling policies for this job
func (*Job) HasUpdateStrategy ¶ added in v0.6.0
HasUpdateStrategy returns if any task group in the job has an update strategy
func (*Job) IsMultiregion ¶ added in v0.12.0
IsMultiregion returns whether a job is multiregion
func (*Job) IsParameterized ¶ added in v0.5.3
IsParameterized returns whether a job is parameterized job.
func (*Job) IsPeriodic ¶ added in v0.2.2
IsPeriodic returns whether a job is periodic.
func (*Job) IsPeriodicActive ¶ added in v0.7.1
IsPeriodicActive returns whether the job is an active periodic job that will create child jobs
func (*Job) IsPlugin ¶ added in v1.3.0
IsPlugin returns whether a job is implements a plugin (currently just CSI)
func (*Job) LookupTaskGroup ¶
LookupTaskGroup finds a task group by name
func (*Job) NamespacedID ¶ added in v0.8.2
func (j *Job) NamespacedID() NamespacedID
NamespacedID returns the namespaced id useful for logging
func (*Job) RequiredConsulServiceDiscovery ¶ added in v1.3.0
RequiredConsulServiceDiscovery identifies which task groups, if any, within the job are utilising Consul service discovery.
func (*Job) RequiredNativeServiceDiscovery ¶ added in v1.3.0
func (j *Job) RequiredNativeServiceDiscovery() *NativeServiceDiscoveryUsage
RequiredNativeServiceDiscovery identifies which task groups, if any, within the job are utilising Nomad native service discovery.
func (*Job) RequiredSignals ¶ added in v0.5.0
RequiredSignals returns a mapping of task groups to tasks to their required set of signals
func (*Job) SetSubmitTime ¶ added in v0.6.0
func (j *Job) SetSubmitTime()
func (*Job) SpecChanged ¶ added in v0.6.0
SpecChanged determines if the functional specification has changed between two job versions.
func (*Job) Stub ¶
func (j *Job) Stub(summary *JobSummary, fields *JobStubFields) *JobListStub
Stub is used to return a summary of the job
func (*Job) UsesDeployments ¶ added in v1.3.6
UsesDeployments returns a boolean indicating whether the job configuration results in a deployment during scheduling.
type JobACL ¶ added in v1.4.0
type JobACL struct { Namespace string // namespace of the job JobID string // ID of the job Group string // ID of the group Task string // ID of the task }
JobACL represents an ACL policy's attachment to a job, group, or task.
type JobAllocationsResponse ¶
type JobAllocationsResponse struct { Allocations []*AllocListStub QueryMeta }
JobAllocationsResponse is used to return the allocations for a job
type JobBatchDeregisterRequest ¶ added in v0.8.0
type JobBatchDeregisterRequest struct { // Jobs is the set of jobs to deregister Jobs map[NamespacedID]*JobDeregisterOptions // Evals is the set of evaluations to create. Evals []*Evaluation WriteRequest }
JobBatchDeregisterRequest is used to batch deregister jobs and upsert evaluations.
type JobBatchDeregisterResponse ¶ added in v0.8.0
type JobBatchDeregisterResponse struct { // JobEvals maps the job to its created evaluation JobEvals map[NamespacedID]string QueryMeta }
JobBatchDeregisterResponse is used to respond to a batch job deregistration
type JobChildrenSummary ¶ added in v0.5.3
JobChildrenSummary contains the summary of children job statuses
func (*JobChildrenSummary) Copy ¶ added in v0.5.3
func (jc *JobChildrenSummary) Copy() *JobChildrenSummary
Copy returns a new copy of a JobChildrenSummary
type JobDeregisterOptions ¶ added in v0.8.0
type JobDeregisterOptions struct { // Purge controls whether the deregister purges the job from the system or // whether the job is just marked as stopped and will be removed by the // garbage collector Purge bool }
JobDeregisterOptions configures how a job is deregistered.
type JobDeregisterRequest ¶
type JobDeregisterRequest struct { JobID string // Purge controls whether the deregister purges the job from the system or // whether the job is just marked as stopped and will be removed by the // garbage collector Purge bool // Global controls whether all regions of a multi-region job are // deregistered. It is ignored for single-region jobs. Global bool // EvalPriority is an optional priority to use on any evaluation created as // a result on this job deregistration. This value must be between 1-100 // inclusively, where a larger value corresponds to a higher priority. This // is useful when an operator wishes to push through a job deregistration // in busy clusters with a large evaluation backlog. EvalPriority int // NoShutdownDelay, if set to true, will override the group and // task shutdown_delay configuration and ignore the delay for any // allocations stopped as a result of this Deregister call. NoShutdownDelay bool // Eval is the evaluation to create that's associated with job deregister Eval *Evaluation WriteRequest }
JobDeregisterRequest is used for Job.Deregister endpoint to deregister a job as being a schedulable entity.
type JobDeregisterResponse ¶
type JobDeregisterResponse struct { EvalID string EvalCreateIndex uint64 JobModifyIndex uint64 VolumeEvalID string VolumeEvalIndex uint64 QueryMeta }
JobDeregisterResponse is used to respond to a job deregistration
type JobDescription ¶ added in v0.12.4
JobDescription records Job identification and the count of expected plugin instances
type JobDescriptions ¶ added in v0.12.4
type JobDescriptions map[string]JobNamespacedDescriptions
JobDescriptions maps Namespace to a mapping of Job.ID to JobDescription
func (JobDescriptions) Add ¶ added in v0.12.4
func (j JobDescriptions) Add(job *Job, expected int)
Add the Job to the JobDescriptions, creating maps as necessary
func (JobDescriptions) Count ¶ added in v0.12.4
func (j JobDescriptions) Count() int
Count the Expected instances for all JobDescriptions
func (JobDescriptions) Delete ¶ added in v0.12.4
func (j JobDescriptions) Delete(job *Job)
Delete the Job from the JobDescriptions
type JobDiff ¶ added in v0.4.0
type JobDiff struct { Type DiffType ID string Fields []*FieldDiff Objects []*ObjectDiff TaskGroups []*TaskGroupDiff }
JobDiff contains the diff of two jobs.
type JobDispatchRequest ¶ added in v0.5.3
type JobDispatchRequest struct { JobID string Payload []byte Meta map[string]string WriteRequest IdPrefixTemplate string }
JobDispatchRequest is used to dispatch a job based on a parameterized job
type JobDispatchResponse ¶ added in v0.5.3
type JobEvaluateRequest ¶
type JobEvaluateRequest struct { JobID string EvalOptions EvalOptions WriteRequest }
JobEvaluateRequest is used when we just need to re-evaluate a target job
type JobEvaluationsResponse ¶
type JobEvaluationsResponse struct { Evaluations []*Evaluation QueryMeta }
JobEvaluationsResponse is used to return the evaluations for a job
type JobEvent ¶ added in v1.0.0
type JobEvent struct {
Job *Job
}
JobEvent holds a newly updated Job.
type JobListRequest ¶
type JobListRequest struct { QueryOptions Fields *JobStubFields }
JobListRequest is used to parameterize a list request
type JobListResponse ¶
type JobListResponse struct { Jobs []*JobListStub QueryMeta }
JobListResponse is used for a list request
type JobListStub ¶
type JobListStub struct { ID string ParentID string Name string Namespace string `json:",omitempty"` Datacenters []string Multiregion *Multiregion Type string Priority int Periodic bool ParameterizedJob bool Stop bool Status string StatusDescription string JobSummary *JobSummary CreateIndex uint64 ModifyIndex uint64 JobModifyIndex uint64 SubmitTime int64 Meta map[string]string `json:",omitempty"` }
JobListStub is used to return a subset of job information for the job list
type JobNamespacedDescriptions ¶ added in v0.12.4
type JobNamespacedDescriptions map[string]JobDescription
JobNamespacedDescriptions maps Job.ID to JobDescription
func (JobNamespacedDescriptions) Copy ¶ added in v1.0.0
func (j JobNamespacedDescriptions) Copy() JobNamespacedDescriptions
type JobPlanRequest ¶ added in v0.4.0
type JobPlanRequest struct { Job *Job Diff bool // Toggles an annotated diff // PolicyOverride is set when the user is attempting to override any policies PolicyOverride bool WriteRequest }
JobPlanRequest is used for the Job.Plan endpoint to trigger a dry-run evaluation of the Job.
type JobPlanResponse ¶ added in v0.4.0
type JobPlanResponse struct { // Annotations stores annotations explaining decisions the scheduler made. Annotations *PlanAnnotations // FailedTGAllocs is the placement failures per task group. FailedTGAllocs map[string]*AllocMetric // JobModifyIndex is the modification index of the job. The value can be // used when running `nomad run` to ensure that the Job wasn’t modified // since the last plan. If the job is being created, the value is zero. JobModifyIndex uint64 // CreatedEvals is the set of evaluations created by the scheduler. The // reasons for this can be rolling-updates or blocked evals. CreatedEvals []*Evaluation // Diff contains the diff of the job and annotations on whether the change // causes an in-place update or create/destroy Diff *JobDiff // NextPeriodicLaunch is the time duration till the job would be launched if // submitted. NextPeriodicLaunch time.Time // Warnings contains any warnings about the given job. These may include // deprecation warnings. Warnings string WriteMeta }
JobPlanResponse is used to respond to a job plan request
type JobRegisterRequest ¶
type JobRegisterRequest struct { Job *Job // If EnforceIndex is set then the job will only be registered if the passed // JobModifyIndex matches the current Jobs index. If the index is zero, the // register only occurs if the job is new. EnforceIndex bool JobModifyIndex uint64 // PreserveCounts indicates that during job update, existing task group // counts should be preserved, over those specified in the new job spec // PreserveCounts is ignored for newly created jobs. PreserveCounts bool // PolicyOverride is set when the user is attempting to override any policies PolicyOverride bool // EvalPriority is an optional priority to use on any evaluation created as // a result on this job registration. This value must be between 1-100 // inclusively, where a larger value corresponds to a higher priority. This // is useful when an operator wishes to push through a job registration in // busy clusters with a large evaluation backlog. This avoids needing to // change the job priority which also impacts preemption. EvalPriority int // Eval is the evaluation that is associated with the job registration Eval *Evaluation // Deployment is the deployment to be create when the job is registered. If // there is an active deployment for the job it will be canceled. Deployment *Deployment WriteRequest }
JobRegisterRequest is used for Job.Register endpoint to register a job as being a schedulable entity.
type JobRegisterResponse ¶
type JobRegisterResponse struct { EvalID string EvalCreateIndex uint64 JobModifyIndex uint64 // Warnings contains any warnings about the given job. These may include // deprecation warnings. Warnings string QueryMeta }
JobRegisterResponse is used to respond to a job registration
type JobRevertRequest ¶ added in v0.6.0
type JobRevertRequest struct { // JobID is the ID of the job being reverted JobID string // JobVersion the version to revert to. JobVersion uint64 // EnforcePriorVersion if set will enforce that the job is at the given // version before reverting. EnforcePriorVersion *uint64 // ConsulToken is the Consul token that proves the submitter of the job revert // has access to the Service Identity policies associated with the job's // Consul Connect enabled services. This field is only used to transfer the // token and is not stored after the Job revert. ConsulToken string // VaultToken is the Vault token that proves the submitter of the job revert // has access to any Vault policies specified in the targeted job version. This // field is only used to transfer the token and is not stored after the Job // revert. VaultToken string WriteRequest }
JobRevertRequest is used to revert a job to a prior version.
type JobScaleRequest ¶ added in v0.11.0
type JobScaleRequest struct { JobID string Target map[string]string Count *int64 Message string Error bool Meta map[string]interface{} // PolicyOverride is set when the user is attempting to override any policies PolicyOverride bool WriteRequest }
JobScaleRequest is used for the Job.Scale endpoint to scale one of the scaling targets in a job
func (*JobScaleRequest) Validate ¶ added in v1.0.4
func (r *JobScaleRequest) Validate() error
Validate is used to validate the arguments in the request
type JobScaleStatus ¶ added in v0.11.0
type JobScaleStatusRequest ¶ added in v0.11.0
type JobScaleStatusRequest struct { JobID string QueryOptions }
JobScaleStatusRequest is used to get the scale status for a job
type JobScaleStatusResponse ¶ added in v0.11.0
type JobScaleStatusResponse struct { JobScaleStatus *JobScaleStatus QueryMeta }
JobScaleStatusResponse is used to return the scale status for a job
type JobScalingEvents ¶ added in v0.11.0
type JobScalingEvents struct { Namespace string JobID string // This map is indexed by target; currently, this is just task group // the indexed array is sorted from newest to oldest event // the array should have less than JobTrackedScalingEvents entries ScalingEvents map[string][]*ScalingEvent // Raft index ModifyIndex uint64 }
JobScalingEvents contains the scaling events for a given job
type JobServiceRegistrationsRequest ¶ added in v1.3.0
type JobServiceRegistrationsRequest struct { JobID string QueryOptions }
JobServiceRegistrationsRequest is the request object used to list all service registrations belonging to the specified Job.ID.
type JobServiceRegistrationsResponse ¶ added in v1.3.0
type JobServiceRegistrationsResponse struct { Services []*ServiceRegistration QueryMeta }
JobServiceRegistrationsResponse is the response object when performing a listing of services belonging to a namespaced job.
type JobSpecificRequest ¶
type JobSpecificRequest struct { JobID string All bool QueryOptions }
JobSpecificRequest is used when we just need to specify a target job
type JobStabilityRequest ¶ added in v0.6.0
type JobStabilityRequest struct { // Job to set the stability on JobID string JobVersion uint64 // Set the stability Stable bool WriteRequest }
JobStabilityRequest is used to marked a job as stable.
type JobStabilityResponse ¶ added in v0.6.0
type JobStabilityResponse struct {
WriteMeta
}
JobStabilityResponse is the response when marking a job as stable.
type JobStubFields ¶ added in v1.4.3
type JobStubFields struct {
Meta bool
}
Stub returns a summarized version of the job
type JobSummary ¶ added in v0.4.1
type JobSummary struct { // JobID is the ID of the job the summary is for JobID string // Namespace is the namespace of the job and its summary Namespace string // Summary contains the summary per task group for the Job Summary map[string]TaskGroupSummary // Children contains a summary for the children of this job. Children *JobChildrenSummary // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
JobSummary summarizes the state of the allocations of a job
func (*JobSummary) Copy ¶ added in v0.4.1
func (js *JobSummary) Copy() *JobSummary
Copy returns a new copy of JobSummary
type JobSummaryRequest ¶ added in v0.4.1
type JobSummaryRequest struct { JobID string QueryOptions }
JobSummaryRequest is used when we just need to get a specific job summary
type JobSummaryResponse ¶ added in v0.4.1
type JobSummaryResponse struct { JobSummary *JobSummary QueryMeta }
JobSummaryResponse is used to return a single job summary
type JobValidateRequest ¶ added in v0.5.5
type JobValidateRequest struct { Job *Job WriteRequest }
JobValidateRequest is used to validate a job
type JobValidateResponse ¶ added in v0.5.5
type JobValidateResponse struct { // DriverConfigValidated indicates whether the agent validated the driver // config DriverConfigValidated bool // ValidationErrors is a list of validation errors ValidationErrors []string // Error is a string version of any error that may have occurred Error string // Warnings contains any warnings about the given job. These may include // deprecation warnings. Warnings string }
JobValidateResponse is the response from validate request
type JobVersionsRequest ¶ added in v0.6.0
type JobVersionsRequest struct { JobID string Diffs bool QueryOptions }
JobVersionsRequest is used to get a jobs versions
type JobVersionsResponse ¶ added in v0.6.0
JobVersionsResponse is used for a job get versions request
type KeyEncryptionKeyWrapper ¶ added in v1.4.0
type KeyEncryptionKeyWrapper struct { Meta *RootKeyMeta EncryptedDataEncryptionKey []byte `json:"DEK"` KeyEncryptionKey []byte `json:"KEK"` }
KeyEncryptionKeyWrapper is the struct that gets serialized for the on-disk KMS wrapper. This struct includes the server-specific key-wrapping key and should never be sent over RPC.
type KeyringDeleteRootKeyRequest ¶ added in v1.4.0
type KeyringDeleteRootKeyRequest struct { KeyID string WriteRequest }
type KeyringDeleteRootKeyResponse ¶ added in v1.4.0
type KeyringDeleteRootKeyResponse struct {
WriteMeta
}
type KeyringGetRootKeyRequest ¶ added in v1.4.0
type KeyringGetRootKeyRequest struct { KeyID string QueryOptions }
KeyringGetRootKeyRequest is used internally for key replication only and for keyring restores.
type KeyringGetRootKeyResponse ¶ added in v1.4.0
type KeyringListRootKeyMetaRequest ¶ added in v1.4.0
type KeyringListRootKeyMetaRequest struct {
QueryOptions
}
KeyringListRootKeyMetaRequest is the argument to the Keyring.List RPC
type KeyringListRootKeyMetaResponse ¶ added in v1.4.0
type KeyringListRootKeyMetaResponse struct { Keys []*RootKeyMeta QueryMeta }
KeyringListRootKeyMetaRequest is the response value of the List RPC
type KeyringRequest ¶ added in v0.5.0
type KeyringRequest struct {
Key string
}
KeyringRequest is request objects for serf key operations.
type KeyringResponse ¶ added in v0.5.0
KeyringResponse is a unified key response and can be used for install, remove, use, as well as listing key queries.
type KeyringRotateRootKeyRequest ¶ added in v1.4.0
type KeyringRotateRootKeyRequest struct { Algorithm EncryptionAlgorithm Full bool WriteRequest }
KeyringRotateRootKeyRequest is the argument to the Keyring.Rotate RPC
type KeyringRotateRootKeyResponse ¶ added in v1.4.0
type KeyringRotateRootKeyResponse struct { Key *RootKeyMeta WriteMeta }
KeyringRotateRootKeyResponse returns the full key metadata
type KeyringUpdateRootKeyMetaRequest ¶ added in v1.4.0
type KeyringUpdateRootKeyMetaRequest struct { RootKeyMeta *RootKeyMeta Rekey bool WriteRequest }
KeyringUpdateRootKeyMetaRequest is used internally for key replication so that we have a request wrapper for writing the metadata to the FSM without including the key material
type KeyringUpdateRootKeyMetaResponse ¶ added in v1.4.0
type KeyringUpdateRootKeyMetaResponse struct {
WriteMeta
}
type KeyringUpdateRootKeyRequest ¶ added in v1.4.0
type KeyringUpdateRootKeyRequest struct { RootKey *RootKey Rekey bool WriteRequest }
KeyringUpdateRootKeyRequest is used internally for key replication only and for keyring restores. The RootKeyMeta will be extracted for applying to the FSM with the KeyringUpdateRootKeyMetaRequest (see below)
type KeyringUpdateRootKeyResponse ¶ added in v1.4.0
type KeyringUpdateRootKeyResponse struct {
WriteMeta
}
type LogConfig ¶ added in v0.3.0
LogConfig provides configuration for log rotation
func DefaultLogConfig ¶ added in v0.3.0
func DefaultLogConfig() *LogConfig
DefaultLogConfig returns the default LogConfig values.
type MessageType ¶
type MessageType uint8
const ( NodeRegisterRequestType MessageType = 0 NodeDeregisterRequestType MessageType = 1 NodeUpdateStatusRequestType MessageType = 2 NodeUpdateDrainRequestType MessageType = 3 JobRegisterRequestType MessageType = 4 JobDeregisterRequestType MessageType = 5 EvalUpdateRequestType MessageType = 6 EvalDeleteRequestType MessageType = 7 AllocUpdateRequestType MessageType = 8 AllocClientUpdateRequestType MessageType = 9 ReconcileJobSummariesRequestType MessageType = 10 VaultAccessorRegisterRequestType MessageType = 11 VaultAccessorDeregisterRequestType MessageType = 12 ApplyPlanResultsRequestType MessageType = 13 DeploymentStatusUpdateRequestType MessageType = 14 DeploymentPromoteRequestType MessageType = 15 DeploymentAllocHealthRequestType MessageType = 16 DeploymentDeleteRequestType MessageType = 17 JobStabilityRequestType MessageType = 18 ACLPolicyUpsertRequestType MessageType = 19 ACLPolicyDeleteRequestType MessageType = 20 ACLTokenUpsertRequestType MessageType = 21 ACLTokenDeleteRequestType MessageType = 22 ACLTokenBootstrapRequestType MessageType = 23 AutopilotRequestType MessageType = 24 UpsertNodeEventsType MessageType = 25 JobBatchDeregisterRequestType MessageType = 26 AllocUpdateDesiredTransitionRequestType MessageType = 27 NodeUpdateEligibilityRequestType MessageType = 28 BatchNodeUpdateDrainRequestType MessageType = 29 SchedulerConfigRequestType MessageType = 30 NodeBatchDeregisterRequestType MessageType = 31 ClusterMetadataRequestType MessageType = 32 ServiceIdentityAccessorRegisterRequestType MessageType = 33 ServiceIdentityAccessorDeregisterRequestType MessageType = 34 CSIVolumeRegisterRequestType MessageType = 35 CSIVolumeDeregisterRequestType MessageType = 36 CSIVolumeClaimRequestType MessageType = 37 ScalingEventRegisterRequestType MessageType = 38 CSIVolumeClaimBatchRequestType MessageType = 39 CSIPluginDeleteRequestType MessageType = 40 EventSinkUpsertRequestType MessageType = 41 EventSinkDeleteRequestType MessageType = 42 BatchEventSinkUpdateProgressType MessageType = 43 OneTimeTokenUpsertRequestType MessageType = 44 OneTimeTokenDeleteRequestType MessageType = 45 OneTimeTokenExpireRequestType MessageType = 46 ServiceRegistrationUpsertRequestType MessageType = 47 ServiceRegistrationDeleteByIDRequestType MessageType = 48 ServiceRegistrationDeleteByNodeIDRequestType MessageType = 49 VarApplyStateRequestType MessageType = 50 RootKeyMetaUpsertRequestType MessageType = 51 RootKeyMetaDeleteRequestType MessageType = 52 ACLRolesUpsertRequestType MessageType = 53 ACLRolesDeleteByIDRequestType MessageType = 54 // Namespace types were moved from enterprise and therefore start at 64 NamespaceUpsertRequestType MessageType = 64 NamespaceDeleteRequestType MessageType = 65 )
note: new raft message types need to be added to the end of this list of contents
type MigrateStrategy ¶ added in v0.8.0
type MigrateStrategy struct { MaxParallel int HealthCheck string MinHealthyTime time.Duration HealthyDeadline time.Duration }
func DefaultMigrateStrategy ¶ added in v0.8.0
func DefaultMigrateStrategy() *MigrateStrategy
DefaultMigrateStrategy is used for backwards compat with pre-0.8 Allocations that lack an update strategy.
This function should match its counterpart in api/tasks.go
func (*MigrateStrategy) Validate ¶ added in v0.8.0
func (m *MigrateStrategy) Validate() error
type Multiregion ¶ added in v0.12.0
type Multiregion struct { Strategy *MultiregionStrategy Regions []*MultiregionRegion }
func (*Multiregion) Canonicalize ¶ added in v0.12.0
func (m *Multiregion) Canonicalize()
func (*Multiregion) Copy ¶ added in v0.12.0
func (m *Multiregion) Copy() *Multiregion
func (*Multiregion) Diff ¶ added in v0.12.0
func (m *Multiregion) Diff(m2 *Multiregion) bool
Diff indicates whether the multiregion config has changed
type MultiregionRegion ¶ added in v0.12.0
type MultiregionStrategy ¶ added in v0.12.0
type Namespace ¶ added in v1.0.0
type Namespace struct { // Name is the name of the namespace Name string // Description is a human readable description of the namespace Description string // Quota is the quota specification that the namespace should account // against. Quota string // Capabilities is the set of capabilities allowed for this namespace Capabilities *NamespaceCapabilities // Meta is the set of metadata key/value pairs that attached to the namespace Meta map[string]string // Hash is the hash of the namespace which is used to efficiently replicate // cross-regions. Hash []byte // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
Namespace allows logically grouping jobs and their associated objects.
type NamespaceCapabilities ¶ added in v1.3.0
NamespaceCapabilities represents a set of capabilities allowed for this namespace, to be checked at job submission time.
type NamespaceDeleteRequest ¶ added in v1.0.0
type NamespaceDeleteRequest struct { Namespaces []string WriteRequest }
NamespaceDeleteRequest is used to delete a set of namespaces
type NamespaceListRequest ¶ added in v1.0.0
type NamespaceListRequest struct {
QueryOptions
}
NamespaceListRequest is used to request a list of namespaces
type NamespaceListResponse ¶ added in v1.0.0
NamespaceListResponse is used for a list request
type NamespaceSetRequest ¶ added in v1.0.0
type NamespaceSetRequest struct { Namespaces []string QueryOptions }
NamespaceSetRequest is used to query a set of namespaces
type NamespaceSetResponse ¶ added in v1.0.0
type NamespaceSetResponse struct { Namespaces map[string]*Namespace // Keyed by namespace Name QueryMeta }
NamespaceSetResponse is used to return a set of namespaces
type NamespaceSpecificRequest ¶ added in v1.0.0
type NamespaceSpecificRequest struct { Name string QueryOptions }
NamespaceSpecificRequest is used to query a specific namespace
type NamespaceUpsertRequest ¶ added in v1.0.0
type NamespaceUpsertRequest struct { Namespaces []*Namespace WriteRequest }
NamespaceUpsertRequest is used to upsert a set of namespaces
type NamespacedID ¶ added in v0.7.0
NamespacedID is a tuple of an ID and a namespace
func NewNamespacedID ¶ added in v0.8.7
func NewNamespacedID(id, ns string) NamespacedID
NewNamespacedID returns a new namespaced ID given the ID and namespace
func (NamespacedID) String ¶ added in v0.8.0
func (n NamespacedID) String() string
type NativeServiceDiscoveryUsage ¶ added in v1.4.2
type NativeServiceDiscoveryUsage struct { Basic *set.Set[string] // implies v1.3.0 + ${attr.nomad.service_discovery} Checks *set.Set[string] // implies v1.4.0 }
NativeServiceDiscoveryUsage tracks which groups make use of the nomad service discovery provider, and also which of those groups make use of checks. This information will be used to configure implicit constraints on the job.
func (*NativeServiceDiscoveryUsage) Empty ¶ added in v1.4.2
func (u *NativeServiceDiscoveryUsage) Empty() bool
Empty returns true if no groups are using native service discovery.
type NetworkIndex ¶
type NetworkIndex struct { // TaskNetworks are the node networks available for // task.resources.network asks. TaskNetworks []*NetworkResource // GroupNetworks are the node networks available for group.network // asks. GroupNetworks []*NodeNetworkResource // HostNetworks indexes addresses by host network alias HostNetworks map[string][]NodeNetworkAddress // UsedPorts tracks which ports are used on a per-IP address basis. For // example if a node has `network_interface=lo` and port 22 reserved, // then on a dual stack loopback interface UsedPorts would contain: // { // "127.0.0.1": Bitmap{22}, // "::1": Bitmap{22}, // } UsedPorts map[string]Bitmap // Deprecated bandwidth fields AvailBandwidth map[string]int // Bandwidth by device UsedBandwidth map[string]int // Bandwidth by device MinDynamicPort int // The smallest dynamic port generated MaxDynamicPort int // The largest dynamic port generated }
NetworkIndex is used to index the available network resources and the used network resources on a machine given allocations
Fields are exported so they may be JSON serialized for debugging. Fields are *not* intended to be used directly.
func NewNetworkIndex ¶
func NewNetworkIndex() *NetworkIndex
NewNetworkIndex is used to construct a new network index
func (*NetworkIndex) AddAllocs ¶
func (idx *NetworkIndex) AddAllocs(allocs []*Allocation) (collide bool, reason string)
AddAllocs is used to add the used network resources. Returns true if there is a collision
AddAllocs may be called multiple times for the same NetworkIndex with UsedPorts cleared between calls (by Release). Therefore AddAllocs must be determistic and must not manipulate state outside of UsedPorts as that state would persist between Release calls.
func (*NetworkIndex) AddReserved ¶
func (idx *NetworkIndex) AddReserved(n *NetworkResource) (collide bool, reasons []string)
AddReserved is used to add a reserved network usage, returns true if there is a port collision
func (*NetworkIndex) AddReservedPorts ¶ added in v0.12.0
func (idx *NetworkIndex) AddReservedPorts(ports AllocatedPorts) (collide bool, reasons []string)
func (*NetworkIndex) AddReservedPortsForIP ¶ added in v0.12.0
func (idx *NetworkIndex) AddReservedPortsForIP(ports []uint64, ip string) (collide bool, reasons []string)
AddReservedPortsForIP checks whether any reserved ports collide with those in use for the IP address.
func (*NetworkIndex) AssignPorts ¶ added in v0.12.0
func (idx *NetworkIndex) AssignPorts(ask *NetworkResource) (AllocatedPorts, error)
AssignPorts based on an ask from the scheduler processing a group.network block. Supports multi-interfaces through node configured host_networks.
AssignTaskNetwork supports the deprecated task.resources.network block.
func (*NetworkIndex) AssignTaskNetwork ¶ added in v1.1.15
func (idx *NetworkIndex) AssignTaskNetwork(ask *NetworkResource) (out *NetworkResource, err error)
AssignTaskNetwork is used to offer network resources given a task.resources.network ask. If the ask cannot be satisfied, returns nil
AssignTaskNetwork and task.resources.network are deprecated in favor of AssignPorts and group.network. AssignTaskNetwork does not support multiple interfaces and only uses the node's default interface. AssignPorts is the method that is used for group.network asks.
func (*NetworkIndex) Copy ¶ added in v1.0.16
func (idx *NetworkIndex) Copy() *NetworkIndex
func (*NetworkIndex) Overcommitted ¶
func (idx *NetworkIndex) Overcommitted() bool
Overcommitted checks if the network is overcommitted
func (*NetworkIndex) Release ¶ added in v0.3.0
func (idx *NetworkIndex) Release()
Release is called when the network index is no longer needed to attempt to re-use some of the memory it has allocated
func (*NetworkIndex) SetNode ¶
func (idx *NetworkIndex) SetNode(node *Node) error
SetNode is used to initialize a node's network index with available IPs, reserved ports, and other details from a node's configuration and fingerprinting.
SetNode must be idempotent as preemption causes SetNode to be called multiple times on the same NetworkIndex, only clearing UsedPorts between calls.
An error is returned if the Node cannot produce a consistent NetworkIndex such as if reserved_ports are unparseable.
Any errors returned by SetNode indicate a bug! The bug may lie in client code not properly validating its configuration or it may lie in improper Node object handling by servers. Users should not be able to cause SetNode to error. Data that cause SetNode to error should be caught upstream such as a client agent refusing to start with an invalid configuration.
type NetworkResource ¶
type NetworkResource struct { Mode string // Mode of the network Device string // Name of the device CIDR string // CIDR block of addresses IP string // Host IP address Hostname string `json:",omitempty"` // Hostname of the network namespace MBits int // Throughput DNS *DNSConfig // DNS Configuration ReservedPorts []Port // Host Reserved ports DynamicPorts []Port // Host Dynamically assigned ports }
NetworkResource is used to represent available network resources
func AllocatedPortsToNetworkResouce ¶ added in v0.12.0
func AllocatedPortsToNetworkResouce(ask *NetworkResource, ports AllocatedPorts, node *NodeResources) *NetworkResource
AllocatedPortsToNetworkResouce is a COMPAT(1.0) remove when NetworkResource is no longer used for materialized client view of ports.
func (*NetworkResource) Add ¶
func (n *NetworkResource) Add(delta *NetworkResource)
Add adds the resources of the delta to this, potentially returning an error if not possible.
func (*NetworkResource) Canonicalize ¶ added in v0.4.1
func (n *NetworkResource) Canonicalize()
func (*NetworkResource) Copy ¶
func (n *NetworkResource) Copy() *NetworkResource
Copy returns a deep copy of the network resource
func (*NetworkResource) Diff ¶ added in v0.4.0
func (n *NetworkResource) Diff(other *NetworkResource, contextual bool) *ObjectDiff
Diff returns a diff of two network resources. If contextual diff is enabled, non-changed fields will still be returned.
func (*NetworkResource) Equals ¶ added in v0.8.0
func (n *NetworkResource) Equals(other *NetworkResource) bool
func (*NetworkResource) GoString ¶
func (n *NetworkResource) GoString() string
func (*NetworkResource) Hash ¶ added in v0.12.0
func (n *NetworkResource) Hash() uint32
func (*NetworkResource) PortLabels ¶ added in v0.6.0
func (n *NetworkResource) PortLabels() map[string]int
PortLabels returns a map of port labels to their assigned host ports.
type NetworkStatus ¶ added in v1.4.0
type NetworkStatus interface {
NetworkStatus() *AllocNetworkStatus
}
NetworkStatus is an interface satisfied by alloc runner, for acquiring the network status of an allocation.
type Networks ¶ added in v0.6.0
type Networks []*NetworkResource
Networks defined for a task on the Resources struct.
func (Networks) NetIndex ¶ added in v0.9.0
func (ns Networks) NetIndex(n *NetworkResource) int
func (Networks) Port ¶ added in v0.6.0
func (ns Networks) Port(label string) AllocatedPortMapping
Port assignment and IP for the given label or empty values.
type Node ¶
type Node struct { // ID is a unique identifier for the node. It can be constructed // by doing a concatenation of the Name and Datacenter as a simple // approach. Alternatively a UUID may be used. ID string // SecretID is an ID that is only known by the Node and the set of Servers. // It is not accessible via the API and is used to authenticate nodes // conducting privileged activities. SecretID string // Datacenter for this node Datacenter string // Node name Name string // CgroupParent for this node (linux only) CgroupParent string // HTTPAddr is the address on which the Nomad client is listening for http // requests HTTPAddr string // TLSEnabled indicates if the Agent has TLS enabled for the HTTP API TLSEnabled bool // Attributes is an arbitrary set of key/value // data that can be used for constraints. Examples // include "kernel.name=linux", "arch=386", "driver.docker=1", // "docker.runtime=1.8.3" Attributes map[string]string // NodeResources captures the available resources on the client. NodeResources *NodeResources // ReservedResources captures the set resources on the client that are // reserved from scheduling. ReservedResources *NodeReservedResources // Resources is the available resources on the client. // For example 'cpu=2' 'memory=2048' // COMPAT(0.10): Remove after 0.10 Resources *Resources // Reserved is the set of resources that are reserved, // and should be subtracted from the total resources for // the purposes of scheduling. This may be provide certain // high-watermark tolerances or because of external schedulers // consuming resources. // COMPAT(0.10): Remove after 0.10 Reserved *Resources // Links are used to 'link' this client to external // systems. For example 'consul=foo.dc1' 'aws=i-83212' // 'ami=ami-123' Links map[string]string // Meta is used to associate arbitrary metadata with this // client. This is opaque to Nomad. Meta map[string]string // NodeClass is an opaque identifier used to group nodes // together for the purpose of determining scheduling pressure. NodeClass string // ComputedClass is a unique id that identifies nodes with a common set of // attributes and capabilities. ComputedClass string // DrainStrategy determines the node's draining behavior. // Will be non-nil only while draining. DrainStrategy *DrainStrategy // SchedulingEligibility determines whether this node will receive new // placements. SchedulingEligibility string // Status of this node Status string // StatusDescription is meant to provide more human useful information StatusDescription string // StatusUpdatedAt is the time stamp at which the state of the node was // updated StatusUpdatedAt int64 // Events is the most recent set of events generated for the node, // retaining only MaxRetainedNodeEvents number at a time Events []*NodeEvent // Drivers is a map of driver names to current driver information Drivers map[string]*DriverInfo // CSIControllerPlugins is a map of plugin names to current CSI Plugin info CSIControllerPlugins map[string]*CSIInfo // CSINodePlugins is a map of plugin names to current CSI Plugin info CSINodePlugins map[string]*CSIInfo // HostVolumes is a map of host volume names to their configuration HostVolumes map[string]*ClientHostVolumeConfig // HostNetworks is a map of host host_network names to their configuration HostNetworks map[string]*ClientHostNetworkConfig // LastDrain contains metadata about the most recent drain operation LastDrain *DrainMetadata // LastMissedHeartbeatIndex stores the Raft index when the node last missed // a heartbeat. It resets to zero once the node is marked as ready again. LastMissedHeartbeatIndex uint64 // LastAllocUpdateIndex stores the Raft index of the last time the node // updatedd its allocations status. LastAllocUpdateIndex uint64 // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
Node is a representation of a schedulable client node
func MockNvidiaNode ¶ added in v0.9.0
func MockNvidiaNode() *Node
MockNvidiaNode returns a node with two instances of an Nvidia GPU
func (*Node) Canonicalize ¶ added in v0.8.0
func (n *Node) Canonicalize()
func (*Node) ComparableReservedResources ¶ added in v0.9.0
func (n *Node) ComparableReservedResources() *ComparableResources
ComparableReservedResources returns the reserved resouces on the node handling upgrade paths. Reserved networks must be handled separately. After 0.11 calls to this should be replaced with: node.ReservedResources.Comparable()
COMPAT(0.11): Remove in 0.11
func (*Node) ComparableResources ¶ added in v0.9.0
func (n *Node) ComparableResources() *ComparableResources
ComparableResources returns the resouces on the node handling upgrade paths. Networking must be handled separately. After 0.11 calls to this should be replaced with: node.NodeResources.Comparable()
// COMPAT(0.11): Remove in 0.11
func (*Node) ComputeClass ¶ added in v0.3.0
ComputeClass computes a derived class for the node based on its attributes. ComputedClass is a unique id that identifies nodes with a common set of attributes and capabilities. Thus, when calculating a node's computed class we avoid including any uniquely identifying fields.
func (*Node) GetID ¶ added in v1.3.0
GetID is a helper for getting the ID when the object may be nil and is required for pagination.
func (Node) HashInclude ¶ added in v0.3.0
HashInclude is used to denylist uniquely identifying node fields from being included in the computed node class.
func (Node) HashIncludeMap ¶ added in v0.3.0
HashIncludeMap is used to denylist uniquely identifying node map keys from being included in the computed node class.
func (*Node) Ready ¶ added in v0.5.0
Ready returns true if the node is ready for running allocations
func (*Node) Sanitize ¶ added in v1.1.0
Sanitize returns a copy of the Node omitting confidential fields It only returns a copy if the Node contains the confidential fields
func (*Node) Stub ¶
func (n *Node) Stub(fields *NodeStubFields) *NodeListStub
Stub returns a summarized version of the node
func (*Node) TerminalStatus ¶
TerminalStatus returns if the current status is terminal and will no longer transition.
func (*Node) UnresponsiveStatus ¶ added in v1.3.10
UnresponsiveStatus returns true if the node is a status where it is not communicating with the server.
type NodeAllocsResponse ¶
type NodeAllocsResponse struct { Allocs []*Allocation QueryMeta }
NodeAllocsResponse is used to return allocs for a single node
type NodeBatchDeregisterRequest ¶ added in v0.9.4
type NodeBatchDeregisterRequest struct { NodeIDs []string WriteRequest }
NodeBatchDeregisterRequest is used for Node.BatchDeregister endpoint to deregister a batch of nodes from being schedulable entities.
type NodeClientAllocsResponse ¶ added in v0.3.0
type NodeClientAllocsResponse struct { Allocs map[string]uint64 // MigrateTokens are used when ACLs are enabled to allow cross node, // authenticated access to sticky volumes MigrateTokens map[string]string QueryMeta }
NodeClientAllocsResponse is used to return allocs meta data for a single node
type NodeConnQueryResponse ¶ added in v0.8.0
type NodeConnQueryResponse struct { // Connected indicates whether a connection to the Client exists Connected bool // Established marks the time at which the connection was established Established time.Time QueryMeta }
NodeConnQueryResponse is used to respond to a query of whether a server has a connection to a specific Node
type NodeCpuResources ¶ added in v0.9.0
type NodeCpuResources struct { // cores multiplied by the core frequency. CpuShares int64 // TotalCpuCores is the total number of cores on the machine. This includes cores not in // the agent's cpuset if on a linux platform TotalCpuCores uint16 // ReservableCpuCores is the set of cpus which are available to be reserved on the Node. // This value is currently only reported on Linux platforms which support cgroups and is // discovered by inspecting the cpuset of the agent's cgroup. ReservableCpuCores []uint16 }
NodeCpuResources captures the CPU resources of the node.
func (NodeCpuResources) Copy ¶ added in v1.0.16
func (n NodeCpuResources) Copy() NodeCpuResources
func (*NodeCpuResources) Equals ¶ added in v0.9.0
func (n *NodeCpuResources) Equals(o *NodeCpuResources) bool
func (*NodeCpuResources) Merge ¶ added in v0.9.0
func (n *NodeCpuResources) Merge(o *NodeCpuResources)
func (*NodeCpuResources) SharesPerCore ¶ added in v1.1.0
func (n *NodeCpuResources) SharesPerCore() int64
type NodeDeregisterRequest ¶
type NodeDeregisterRequest struct { NodeID string WriteRequest }
NodeDeregisterRequest is used for Node.Deregister endpoint to deregister a node as being a schedulable entity.
type NodeDevice ¶ added in v0.9.0
type NodeDevice struct { // ID is the ID of the device. ID string // Healthy captures whether the device is healthy. Healthy bool // HealthDescription is used to provide a human readable description of why // the device may be unhealthy. HealthDescription string // Locality stores HW locality information for the node to optionally be // used when making placement decisions. Locality *NodeDeviceLocality }
NodeDevice is an instance of a particular device.
func (*NodeDevice) Copy ¶ added in v0.9.0
func (n *NodeDevice) Copy() *NodeDevice
func (*NodeDevice) Equals ¶ added in v0.9.0
func (n *NodeDevice) Equals(o *NodeDevice) bool
type NodeDeviceLocality ¶ added in v0.9.0
type NodeDeviceLocality struct { // PciBusID is the PCI Bus ID for the device. PciBusID string }
NodeDeviceLocality stores information about the devices hardware locality on the node.
func (*NodeDeviceLocality) Copy ¶ added in v0.9.0
func (n *NodeDeviceLocality) Copy() *NodeDeviceLocality
func (*NodeDeviceLocality) Equals ¶ added in v0.9.0
func (n *NodeDeviceLocality) Equals(o *NodeDeviceLocality) bool
type NodeDeviceResource ¶ added in v0.9.0
type NodeDeviceResource struct { Vendor string Type string Name string Instances []*NodeDevice Attributes map[string]*psstructs.Attribute }
NodeDeviceResource captures a set of devices sharing a common vendor/type/device_name tuple.
func (*NodeDeviceResource) Copy ¶ added in v0.9.0
func (n *NodeDeviceResource) Copy() *NodeDeviceResource
func (*NodeDeviceResource) Equals ¶ added in v0.9.0
func (n *NodeDeviceResource) Equals(o *NodeDeviceResource) bool
func (NodeDeviceResource) HashInclude ¶ added in v0.9.0
func (n NodeDeviceResource) HashInclude(field string, v interface{}) (bool, error)
HashInclude is used to denylist uniquely identifying node fields from being included in the computed node class.
func (NodeDeviceResource) HashIncludeMap ¶ added in v0.9.0
func (n NodeDeviceResource) HashIncludeMap(field string, k, v interface{}) (bool, error)
HashIncludeMap is used to denylist uniquely identifying node map keys from being included in the computed node class.
func (*NodeDeviceResource) ID ¶ added in v0.9.0
func (n *NodeDeviceResource) ID() *DeviceIdTuple
type NodeDiskResources ¶ added in v0.9.0
type NodeDiskResources struct { // DiskMB is the total available disk space on the node DiskMB int64 }
NodeDiskResources captures the disk resources of the node
func (*NodeDiskResources) Equals ¶ added in v0.9.0
func (n *NodeDiskResources) Equals(o *NodeDiskResources) bool
func (*NodeDiskResources) Merge ¶ added in v0.9.0
func (n *NodeDiskResources) Merge(o *NodeDiskResources)
type NodeDrainUpdateResponse ¶
type NodeDrainUpdateResponse struct { NodeModifyIndex uint64 EvalIDs []string EvalCreateIndex uint64 WriteMeta }
NodeDrainUpdateResponse is used to respond to a node drain update
type NodeEligibilityUpdateResponse ¶ added in v0.8.0
type NodeEligibilityUpdateResponse struct { NodeModifyIndex uint64 EvalIDs []string EvalCreateIndex uint64 WriteMeta }
NodeEligibilityUpdateResponse is used to respond to a node eligibility update
type NodeEvaluateRequest ¶
type NodeEvaluateRequest struct { NodeID string WriteRequest }
NodeEvaluateRequest is used to re-evaluate the node
type NodeEvent ¶ added in v0.8.0
type NodeEvent struct { Message string Subsystem string Details map[string]string Timestamp time.Time CreateIndex uint64 }
NodeEvent is a single unit representing a node’s state change
func NewNodeEvent ¶ added in v0.8.4
func NewNodeEvent() *NodeEvent
NewNodeEvent generates a new node event storing the current time as the timestamp
func (*NodeEvent) SetMessage ¶ added in v0.8.4
SetMessage is used to set the message on the node event
func (*NodeEvent) SetSubsystem ¶ added in v0.8.4
SetSubsystem is used to set the subsystem on the node event
func (*NodeEvent) SetTimestamp ¶ added in v0.8.4
SetTimestamp is used to set the timestamp on the node event
type NodeListRequest ¶
type NodeListRequest struct { QueryOptions Fields *NodeStubFields }
NodeListRequest is used to parameterize a list request
type NodeListResponse ¶
type NodeListResponse struct { Nodes []*NodeListStub QueryMeta }
NodeListResponse is used for a list request
type NodeListStub ¶
type NodeListStub struct { Address string ID string Attributes map[string]string `json:",omitempty"` Datacenter string Name string NodeClass string Version string Drain bool SchedulingEligibility string Status string StatusDescription string Drivers map[string]*DriverInfo HostVolumes map[string]*ClientHostVolumeConfig NodeResources *NodeResources `json:",omitempty"` ReservedResources *NodeReservedResources `json:",omitempty"` LastDrain *DrainMetadata CreateIndex uint64 ModifyIndex uint64 }
NodeListStub is used to return a subset of job information for the job list
type NodeMemoryResources ¶ added in v0.9.0
type NodeMemoryResources struct { // MemoryMB is the total available memory on the node MemoryMB int64 }
NodeMemoryResources captures the memory resources of the node
func (*NodeMemoryResources) Equals ¶ added in v0.9.0
func (n *NodeMemoryResources) Equals(o *NodeMemoryResources) bool
func (*NodeMemoryResources) Merge ¶ added in v0.9.0
func (n *NodeMemoryResources) Merge(o *NodeMemoryResources)
type NodeNetworkAF ¶ added in v0.12.0
type NodeNetworkAF string
const ( NodeNetworkAF_IPv4 NodeNetworkAF = "ipv4" NodeNetworkAF_IPv6 NodeNetworkAF = "ipv6" )
type NodeNetworkAddress ¶ added in v0.12.0
type NodeNetworkAddress struct { Family NodeNetworkAF Alias string Address string ReservedPorts string Gateway string // default route for this address }
type NodeNetworkResource ¶ added in v0.12.0
type NodeNetworkResource struct { Mode string // host for physical networks, cni/<name> for cni networks // The following apply only to host networks Device string // interface name MacAddress string Speed int Addresses []NodeNetworkAddress // not valid for cni, for bridge there will only be 1 ip }
NodeNetworkResource is used to describe a fingerprinted network of a node
func (*NodeNetworkResource) Copy ¶ added in v1.0.16
func (n *NodeNetworkResource) Copy() *NodeNetworkResource
func (*NodeNetworkResource) Equals ¶ added in v0.12.0
func (n *NodeNetworkResource) Equals(o *NodeNetworkResource) bool
func (*NodeNetworkResource) HasAlias ¶ added in v0.12.0
func (n *NodeNetworkResource) HasAlias(alias string) bool
type NodeRegisterRequest ¶
type NodeRegisterRequest struct { Node *Node NodeEvent *NodeEvent WriteRequest }
NodeRegisterRequest is used for Node.Register endpoint to register a node as being a schedulable entity.
type NodeReservedCpuResources ¶ added in v0.9.0
type NodeReservedCpuResources struct { ReservedCpuCores []uint16 }
NodeReservedCpuResources captures the reserved CPU resources of the node.
type NodeReservedDiskResources ¶ added in v0.9.0
type NodeReservedDiskResources struct {
DiskMB int64
}
NodeReservedDiskResources captures the reserved disk resources of the node.
type NodeReservedMemoryResources ¶ added in v0.9.0
type NodeReservedMemoryResources struct {
MemoryMB int64
}
NodeReservedMemoryResources captures the reserved memory resources of the node.
type NodeReservedNetworkResources ¶ added in v0.9.0
type NodeReservedNetworkResources struct { // ReservedHostPorts is the set of ports reserved on all host network // interfaces. Its format is a comma separate list of integers or integer // ranges. (80,443,1000-2000,2005) ReservedHostPorts string }
NodeReservedNetworkResources captures the reserved network resources of the node.
func (*NodeReservedNetworkResources) ParseReservedHostPorts ¶ added in v0.9.0
func (n *NodeReservedNetworkResources) ParseReservedHostPorts() ([]uint64, error)
ParseReservedHostPorts returns the reserved host ports.
type NodeReservedResources ¶ added in v0.9.0
type NodeReservedResources struct { Cpu NodeReservedCpuResources Memory NodeReservedMemoryResources Disk NodeReservedDiskResources Networks NodeReservedNetworkResources }
NodeReservedResources is used to capture the resources on a client node that should be reserved and not made available to jobs.
func (*NodeReservedResources) Comparable ¶ added in v0.9.0
func (n *NodeReservedResources) Comparable() *ComparableResources
Comparable returns a comparable version of the node's reserved resources. The returned resources doesn't contain any network information. This conversion can be lossy so care must be taken when using it.
func (*NodeReservedResources) Copy ¶ added in v0.9.0
func (n *NodeReservedResources) Copy() *NodeReservedResources
type NodeResources ¶ added in v0.9.0
type NodeResources struct { Cpu NodeCpuResources Memory NodeMemoryResources Disk NodeDiskResources Devices []*NodeDeviceResource // NodeNetworks was added in Nomad 0.12 to support multiple interfaces. // It is the superset of host_networks, fingerprinted networks, and the // node's default interface. NodeNetworks []*NodeNetworkResource // Networks is the node's bridge network and default interface. It is // only used when scheduling jobs with a deprecated // task.resources.network block. Networks Networks // MinDynamicPort and MaxDynamicPort represent the inclusive port range // to select dynamic ports from across all networks. MinDynamicPort int MaxDynamicPort int }
NodeResources is used to define the resources available on a client node.
func (*NodeResources) Comparable ¶ added in v0.9.0
func (n *NodeResources) Comparable() *ComparableResources
Comparable returns a comparable version of the nodes resources. This conversion can be lossy so care must be taken when using it.
func (*NodeResources) Copy ¶ added in v0.9.0
func (n *NodeResources) Copy() *NodeResources
func (*NodeResources) Equals ¶ added in v0.9.0
func (n *NodeResources) Equals(o *NodeResources) bool
func (NodeResources) HashInclude ¶ added in v0.9.0
func (n NodeResources) HashInclude(field string, v interface{}) (bool, error)
HashInclude is used to denylist uniquely identifying node fields from being included in the computed node class.
func (*NodeResources) Merge ¶ added in v0.9.0
func (n *NodeResources) Merge(o *NodeResources)
type NodeScoreMeta ¶ added in v0.9.0
NodeScoreMeta captures scoring meta data derived from different scoring factors.
func CopySliceNodeScoreMeta ¶ added in v0.9.0
func CopySliceNodeScoreMeta(s []*NodeScoreMeta) []*NodeScoreMeta
func (*NodeScoreMeta) Copy ¶ added in v0.9.0
func (s *NodeScoreMeta) Copy() *NodeScoreMeta
func (*NodeScoreMeta) Data ¶ added in v0.9.0
func (s *NodeScoreMeta) Data() interface{}
func (*NodeScoreMeta) Score ¶ added in v0.9.0
func (s *NodeScoreMeta) Score() float64
func (*NodeScoreMeta) String ¶ added in v0.9.0
func (s *NodeScoreMeta) String() string
type NodeServerInfo ¶ added in v0.4.0
type NodeServerInfo struct { // RPCAdvertiseAddr is the IP endpoint that a Nomad Server wishes to // be contacted at for RPCs. RPCAdvertiseAddr string // RpcMajorVersion is the major version number the Nomad Server // supports RPCMajorVersion int32 // RpcMinorVersion is the minor version number the Nomad Server // supports RPCMinorVersion int32 // Datacenter is the datacenter that a Nomad server belongs to Datacenter string }
NodeServerInfo is used to in NodeUpdateResponse to return Nomad server information used in RPC server lists.
type NodeSpecificRequest ¶
type NodeSpecificRequest struct { NodeID string SecretID string QueryOptions }
NodeSpecificRequest is used when we just need to specify a target node
type NodeStreamEvent ¶ added in v1.0.0
type NodeStreamEvent struct {
Node *Node
}
NodeStreamEvent holds a newly updated Node
type NodeStubFields ¶ added in v1.0.0
NodeStubFields defines which fields are included in the NodeListStub.
type NodeUpdateDrainRequest ¶
type NodeUpdateDrainRequest struct { NodeID string DrainStrategy *DrainStrategy // MarkEligible marks the node as eligible if removing the drain strategy. MarkEligible bool // NodeEvent is the event added to the node NodeEvent *NodeEvent // UpdatedAt represents server time of receiving request UpdatedAt int64 // Meta is user-provided metadata relating to the drain operation Meta map[string]string WriteRequest }
NodeUpdateDrainRequest is used for updating the drain strategy
type NodeUpdateEligibilityRequest ¶ added in v0.8.0
type NodeUpdateEligibilityRequest struct { NodeID string Eligibility string // NodeEvent is the event added to the node NodeEvent *NodeEvent // UpdatedAt represents server time of receiving request UpdatedAt int64 WriteRequest }
NodeUpdateEligibilityRequest is used for updating the scheduling eligibility
type NodeUpdateResponse ¶
type NodeUpdateResponse struct { HeartbeatTTL time.Duration EvalIDs []string EvalCreateIndex uint64 NodeModifyIndex uint64 // Features informs clients what enterprise features are allowed Features uint64 // LeaderRPCAddr is the RPC address of the current Raft Leader. If // empty, the current Nomad Server is in the minority of a partition. LeaderRPCAddr string // NumNodes is the number of Nomad nodes attached to this quorum of // Nomad Servers at the time of the response. This value can // fluctuate based on the health of the cluster between heartbeats. NumNodes int32 // Servers is the full list of known Nomad servers in the local // region. Servers []*NodeServerInfo // SchedulingEligibility is used to inform clients what the server-side // has for their scheduling status during heartbeats. SchedulingEligibility string QueryMeta }
NodeUpdateResponse is used to respond to a node update
type NodeUpdateStatusRequest ¶
type NodeUpdateStatusRequest struct { NodeID string Status string NodeEvent *NodeEvent UpdatedAt int64 WriteRequest }
NodeUpdateStatusRequest is used for Node.UpdateStatus endpoint to update the status of a node.
type ObjectDiff ¶ added in v0.4.0
type ObjectDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff }
ObjectDiff contains the diff of two generic objects.
func (*ObjectDiff) GoString ¶ added in v0.4.0
func (o *ObjectDiff) GoString() string
func (*ObjectDiff) Less ¶ added in v0.4.0
func (o *ObjectDiff) Less(other *ObjectDiff) bool
type ObjectDiffs ¶ added in v0.4.0
type ObjectDiffs []*ObjectDiff
For sorting ObjectDiffs
func (ObjectDiffs) Len ¶ added in v0.4.0
func (o ObjectDiffs) Len() int
func (ObjectDiffs) Less ¶ added in v0.4.0
func (o ObjectDiffs) Less(i, j int) bool
func (ObjectDiffs) Swap ¶ added in v0.4.0
func (o ObjectDiffs) Swap(i, j int)
type OneTimeToken ¶ added in v1.1.0
type OneTimeToken struct { OneTimeSecretID string AccessorID string ExpiresAt time.Time CreateIndex uint64 ModifyIndex uint64 }
OneTimeToken is used to log into the web UI using a token provided by the command line.
type OneTimeTokenDeleteRequest ¶ added in v1.1.0
type OneTimeTokenDeleteRequest struct { AccessorIDs []string WriteRequest }
OneTimeTokenDeleteRequest is a request to delete a group of one-time tokens
type OneTimeTokenExchangeRequest ¶ added in v1.1.0
type OneTimeTokenExchangeRequest struct { OneTimeSecretID string WriteRequest }
OneTimeTokenExchangeRequest is a request to swap the one-time token with the backing ACL token
type OneTimeTokenExchangeResponse ¶ added in v1.1.0
OneTimeTokenExchangeResponse is the response to swapping the one-time token with the backing ACL token
type OneTimeTokenExpireRequest ¶ added in v1.1.0
type OneTimeTokenExpireRequest struct { Timestamp time.Time WriteRequest }
OneTimeTokenExpireRequest is a request to delete all expired one-time tokens
type OneTimeTokenUpsertRequest ¶ added in v1.1.0
type OneTimeTokenUpsertRequest struct {
WriteRequest
}
OneTimeTokenUpsertRequest is the request for a UpsertOneTimeToken RPC
type OneTimeTokenUpsertResponse ¶ added in v1.1.0
type OneTimeTokenUpsertResponse struct { OneTimeToken *OneTimeToken WriteMeta }
OneTimeTokenUpsertResponse is the response to a UpsertOneTimeToken RPC.
type OperatorHealthReply ¶ added in v1.4.0
type OperatorHealthReply struct { // Healthy is true if all the servers in the cluster are healthy. Healthy bool // FailureTolerance is the number of healthy servers that could be lost without // an outage occurring. FailureTolerance int // Servers holds the health of each server. Servers []ServerHealth }
OperatorHealthReply is a representation of the overall health of the cluster
type ParameterizedJobConfig ¶ added in v0.5.3
type ParameterizedJobConfig struct { // Payload configure the payload requirements Payload string // MetaRequired is metadata keys that must be specified by the dispatcher MetaRequired []string // MetaOptional is metadata keys that may be specified by the dispatcher MetaOptional []string }
ParameterizedJobConfig is used to configure the parameterized job
func (*ParameterizedJobConfig) Canonicalize ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Canonicalize()
func (*ParameterizedJobConfig) Copy ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Copy() *ParameterizedJobConfig
func (*ParameterizedJobConfig) Validate ¶ added in v0.5.3
func (d *ParameterizedJobConfig) Validate() error
type PeriodicConfig ¶ added in v0.2.2
type PeriodicConfig struct { // Enabled determines if the job should be run periodically. Enabled bool // Spec specifies the interval the job should be run as. It is parsed based // on the SpecType. Spec string // SpecType defines the format of the spec. SpecType string // ProhibitOverlap enforces that spawned jobs do not run in parallel. ProhibitOverlap bool // TimeZone is the user specified string that determines the time zone to // launch against. The time zones must be specified from IANA Time Zone // database, such as "America/New_York". // Reference: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones // Reference: https://www.iana.org/time-zones TimeZone string // contains filtered or unexported fields }
Periodic defines the interval a job should be run at.
func (*PeriodicConfig) Canonicalize ¶ added in v0.5.5
func (p *PeriodicConfig) Canonicalize()
func (*PeriodicConfig) Copy ¶ added in v0.3.0
func (p *PeriodicConfig) Copy() *PeriodicConfig
func (*PeriodicConfig) GetLocation ¶ added in v0.5.5
func (p *PeriodicConfig) GetLocation() *time.Location
GetLocation returns the location to use for determining the time zone to run the periodic job against.
func (*PeriodicConfig) Next ¶ added in v0.2.2
Next returns the closest time instant matching the spec that is after the passed time. If no matching instance exists, the zero value of time.Time is returned. The `time.Location` of the returned value matches that of the passed time.
func (*PeriodicConfig) Validate ¶ added in v0.2.2
func (p *PeriodicConfig) Validate() error
type PeriodicForceRequest ¶ added in v0.3.0
type PeriodicForceRequest struct { JobID string WriteRequest }
PeriodicForceRequest is used to force a specific periodic job.
type PeriodicForceResponse ¶ added in v0.3.0
PeriodicForceResponse is used to respond to a periodic job force launch
type PeriodicLaunch ¶ added in v0.3.0
type PeriodicLaunch struct { ID string // ID of the periodic job. Namespace string // Namespace of the periodic job Launch time.Time // The last launch time. // Raft Indexes CreateIndex uint64 ModifyIndex uint64 }
PeriodicLaunch tracks the last launch time of a periodic job.
type Plan ¶
type Plan struct { // EvalID is the evaluation ID this plan is associated with EvalID string // EvalToken is used to prevent a split-brain processing of // an evaluation. There should only be a single scheduler running // an Eval at a time, but this could be violated after a leadership // transition. This unique token is used to reject plans that are // being submitted from a different leader. EvalToken string // Priority is the priority of the upstream job Priority int // AllAtOnce is used to control if incremental scheduling of task groups // is allowed or if we must do a gang scheduling of the entire job. // If this is false, a plan may be partially applied. Otherwise, the // entire plan must be able to make progress. AllAtOnce bool // Job is the parent job of all the allocations in the Plan. // Since a Plan only involves a single Job, we can reduce the size // of the plan by only including it once. Job *Job // NodeUpdate contains all the allocations to be stopped or evicted for // each node. NodeUpdate map[string][]*Allocation // NodeAllocation contains all the allocations for each node. // The evicts must be considered prior to the allocations. NodeAllocation map[string][]*Allocation // Annotations contains annotations by the scheduler to be used by operators // to understand the decisions made by the scheduler. Annotations *PlanAnnotations // Deployment is the deployment created or updated by the scheduler that // should be applied by the planner. Deployment *Deployment // DeploymentUpdates is a set of status updates to apply to the given // deployments. This allows the scheduler to cancel any unneeded deployment // because the job is stopped or the update block is removed. DeploymentUpdates []*DeploymentStatusUpdate // NodePreemptions is a map from node id to a set of allocations from other // lower priority jobs that are preempted. Preempted allocations are marked // as evicted. NodePreemptions map[string][]*Allocation // SnapshotIndex is the Raft index of the snapshot used to create the // Plan. The leader will wait to evaluate the plan until its StateStore // has reached at least this index. SnapshotIndex uint64 // contains filtered or unexported fields }
Plan is used to submit a commit plan for task allocations. These are submitted to the leader which verifies that resources have not been overcommitted before admitting the plan.
func (*Plan) AppendAlloc ¶
func (p *Plan) AppendAlloc(alloc *Allocation, job *Job)
AppendAlloc appends the alloc to the plan allocations. Uses the passed job if explicitly passed, otherwise it is assumed the alloc will use the plan Job version.
func (*Plan) AppendPreemptedAlloc ¶ added in v0.9.0
func (p *Plan) AppendPreemptedAlloc(alloc *Allocation, preemptingAllocID string)
AppendPreemptedAlloc is used to append an allocation that's being preempted to the plan. To minimize the size of the plan, this only sets a minimal set of fields in the allocation
func (*Plan) AppendStoppedAlloc ¶ added in v0.9.2
func (p *Plan) AppendStoppedAlloc(alloc *Allocation, desiredDesc, clientStatus, followupEvalID string)
AppendStoppedAlloc marks an allocation to be stopped. The clientStatus of the allocation may be optionally set by passing in a non-empty value.
func (*Plan) AppendUnknownAlloc ¶ added in v1.3.0
func (p *Plan) AppendUnknownAlloc(alloc *Allocation)
AppendUnknownAlloc marks an allocation as unknown.
func (*Plan) NormalizeAllocations ¶ added in v0.9.2
func (p *Plan) NormalizeAllocations()
NormalizeAllocations normalizes allocations to remove fields that can be fetched from the MemDB instead of sending over the wire
func (*Plan) PopUpdate ¶
func (p *Plan) PopUpdate(alloc *Allocation)
type PlanAnnotations ¶ added in v0.4.0
type PlanAnnotations struct { // DesiredTGUpdates is the set of desired updates per task group. DesiredTGUpdates map[string]*DesiredUpdates // PreemptedAllocs is the set of allocations to be preempted to make the placement successful. PreemptedAllocs []*AllocListStub }
PlanAnnotations holds annotations made by the scheduler to give further debug information to operators.
type PlanRequest ¶
type PlanRequest struct { Plan *Plan WriteRequest }
PlanRequest is used to submit an allocation plan to the leader
type PlanResponse ¶
type PlanResponse struct { Result *PlanResult WriteMeta }
PlanResponse is used to return from a PlanRequest
type PlanResult ¶
type PlanResult struct { // NodeUpdate contains all the evictions and stops that were committed. NodeUpdate map[string][]*Allocation // NodeAllocation contains all the allocations that were committed. NodeAllocation map[string][]*Allocation // Deployment is the deployment that was committed. Deployment *Deployment // DeploymentUpdates is the set of deployment updates that were committed. DeploymentUpdates []*DeploymentStatusUpdate // NodePreemptions is a map from node id to a set of allocations from other // lower priority jobs that are preempted. Preempted allocations are marked // as stopped. NodePreemptions map[string][]*Allocation // RejectedNodes are nodes the scheduler worker has rejected placements for // and should be considered for ineligibility by the plan applier to avoid // retrying them repeatedly. RejectedNodes []string // IneligibleNodes are nodes the plan applier has repeatedly rejected // placements for and should therefore be considered ineligible by workers // to avoid retrying them repeatedly. IneligibleNodes []string // RefreshIndex is the index the worker should refresh state up to. // This allows all evictions and allocations to be materialized. // If any allocations were rejected due to stale data (node state, // over committed) this can be used to force a worker refresh. RefreshIndex uint64 // AllocIndex is the Raft index in which the evictions and // allocations took place. This is used for the write index. AllocIndex uint64 }
PlanResult is the result of a plan submitted to the leader.
func (*PlanResult) FullCommit ¶
func (p *PlanResult) FullCommit(plan *Plan) (bool, int, int)
FullCommit is used to check if all the allocations in a plan were committed as part of the result. Returns if there was a match, and the number of expected and actual allocations.
func (*PlanResult) IsNoOp ¶
func (p *PlanResult) IsNoOp() bool
IsNoOp checks if this plan result would do nothing
type Port ¶ added in v0.2.0
type Port struct { // Label is the key for HCL port blocks: port "foo" {} Label string // Value is the static or dynamic port value. For dynamic ports this // will be 0 in the jobspec and set by the scheduler. Value int // To is the port inside a network namespace where this port is // forwarded. -1 is an internal sentinel value used by Consul Connect // to mean "same as the host port." To int // HostNetwork is the name of the network this port should be assigned // to. Jobs with a HostNetwork set can only be placed on nodes with // that host network available. HostNetwork string }
type PreemptionConfig ¶ added in v0.9.0
type PreemptionConfig struct { // SystemSchedulerEnabled specifies if preemption is enabled for system jobs SystemSchedulerEnabled bool `hcl:"system_scheduler_enabled"` // SysBatchSchedulerEnabled specifies if preemption is enabled for sysbatch jobs SysBatchSchedulerEnabled bool `hcl:"sysbatch_scheduler_enabled"` // BatchSchedulerEnabled specifies if preemption is enabled for batch jobs BatchSchedulerEnabled bool `hcl:"batch_scheduler_enabled"` // ServiceSchedulerEnabled specifies if preemption is enabled for service jobs ServiceSchedulerEnabled bool `hcl:"service_scheduler_enabled"` }
PreemptionConfig specifies whether preemption is enabled based on scheduler type
type QueryMeta ¶
type QueryMeta struct { // This is the index associated with the read Index uint64 // If AllowStale is used, this is time elapsed since // last contact between the follower and leader. This // can be used to gauge staleness. LastContact time.Duration // Used to indicate if there is a known leader node KnownLeader bool // NextToken is the token returned with queries that support // paginated lists. To resume paging from this point, pass // this token in the next request's QueryOptions. NextToken string }
QueryMeta allows a query response to include potentially useful metadata about a query
type QueryOptions ¶
type QueryOptions struct { // The target region for this query Region string // Namespace is the target namespace for the query. // // Since handlers do not have a default value set they should access // the Namespace via the RequestNamespace method. // // Requests accessing specific namespaced objects must check ACLs // against the namespace of the object, not the namespace in the // request. Namespace string // If set, wait until query exceeds given index. Must be provided // with MaxQueryTime. MinQueryIndex uint64 // Provided with MinQueryIndex to wait for change. MaxQueryTime time.Duration // If set, any follower can service the request. Results // may be arbitrarily stale. AllowStale bool // If set, used as prefix for resource list searches Prefix string // AuthToken is secret portion of the ACL token used for the request AuthToken string // Filter specifies the go-bexpr filter expression to be used for // filtering the data prior to returning a response Filter string // PerPage is the number of entries to be returned in queries that support // paginated lists. PerPage int32 // NextToken is the token used to indicate where to start paging // for queries that support paginated lists. This token should be // the ID of the next object after the last one seen in the // previous response. NextToken string // Reverse is used to reverse the default order of list results. Reverse bool InternalRpcInfo }
QueryOptions is used to specify various flags for read queries
func (QueryOptions) AllowStaleRead ¶
func (q QueryOptions) AllowStaleRead() bool
func (QueryOptions) IsRead ¶
func (q QueryOptions) IsRead() bool
IsRead only applies to reads, so always true.
func (QueryOptions) RequestNamespace ¶ added in v0.7.0
func (q QueryOptions) RequestNamespace() string
RequestNamespace returns the request's namespace or the default namespace if no explicit namespace was sent.
Requests accessing specific namespaced objects must check ACLs against the namespace of the object, not the namespace in the request.
func (QueryOptions) RequestRegion ¶
func (q QueryOptions) RequestRegion() string
func (*QueryOptions) SetTimeToBlock ¶ added in v1.0.0
func (q *QueryOptions) SetTimeToBlock(t time.Duration)
func (QueryOptions) TimeToBlock ¶ added in v1.0.0
func (q QueryOptions) TimeToBlock() time.Duration
TimeToBlock returns MaxQueryTime adjusted for maximums and defaults it will return 0 if this is not a blocking query
type RPCInfo ¶
type RPCInfo interface { RequestRegion() string IsRead() bool AllowStaleRead() bool IsForwarded() bool SetForwarded() TimeToBlock() time.Duration // SetTimeToBlock sets how long this request can block. The requested time may not be possible, // so Callers should readback TimeToBlock. E.g. you cannot set time to block at all on WriteRequests // and it cannot exceed MaxBlockingRPCQueryTime SetTimeToBlock(t time.Duration) }
RPCInfo is used to describe common information about query
type RaftConfigurationResponse ¶ added in v0.5.5
type RaftConfigurationResponse struct { // Servers has the list of servers in the Raft configuration. Servers []*RaftServer // Index has the Raft index of this configuration. Index uint64 }
RaftConfigurationResponse is returned when querying for the current Raft configuration.
type RaftPeerByAddressRequest ¶ added in v0.5.5
type RaftPeerByAddressRequest struct { // Address is the peer to remove, in the form "IP:port". Address raft.ServerAddress // WriteRequest holds the Region for this request. WriteRequest }
RaftPeerByAddressRequest is used by the Operator endpoint to apply a Raft operation on a specific Raft peer by address in the form of "IP:port".
type RaftPeerByIDRequest ¶ added in v0.8.0
type RaftPeerByIDRequest struct { // ID is the peer ID to remove. ID raft.ServerID // WriteRequest holds the Region for this request. WriteRequest }
RaftPeerByIDRequest is used by the Operator endpoint to apply a Raft operation on a specific Raft peer by ID.
type RaftServer ¶ added in v0.5.5
type RaftServer struct { // ID is the unique ID for the server. These are currently the same // as the address, but they will be changed to a real GUID in a future // release of Nomad. ID raft.ServerID // Node is the node name of the server, as known by Nomad, or this // will be set to "(unknown)" otherwise. Node string // Address is the IP:port of the server, used for Raft communications. Address raft.ServerAddress // Leader is true if this server is the current cluster leader. Leader bool // Voter is true if this server has a vote in the cluster. This might // be false if the server is staging and still coming online, or if // it's a non-voting server, which will be added in a future release of // Nomad. Voter bool // RaftProtocol is the version of the Raft protocol spoken by this server. RaftProtocol string }
RaftServer has information about a server in the Raft configuration.
type RaftStats ¶ added in v1.4.0
type RaftStats struct { // LastContact is the time since this node's last contact with the leader. LastContact string // LastTerm is the highest leader term this server has a record of in its Raft log. LastTerm uint64 // LastIndex is the last log index this server has a record of in its Raft log. LastIndex uint64 }
RaftStats holds miscellaneous Raft metrics for a server, used by autopilot.
func (*RaftStats) ToAutopilotServerStats ¶ added in v1.4.0
func (s *RaftStats) ToAutopilotServerStats() *autopilot.ServerStats
type Recoverable ¶ added in v0.5.6
Recoverable is an interface for errors to implement to indicate whether or not they are fatal or recoverable.
type RecoverableError ¶ added in v0.5.0
type RecoverableError struct { Err string Recoverable bool // contains filtered or unexported fields }
RecoverableError wraps an error and marks whether it is recoverable and could be retried or it is fatal.
func (*RecoverableError) Error ¶ added in v0.5.0
func (r *RecoverableError) Error() string
func (*RecoverableError) IsRecoverable ¶ added in v0.5.6
func (r *RecoverableError) IsRecoverable() bool
func (*RecoverableError) IsUnrecoverable ¶ added in v0.9.0
func (r *RecoverableError) IsUnrecoverable() bool
func (*RecoverableError) Unwrap ¶ added in v1.4.5
func (r *RecoverableError) Unwrap() error
type RequestedDevice ¶ added in v0.9.0
type RequestedDevice struct { // Name is the request name. The possible values are as follows: // * <type>: A single value only specifies the type of request. // * <vendor>/<type>: A single slash delimiter assumes the vendor and type of device is specified. // * <vendor>/<type>/<name>: Two slash delimiters assume vendor, type and specific model are specified. // // Examples are as follows: // * "gpu" // * "nvidia/gpu" // * "nvidia/gpu/GTX2080Ti" Name string // Count is the number of requested devices Count uint64 // Constraints are a set of constraints to apply when selecting the device // to use. Constraints Constraints // Affinities are a set of affinities to apply when selecting the device // to use. Affinities Affinities }
RequestedDevice is used to request a device for a task.
func (*RequestedDevice) Copy ¶ added in v0.9.0
func (r *RequestedDevice) Copy() *RequestedDevice
func (*RequestedDevice) Diff ¶ added in v0.9.0
func (r *RequestedDevice) Diff(other *RequestedDevice, contextual bool) *ObjectDiff
Diff returns a diff of two requested devices. If contextual diff is enabled, non-changed fields will still be returned.
func (*RequestedDevice) Equals ¶ added in v0.9.2
func (r *RequestedDevice) Equals(o *RequestedDevice) bool
func (*RequestedDevice) ID ¶ added in v0.9.0
func (r *RequestedDevice) ID() *DeviceIdTuple
func (*RequestedDevice) Validate ¶ added in v0.9.0
func (r *RequestedDevice) Validate() error
type RescheduleEvent ¶ added in v0.8.0
type RescheduleEvent struct { // RescheduleTime is the timestamp of a reschedule attempt RescheduleTime int64 // PrevAllocID is the ID of the previous allocation being restarted PrevAllocID string // PrevNodeID is the node ID of the previous allocation PrevNodeID string // Delay is the reschedule delay associated with the attempt Delay time.Duration }
RescheduleEvent is used to keep track of previous attempts at rescheduling an allocation
func NewRescheduleEvent ¶ added in v0.8.0
func (*RescheduleEvent) Copy ¶ added in v0.8.0
func (re *RescheduleEvent) Copy() *RescheduleEvent
type ReschedulePolicy ¶ added in v0.8.0
type ReschedulePolicy struct { // Attempts limits the number of rescheduling attempts that can occur in an interval. Attempts int // Interval is a duration in which we can limit the number of reschedule attempts. Interval time.Duration // Delay is a minimum duration to wait between reschedule attempts. // The delay function determines how much subsequent reschedule attempts are delayed by. Delay time.Duration // DelayFunction determines how the delay progressively changes on subsequent reschedule // attempts. Valid values are "exponential", "constant", and "fibonacci". DelayFunction string // MaxDelay is an upper bound on the delay. MaxDelay time.Duration // Unlimited allows infinite rescheduling attempts. Only allowed when delay is set // between reschedule attempts. Unlimited bool }
ReschedulePolicy configures how Tasks are rescheduled when they crash or fail.
func NewReschedulePolicy ¶ added in v0.8.0
func NewReschedulePolicy(jobType string) *ReschedulePolicy
func (*ReschedulePolicy) Copy ¶ added in v0.8.0
func (r *ReschedulePolicy) Copy() *ReschedulePolicy
func (*ReschedulePolicy) Enabled ¶ added in v0.8.4
func (r *ReschedulePolicy) Enabled() bool
func (*ReschedulePolicy) Validate ¶ added in v0.8.0
func (r *ReschedulePolicy) Validate() error
Validate uses different criteria to validate the reschedule policy Delay must be a minimum of 5 seconds Delay Ceiling is ignored if Delay Function is "constant" Number of possible attempts is validated, given the interval, delay and delay function
type RescheduleTracker ¶ added in v0.8.0
type RescheduleTracker struct {
Events []*RescheduleEvent
}
RescheduleTracker encapsulates previous reschedule events
func (*RescheduleTracker) Copy ¶ added in v0.8.0
func (rt *RescheduleTracker) Copy() *RescheduleTracker
type ResolveACLTokenRequest ¶ added in v0.7.0
type ResolveACLTokenRequest struct { SecretID string QueryOptions }
ResolveACLTokenRequest is used to resolve a specific token
type ResolveACLTokenResponse ¶ added in v0.7.0
ResolveACLTokenResponse is used to resolve a single token
type ResourceDevices ¶ added in v0.9.2
type ResourceDevices []*RequestedDevice
ResourceDevices are part of Resources.
COMPAT(0.10): Remove in 0.10.
func (*ResourceDevices) Equals ¶ added in v0.9.2
func (d *ResourceDevices) Equals(o *ResourceDevices) bool
Equals ResourceDevices as set keyed by Name.
COMPAT(0.10): Remove in 0.10
type Resources ¶
type Resources struct { CPU int Cores int MemoryMB int MemoryMaxMB int DiskMB int IOPS int // COMPAT(0.10): Only being used to issue warnings Networks Networks Devices ResourceDevices }
Resources is used to define the resources available on a client
func DefaultResources ¶ added in v0.3.0
func DefaultResources() *Resources
DefaultResources is a small resources object that contains the default resources requests that we will provide to an object. --- THIS FUNCTION IS REPLICATED IN api/resources.go and should be kept in sync.
func MinResources ¶ added in v0.7.1
func MinResources() *Resources
MinResources is a small resources object that contains the absolute minimum resources that we will provide to an object. This should not be confused with the defaults which are provided in Canonicalize() --- THIS FUNCTION IS REPLICATED IN api/resources.go and should be kept in sync.
func (*Resources) Add ¶
Add adds the resources of the delta to this, potentially returning an error if not possible. COMPAT(0.10): Remove in 0.10
func (*Resources) Canonicalize ¶ added in v0.4.1
func (r *Resources) Canonicalize()
Canonicalize the Resources struct.
COMPAT(0.10): Remove in 0.10
func (*Resources) Diff ¶ added in v0.4.0
func (r *Resources) Diff(other *Resources, contextual bool) *ObjectDiff
Diff returns a diff of two resource objects. If contextual diff is enabled, non-changed fields will still be returned.
func (*Resources) DiskInBytes ¶ added in v0.5.0
DiskInBytes returns the amount of disk resources in bytes.
func (*Resources) GoString ¶
GoString returns the string representation of the Resources struct.
COMPAT(0.10): Remove in 0.10
func (*Resources) MeetsMinResources ¶ added in v0.3.0
MeetsMinResources returns an error if the resources specified are less than the minimum allowed. This is based on the minimums defined in the Resources type COMPAT(0.10): Remove in 0.10
func (*Resources) Merge ¶ added in v0.3.0
Merge merges this resource with another resource. COMPAT(0.10): Remove in 0.10
func (*Resources) NetIndex ¶
func (r *Resources) NetIndex(n *NetworkResource) int
NetIndex finds the matching net index using device name COMPAT(0.10): Remove in 0.10
type RestartPolicy ¶ added in v0.2.0
type RestartPolicy struct { // Attempts is the number of restart that will occur in an interval. Attempts int // Interval is a duration in which we can limit the number of restarts // within. Interval time.Duration // Delay is the time between a failure and a restart. Delay time.Duration // Mode controls what happens when the task restarts more than attempt times // in an interval. Mode string }
RestartPolicy configures how Tasks are restarted when they crash or fail.
func NewRestartPolicy ¶ added in v0.2.0
func NewRestartPolicy(jobType string) *RestartPolicy
func (*RestartPolicy) Copy ¶ added in v0.3.0
func (r *RestartPolicy) Copy() *RestartPolicy
func (*RestartPolicy) Validate ¶ added in v0.2.0
func (r *RestartPolicy) Validate() error
type RootKey ¶ added in v1.4.0
type RootKey struct { Meta *RootKeyMeta Key []byte // serialized to keystore as base64 blob }
RootKey is used to encrypt and decrypt variables. It is never stored in raft.
func NewRootKey ¶ added in v1.4.0
func NewRootKey(algorithm EncryptionAlgorithm) (*RootKey, error)
NewRootKey returns a new root key and its metadata.
type RootKeyMeta ¶ added in v1.4.0
type RootKeyMeta struct { KeyID string // UUID Algorithm EncryptionAlgorithm CreateTime int64 CreateIndex uint64 ModifyIndex uint64 State RootKeyState }
RootKeyMeta is the metadata used to refer to a RootKey. It is stored in raft.
func NewRootKeyMeta ¶ added in v1.4.0
func NewRootKeyMeta() *RootKeyMeta
NewRootKeyMeta returns a new RootKeyMeta with default values
func (*RootKeyMeta) Active ¶ added in v1.4.0
func (rkm *RootKeyMeta) Active() bool
Active indicates his key is the one currently being used for crypto operations (at most one key can be Active)
func (*RootKeyMeta) Copy ¶ added in v1.4.0
func (rkm *RootKeyMeta) Copy() *RootKeyMeta
func (*RootKeyMeta) Inactive ¶ added in v1.4.3
func (rkm *RootKeyMeta) Inactive() bool
Inactive indicates that this key is no longer being used to encrypt new variables or workload identities.
func (*RootKeyMeta) Rekeying ¶ added in v1.4.0
func (rkm *RootKeyMeta) Rekeying() bool
Rekeying indicates that variables encrypted with this key should be rekeyed
func (*RootKeyMeta) SetActive ¶ added in v1.4.0
func (rkm *RootKeyMeta) SetActive()
func (*RootKeyMeta) SetInactive ¶ added in v1.4.0
func (rkm *RootKeyMeta) SetInactive()
func (*RootKeyMeta) SetRekeying ¶ added in v1.4.0
func (rkm *RootKeyMeta) SetRekeying()
func (*RootKeyMeta) Stub ¶ added in v1.4.0
func (rkm *RootKeyMeta) Stub() *RootKeyMetaStub
func (*RootKeyMeta) Validate ¶ added in v1.4.0
func (rkm *RootKeyMeta) Validate() error
type RootKeyMetaStub ¶ added in v1.4.0
type RootKeyMetaStub struct { KeyID string Algorithm EncryptionAlgorithm CreateTime int64 State RootKeyState }
RootKeyMetaStub is for serializing root key metadata to the keystore, not for the List API. It excludes frequently-changing fields such as ModifyIndex so we don't have to sync them to the on-disk keystore when the fields are already in raft.
type RootKeyState ¶ added in v1.4.0
type RootKeyState string
RootKeyState enum describes the lifecycle of a root key.
type RpcError ¶ added in v1.0.0
RpcError is used for serializing errors with a potential error code
func NewRpcError ¶ added in v1.0.0
type SIToken ¶ added in v0.10.4
type SIToken struct { ConsulNamespace string TaskName string // the nomad task backing the consul service (native or sidecar) AccessorID string SecretID string }
An SIToken is the important bits of a Service Identity token generated by Consul.
type SITokenAccessor ¶ added in v0.10.4
type SITokenAccessor struct { ConsulNamespace string NodeID string AllocID string AccessorID string TaskName string // Raft index CreateIndex uint64 }
An SITokenAccessor is a reference to a created Consul Service Identity token on behalf of an allocation's task.
type SITokenAccessorsRequest ¶ added in v0.10.4
type SITokenAccessorsRequest struct {
Accessors []*SITokenAccessor
}
SITokenAccessorsRequest is used to operate on a set of SITokenAccessor, like recording a set of accessors for an alloc into raft.
type ScalingEvent ¶ added in v0.11.0
type ScalingEvent struct { // Unix Nanosecond timestamp for the scaling event Time int64 // Count is the new scaling count, if provided Count *int64 // PreviousCount is the count at the time of the scaling event PreviousCount int64 // Message is the message describing a scaling event Message string // Error indicates an error state for this scaling event Error bool // Meta is a map of metadata returned during a scaling event Meta map[string]interface{} // EvalID is the ID for an evaluation if one was created as part of a scaling event EvalID *string // Raft index CreateIndex uint64 }
ScalingEvent describes a scaling event against a Job
func NewScalingEvent ¶ added in v0.11.0
func NewScalingEvent(message string) *ScalingEvent
NewScalingEvent method for ScalingEvent objects.
func (*ScalingEvent) SetError ¶ added in v0.11.0
func (e *ScalingEvent) SetError(error bool) *ScalingEvent
func (*ScalingEvent) SetEvalID ¶ added in v0.11.0
func (e *ScalingEvent) SetEvalID(evalID string) *ScalingEvent
func (*ScalingEvent) SetMeta ¶ added in v0.11.0
func (e *ScalingEvent) SetMeta(meta map[string]interface{}) *ScalingEvent
type ScalingEventRequest ¶ added in v0.11.0
type ScalingEventRequest struct { Namespace string JobID string TaskGroup string ScalingEvent *ScalingEvent }
ScalingEventRequest is by for Job.Scale endpoint to register scaling events
type ScalingPolicy ¶ added in v0.11.0
type ScalingPolicy struct { // ID is a generated UUID used for looking up the scaling policy ID string // Type is the type of scaling performed by the policy Type string // Target contains information about the target of the scaling policy, like job and group Target map[string]string // Policy is an opaque description of the scaling policy, passed to the autoscaler Policy map[string]interface{} // Min is the minimum allowable scaling count for this target Min int64 // Max is the maximum allowable scaling count for this target Max int64 // Enabled indicates whether this policy has been enabled/disabled Enabled bool CreateIndex uint64 ModifyIndex uint64 }
ScalingPolicy specifies the scaling policy for a scaling target
func (*ScalingPolicy) Canonicalize ¶ added in v1.0.0
func (p *ScalingPolicy) Canonicalize()
func (*ScalingPolicy) Copy ¶ added in v1.0.0
func (p *ScalingPolicy) Copy() *ScalingPolicy
func (*ScalingPolicy) Diff ¶ added in v0.11.0
func (p *ScalingPolicy) Diff(p2 *ScalingPolicy) bool
Diff indicates whether the specification for a given scaling policy has changed
func (*ScalingPolicy) JobKey ¶ added in v1.0.0
func (p *ScalingPolicy) JobKey() string
JobKey returns a key that is unique to a job-scoped target, useful as a map key. This uses the policy type, plus target (group and task).
func (*ScalingPolicy) Stub ¶ added in v0.11.0
func (p *ScalingPolicy) Stub() *ScalingPolicyListStub
func (*ScalingPolicy) TargetTask ¶ added in v1.0.0
func (p *ScalingPolicy) TargetTask(job *Job, tg *TaskGroup, task *Task) *ScalingPolicy
TargetTask updates a ScalingPolicy target to specify a given task
func (*ScalingPolicy) TargetTaskGroup ¶ added in v0.11.0
func (p *ScalingPolicy) TargetTaskGroup(job *Job, tg *TaskGroup) *ScalingPolicy
TargetTaskGroup updates a ScalingPolicy target to specify a given task group
func (*ScalingPolicy) Validate ¶ added in v1.0.0
func (p *ScalingPolicy) Validate() error
type ScalingPolicyListRequest ¶ added in v0.11.0
type ScalingPolicyListRequest struct { Job string Type string QueryOptions }
ScalingPolicyListRequest is used to parameterize a scaling policy list request
type ScalingPolicyListResponse ¶ added in v0.11.0
type ScalingPolicyListResponse struct { Policies []*ScalingPolicyListStub QueryMeta }
ScalingPolicyListResponse is used for a list request
type ScalingPolicyListStub ¶ added in v0.11.0
type ScalingPolicyListStub struct { ID string Enabled bool Type string Target map[string]string CreateIndex uint64 ModifyIndex uint64 }
ScalingPolicyListStub is used to return a subset of scaling policy information for the scaling policy list
type ScalingPolicySpecificRequest ¶ added in v0.11.0
type ScalingPolicySpecificRequest struct { ID string QueryOptions }
ScalingPolicySpecificRequest is used when we just need to specify a target scaling policy
type SchedulerAlgorithm ¶ added in v0.11.2
type SchedulerAlgorithm string
SchedulerAlgorithm is an enum string that encapsulates the valid options for a SchedulerConfiguration block's SchedulerAlgorithm. These modes will allow the scheduler to be user-selectable.
const ( // SchedulerAlgorithmBinpack indicates that the scheduler should spread // allocations as evenly as possible over the available hardware. SchedulerAlgorithmBinpack SchedulerAlgorithm = "binpack" // SchedulerAlgorithmSpread indicates that the scheduler should spread // allocations as evenly as possible over the available hardware. SchedulerAlgorithmSpread SchedulerAlgorithm = "spread" )
type SchedulerConfiguration ¶ added in v0.9.0
type SchedulerConfiguration struct { // SchedulerAlgorithm lets you select between available scheduling algorithms. SchedulerAlgorithm SchedulerAlgorithm `hcl:"scheduler_algorithm"` // PreemptionConfig specifies whether to enable eviction of lower // priority jobs to place higher priority jobs. PreemptionConfig PreemptionConfig `hcl:"preemption_config"` // MemoryOversubscriptionEnabled specifies whether memory oversubscription is enabled MemoryOversubscriptionEnabled bool `hcl:"memory_oversubscription_enabled"` // RejectJobRegistration disables new job registrations except with a // management ACL token RejectJobRegistration bool `hcl:"reject_job_registration"` // PauseEvalBroker is a boolean to control whether the evaluation broker // should be paused on the cluster leader. Only a single broker runs per // region, and it must be persisted to state so the parameter is consistent // during leadership transitions. PauseEvalBroker bool `hcl:"pause_eval_broker"` // CreateIndex/ModifyIndex store the create/modify indexes of this configuration. CreateIndex uint64 ModifyIndex uint64 }
SchedulerConfiguration is the config for controlling scheduler behavior
func (*SchedulerConfiguration) Canonicalize ¶ added in v0.11.2
func (s *SchedulerConfiguration) Canonicalize()
func (*SchedulerConfiguration) Copy ¶ added in v1.2.13
func (s *SchedulerConfiguration) Copy() *SchedulerConfiguration
func (*SchedulerConfiguration) EffectiveSchedulerAlgorithm ¶ added in v0.11.2
func (s *SchedulerConfiguration) EffectiveSchedulerAlgorithm() SchedulerAlgorithm
func (*SchedulerConfiguration) Validate ¶ added in v0.11.2
func (s *SchedulerConfiguration) Validate() error
type SchedulerConfigurationResponse ¶ added in v0.9.0
type SchedulerConfigurationResponse struct { // SchedulerConfig contains scheduler config options SchedulerConfig *SchedulerConfiguration QueryMeta }
SchedulerConfigurationResponse is the response object that wraps SchedulerConfiguration
type SchedulerSetConfigRequest ¶ added in v0.9.0
type SchedulerSetConfigRequest struct { // Config is the new Scheduler configuration to use. Config SchedulerConfiguration // CAS controls whether to use check-and-set semantics for this request. CAS bool // WriteRequest holds the ACL token to go along with this request. WriteRequest }
SchedulerSetConfigRequest is used by the Operator endpoint to update the current Scheduler configuration of the cluster.
type SchedulerSetConfigurationResponse ¶ added in v0.9.0
type SchedulerSetConfigurationResponse struct { // Updated returns whether the config was actually updated // Only set when the request uses CAS Updated bool WriteMeta }
SchedulerSetConfigurationResponse is the response object used when updating scheduler configuration
type SearchConfig ¶ added in v1.1.0
type SearchConfig struct { // FuzzyEnabled toggles whether the FuzzySearch API is enabled. If not // enabled, requests to /v1/search/fuzzy will reply with a 404 response code. FuzzyEnabled bool `hcl:"fuzzy_enabled"` // LimitQuery limits the number of objects searched in the FuzzySearch API. // The results are indicated as truncated if the limit is reached. // // Lowering this value can reduce resource consumption of Nomad server when // the FuzzySearch API is enabled. LimitQuery int `hcl:"limit_query"` // LimitResults limits the number of results provided by the FuzzySearch API. // The results are indicated as truncate if the limit is reached. // // Lowering this value can reduce resource consumption of Nomad server per // fuzzy search request when the FuzzySearch API is enabled. LimitResults int `hcl:"limit_results"` // MinTermLength is the minimum length of Text required before the FuzzySearch // API will return results. // // Increasing this value can avoid resource consumption on Nomad server by // reducing searches with less meaningful results. MinTermLength int `hcl:"min_term_length"` }
SearchConfig is used in servers to configure search API options.
func (*SearchConfig) Copy ¶ added in v1.2.13
func (s *SearchConfig) Copy() *SearchConfig
type SearchRequest ¶ added in v0.6.1
type SearchRequest struct { // Prefix is what ids are matched to. I.e, if the given prefix were // "a", potential matches might be "abcd" or "aabb" Prefix string // Context is the type that can be matched against. A context can be a job, // node, evaluation, allocation, or empty (indicated every context should be // matched) Context Context QueryOptions }
SearchRequest is used to parameterize a request, and returns a list of matches made up of jobs, allocations, evaluations, and/or nodes, along with whether or not the information returned is truncated.
type SearchResponse ¶ added in v0.6.1
type SearchResponse struct { // Map of Context types to ids which match a specified prefix Matches map[Context][]string // Truncations indicates whether the matches for a particular Context have // been truncated Truncations map[Context]bool QueryMeta }
SearchResponse is used to return matches and information about whether the match list is truncated specific to each type of Context.
type ServerHealth ¶ added in v1.4.0
type ServerHealth struct { // ID is the raft ID of the server. ID string // Name is the node name of the server. Name string // Address is the address of the server. Address string // The status of the SerfHealth check for the server. SerfStatus serf.MemberStatus // Version is the Nomad version of the server. Version string // Leader is whether this server is currently the leader. Leader bool // LastContact is the time since this node's last contact with the leader. LastContact time.Duration // LastTerm is the highest leader term this server has a record of in its Raft log. LastTerm uint64 // LastIndex is the last log index this server has a record of in its Raft log. LastIndex uint64 // Healthy is whether or not the server is healthy according to the current // Autopilot config. Healthy bool // Voter is whether this is a voting server. Voter bool // StableSince is the last time this server's Healthy value changed. StableSince time.Time }
ServerHealth is the health (from the leader's point of view) of a server.
type ServerMember ¶ added in v0.5.0
type ServerMember struct { Name string Addr net.IP Port uint16 Tags map[string]string Status string ProtocolMin uint8 ProtocolMax uint8 ProtocolCur uint8 DelegateMin uint8 DelegateMax uint8 DelegateCur uint8 }
ServerMember holds information about a Nomad server agent in a cluster
type ServerMembersResponse ¶ added in v0.5.0
type ServerMembersResponse struct { ServerName string ServerRegion string ServerDC string Members []*ServerMember }
ServerMembersResponse has the list of servers in a cluster
type ServerSideError ¶ added in v0.8.0
ServerSideError is an interface for errors to implement to indicate errors occurring after the request makes it to a server
type Service ¶ added in v0.2.0
type Service struct { // Name of the service registered with Consul. Consul defaults the // Name to ServiceID if not specified. The Name if specified is used // as one of the seed values when generating a Consul ServiceID. Name string // Name of the Task associated with this service. // Group services do not have a task name, unless they are a connect native // service specifying the task implementing the service. // Task-level services automatically have the task name plumbed through // down to checks for convenience. TaskName string // PortLabel is either the numeric port number or the `host:port`. // To specify the port number using the host's Consul Advertise // address, specify an empty host in the PortLabel (e.g. `:port`). PortLabel string // AddressMode specifies how the address in service registration is // determined. Must be "auto" (default), "host", "driver", or "alloc". AddressMode string // Address enables explicitly setting a custom address to use in service // registration. AddressMode must be "auto" if Address is set. Address string // EnableTagOverride will disable Consul's anti-entropy mechanism for the // tags of this service. External updates to the service definition via // Consul will not be corrected to match the service definition set in the // Nomad job specification. // // https://www.consul.io/docs/agent/services.html#service-definition EnableTagOverride bool Tags []string // List of tags for the service CanaryTags []string // List of tags for the service when it is a canary Checks []*ServiceCheck // List of checks associated with the service Connect *ConsulConnect // Consul Connect configuration Meta map[string]string // Consul service meta CanaryMeta map[string]string // Consul service meta when it is a canary // The values to set for tagged_addresses in Consul service registration. // Does not affect Nomad networking, these are for Consul service discovery. TaggedAddresses map[string]string // The consul namespace in which this service will be registered. Namespace // at the service.check level is not part of the Nomad API - it must be // set at the job or group level. This field is managed internally so // that Hash can work correctly. Namespace string // OnUpdate Specifies how the service and its checks should be evaluated // during an update OnUpdate string // Provider dictates which service discovery provider to use. This can be // either ServiceProviderConsul or ServiceProviderNomad and defaults to the former when // left empty by the operator. Provider string }
Service represents a Consul service definition
func (*Service) Canonicalize ¶ added in v0.4.1
Canonicalize interpolates values of Job, Task Group and Task in the Service Name. This also generates check names, service id and check ids.
func (*Service) Hash ¶ added in v0.2.1
Hash returns a base32 encoded hash of a Service's contents excluding checks as they're hashed independently and the provider in order to not cause churn during cluster upgrades.
func (*Service) ValidateName ¶ added in v0.5.0
ValidateName checks if the service Name is valid and should be called after the name has been interpolated
type ServiceCheck ¶ added in v0.2.0
type ServiceCheck struct { Name string // Name of the check, defaults to a generated label Type string // Type of the check - tcp, http, docker and script Command string // Command is the command to run for script checks Args []string // Args is a list of arguments for script checks Path string // path of the health check url for http type check Protocol string // Protocol to use if check is http, defaults to http PortLabel string // The port to use for tcp/http checks Expose bool // Whether to have Envoy expose the check path (connect-enabled group-services only) AddressMode string // Must be empty, "alloc", "host", or "driver" Interval time.Duration // Interval of the check Timeout time.Duration // Timeout of the response from the check before consul fails the check InitialStatus string // Initial status of the check TLSSkipVerify bool // Skip TLS verification when Protocol=https Method string // HTTP Method to use (GET by default) Header map[string][]string // HTTP Headers for Consul to set when making HTTP checks CheckRestart *CheckRestart // If and when a task should be restarted based on checks GRPCService string // Service for GRPC checks GRPCUseTLS bool // Whether or not to use TLS for GRPC checks TaskName string // What task to execute this check in SuccessBeforePassing int // Number of consecutive successes required before considered healthy FailuresBeforeCritical int // Number of consecutive failures required before considered unhealthy Body string // Body to use in HTTP check OnUpdate string }
ServiceCheck represents a Nomad or Consul service health check.
The fields available depend on the service provider the check is being registered into.
func (*ServiceCheck) Canonicalize ¶ added in v0.4.1
func (sc *ServiceCheck) Canonicalize(serviceName, taskName string)
func (*ServiceCheck) Copy ¶ added in v0.3.0
func (sc *ServiceCheck) Copy() *ServiceCheck
Copy the block recursively. Returns nil if nil.
func (*ServiceCheck) Equals ¶ added in v0.10.0
func (sc *ServiceCheck) Equals(o *ServiceCheck) bool
Equals returns true if the structs are recursively equal.
func (*ServiceCheck) Hash ¶ added in v0.2.1
func (sc *ServiceCheck) Hash(serviceID string) string
Hash all ServiceCheck fields and the check's corresponding service ID to create an identifier. The identifier is not guaranteed to be unique as if the PortLabel is blank, the Service's PortLabel will be used after Hash is called.
func (*ServiceCheck) IsReadiness ¶ added in v1.4.0
func (sc *ServiceCheck) IsReadiness() bool
IsReadiness returns whether the configuration of the ServiceCheck is effectively a readiness check - i.e. check failures do not affect a deployment.
func (*ServiceCheck) RequiresPort ¶ added in v0.3.2
func (sc *ServiceCheck) RequiresPort() bool
RequiresPort returns whether the service check requires the task has a port.
func (*ServiceCheck) TriggersRestarts ¶ added in v0.7.0
func (sc *ServiceCheck) TriggersRestarts() bool
TriggersRestarts returns true if this check should be watched and trigger a restart on failure.
type ServiceRegistration ¶ added in v1.3.0
type ServiceRegistration struct { // ID is the unique identifier for this registration. It currently follows // the Consul service registration format to provide consistency between // the two solutions. ID string // ServiceName is the human friendly identifier for this service // registration. This is not unique. ServiceName string // Namespace is Job.Namespace and therefore the namespace in which this // service registration resides. Namespace string // NodeID is Node.ID on which this service registration is currently // running. NodeID string // Datacenter is the DC identifier of the node as identified by // Node.Datacenter. It is denormalized here to allow filtering services by // datacenter without looking up every node. Datacenter string // JobID is Job.ID and represents the job which contained the service block // which resulted in this service registration. JobID string // AllocID is Allocation.ID and represents the allocation within which this // service is running. AllocID string // Tags are determined from either Service.Tags or Service.CanaryTags and // help identify this service. Tags can also be used to perform lookups of // services depending on their state and role. Tags []string // Address is the IP address of this service registration. This information // comes from the client and is not guaranteed to be routable; this depends // on cluster network topology. Address string // Port is the port number on which this service registration is bound. It // is determined by a combination of factors on the client. Port int CreateIndex uint64 ModifyIndex uint64 }
ServiceRegistration is the internal representation of a Nomad service registration.
func (*ServiceRegistration) Copy ¶ added in v1.3.0
func (s *ServiceRegistration) Copy() *ServiceRegistration
Copy creates a deep copy of the service registration. This copy can then be safely modified. It handles nil objects.
func (*ServiceRegistration) Equals ¶ added in v1.3.0
func (s *ServiceRegistration) Equals(o *ServiceRegistration) bool
Equals performs an equality check on the two service registrations. It handles nil objects.
func (*ServiceRegistration) GetID ¶ added in v1.3.0
func (s *ServiceRegistration) GetID() string
GetID is a helper for getting the ID when the object may be nil and is required for pagination.
func (*ServiceRegistration) GetNamespace ¶ added in v1.3.0
func (s *ServiceRegistration) GetNamespace() string
GetNamespace is a helper for getting the namespace when the object may be nil and is required for pagination.
func (*ServiceRegistration) HashWith ¶ added in v1.3.2
func (s *ServiceRegistration) HashWith(key string) string
HashWith generates a unique value representative of s based on the contents of s.
func (*ServiceRegistration) Validate ¶ added in v1.3.0
func (s *ServiceRegistration) Validate() error
Validate ensures the upserted service registration contains valid information and routing capabilities. Objects should never fail here as Nomad controls the entire registration process; but it's possible configuration problems could cause failures.
type ServiceRegistrationByNameRequest ¶ added in v1.3.0
type ServiceRegistrationByNameRequest struct { ServiceName string Choose string // stable selection of n services QueryOptions }
ServiceRegistrationByNameRequest is the request object to perform a lookup of services matching a specific name.
type ServiceRegistrationByNameResponse ¶ added in v1.3.0
type ServiceRegistrationByNameResponse struct { Services []*ServiceRegistration QueryMeta }
ServiceRegistrationByNameResponse is the response object when performing a lookup of services matching a specific name.
type ServiceRegistrationDeleteByIDRequest ¶ added in v1.3.0
type ServiceRegistrationDeleteByIDRequest struct { ID string WriteRequest }
ServiceRegistrationDeleteByIDRequest is the request object to delete a service registration as specified by the ID parameter.
type ServiceRegistrationDeleteByIDResponse ¶ added in v1.3.0
type ServiceRegistrationDeleteByIDResponse struct {
WriteMeta
}
ServiceRegistrationDeleteByIDResponse is the response object when performing a deletion of an individual service registration.
type ServiceRegistrationDeleteByNodeIDRequest ¶ added in v1.3.0
type ServiceRegistrationDeleteByNodeIDRequest struct { NodeID string WriteRequest }
ServiceRegistrationDeleteByNodeIDRequest is the request object to delete all service registrations assigned to a particular node.
type ServiceRegistrationDeleteByNodeIDResponse ¶ added in v1.3.0
type ServiceRegistrationDeleteByNodeIDResponse struct {
WriteMeta
}
ServiceRegistrationDeleteByNodeIDResponse is the response object when performing a deletion of all service registrations assigned to a particular node.
type ServiceRegistrationListRequest ¶ added in v1.3.0
type ServiceRegistrationListRequest struct {
QueryOptions
}
ServiceRegistrationListRequest is the request object when performing service registration listings.
type ServiceRegistrationListResponse ¶ added in v1.3.0
type ServiceRegistrationListResponse struct { Services []*ServiceRegistrationListStub QueryMeta }
ServiceRegistrationListResponse is the response object when performing a list of services. This is specifically concise to reduce the serialisation and network costs endpoint incur, particularly when performing blocking list queries.
type ServiceRegistrationListStub ¶ added in v1.3.0
type ServiceRegistrationListStub struct { Namespace string Services []*ServiceRegistrationStub }
ServiceRegistrationListStub is the object which contains a list of namespace service registrations and their tags.
type ServiceRegistrationStreamEvent ¶ added in v1.3.0
type ServiceRegistrationStreamEvent struct {
Service *ServiceRegistration
}
ServiceRegistrationStreamEvent holds a newly updated or deleted service registration.
type ServiceRegistrationStub ¶ added in v1.3.0
ServiceRegistrationStub is the stub object describing an individual namespaced service. The object is built in a manner which would allow us to add additional fields in the future, if we wanted.
type ServiceRegistrationUpsertRequest ¶ added in v1.3.0
type ServiceRegistrationUpsertRequest struct { Services []*ServiceRegistration WriteRequest }
ServiceRegistrationUpsertRequest is the request object used to upsert one or more service registrations.
type ServiceRegistrationUpsertResponse ¶ added in v1.3.0
type ServiceRegistrationUpsertResponse struct {
WriteMeta
}
ServiceRegistrationUpsertResponse is the response object when one or more service registrations have been successfully upserted into state.
type SidecarTask ¶ added in v0.10.0
type SidecarTask struct { // Name of the task Name string // Driver is used to control which driver is used Driver string // User is used to determine which user will run the task. It defaults to // the same user the Nomad client is being run as. User string // Config is provided to the driver to initialize Config map[string]interface{} // Map of environment variables to be used by the driver Env map[string]string // Resources is the resources needed by this task Resources *Resources // Meta is used to associate arbitrary metadata with this // task. This is opaque to Nomad. Meta map[string]string // KillTimeout is the time between signaling a task that it will be // killed and killing it. KillTimeout *time.Duration // LogConfig provides configuration for log rotation LogConfig *LogConfig // ShutdownDelay is the duration of the delay between deregistering a // task from Consul and sending it a signal to shutdown. See #2441 ShutdownDelay *time.Duration // KillSignal is the kill signal to use for the task. This is an optional // specification and defaults to SIGINT KillSignal string }
SidecarTask represents a subset of Task fields that are able to be overridden from the sidecar_task block
func (*SidecarTask) Copy ¶ added in v0.10.0
func (t *SidecarTask) Copy() *SidecarTask
func (*SidecarTask) Equals ¶ added in v1.0.0
func (t *SidecarTask) Equals(o *SidecarTask) bool
func (*SidecarTask) MergeIntoTask ¶ added in v0.10.0
func (t *SidecarTask) MergeIntoTask(task *Task)
MergeIntoTask merges the SidecarTask fields over the given task
type SingleACLPolicyResponse ¶ added in v0.7.0
SingleACLPolicyResponse is used to return a single policy
type SingleACLTokenResponse ¶ added in v0.7.0
SingleACLTokenResponse is used to return a single token
type SingleAllocResponse ¶
type SingleAllocResponse struct { Alloc *Allocation QueryMeta }
SingleAllocResponse is used to return a single allocation
type SingleDeploymentResponse ¶ added in v0.6.0
type SingleDeploymentResponse struct { Deployment *Deployment QueryMeta }
SingleDeploymentResponse is used to respond with a single deployment
type SingleEvalResponse ¶
type SingleEvalResponse struct { Eval *Evaluation QueryMeta }
SingleEvalResponse is used to return a single evaluation
type SingleJobResponse ¶
SingleJobResponse is used to return a single job
type SingleNamespaceResponse ¶ added in v1.0.0
SingleNamespaceResponse is used to return a single namespace
type SingleNodeResponse ¶
SingleNodeResponse is used to return a single node
type SingleScalingPolicyResponse ¶ added in v0.11.0
type SingleScalingPolicyResponse struct { Policy *ScalingPolicy QueryMeta }
SingleScalingPolicyResponse is used to return a single job
type SnapshotRestoreRequest ¶ added in v0.12.0
type SnapshotRestoreRequest struct {
WriteRequest
}
type SnapshotRestoreResponse ¶ added in v0.12.0
type SnapshotSaveRequest ¶ added in v0.12.0
type SnapshotSaveRequest struct {
QueryOptions
}
SnapshotSaveRequest is used by the Operator endpoint to get a Raft snapshot
type SnapshotSaveResponse ¶ added in v0.12.0
type SnapshotSaveResponse struct { // SnapshotChecksum returns the checksum of snapshot file in the format // `<algo>=<base64>` (e.g. `sha-256=...`) SnapshotChecksum string // ErrorCode is an http error code if an error is found, e.g. 403 for permission errors ErrorCode int `codec:",omitempty"` // ErrorMsg is the error message if an error is found, e.g. "Permission Denied" ErrorMsg string `codec:",omitempty"` QueryMeta }
SnapshotSaveResponse is the header for the streaming snapshot endpoint, and followed by the snapshot file content.
type Spread ¶ added in v0.9.0
type Spread struct { // Attribute is the node attribute used as the spread criteria Attribute string // Weight is the relative weight of this spread, useful when there are multiple // spread and affinities Weight int8 // SpreadTarget is used to describe desired percentages for each attribute value SpreadTarget []*SpreadTarget // contains filtered or unexported fields }
Spread is used to specify desired distribution of allocations according to weight
func CopySliceSpreads ¶ added in v0.9.0
type SpreadTarget ¶ added in v0.9.0
type SpreadTarget struct { // Value is a single attribute value, like "dc1" Value string // Percent is the desired percentage of allocs Percent uint8 // contains filtered or unexported fields }
SpreadTarget is used to specify desired percentages for each attribute value
func CopySliceSpreadTarget ¶ added in v0.9.0
func CopySliceSpreadTarget(s []*SpreadTarget) []*SpreadTarget
func (*SpreadTarget) Copy ¶ added in v0.9.0
func (s *SpreadTarget) Copy() *SpreadTarget
func (*SpreadTarget) String ¶ added in v0.9.0
func (s *SpreadTarget) String() string
type StreamingRpcAck ¶ added in v0.8.0
type StreamingRpcAck struct { // Error is used to return whether an error occurred establishing the // streaming RPC. This error occurs before entering the RPC handler. Error string }
StreamingRpcAck is used to acknowledge receiving the StreamingRpcHeader and routing to the requested handler.
type StreamingRpcHandler ¶ added in v0.8.0
type StreamingRpcHandler func(conn io.ReadWriteCloser)
StreamingRpcHandler defines the handler for a streaming RPC.
type StreamingRpcHeader ¶ added in v0.8.0
type StreamingRpcHeader struct { // Method is the name of the method to invoke. Method string }
StreamingRpcHeader is the first struct serialized after entering the streaming RPC mode. The header is used to dispatch to the correct method.
type StreamingRpcRegistry ¶ added in v0.8.0
type StreamingRpcRegistry struct {
// contains filtered or unexported fields
}
StreamingRpcRegistry is used to add and retrieve handlers
func NewStreamingRpcRegistry ¶ added in v0.8.0
func NewStreamingRpcRegistry() *StreamingRpcRegistry
NewStreamingRpcRegistry creates a new registry. All registrations of handlers should be done before retrieving handlers.
func (*StreamingRpcRegistry) GetHandler ¶ added in v0.8.0
func (s *StreamingRpcRegistry) GetHandler(method string) (StreamingRpcHandler, error)
GetHandler returns a handler for the given method or an error if it doesn't exist.
func (*StreamingRpcRegistry) Register ¶ added in v0.8.0
func (s *StreamingRpcRegistry) Register(method string, handler StreamingRpcHandler)
Register registers a new handler for the given method name
type Task ¶
type Task struct { // Name of the task Name string // Driver is used to control which driver is used Driver string // User is used to determine which user will run the task. It defaults to // the same user the Nomad client is being run as. User string // Config is provided to the driver to initialize Config map[string]interface{} // Map of environment variables to be used by the driver Env map[string]string // List of service definitions exposed by the Task Services []*Service // Vault is used to define the set of Vault policies that this task should // have access to. Vault *Vault // Templates are the set of templates to be rendered for the task. Templates []*Template // Constraints can be specified at a task level and apply only to // the particular task. Constraints []*Constraint // Affinities can be specified at the task level to express // scheduling preferences Affinities []*Affinity // Resources is the resources needed by this task Resources *Resources // RestartPolicy of a TaskGroup RestartPolicy *RestartPolicy // DispatchPayload configures how the task retrieves its input from a dispatch DispatchPayload *DispatchPayloadConfig Lifecycle *TaskLifecycleConfig // Meta is used to associate arbitrary metadata with this // task. This is opaque to Nomad. Meta map[string]string // KillTimeout is the time between signaling a task that it will be // killed and killing it. KillTimeout time.Duration // LogConfig provides configuration for log rotation LogConfig *LogConfig // Artifacts is a list of artifacts to download and extract before running // the task. Artifacts []*TaskArtifact // Leader marks the task as the leader within the group. When the leader // task exits, other tasks will be gracefully terminated. Leader bool // ShutdownDelay is the duration of the delay between de-registering a // task from Consul and sending it a signal to shutdown. See #2441 ShutdownDelay time.Duration // VolumeMounts is a list of Volume name <-> mount configurations that will be // attached to this task. VolumeMounts []*VolumeMount // ScalingPolicies is a list of scaling policies scoped to this task ScalingPolicies []*ScalingPolicy // KillSignal is the kill signal to use for the task. This is an optional // specification and defaults to SIGINT KillSignal string // Used internally to manage tasks according to their TaskKind. Initial use case // is for Consul Connect Kind TaskKind // CSIPluginConfig is used to configure the plugin supervisor for the task. CSIPluginConfig *TaskCSIPluginConfig }
Task is a single process typically that is executed as part of a task group.
func (*Task) Canonicalize ¶ added in v0.4.1
Canonicalize canonicalizes fields in the task.
func (*Task) Diff ¶ added in v0.4.0
Diff returns a diff of two tasks. If contextual diff is enabled, objects within the task will contain field information even if unchanged.
func (*Task) IsPoststart ¶ added in v1.3.4
func (*Task) IsPoststop ¶ added in v1.3.4
func (*Task) IsPrestart ¶ added in v1.3.4
func (*Task) UsesConnect ¶ added in v0.10.4
UsesConnect is for conveniently detecting if the Task is able to make use of Consul Connect features. This will be indicated in the TaskKind of the Task, which exports known types of Tasks. UsesConnect will be true if the task is a connect proxy, connect native, or is a connect gateway.
func (*Task) UsesConnectSidecar ¶ added in v1.0.0
type TaskArtifact ¶ added in v0.3.1
type TaskArtifact struct { // GetterSource is the source to download an artifact using go-getter GetterSource string // GetterOptions are options to use when downloading the artifact using // go-getter. GetterOptions map[string]string // GetterHeaders are headers to use when downloading the artifact using // go-getter. GetterHeaders map[string]string // GetterMode is the go-getter.ClientMode for fetching resources. // Defaults to "any" but can be set to "file" or "dir". GetterMode string // RelativeDest is the download destination given relative to the task's // directory. RelativeDest string }
TaskArtifact is an artifact to download before running the task.
func (*TaskArtifact) Copy ¶ added in v0.3.1
func (ta *TaskArtifact) Copy() *TaskArtifact
func (*TaskArtifact) DiffID ¶ added in v1.2.0
func (ta *TaskArtifact) DiffID() string
DiffID fulfills the DiffableWithID interface.
func (*TaskArtifact) GoString ¶ added in v0.3.2
func (ta *TaskArtifact) GoString() string
func (*TaskArtifact) Hash ¶ added in v0.9.0
func (ta *TaskArtifact) Hash() string
Hash creates a unique identifier for a TaskArtifact as the same GetterSource may be specified multiple times with different destinations.
func (*TaskArtifact) Validate ¶ added in v0.3.1
func (ta *TaskArtifact) Validate() error
type TaskCSIPluginConfig ¶ added in v0.11.0
type TaskCSIPluginConfig struct { // ID is the identifier of the plugin. // Ideally this should be the FQDN of the plugin. ID string // Type instructs Nomad on how to handle processing a plugin Type CSIPluginType // MountDir is the directory (within its container) in which the plugin creates a // socket (called CSISocketName) for communication with Nomad. Default is /csi. MountDir string // StagePublishBaseDir is the base directory (within its container) in which the plugin // mounts volumes being staged and bind mount volumes being published. // e.g. staging_target_path = {StagePublishBaseDir}/staging/{volume-id}/{usage-mode} // e.g. target_path = {StagePublishBaseDir}/per-alloc/{alloc-id}/{volume-id}/{usage-mode} // Default is /local/csi. StagePublishBaseDir string // HealthTimeout is the time after which the CSI plugin tasks will be killed // if the CSI Plugin is not healthy. HealthTimeout time.Duration `mapstructure:"health_timeout" hcl:"health_timeout,optional"` }
TaskCSIPluginConfig contains the data that is required to setup a task as a CSI plugin. This will be used by the csi_plugin_supervisor_hook to configure mounts for the plugin and initiate the connection to the plugin catalog.
func (*TaskCSIPluginConfig) Copy ¶ added in v0.11.0
func (t *TaskCSIPluginConfig) Copy() *TaskCSIPluginConfig
type TaskDiff ¶ added in v0.4.0
type TaskDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff Annotations []string }
TaskDiff contains the diff of two Tasks
type TaskEvent ¶ added in v0.2.0
type TaskEvent struct { Type string Time int64 // Unix Nanosecond timestamp Message string // A possible message explaining the termination of the task. // DisplayMessage is a human friendly message about the event DisplayMessage string // Details is a map with annotated info about the event Details map[string]string // FailsTask marks whether this event fails the task. // Deprecated, use Details["fails_task"] to access this. FailsTask bool // Restart fields. // Deprecated, use Details["restart_reason"] to access this. RestartReason string // Setup Failure fields. // Deprecated, use Details["setup_error"] to access this. SetupError string // Driver Failure fields. // Deprecated, use Details["driver_error"] to access this. DriverError string // A driver error occurred while starting the task. // Deprecated, use Details["exit_code"] to access this. ExitCode int // The exit code of the task. // Deprecated, use Details["signal"] to access this. Signal int // The signal that terminated the task. // Killing fields // Deprecated, use Details["kill_timeout"] to access this. KillTimeout time.Duration // Task Killed Fields. // Deprecated, use Details["kill_error"] to access this. KillError string // Error killing the task. // KillReason is the reason the task was killed // Deprecated, use Details["kill_reason"] to access this. KillReason string // TaskRestarting fields. // Deprecated, use Details["start_delay"] to access this. StartDelay int64 // The sleep period before restarting the task in unix nanoseconds. // Artifact Download fields // Deprecated, use Details["download_error"] to access this. DownloadError string // Error downloading artifacts // Validation fields // Deprecated, use Details["validation_error"] to access this. ValidationError string // Validation error // The maximum allowed task disk size. // Deprecated, use Details["disk_limit"] to access this. DiskLimit int64 // Name of the sibling task that caused termination of the task that // the TaskEvent refers to. // Deprecated, use Details["failed_sibling"] to access this. FailedSibling string // VaultError is the error from token renewal // Deprecated, use Details["vault_renewal_error"] to access this. VaultError string // TaskSignalReason indicates the reason the task is being signalled. // Deprecated, use Details["task_signal_reason"] to access this. TaskSignalReason string // TaskSignal is the signal that was sent to the task // Deprecated, use Details["task_signal"] to access this. TaskSignal string // DriverMessage indicates a driver action being taken. // Deprecated, use Details["driver_message"] to access this. DriverMessage string // GenericSource is the source of a message. // Deprecated, is redundant with event type. GenericSource string }
TaskEvent is an event that effects the state of a task and contains meta-data appropriate to the events type.
func NewTaskEvent ¶ added in v0.2.0
func (*TaskEvent) PopulateEventDisplayMessage ¶ added in v0.7.1
func (e *TaskEvent) PopulateEventDisplayMessage()
func (*TaskEvent) SetDiskLimit ¶ added in v0.5.0
func (*TaskEvent) SetDisplayMessage ¶ added in v0.9.0
SetDisplayMessage sets the display message of TaskEvent
func (*TaskEvent) SetDownloadError ¶ added in v0.3.1
func (*TaskEvent) SetDriverError ¶ added in v0.2.0
func (*TaskEvent) SetDriverMessage ¶ added in v0.5.2
func (*TaskEvent) SetExitCode ¶ added in v0.2.0
func (*TaskEvent) SetExitMessage ¶ added in v0.2.0
func (*TaskEvent) SetFailedSibling ¶ added in v0.5.0
func (*TaskEvent) SetFailsTask ¶ added in v0.5.0
func (*TaskEvent) SetKillError ¶ added in v0.2.0
func (*TaskEvent) SetKillReason ¶ added in v0.5.0
func (*TaskEvent) SetKillTimeout ¶ added in v0.4.1
func (*TaskEvent) SetMessage ¶ added in v0.5.5
SetMessage sets the message of TaskEvent
func (*TaskEvent) SetOOMKilled ¶ added in v0.9.0
func (*TaskEvent) SetRestartDelay ¶ added in v0.3.1
func (*TaskEvent) SetRestartReason ¶ added in v0.3.2
func (*TaskEvent) SetSetupError ¶ added in v0.5.0
SetSetupError is used to store an error that occurred while setting up the task
func (*TaskEvent) SetSignalText ¶ added in v0.9.2
func (*TaskEvent) SetTaskSignal ¶ added in v0.5.0
func (*TaskEvent) SetTaskSignalReason ¶ added in v0.5.0
func (*TaskEvent) SetValidationError ¶ added in v0.3.2
func (*TaskEvent) SetVaultRenewalError ¶ added in v0.5.0
type TaskGroup ¶
type TaskGroup struct { // Name of the task group Name string // Count is the number of replicas of this task group that should // be scheduled. Count int // Update is used to control the update strategy for this task group Update *UpdateStrategy // Migrate is used to control the migration strategy for this task group Migrate *MigrateStrategy // Constraints can be specified at a task group level and apply to // all the tasks contained. Constraints []*Constraint // Scaling is the list of autoscaling policies for the TaskGroup Scaling *ScalingPolicy // RestartPolicy of a TaskGroup RestartPolicy *RestartPolicy // Tasks are the collection of tasks that this task group needs to run Tasks []*Task // EphemeralDisk is the disk resources that the task group requests EphemeralDisk *EphemeralDisk // Meta is used to associate arbitrary metadata with this // task group. This is opaque to Nomad. Meta map[string]string // ReschedulePolicy is used to configure how the scheduler should // retry failed allocations. ReschedulePolicy *ReschedulePolicy // Affinities can be specified at the task group level to express // scheduling preferences. Affinities []*Affinity // Spread can be specified at the task group level to express spreading // allocations across a desired attribute, such as datacenter Spreads []*Spread // Networks are the network configuration for the task group. This can be // overridden in the task. Networks Networks // Consul configuration specific to this task group Consul *Consul // Services this group provides Services []*Service // Volumes is a map of volumes that have been requested by the task group. Volumes map[string]*VolumeRequest // ShutdownDelay is the amount of time to wait between deregistering // group services in consul and stopping tasks. ShutdownDelay *time.Duration // StopAfterClientDisconnect, if set, configures the client to stop the task group // after this duration since the last known good heartbeat StopAfterClientDisconnect *time.Duration // MaxClientDisconnect, if set, configures the client to allow placed // allocations for tasks in this group to attempt to resume running without a restart. MaxClientDisconnect *time.Duration }
TaskGroup is an atomic unit of placement. Each task group belongs to a job and may contain any number of tasks. A task group support running in many replicas using the same configuration..
func (*TaskGroup) Canonicalize ¶ added in v0.4.1
Canonicalize is used to canonicalize fields in the TaskGroup.
func (*TaskGroup) ConsulServices ¶ added in v1.4.5
func (*TaskGroup) Diff ¶ added in v0.4.0
func (tg *TaskGroup) Diff(other *TaskGroup, contextual bool) (*TaskGroupDiff, error)
Diff returns a diff of two task groups. If contextual diff is enabled, objects' fields will be stored even if no diff occurred as long as one field changed.
func (*TaskGroup) LookupTask ¶
LookupTask finds a task by name
func (*TaskGroup) NomadServices ¶ added in v1.4.0
NomadServices returns a list of all group and task - level services in tg that are making use of the nomad service provider.
func (*TaskGroup) UsesConnect ¶ added in v0.10.4
UsesConnect for convenience returns true if the TaskGroup contains at least one service that makes use of Consul Connect features.
Currently used for validating that the task group contains one or more connect aware services before generating a service identity token.
func (*TaskGroup) UsesConnectGateway ¶ added in v0.12.4
UsesConnectGateway for convenience returns true if the TaskGroup contains at least one service that makes use of Consul Connect Gateway features.
type TaskGroupDiff ¶ added in v0.4.0
type TaskGroupDiff struct { Type DiffType Name string Fields []*FieldDiff Objects []*ObjectDiff Tasks []*TaskDiff Updates map[string]uint64 }
TaskGroupDiff contains the diff of two task groups.
func (*TaskGroupDiff) GoString ¶ added in v0.4.0
func (tg *TaskGroupDiff) GoString() string
type TaskGroupDiffs ¶ added in v0.4.0
type TaskGroupDiffs []*TaskGroupDiff
For sorting TaskGroupDiffs
func (TaskGroupDiffs) Len ¶ added in v0.4.0
func (tg TaskGroupDiffs) Len() int
func (TaskGroupDiffs) Less ¶ added in v0.4.0
func (tg TaskGroupDiffs) Less(i, j int) bool
func (TaskGroupDiffs) Swap ¶ added in v0.4.0
func (tg TaskGroupDiffs) Swap(i, j int)
type TaskGroupScaleStatus ¶ added in v0.11.0
type TaskGroupScaleStatus struct { Desired int Placed int Running int Healthy int Unhealthy int Events []*ScalingEvent }
TaskGroupScaleStatus is used to return the scale status for a given task group
type TaskGroupSummary ¶ added in v0.4.1
type TaskGroupSummary struct { Queued int Complete int Failed int Running int Starting int Lost int Unknown int }
TaskGroupSummary summarizes the state of all the allocations of a particular TaskGroup
type TaskHandle ¶ added in v1.1.0
type TaskHandle struct { // Version of driver state. Used by the driver to gracefully handle // plugin upgrades. Version int // Driver-specific state containing a handle to the remote task. DriverState []byte }
TaskHandle is optional handle to a task propogated to the servers for use by remote tasks. Since remote tasks are not implicitly lost when the node they are assigned to is down, their state is migrated to the replacement allocation.
Minimal set of fields from plugins/drivers/task_handle.go:TaskHandle
func (*TaskHandle) Copy ¶ added in v1.1.0
func (h *TaskHandle) Copy() *TaskHandle
type TaskKind ¶ added in v0.10.0
type TaskKind string
TaskKind identifies the special kinds of tasks using the following format: '<kind_name>(:<identifier>)`. The TaskKind can optionally include an identifier that is opaque to the Task. This identifier can be used to relate the task to some other entity based on the kind.
For example, a task may have the TaskKind of `connect-proxy:service` where 'connect-proxy' is the kind name and 'service' is the identifier that relates the task to the service name of which it is a connect proxy for.
func NewTaskKind ¶ added in v0.11.3
func (TaskKind) IsAnyConnectGateway ¶ added in v0.12.4
IsAnyConnectGateway returns true if the TaskKind represents any one of the supported connect gateway types.
func (TaskKind) IsConnectIngress ¶ added in v0.12.4
IsConnectIngress returns true if the TaskKind is connect-ingress.
func (TaskKind) IsConnectMesh ¶ added in v1.1.1
IsConnectMesh returns true if the TaskKind is connect-mesh.
func (TaskKind) IsConnectNative ¶ added in v0.11.3
IsConnectNative returns true if the TaskKind is connect-native.
func (TaskKind) IsConnectProxy ¶ added in v0.10.0
IsConnectProxy returns true if the TaskKind is connect-proxy.
func (TaskKind) IsConnectTerminating ¶ added in v1.0.4
IsConnectTerminating returns true if the TaskKind is connect-terminating.
type TaskLifecycleConfig ¶ added in v0.11.0
func (*TaskLifecycleConfig) Copy ¶ added in v0.11.0
func (d *TaskLifecycleConfig) Copy() *TaskLifecycleConfig
func (*TaskLifecycleConfig) Validate ¶ added in v0.11.0
func (d *TaskLifecycleConfig) Validate() error
type TaskState ¶ added in v0.2.0
type TaskState struct { // The current state of the task. State string // Failed marks a task as having failed Failed bool // Restarts is the number of times the task has restarted Restarts uint64 // LastRestart is the time the task last restarted. It is updated each time the // task restarts LastRestart time.Time // StartedAt is the time the task is started. It is updated each time the // task starts StartedAt time.Time // FinishedAt is the time at which the task transitioned to dead and will // not be started again. FinishedAt time.Time // Series of task events that transition the state of the task. Events []*TaskEvent // Experimental - TaskHandle is based on drivers.TaskHandle and used // by remote task drivers to migrate task handles between allocations. TaskHandle *TaskHandle }
TaskState tracks the current state of a task and events that caused state transitions.
func NewTaskState ¶ added in v0.9.0
func NewTaskState() *TaskState
NewTaskState returns a TaskState initialized in the Pending state.
func (*TaskState) Canonicalize ¶ added in v0.9.0
func (ts *TaskState) Canonicalize()
Canonicalize ensures the TaskState has a State set. It should default to Pending.
func (*TaskState) Successful ¶ added in v0.4.0
Successful returns whether a task finished successfully. Only meaningful for for batch allocations or ephemeral (non-sidecar) lifecycle tasks part of a service or system allocation.
type Template ¶ added in v0.5.0
type Template struct { // SourcePath is the path to the template to be rendered SourcePath string // DestPath is the path to where the template should be rendered DestPath string // EmbeddedTmpl store the raw template. This is useful for smaller templates // where they are embedded in the job file rather than sent as an artifact EmbeddedTmpl string // ChangeMode indicates what should be done if the template is re-rendered ChangeMode string // ChangeSignal is the signal that should be sent if the change mode // requires it. ChangeSignal string // ChangeScript is the configuration of the script. It's required if // ChangeMode is set to script. ChangeScript *ChangeScript // Splay is used to avoid coordinated restarts of processes by applying a // random wait between 0 and the given splay value before signalling the // application of a change Splay time.Duration // Perms is the permission the file should be written out with. Perms string // User and group that should own the file. Uid *int Gid *int // LeftDelim and RightDelim are optional configurations to control what // delimiter is utilized when parsing the template. LeftDelim string RightDelim string // Envvars enables exposing the template as environment variables // instead of as a file. The template must be of the form: // // VAR_NAME_1={{ key service/my-key }} // VAR_NAME_2=raw string and {{ env "attr.kernel.name" }} // // Lines will be split on the initial "=" with the first part being the // key name and the second part the value. // Empty lines and lines starting with # will be ignored, but to avoid // escaping issues #s within lines will not be treated as comments. Envvars bool // VaultGrace is the grace duration between lease renewal and reacquiring a // secret. If the lease of a secret is less than the grace, a new secret is // acquired. // COMPAT(0.12) VaultGrace has been ignored by Vault since Vault v0.5. VaultGrace time.Duration // WaitConfig is used to override the global WaitConfig on a per-template basis Wait *WaitConfig // ErrMissingKey is used to control how the template behaves when attempting // to index a struct or map key that does not exist. ErrMissingKey bool }
Template represents a template configuration to be rendered for a given task
func DefaultTemplate ¶ added in v0.5.0
func DefaultTemplate() *Template
DefaultTemplate returns a default template.
func (*Template) Canonicalize ¶ added in v0.5.0
func (t *Template) Canonicalize()
type TerminalByNodeByName ¶ added in v1.2.0
type TerminalByNodeByName map[string]map[string]*Allocation
TerminalByNodeByName is a map of NodeID->Allocation.Name->Allocation used by the sysbatch scheduler for locating the most up-to-date terminal allocations.
func (TerminalByNodeByName) Get ¶ added in v1.2.0
func (a TerminalByNodeByName) Get(nodeID, name string) (*Allocation, bool)
func (TerminalByNodeByName) Set ¶ added in v1.2.0
func (a TerminalByNodeByName) Set(allocation *Allocation)
type UpdateStrategy ¶
type UpdateStrategy struct { // Stagger is used to determine the rate at which allocations are migrated // due to down or draining nodes. Stagger time.Duration // MaxParallel is how many updates can be done in parallel MaxParallel int // HealthCheck specifies the mechanism in which allocations are marked // healthy or unhealthy as part of a deployment. HealthCheck string // MinHealthyTime is the minimum time an allocation must be in the healthy // state before it is marked as healthy, unblocking more allocations to be // rolled. MinHealthyTime time.Duration // HealthyDeadline is the time in which an allocation must be marked as // healthy before it is automatically transitioned to unhealthy. This time // period doesn't count against the MinHealthyTime. HealthyDeadline time.Duration // ProgressDeadline is the time in which an allocation as part of the // deployment must transition to healthy. If no allocation becomes healthy // after the deadline, the deployment is marked as failed. If the deadline // is zero, the first failure causes the deployment to fail. ProgressDeadline time.Duration // AutoRevert declares that if a deployment fails because of unhealthy // allocations, there should be an attempt to auto-revert the job to a // stable version. AutoRevert bool // AutoPromote declares that the deployment should be promoted when all canaries are // healthy AutoPromote bool // Canary is the number of canaries to deploy when a change to the task // group is detected. Canary int }
UpdateStrategy is used to modify how updates are done
func (*UpdateStrategy) Copy ¶ added in v0.6.0
func (u *UpdateStrategy) Copy() *UpdateStrategy
func (*UpdateStrategy) IsEmpty ¶ added in v0.10.0
func (u *UpdateStrategy) IsEmpty() bool
func (*UpdateStrategy) Rolling ¶
func (u *UpdateStrategy) Rolling() bool
Rolling returns if a rolling strategy should be used. TODO(alexdadgar): Remove once no longer used by the scheduler.
func (*UpdateStrategy) Validate ¶ added in v0.6.0
func (u *UpdateStrategy) Validate() error
type VarApplyStateRequest ¶ added in v1.4.0
type VarApplyStateRequest struct { Op VarOp // Which operation are we performing Var *VariableEncrypted // Which directory entry WriteRequest }
VarApplyStateRequest is used by the FSM to modify the variable store
func (*VarApplyStateRequest) ConflictResponse ¶ added in v1.4.0
func (r *VarApplyStateRequest) ConflictResponse(raftIndex uint64, cv *VariableEncrypted) *VarApplyStateResponse
func (*VarApplyStateRequest) ErrorResponse ¶ added in v1.4.0
func (r *VarApplyStateRequest) ErrorResponse(raftIndex uint64, err error) *VarApplyStateResponse
func (*VarApplyStateRequest) SuccessResponse ¶ added in v1.4.0
func (r *VarApplyStateRequest) SuccessResponse(raftIndex uint64, meta *VariableMetadata) *VarApplyStateResponse
type VarApplyStateResponse ¶ added in v1.4.0
type VarApplyStateResponse struct { Op VarOp // Which operation were we performing Result VarOpResult // What happened (ok, conflict, error) Error error // error if any Conflict *VariableEncrypted // conflicting variable if applies WrittenSVMeta *VariableMetadata // for making the VariablesApplyResponse WriteMeta }
VarApplyStateResponse is used by the FSM to inform the RPC layer of success or failure
func (*VarApplyStateResponse) IsConflict ¶ added in v1.4.0
func (r *VarApplyStateResponse) IsConflict() bool
func (*VarApplyStateResponse) IsError ¶ added in v1.4.0
func (r *VarApplyStateResponse) IsError() bool
func (*VarApplyStateResponse) IsOk ¶ added in v1.4.0
func (r *VarApplyStateResponse) IsOk() bool
type VarOp ¶ added in v1.4.0
type VarOp string
VarOp constants give possible operations available in a transaction.
type VarOpResult ¶ added in v1.4.0
type VarOpResult string
VarOpResult constants give possible operations results from a transaction.
const ( VarOpResultOk VarOpResult = "ok" VarOpResultConflict VarOpResult = "conflict" VarOpResultRedacted VarOpResult = "conflict-redacted" VarOpResultError VarOpResult = "error" )
type VariableData ¶ added in v1.4.0
type VariableData struct { Data []byte // includes nonce KeyID string // ID of root key used to encrypt this entry }
VariableData is the secret data for a Variable
func (VariableData) Copy ¶ added in v1.4.0
func (sv VariableData) Copy() VariableData
func (VariableData) Equals ¶ added in v1.4.0
func (d1 VariableData) Equals(d2 VariableData) bool
Equals performs deep equality checking on the encrypted data part of a VariableEncrypted
type VariableDecrypted ¶ added in v1.4.0
type VariableDecrypted struct { VariableMetadata Items VariableItems }
VariableDecrypted structs are returned from the Encrypter's decrypt method. Since they contains sensitive material, they should never be persisted to disk.
func (*VariableDecrypted) Canonicalize ¶ added in v1.4.0
func (sv *VariableDecrypted) Canonicalize()
func (VariableDecrypted) Copy ¶ added in v1.4.0
func (sv VariableDecrypted) Copy() VariableDecrypted
func (VariableDecrypted) Equals ¶ added in v1.4.0
func (v1 VariableDecrypted) Equals(v2 VariableDecrypted) bool
Equals checks both the metadata and items in a VariableDecrypted struct
func (VariableDecrypted) Validate ¶ added in v1.4.0
func (v VariableDecrypted) Validate() error
type VariableEncrypted ¶ added in v1.4.0
type VariableEncrypted struct { VariableMetadata VariableData }
VariableEncrypted structs are returned from the Encrypter's encrypt method. They are the only form that should ever be persisted to storage.
func (VariableEncrypted) Copy ¶ added in v1.4.0
func (sv VariableEncrypted) Copy() VariableEncrypted
func (VariableEncrypted) Equals ¶ added in v1.4.0
func (v1 VariableEncrypted) Equals(v2 VariableEncrypted) bool
Equals checks both the metadata and encrypted data for a VariableEncrypted struct
type VariableItems ¶ added in v1.4.0
VariableItems are the actual secrets stored in a variable. They are always encrypted and decrypted as a single unit.
func (VariableItems) Copy ¶ added in v1.4.0
func (sv VariableItems) Copy() VariableItems
func (VariableItems) Equals ¶ added in v1.4.0
func (i1 VariableItems) Equals(i2 VariableItems) bool
Equals performs deep equality checking on the cleartext items of a VariableDecrypted. Uses reflect.DeepEqual
func (VariableItems) Size ¶ added in v1.4.0
func (svi VariableItems) Size() uint64
type VariableMetadata ¶ added in v1.4.0
type VariableMetadata struct { Namespace string Path string CreateIndex uint64 CreateTime int64 ModifyIndex uint64 ModifyTime int64 }
VariableMetadata is the metadata envelope for a Variable, it is the list object and is shared data between an VariableEncrypted and a VariableDecrypted object.
func (*VariableMetadata) Copy ¶ added in v1.4.0
func (sv *VariableMetadata) Copy() *VariableMetadata
GetNamespace returns the variable's namespace. Used for pagination.
func (VariableMetadata) Equals ¶ added in v1.4.0
func (sv VariableMetadata) Equals(sv2 VariableMetadata) bool
Equals is a convenience method to provide similar equality checking syntax for metadata and the VariablesData or VariableItems struct
func (VariableMetadata) GetCreateIndex ¶ added in v1.4.0
func (sv VariableMetadata) GetCreateIndex() uint64
GetCreateIndex returns the variable's create index. Used for pagination.
func (VariableMetadata) GetID ¶ added in v1.4.0
func (sv VariableMetadata) GetID() string
GetID returns the variable's path. Used for pagination.
func (VariableMetadata) GetNamespace ¶ added in v1.4.0
func (sv VariableMetadata) GetNamespace() string
GetNamespace returns the variable's namespace. Used for pagination.
type VariablesApplyRequest ¶ added in v1.4.0
type VariablesApplyRequest struct { Op VarOp // Operation to be performed during apply Var *VariableDecrypted // Variable-shaped request data WriteRequest }
VariablesApplyRequest is used by users to operate on the variable store
type VariablesApplyResponse ¶ added in v1.4.0
type VariablesApplyResponse struct { Op VarOp // Operation performed Input *VariableDecrypted // Input supplied Result VarOpResult // Return status from operation Error error // Error if any Conflict *VariableDecrypted // Conflicting value if applicable Output *VariableDecrypted // Operation Result if successful; nil for successful deletes WriteMeta }
VariablesApplyResponse is sent back to the user to inform them of success or failure
func (*VariablesApplyResponse) IsConflict ¶ added in v1.4.0
func (r *VariablesApplyResponse) IsConflict() bool
func (*VariablesApplyResponse) IsError ¶ added in v1.4.0
func (r *VariablesApplyResponse) IsError() bool
func (*VariablesApplyResponse) IsOk ¶ added in v1.4.0
func (r *VariablesApplyResponse) IsOk() bool
func (*VariablesApplyResponse) IsRedacted ¶ added in v1.4.0
func (r *VariablesApplyResponse) IsRedacted() bool
type VariablesListRequest ¶ added in v1.4.0
type VariablesListRequest struct {
QueryOptions
}
type VariablesListResponse ¶ added in v1.4.0
type VariablesListResponse struct { Data []*VariableMetadata QueryMeta }
type VariablesQuota ¶ added in v1.4.0
VariablesQuota is used to track the total size of variables entries per namespace. The total length of Variable.EncryptedData in bytes will be added to the VariablesQuota table in the same transaction as a write, update, or delete. This tracking effectively caps the maximum size of variables in a given namespace to MaxInt64 bytes.
func (*VariablesQuota) Copy ¶ added in v1.4.0
func (svq *VariablesQuota) Copy() *VariablesQuota
type VariablesReadRequest ¶ added in v1.4.0
type VariablesReadRequest struct { Path string QueryOptions }
type VariablesReadResponse ¶ added in v1.4.0
type VariablesReadResponse struct { Data *VariableDecrypted QueryMeta }
type Vault ¶ added in v0.5.0
type Vault struct { // Policies is the set of policies that the task needs access to Policies []string // Namespace is the vault namespace that should be used. Namespace string // Env marks whether the Vault Token should be exposed as an environment // variable Env bool // ChangeMode is used to configure the task's behavior when the Vault // token changes because the original token could not be renewed in time. ChangeMode string // ChangeSignal is the signal sent to the task when a new token is // retrieved. This is only valid when using the signal change mode. ChangeSignal string }
Vault stores the set of permissions a task needs access to from Vault.
func DefaultVaultBlock ¶ added in v0.5.0
func DefaultVaultBlock() *Vault
func (*Vault) Canonicalize ¶ added in v0.5.0
func (v *Vault) Canonicalize()
type VaultAccessor ¶ added in v0.5.0
type VaultAccessor struct { AllocID string Task string NodeID string Accessor string CreationTTL int // Raft Indexes CreateIndex uint64 }
VaultAccessor is a reference to a created Vault token on behalf of an allocation's task.
type VaultAccessorsRequest ¶ added in v0.5.0
type VaultAccessorsRequest struct {
Accessors []*VaultAccessor
}
VaultAccessorsRequest is used to operate on a set of Vault accessors
type VaultTokenData ¶ added in v1.3.0
type VaultTokenData struct { CreationTTL int `mapstructure:"creation_ttl"` TTL int `mapstructure:"ttl"` Renewable bool `mapstructure:"renewable"` Policies []string `mapstructure:"policies"` Role string `mapstructure:"role"` NamespacePath string `mapstructure:"namespace_path"` // contains filtered or unexported fields }
VaultTokenData represents some of the fields returned in the Data map of the sercret returned by the Vault API when doing a token lookup request.
func (VaultTokenData) Root ¶ added in v1.3.0
func (d VaultTokenData) Root() bool
Root returns true if the token has the `root` policy.
type VaultTokenRoleData ¶ added in v1.3.0
type VaultTokenRoleData struct { Name string `mapstructure:"name"` ExplicitMaxTtl int `mapstructure:"explicit_max_ttl"` TokenExplicitMaxTtl int `mapstructure:"token_explicit_max_ttl"` Orphan bool Period int TokenPeriod int `mapstructure:"token_period"` Renewable bool DisallowedPolicies []string `mapstructure:"disallowed_policies"` AllowedEntityAliases []string `mapstructure:"allowed_entity_aliases"` AllowedPolicies []string `mapstructure:"allowed_policies"` }
VaultTokenRoleData represents some of the fields returned in the Data map of the sercret returned by the Vault API when reading a token role.
type VersionResponse ¶
VersionResponse is used for the Status.Version response
type VolumeMount ¶ added in v0.10.0
VolumeMount represents the relationship between a destination path in a task and the task group volume that should be mounted there.
func CopySliceVolumeMount ¶ added in v0.10.0
func CopySliceVolumeMount(s []*VolumeMount) []*VolumeMount
func (*VolumeMount) Copy ¶ added in v0.10.0
func (v *VolumeMount) Copy() *VolumeMount
type VolumeRequest ¶ added in v0.10.0
type VolumeRequest struct { Name string Type string Source string ReadOnly bool AccessMode CSIVolumeAccessMode AttachmentMode CSIVolumeAttachmentMode MountOptions *CSIMountOptions PerAlloc bool }
VolumeRequest is a representation of a storage volume that a TaskGroup wishes to use.
func (*VolumeRequest) Copy ¶ added in v0.10.0
func (v *VolumeRequest) Copy() *VolumeRequest
type WaitConfig ¶ added in v1.2.4
WaitConfig is the Min/Max duration used by the Consul Template Watcher. Consul Template relies on pointer based business logic. This struct uses pointers so that we tell the different between zero values and unset values.
func (*WaitConfig) Copy ¶ added in v1.2.4
func (wc *WaitConfig) Copy() *WaitConfig
Copy returns a deep copy of this configuration.
func (*WaitConfig) Equals ¶ added in v1.2.4
func (wc *WaitConfig) Equals(o *WaitConfig) bool
func (*WaitConfig) Validate ¶ added in v1.2.4
func (wc *WaitConfig) Validate() error
Validate that the min is not greater than the max
type WrappedServerError ¶ added in v0.8.0
type WrappedServerError struct {
Err error
}
WrappedServerError wraps an error and satisfies both the Recoverable and the ServerSideError interfaces
func (*WrappedServerError) Error ¶ added in v0.8.0
func (r *WrappedServerError) Error() string
func (*WrappedServerError) IsRecoverable ¶ added in v0.8.0
func (r *WrappedServerError) IsRecoverable() bool
func (*WrappedServerError) IsServerSide ¶ added in v0.8.0
func (r *WrappedServerError) IsServerSide() bool
type WriteMeta ¶
type WriteMeta struct { // This is the index associated with the write Index uint64 }
WriteMeta allows a write response to include potentially useful metadata about the write
type WriteRequest ¶
type WriteRequest struct { // The target region for this write Region string // Namespace is the target namespace for the write. // // Since RPC handlers do not have a default value set they should // access the Namespace via the RequestNamespace method. // // Requests accessing specific namespaced objects must check ACLs // against the namespace of the object, not the namespace in the // request. Namespace string // AuthToken is secret portion of the ACL token used for the request AuthToken string // IdempotencyToken can be used to ensure the write is idempotent. IdempotencyToken string InternalRpcInfo }
func (WriteRequest) AllowStaleRead ¶
func (w WriteRequest) AllowStaleRead() bool
func (WriteRequest) IsRead ¶
func (w WriteRequest) IsRead() bool
IsRead only applies to writes, always false.
func (WriteRequest) RequestNamespace ¶ added in v0.7.0
func (w WriteRequest) RequestNamespace() string
RequestNamespace returns the request's namespace or the default namespace if no explicit namespace was sent.
Requests accessing specific namespaced objects must check ACLs against the namespace of the object, not the namespace in the request.
func (WriteRequest) RequestRegion ¶
func (w WriteRequest) RequestRegion() string
func (WriteRequest) SetTimeToBlock ¶ added in v1.0.0
func (w WriteRequest) SetTimeToBlock(_ time.Duration)
func (WriteRequest) TimeToBlock ¶ added in v1.0.0
func (w WriteRequest) TimeToBlock() time.Duration
Source Files ¶
- acl.go
- alloc.go
- autopilot.go
- batch_future.go
- bitmap.go
- checks.go
- connect.go
- consul.go
- consul_oss.go
- csi.go
- devices.go
- diff.go
- encoding.go
- errors.go
- eval.go
- event.go
- extensions.go
- funcs.go
- handlers.go
- job.go
- keyring.go
- network.go
- node.go
- node_class.go
- operator.go
- search.go
- service_identities.go
- service_registration.go
- services.go
- streaming_rpc.go
- structs.go
- structs_codegen.go
- structs_oss.go
- testing.go
- uuid.go
- variables.go
- vault.go
- volumes.go