Documentation ¶
Index ¶
- func HostChangePool(ctx context.Context, entity goalstate.Entity) error
- func HostDown(ctx context.Context, entity goalstate.Entity) error
- func HostDrain(ctx context.Context, entity goalstate.Entity) error
- func HostInvalidAction(ctx context.Context, entity goalstate.Entity) error
- func HostRequeue(ctx context.Context, entity goalstate.Entity) error
- func HostTriggerMaintenance(ctx context.Context, entity goalstate.Entity) error
- func HostUntrack(ctx context.Context, entity goalstate.Entity) error
- func HostUp(ctx context.Context, entity goalstate.Entity) error
- func NewHostEntity(hostname string, driver *driver) goalstate.Entity
- type Config
- type Driver
- type HostAction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostChangePool ¶
HostChangePool action will set the host's current pool to its desired pool And update the goal state to UP and enqueue the host to reevaluation.
func HostInvalidAction ¶
HostInvalidAction action is a error state transition and should not happen
func HostRequeue ¶
HostRequeue re-enqueues the host into the goal state engine This is needed as host entity GetState() & GetGoalState() are reads from DB which can error out (e.g. DB unavailable), the retry mechanism is handled by re-enqueuing into the goal state engine. TODO: remove once host state & goalState backed by host cache
func HostTriggerMaintenance ¶
HostTriggerMaintenance will make the goal state to DOWN by that we can start draining
func HostUntrack ¶
HostUntrack untracks the host by removing it from the goal state engine's entity map
func NewHostEntity ¶
NewHostEntity implements the goal state Entity interface for hosts.
Types ¶
type Config ¶
type Config struct { // MaxRetryDelay is the absolute maximum duration between any retry, capping // any backoff to this amount. MaxRetryDelay time.Duration `yaml:"max_retry_delay"` // FailureRetryDelay is the delay for retry, if an operation failed. Backoff // will be applied for up to MaxRetryDelay. FailureRetryDelay time.Duration `yaml:"failure_retry_delay"` NumWorkerHostThreads int `yaml:"host_worker_thread_count"` }
Config for the goalstate engine.
type Driver ¶
type Driver interface { // EnqueueHost is used to enqueue a host into the goal state. EnqueueHost(hostname string, deadline time.Time) // DeleteHost deletes the host from the goal state engine. DeleteHost(hostname string) // Start is used to start processing items in the goal state engine. Start() // Stop is used to clean all items and then stop the goal state engine. Stop() // Started returns true if goal state engine has finished start process Started() bool }
Driver is the interface to enqueue hosts into the goal state engine for evaluation and then run the corresponding actions.
func NewDriver ¶
func NewDriver( hostInfoOps ormobjects.HostInfoOps, mesosMasterClient mpb.MasterOperatorClient, parentScope tally.Scope, cfg Config, hostpoolManager manager.HostPoolManager, ) Driver
NewDriver returns a new goal state driver object.
type HostAction ¶
type HostAction string
HostAction is a string for host actions.
const ( // NoAction implies do not take any action NoAction HostAction = "noop" // DrainAction enqueues the host for draining its tasks DrainAction HostAction = "drain" // DownAction registers the host as DOWN, in maintenance DownAction HostAction = "down" // UpAction registers the host as UP, out of maintenance UpAction HostAction = "up" // RequeueAction re-enqueues the host into the goal state engine // This is needed as host entity GetState() & GetGoalState() are reads from DB // which can error out (e.g. DB unavailable), the retry mechanism is handled by // re-enqueing into the goal state engine. // TODO: remove once host state & goalState backed by host cache RequeueAction HostAction = "reenqueue" // UntrackAction untracks the host by removing it // from the goal state engine's entity map UntrackAction HostAction = "untrack" // ChangePoolAction is to change the host pool of the // host. This action will do two things // 1. Change the current pool in db as desired pool // 2. Make the goal state to Up and reenqueue ChangePoolAction HostAction = "ChangePool" // StartMaintenanceAction is to start the Maintenance // if we find pool is not equal to desired pool StartMaintenanceAction HostAction = "StartMaintenance" // InvalidAction is a invalid action and this should not occur InvalidAction HostAction = "InvalidAction" )