Documentation ¶
Index ¶
- func BuildHostInfoForRegisteredAgents() (map[string]*pbhost.HostInfo, error)
- func GetAgentInfo(hostname string) *mesos.AgentInfo
- func GetUpHostIP(hostname string) (string, error)
- func IsHostRegistered(hostname string) bool
- func IsRegisteredAsPelotonAgent(hostname, pelotonAgentRole string) bool
- type AgentMap
- type Drainer
- type Loader
- type Matcher
- type Metrics
- type ResourceCapacity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHostInfoForRegisteredAgents ¶
BuildHostInfoForRegisteredAgents builds host infos for registered agents
func GetAgentInfo ¶
GetAgentInfo return agent info from global map.
func GetUpHostIP ¶
GetUpHostIP gets the IP address of a host in UP state
func IsHostRegistered ¶
IsHostRegistered returns whether the host is registered
func IsRegisteredAsPelotonAgent ¶
IsRegisteredAsPelotonAgent returns true if the host is registered as Peloton agent
Types ¶
type AgentMap ¶
type AgentMap struct { // Registered agent details by id. RegisteredAgents map[string]*mesos_master.Response_GetAgents_Agent // Resource capacity of all hosts. HostCapacities map[string]*ResourceCapacity Capacity scalar.Resources SlackCapacity scalar.Resources }
AgentMap is a placeholder from agent id to agent related information. Note that AgentInfo is immutable as of Mesos 1.3.
func GetAgentMap ¶
func GetAgentMap() *AgentMap
GetAgentMap returns a full map of all registered agents. Note that caller should not mutable the content since it's not protected by any lock.
func (*AgentMap) ReportCapacityMetrics ¶
ReportCapacityMetrics into given metric scope.
type Drainer ¶
type Drainer interface { // Start the module Start() // Stop the module Stop() // GetDrainingHostInfos returns HostInfo of the specified DRAINING hosts. // If the hostFilter is empty then HostInfos of all DRAINING hosts // is returned. GetDrainingHostInfos(hostFilter []string) []*pbhost.HostInfo // GetDownHostInfos returns HostInfo of the specified DOWN hosts. // If the hostFilter is empty then HostInfos of all DOWN hosts // is returned. GetDownHostInfos(hostFilter []string) []*pbhost.HostInfo // StartMaintenance initiates putting a host into maintenance. StartMaintenance(ctx context.Context, hostname string) error // CompleteMaintenance brings a host out of maintenance. CompleteMaintenance(ctx context.Context, hostname string) error }
Drainer defines the interface for host drainer
func NewDrainer ¶
func NewDrainer( drainerPeriod time.Duration, pelotonAgentRole string, masterOperatorClient mpb.MasterOperatorClient, maintenanceQueue queue.MaintenanceQueue, hostInfoMap MaintenanceHostInfoMap, ) Drainer
NewDrainer creates a new host drainer
type Loader ¶
type Loader struct { sync.Mutex OperatorClient mpb.MasterOperatorClient SlackResourceTypes []string Scope tally.Scope HostInfoOps ormobjects.HostInfoOps // DB ops for host_info table }
Loader loads hostmap from Mesos and stores in global singleton.
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher keeps track of matched host offers for given constraints.
func NewMatcher ¶
func NewMatcher( hostFilter *hostsvc.HostFilter, evaluator constraints.Evaluator, filter filterSlackResources) *Matcher
NewMatcher returns a new instance of Matcher. hostFilter defines the constraints on matching a host such as resources, revocable. evaluator is used to validate constraints such as labels.
func (*Matcher) GetMatchingHosts ¶
GetMatchingHosts tries to match the hosts through Host filter and it returns the hostname-> AgentInfo for the matched hosts. If the filter does not match, it returns the error
type Metrics ¶
type Metrics struct { DrainingHosts tally.Gauge DownHosts tally.Gauge // contains filtered or unexported fields }
Metrics is placeholder for all metrics in hostmgr/host package.
func NewMetrics ¶
NewMetrics returns a new Metrics struct, with all metrics initialized and rooted at the given tally.Scope