Versions in this module Expand all Collapse all v0 v0.7.1 Dec 20, 2017 Changes in this version + const DefaultDC + const DefaultDequeueTimeout + const DefaultRegion + const DefaultSerfPort + const DispatchPayloadSizeLimit + const ProtocolVersionMax + const ProtocolVersionMin + const RegisterEnforceIndexErrPrefix + const StatusReap + var DefaultRPCAddr = &net.TCPAddr + var ErrNackTimeoutReached = errors.New("evaluation nack timeout reached") + var ErrNotOutstanding = errors.New("evaluation is not outstanding") + var ErrTokenMismatch = errors.New("evaluation token does not match") + func CompareMigrateToken(allocID, nodeSecretID, otherMigrateToken string) bool + func GenerateMigrateToken(allocID, nodeSecretID string) (string, error) + func NewBatchFuture() *batchFuture + func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec + func NewCoreScheduler(srv *Server, snap *state.StateSnapshot) scheduler.Scheduler + func NewFSM(config *FSMConfig) (*nomadFSM, error) + func NewPeriodicHeap() *periodicHeap + func NewServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec + func NewVaultClient(c *config.VaultConfig, logger *log.Logger, purgeFn PurgeVaultAccessorFn) (*vaultClient, error) + func PoliciesFrom(s *vapi.Secret) ([]string, error) + func RuntimeStats() map[string]string + func ServersMeetMinimumVersion(members []serf.Member, minVersion *version.Version) bool + type ACL struct + func (a *ACL) Bootstrap(args *structs.ACLTokenBootstrapRequest, reply *structs.ACLTokenUpsertResponse) error + func (a *ACL) DeletePolicies(args *structs.ACLPolicyDeleteRequest, reply *structs.GenericResponse) error + func (a *ACL) DeleteTokens(args *structs.ACLTokenDeleteRequest, reply *structs.GenericResponse) error + func (a *ACL) GetPolicies(args *structs.ACLPolicySetRequest, reply *structs.ACLPolicySetResponse) error + func (a *ACL) GetPolicy(args *structs.ACLPolicySpecificRequest, reply *structs.SingleACLPolicyResponse) error + func (a *ACL) GetToken(args *structs.ACLTokenSpecificRequest, reply *structs.SingleACLTokenResponse) error + func (a *ACL) GetTokens(args *structs.ACLTokenSetRequest, reply *structs.ACLTokenSetResponse) error + func (a *ACL) ListPolicies(args *structs.ACLPolicyListRequest, reply *structs.ACLPolicyListResponse) error + func (a *ACL) ListTokens(args *structs.ACLTokenListRequest, reply *structs.ACLTokenListResponse) error + func (a *ACL) ResolveToken(args *structs.ResolveACLTokenRequest, reply *structs.ResolveACLTokenResponse) error + func (a *ACL) UpsertPolicies(args *structs.ACLPolicyUpsertRequest, reply *structs.GenericResponse) error + func (a *ACL) UpsertTokens(args *structs.ACLTokenUpsertRequest, reply *structs.ACLTokenUpsertResponse) error + type Alloc struct + func (a *Alloc) GetAlloc(args *structs.AllocSpecificRequest, reply *structs.SingleAllocResponse) error + func (a *Alloc) GetAllocs(args *structs.AllocsGetRequest, reply *structs.AllocsGetResponse) error + func (a *Alloc) List(args *structs.AllocListRequest, reply *structs.AllocListResponse) error + type BlockedEvals struct + func NewBlockedEvals(evalBroker *EvalBroker) *BlockedEvals + func (b *BlockedEvals) Block(eval *structs.Evaluation) + func (b *BlockedEvals) EmitStats(period time.Duration, stopCh chan struct{}) + func (b *BlockedEvals) Enabled() bool + func (b *BlockedEvals) Flush() + func (b *BlockedEvals) GetDuplicates(timeout time.Duration) []*structs.Evaluation + func (b *BlockedEvals) Reblock(eval *structs.Evaluation, token string) + func (b *BlockedEvals) SetEnabled(enabled bool) + func (b *BlockedEvals) SetTimetable(timetable *TimeTable) + func (b *BlockedEvals) Stats() *BlockedStats + func (b *BlockedEvals) Unblock(computedClass string, index uint64) + func (b *BlockedEvals) UnblockClassAndQuota(class, quota string, index uint64) + func (b *BlockedEvals) UnblockFailed() + func (b *BlockedEvals) UnblockQuota(quota string, index uint64) + func (b *BlockedEvals) Untrack(jobID string) + type BlockedStats struct + TotalBlocked int + TotalEscaped int + TotalQuotaLimit int + type BrokerStats struct + ByScheduler map[string]*SchedulerStats + TotalBlocked int + TotalReady int + TotalUnacked int + TotalWaiting int + type Config struct + ACLEnabled bool + AuthoritativeRegion string + BackwardsCompatibleMetrics bool + Bootstrap bool + BootstrapExpect int32 + Build string + ConsulConfig *config.ConsulConfig + DataDir string + Datacenter string + DeploymentGCInterval time.Duration + DeploymentGCThreshold time.Duration + DevDisableBootstrap bool + DevMode bool + DisableTaggedMetrics bool + EnabledSchedulers []string + EvalDeliveryLimit int + EvalFailedFollowupBaselineDelay time.Duration + EvalFailedFollowupDelayRange time.Duration + EvalGCInterval time.Duration + EvalGCThreshold time.Duration + EvalNackInitialReenqueueDelay time.Duration + EvalNackSubsequentReenqueueDelay time.Duration + EvalNackTimeout time.Duration + FailoverHeartbeatTTL time.Duration + HeartbeatGrace time.Duration + JobGCInterval time.Duration + JobGCThreshold time.Duration + LogOutput io.Writer + MaxHeartbeatsPerSecond float64 + MinHeartbeatTTL time.Duration + NodeGCInterval time.Duration + NodeGCThreshold time.Duration + NodeName string + NumSchedulers int + ProtocolVersion uint8 + RPCAddr *net.TCPAddr + RPCAdvertise *net.TCPAddr + RPCHoldTimeout time.Duration + RaftConfig *raft.Config + RaftTimeout time.Duration + ReconcileInterval time.Duration + Region string + ReplicationBackoff time.Duration + ReplicationToken string + SentinelConfig *config.SentinelConfig + SentinelGCInterval time.Duration + SerfConfig *serf.Config + StatsCollectionInterval time.Duration + TLSConfig *config.TLSConfig + VaultConfig *config.VaultConfig + func DefaultConfig() *Config + func (c *Config) CheckVersion() error + type Conn struct + func (c *Conn) Close() error + type ConnPool struct + func NewPool(logOutput io.Writer, maxTime time.Duration, maxStreams int, ...) *ConnPool + func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string, args interface{}, ...) error + func (p *ConnPool) Shutdown() error + type CoreScheduler struct + func (c *CoreScheduler) Process(eval *structs.Evaluation) error + type Deployment struct + func (d *Deployment) Allocations(args *structs.DeploymentSpecificRequest, reply *structs.AllocListResponse) error + func (d *Deployment) Fail(args *structs.DeploymentFailRequest, reply *structs.DeploymentUpdateResponse) error + func (d *Deployment) GetDeployment(args *structs.DeploymentSpecificRequest, ...) error + func (d *Deployment) List(args *structs.DeploymentListRequest, reply *structs.DeploymentListResponse) error + func (d *Deployment) Pause(args *structs.DeploymentPauseRequest, reply *structs.DeploymentUpdateResponse) error + func (d *Deployment) Promote(args *structs.DeploymentPromoteRequest, ...) error + func (d *Deployment) Reap(args *structs.DeploymentDeleteRequest, reply *structs.GenericResponse) error + func (d *Deployment) SetAllocHealth(args *structs.DeploymentAllocHealthRequest, ...) error + type EnterpriseEndpoints struct + func NewEnterpriseEndpoints(s *Server) *EnterpriseEndpoints + func (e *EnterpriseEndpoints) Register(s *Server) + type EnterpriseState struct + type Eval struct + func (e *Eval) Ack(args *structs.EvalAckRequest, reply *structs.GenericResponse) error + func (e *Eval) Allocations(args *structs.EvalSpecificRequest, reply *structs.EvalAllocationsResponse) error + func (e *Eval) Create(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error + func (e *Eval) Dequeue(args *structs.EvalDequeueRequest, reply *structs.EvalDequeueResponse) error + func (e *Eval) GetEval(args *structs.EvalSpecificRequest, reply *structs.SingleEvalResponse) error + func (e *Eval) List(args *structs.EvalListRequest, reply *structs.EvalListResponse) error + func (e *Eval) Nack(args *structs.EvalAckRequest, reply *structs.GenericResponse) error + func (e *Eval) Reap(args *structs.EvalDeleteRequest, reply *structs.GenericResponse) error + func (e *Eval) Reblock(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error + func (e *Eval) Update(args *structs.EvalUpdateRequest, reply *structs.GenericResponse) error + type EvalBroker struct + func NewEvalBroker(timeout, initialNackDelay, subsequentNackDelay time.Duration, ...) (*EvalBroker, error) + func (b *EvalBroker) Ack(evalID, token string) error + func (b *EvalBroker) Dequeue(schedulers []string, timeout time.Duration) (*structs.Evaluation, string, error) + func (b *EvalBroker) EmitStats(period time.Duration, stopCh chan struct{}) + func (b *EvalBroker) Enabled() bool + func (b *EvalBroker) Enqueue(eval *structs.Evaluation) + func (b *EvalBroker) EnqueueAll(evals map[*structs.Evaluation]string) + func (b *EvalBroker) Flush() + func (b *EvalBroker) Nack(evalID, token string) error + func (b *EvalBroker) Outstanding(evalID string) (string, bool) + func (b *EvalBroker) OutstandingReset(evalID, token string) error + func (b *EvalBroker) PauseNackTimeout(evalID, token string) error + func (b *EvalBroker) ResumeNackTimeout(evalID, token string) error + func (b *EvalBroker) SetEnabled(enabled bool) + func (b *EvalBroker) Stats() *BrokerStats + type EvaluatePool struct + func NewEvaluatePool(workers, bufSize int) *EvaluatePool + func (p *EvaluatePool) RequestCh() chan<- evaluateRequest + func (p *EvaluatePool) ResultCh() <-chan evaluateResult + func (p *EvaluatePool) SetSize(size int) + func (p *EvaluatePool) Shutdown() + func (p *EvaluatePool) Size() int + type FSMConfig struct + Blocked *BlockedEvals + EvalBroker *EvalBroker + LogOutput io.Writer + Periodic *PeriodicDispatch + Region string + type Job struct + func (j *Job) Allocations(args *structs.JobSpecificRequest, reply *structs.JobAllocationsResponse) error + func (j *Job) Deployments(args *structs.JobSpecificRequest, reply *structs.DeploymentListResponse) error + func (j *Job) Deregister(args *structs.JobDeregisterRequest, reply *structs.JobDeregisterResponse) error + func (j *Job) Dispatch(args *structs.JobDispatchRequest, reply *structs.JobDispatchResponse) error + func (j *Job) Evaluate(args *structs.JobEvaluateRequest, reply *structs.JobRegisterResponse) error + func (j *Job) Evaluations(args *structs.JobSpecificRequest, reply *structs.JobEvaluationsResponse) error + func (j *Job) GetJob(args *structs.JobSpecificRequest, reply *structs.SingleJobResponse) error + func (j *Job) GetJobVersions(args *structs.JobVersionsRequest, reply *structs.JobVersionsResponse) error + func (j *Job) LatestDeployment(args *structs.JobSpecificRequest, reply *structs.SingleDeploymentResponse) error + func (j *Job) List(args *structs.JobListRequest, reply *structs.JobListResponse) error + func (j *Job) Plan(args *structs.JobPlanRequest, reply *structs.JobPlanResponse) error + func (j *Job) Register(args *structs.JobRegisterRequest, reply *structs.JobRegisterResponse) error + func (j *Job) Revert(args *structs.JobRevertRequest, reply *structs.JobRegisterResponse) error + func (j *Job) Stable(args *structs.JobStabilityRequest, reply *structs.JobStabilityResponse) error + func (j *Job) Summary(args *structs.JobSummaryRequest, reply *structs.JobSummaryResponse) error + func (j *Job) Validate(args *structs.JobValidateRequest, reply *structs.JobValidateResponse) error + type JobEvalDispatcher interface + DispatchJob func(job *structs.Job) (*structs.Evaluation, error) + RunningChildren func(job *structs.Job) (bool, error) + type LogApplier func(buf []byte, index uint64) interface + type LogAppliers map[structs.MessageType]LogApplier + type Node struct + func (n *Node) Deregister(args *structs.NodeDeregisterRequest, reply *structs.NodeUpdateResponse) error + func (n *Node) DeriveVaultToken(args *structs.DeriveVaultTokenRequest, reply *structs.DeriveVaultTokenResponse) error + func (n *Node) Evaluate(args *structs.NodeEvaluateRequest, reply *structs.NodeUpdateResponse) error + func (n *Node) GetAllocs(args *structs.NodeSpecificRequest, reply *structs.NodeAllocsResponse) error + func (n *Node) GetClientAllocs(args *structs.NodeSpecificRequest, reply *structs.NodeClientAllocsResponse) error + func (n *Node) GetNode(args *structs.NodeSpecificRequest, reply *structs.SingleNodeResponse) error + func (n *Node) List(args *structs.NodeListRequest, reply *structs.NodeListResponse) error + func (n *Node) Register(args *structs.NodeRegisterRequest, reply *structs.NodeUpdateResponse) error + func (n *Node) UpdateAlloc(args *structs.AllocUpdateRequest, reply *structs.GenericResponse) error + func (n *Node) UpdateDrain(args *structs.NodeUpdateDrainRequest, reply *structs.NodeDrainUpdateResponse) error + func (n *Node) UpdateStatus(args *structs.NodeUpdateStatusRequest, reply *structs.NodeUpdateResponse) error + type Operator struct + func (op *Operator) RaftGetConfiguration(args *structs.GenericRequest, reply *structs.RaftConfigurationResponse) error + func (op *Operator) RaftRemovePeerByAddress(args *structs.RaftPeerByAddressRequest, reply *struct{}) error + type PendingEvaluations []*structs.Evaluation + func (p *PendingEvaluations) Pop() interface{} + func (p *PendingEvaluations) Push(e interface{}) + func (p PendingEvaluations) Len() int + func (p PendingEvaluations) Less(i, j int) bool + func (p PendingEvaluations) Peek() *structs.Evaluation + func (p PendingEvaluations) Swap(i, j int) + type PendingPlans []*pendingPlan + func (p *PendingPlans) Pop() interface{} + func (p *PendingPlans) Push(e interface{}) + func (p PendingPlans) Len() int + func (p PendingPlans) Less(i, j int) bool + func (p PendingPlans) Peek() *pendingPlan + func (p PendingPlans) Swap(i, j int) + type Periodic struct + func (p *Periodic) Force(args *structs.PeriodicForceRequest, reply *structs.PeriodicForceResponse) error + type PeriodicDispatch struct + func NewPeriodicDispatch(logger *log.Logger, dispatcher JobEvalDispatcher) *PeriodicDispatch + func (p *PeriodicDispatch) Add(job *structs.Job) error + func (p *PeriodicDispatch) ForceRun(namespace, jobID string) (*structs.Evaluation, error) + func (p *PeriodicDispatch) LaunchTime(jobID string) (time.Time, error) + func (p *PeriodicDispatch) Remove(namespace, jobID string) error + func (p *PeriodicDispatch) SetEnabled(enabled bool) + func (p *PeriodicDispatch) Tracked() []*structs.Job + type Plan struct + func (p *Plan) Submit(args *structs.PlanRequest, reply *structs.PlanResponse) error + type PlanFuture interface + Wait func() (*structs.PlanResult, error) + type PlanQueue struct + func NewPlanQueue() (*PlanQueue, error) + func (q *PlanQueue) Dequeue(timeout time.Duration) (*pendingPlan, error) + func (q *PlanQueue) EmitStats(period time.Duration, stopCh chan struct{}) + func (q *PlanQueue) Enabled() bool + func (q *PlanQueue) Enqueue(plan *structs.Plan) (PlanFuture, error) + func (q *PlanQueue) Flush() + func (q *PlanQueue) SetEnabled(enabled bool) + func (q *PlanQueue) Stats() *QueueStats + type PurgeVaultAccessorFn func(accessors []*structs.VaultAccessor) error + type QueueStats struct + Depth int + type RPCType byte + type RaftLayer struct + func NewRaftLayer(addr net.Addr, tlsWrap tlsutil.Wrapper) *RaftLayer + func (l *RaftLayer) Accept() (net.Conn, error) + func (l *RaftLayer) Addr() net.Addr + func (l *RaftLayer) Close() error + func (l *RaftLayer) Dial(address raft.ServerAddress, timeout time.Duration) (net.Conn, error) + func (l *RaftLayer) Handoff(c net.Conn) error + type Region struct + func (r *Region) List(args *structs.GenericRequest, reply *[]string) error + type SchedulerStats struct + Ready int + Unacked int + type Search struct + func (s *Search) PrefixSearch(args *structs.SearchRequest, reply *structs.SearchResponse) error + type Server struct + func NewServer(config *Config, consulCatalog consul.CatalogAPI, logger *log.Logger) (*Server, error) + func (c *Server) LocalMember() serf.Member + func (s *Server) Datacenter() string + func (s *Server) DispatchJob(job *structs.Job) (*structs.Evaluation, error) + func (s *Server) Encrypted() bool + func (s *Server) GetConfig() *Config + func (s *Server) IsLeader() bool + func (s *Server) IsShutdown() bool + func (s *Server) Join(addrs []string) (int, error) + func (s *Server) KeyManager() *serf.KeyManager + func (s *Server) Leave() error + func (s *Server) Members() []serf.Member + func (s *Server) RPC(method string, args interface{}, reply interface{}) error + func (s *Server) Region() string + func (s *Server) Regions() []string + func (s *Server) Reload(config *Config) error + func (s *Server) RemoveFailedNode(node string) error + func (s *Server) ReplicationToken() string + func (s *Server) ResolveToken(secretID string) (*acl.ACL, error) + func (s *Server) RunningChildren(job *structs.Job) (bool, error) + func (s *Server) Shutdown() error + func (s *Server) State() *state.StateStore + func (s *Server) Stats() map[string]map[string]string + type SnapshotRestorer func(restore *state.StateRestore, dec *codec.Decoder) error + type SnapshotRestorers map[SnapshotType]SnapshotRestorer + type SnapshotType byte + const ACLPolicySnapshot + const ACLTokenSnapshot + const AllocSnapshot + const DeploymentSnapshot + const EvalSnapshot + const IndexSnapshot + const JobSnapshot + const JobSummarySnapshot + const JobVersionSnapshot + const NodeSnapshot + const PeriodicLaunchSnapshot + const TimeTableSnapshot + const VaultAccessorSnapshot + type Status struct + func (s *Status) Leader(args *structs.GenericRequest, reply *string) error + func (s *Status) Members(args *structs.GenericRequest, reply *structs.ServerMembersResponse) error + func (s *Status) Peers(args *structs.GenericRequest, reply *[]string) error + func (s *Status) Ping(args struct{}, reply *struct{}) error + func (s *Status) Version(args *structs.GenericRequest, reply *structs.VersionResponse) error + type StreamClient struct + func (sc *StreamClient) Close() + type System struct + func (s *System) GarbageCollect(args *structs.GenericRequest, reply *structs.GenericResponse) error + func (s *System) ReconcileJobSummaries(args *structs.GenericRequest, reply *structs.GenericResponse) error + type TestVaultClient struct + CreateTokenErrors map[string]map[string]error + CreateTokenSecret map[string]map[string]*vapi.Secret + LookupTokenErrors map[string]error + LookupTokenSecret map[string]*vapi.Secret + RevokedTokens []*structs.VaultAccessor + func (v *TestVaultClient) CreateToken(ctx context.Context, a *structs.Allocation, task string) (*vapi.Secret, error) + func (v *TestVaultClient) EmitStats(period time.Duration, stopCh chan struct{}) + func (v *TestVaultClient) LookupToken(ctx context.Context, token string) (*vapi.Secret, error) + func (v *TestVaultClient) RevokeTokens(ctx context.Context, accessors []*structs.VaultAccessor, committed bool) error + func (v *TestVaultClient) Running() bool + func (v *TestVaultClient) SetActive(enabled bool) + func (v *TestVaultClient) SetConfig(config *config.VaultConfig) error + func (v *TestVaultClient) SetCreateTokenError(allocID, task string, err error) + func (v *TestVaultClient) SetCreateTokenSecret(allocID, task string, secret *vapi.Secret) + func (v *TestVaultClient) SetLookupTokenAllowedPolicies(token string, policies []string) + func (v *TestVaultClient) SetLookupTokenError(token string, err error) + func (v *TestVaultClient) SetLookupTokenSecret(token string, secret *vapi.Secret) + func (v *TestVaultClient) Stats() *VaultStats + func (v *TestVaultClient) Stop() + type TimeTable struct + func NewTimeTable(granularity time.Duration, limit time.Duration) *TimeTable + func (t *TimeTable) Deserialize(dec *codec.Decoder) error + func (t *TimeTable) NearestIndex(when time.Time) uint64 + func (t *TimeTable) NearestTime(index uint64) time.Time + func (t *TimeTable) Serialize(enc *codec.Encoder) error + func (t *TimeTable) Witness(index uint64, when time.Time) + type TimeTableEntry struct + Index uint64 + Time time.Time + type VaultClient interface + CreateToken func(ctx context.Context, a *structs.Allocation, task string) (*vapi.Secret, error) + EmitStats func(period time.Duration, stopCh chan struct{}) + LookupToken func(ctx context.Context, token string) (*vapi.Secret, error) + RevokeTokens func(ctx context.Context, accessors []*structs.VaultAccessor, committed bool) error + Running func() bool + SetActive func(active bool) + SetConfig func(config *config.VaultConfig) error + Stats func() *VaultStats + Stop func() + type VaultStats struct + TrackedForRevoke int + type Worker struct + func NewWorker(srv *Server) (*Worker, error) + func (w *Worker) CreateEval(eval *structs.Evaluation) error + func (w *Worker) ReblockEval(eval *structs.Evaluation) error + func (w *Worker) SetPause(p bool) + func (w *Worker) SubmitPlan(plan *structs.Plan) (*structs.PlanResult, scheduler.State, error) + func (w *Worker) UpdateEval(eval *structs.Evaluation) error