host

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 17 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHostInfoForRegisteredAgents

func BuildHostInfoForRegisteredAgents() (map[string]*pbhost.HostInfo, error)

BuildHostInfoForRegisteredAgents builds host infos for registered agents

func GetAgentInfo

func GetAgentInfo(hostname string) *mesos.AgentInfo

GetAgentInfo return agent info from global map.

func GetUpHostIP

func GetUpHostIP(hostname string) (string, error)

GetUpHostIP gets the IP address of a host in UP state

func IsHostRegistered

func IsHostRegistered(hostname string) bool

IsHostRegistered returns whether the host is registered

func IsRegisteredAsPelotonAgent

func IsRegisteredAsPelotonAgent(hostname, pelotonAgentRole string) bool

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

func (a *AgentMap) ReportCapacityMetrics(scope tally.Scope)

ReportCapacityMetrics into given metric scope.

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.

func (*Loader) Load

func (loader *Loader) Load(_ *uatomic.Bool)

Load hostmap into singleton.

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

func NewMetrics(scope tally.Scope) *Metrics

NewMetrics returns a new Metrics struct, with all metrics initialized and rooted at the given tally.Scope

type ResourceCapacity

type ResourceCapacity struct {
	// Physical capacity.
	Physical scalar.Resources
	// Revocable capacity.
	Slack scalar.Resources
}

ResourceCapacity contains total quantity of various kinds of host resources.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL