hostmgr

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: 53 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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,
	hostPoolManager manager.HostPoolManager,
	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

func (m *Matcher) GetMatchingHosts() (map[string]*mesos.AgentInfo, *hostsvc.GetHostsFailure)

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 RecoveryHandler

type RecoveryHandler interface {
	Start() error
	Stop() error
}

RecoveryHandler defines the interface to be called by leader election callbacks.

func NewRecoveryHandler

func NewRecoveryHandler(
	parent tally.Scope,
	taskStore storage.TaskStore,
	ormStore *ormobjects.Store,
	hostCache hostcache.HostCache,
) RecoveryHandler

NewRecoveryHandler creates a recoveryHandler

type Server

type Server struct {
	sync.Mutex

	ID string
	// contains filtered or unexported fields
}

Server contains all structs necessary to run a hostmgr server. This struct also implements leader.Node interface so that it can perform leader election among multiple host manager server instances.

func NewServer

func NewServer(
	parent tally.Scope,
	backgroundManager background.Manager,
	httpPort, grpcPort int,
	mesosDetector mesos.MasterDetector,
	mesosInbound mhttp.Inbound,
	mesosOutbound transport.Outbounds,
	reconciler reconcile.TaskReconciler,
	recoveryHandler RecoveryHandler,
	drainer drainer.Drainer,
	reserver reserver.Reserver,
	watchProcessor watchevent.WatchProcessor,
	plugin plugins.Plugin,
	hostCache hostcache.HostCache,
	mesosManager plugins.Plugin,
	hostPoolManager hpm.HostPoolManager,
) *Server

NewServer creates a host manager Server instance.

func (*Server) GainedLeadershipCallback

func (s *Server) GainedLeadershipCallback() error

GainedLeadershipCallback is the callback when the current node becomes the leader

func (*Server) GetID

func (s *Server) GetID() string

GetID function returns the peloton master address. This implements leader.Nomination.

func (*Server) HasGainedLeadership

func (s *Server) HasGainedLeadership() bool

HasGainedLeadership returns true iff once GainedLeadershipCallback completes.

func (*Server) LostLeadershipCallback

func (s *Server) LostLeadershipCallback() error

LostLeadershipCallback is the callback when the current node lost leadership.

func (*Server) ShutDownCallback

func (s *Server) ShutDownCallback() error

ShutDownCallback is the callback to shut down gracefully if possible.

func (*Server) Start

func (s *Server) Start()

Start starts the ticker

func (*Server) Stop

func (s *Server) Stop()

Stop stops the ticker

type ServiceHandler

type ServiceHandler struct {
	// contains filtered or unexported fields
}

ServiceHandler implements peloton.private.hostmgr.InternalHostService.

func NewServiceHandler

func NewServiceHandler(
	d *yarpc.Dispatcher,
	metrics *metrics.Metrics,
	schedulerClient mpb.SchedulerClient,
	masterOperatorClient mpb.MasterOperatorClient,
	frameworkInfoProvider hostmgr_mesos.FrameworkInfoProvider,
	mesosConfig hostmgr_mesos.Config,
	mesosDetector hostmgr_mesos.MasterDetector,
	hmConfig *config.Config,
	slackResourceTypes []string,
	watchProcessor watchevent.WatchProcessor,
	hostPoolManager manager.HostPoolManager,
	goalStateDriver goalstate.Driver,
	hostInfoOps ormobjects.HostInfoOps,
	hostCache hostcache.HostCache,
	plugin plugins.Plugin,
) *ServiceHandler

NewServiceHandler creates a new ServiceHandler.

func NewTestServiceHandler

func NewTestServiceHandler() *ServiceHandler

NewTestServiceHandler returns an empty new ServiceHandler ptr for testing.

func (*ServiceHandler) AcquireHostOffers

func (h *ServiceHandler) AcquireHostOffers(
	ctx context.Context,
	body *hostsvc.AcquireHostOffersRequest,
) (response *hostsvc.AcquireHostOffersResponse, err error)

AcquireHostOffers implements InternalHostService.AcquireHostOffers.

func (*ServiceHandler) CancelWatchEvent

Cancel cancels a watch. The watch stream will get an error indicating watch was cancelled and the stream will be closed.

func (*ServiceHandler) ClusterCapacity

func (h *ServiceHandler) ClusterCapacity(
	ctx context.Context,
	body *hostsvc.ClusterCapacityRequest,
) (response *hostsvc.ClusterCapacityResponse, err error)

ClusterCapacity fetches the allocated resources to the framework

func (*ServiceHandler) CreateVolumes

CreateVolumes implements InternalHostService.CreateVolumes.

func (*ServiceHandler) DestroyVolumes

DestroyVolumes implements InternalHostService.DestroyVolumes.

func (*ServiceHandler) DisableKillTasks

DisableKillTasks toggles the flag to disable send kill tasks request to mesos master

func (*ServiceHandler) GetCompletedReservations

GetCompletedReservations gets the completed host reservations from reserver. Based on the reserver it returns the list of completed Reservations (hostsvc.CompletedReservation) or return the NoFound Error.

func (*ServiceHandler) GetDrainingHosts

GetDrainingHosts implements InternalHostService.GetDrainingHosts

func (*ServiceHandler) GetHostPoolCapacity

func (h *ServiceHandler) GetHostPoolCapacity(
	ctx context.Context,
	body *hostsvc.GetHostPoolCapacityRequest,
) (response *hostsvc.GetHostPoolCapacityResponse, err error)

GetHostPoolCapacity fetches the resources for all host-pools.

func (*ServiceHandler) GetHosts

func (h *ServiceHandler) GetHosts(
	ctx context.Context,
	body *hostsvc.GetHostsRequest,
) (response *hostsvc.GetHostsResponse, err error)

GetHosts implements InternalHostService.GetHosts. This function gets the hosts based on resource requirements and constraints passed in the request through hostsvc.HostFilter

func (*ServiceHandler) GetHostsByQuery

GetHostsByQuery implements InternalHostService.GetHostsByQuery. This function gets host resources from offer pool and filters host list based on the requirements passed in the request through hostsvc.HostFilter.

func (*ServiceHandler) GetMesosAgentInfo

GetMesosAgentInfo implements InternalHostService.GetMesosAgentInfo Returns Mesos agent info for a single agent or all agents.

func (*ServiceHandler) GetMesosMasterHostPort

func (h *ServiceHandler) GetMesosMasterHostPort(
	ctx context.Context,
	body *hostsvc.MesosMasterHostPortRequest,
) (response *hostsvc.MesosMasterHostPortResponse, err error)

GetMesosMasterHostPort returns the Leader Mesos Master hostname and port.

func (*ServiceHandler) GetOutstandingOffers

GetOutstandingOffers returns all the offers present in offer pool.

func (*ServiceHandler) GetReserver

func (h *ServiceHandler) GetReserver() reserver.Reserver

GetReserver returns the reserver object

func (*ServiceHandler) GetTasksByHostState

func (h *ServiceHandler) GetTasksByHostState(
	ctx context.Context,
	req *hostsvc.GetTasksByHostStateRequest,
) (response *hostsvc.GetTasksByHostStateResponse, err error)

GetTasksByHostState gets tasks on hosts in the specified host state.

func (*ServiceHandler) KillAndReserveTasks

KillAndReserveTasks implements InternalHostService.KillAndReserveTasks.

func (*ServiceHandler) KillTasks

KillTasks implements InternalHostService.KillTasks.

func (*ServiceHandler) LaunchTasks

func (h *ServiceHandler) LaunchTasks(
	ctx context.Context,
	req *hostsvc.LaunchTasksRequest,
) (response *hostsvc.LaunchTasksResponse, err error)

LaunchTasks implements InternalHostService.LaunchTasks.

func (*ServiceHandler) MarkHostDrained

MarkHostDrained implements InternalHostService.MarkHostDrained Mark the host as drained. This method is called by Resource Manager Drainer when there are no tasks on the DRAINING host

func (*ServiceHandler) OfferOperations

OfferOperations implements InternalHostService.OfferOperations.

func (*ServiceHandler) ReleaseHostOffers

func (h *ServiceHandler) ReleaseHostOffers(
	ctx context.Context,
	body *hostsvc.ReleaseHostOffersRequest,
) (response *hostsvc.ReleaseHostOffersResponse, err error)

ReleaseHostOffers implements InternalHostService.ReleaseHostOffers.

func (*ServiceHandler) ReleaseHostsHeldForTasks

ReleaseHostsHeldForTasks releases the hosts which are held for the tasks provided

func (*ServiceHandler) ReserveHosts

ReserveHosts reserves the host for a specified task in the request. Host Manager will keep the host offers to itself till the time it does not have enough offers to itself and once that's fulfilled it will return the reservation with the offer to placement engine. till the time reservation is fulfilled or reservation timeout , offers from that host will not be given to any other placement engine.

func (*ServiceHandler) ReserveResources

ReserveResources implements InternalHostService.ReserveResources.

func (*ServiceHandler) ShutdownExecutors

func (h *ServiceHandler) ShutdownExecutors(
	ctx context.Context,
	body *hostsvc.ShutdownExecutorsRequest,
) (response *hostsvc.ShutdownExecutorsResponse, err error)

ShutdownExecutors implements InternalHostService.ShutdownExecutors.

func (*ServiceHandler) UnreserveResources

UnreserveResources implements InternalHostService.UnreserveResources.

func (*ServiceHandler) WatchHostSummaryEvent

WatchHostSummaryEvent creates a watch to get notified about changes to Host Summary event. Changed objects are streamed back to the caller till the watch is cancelled.

Directories

Path Synopsis
factory
Package mesos is copied from mesos-uns-bridge/mesos/detector.go with modifications : 1) refer to forked mesos-go dependencies
Package mesos is copied from mesos-uns-bridge/mesos/detector.go with modifications : 1) refer to forked mesos-go dependencies
mesos-go
* * This package is forked from https://github.com/mesos/mesos-go/tree/master
* * This package is forked from https://github.com/mesos/mesos-go/tree/master
mesos-go/detector
The detector package houses implementation of master detectors.
The detector package houses implementation of master detectors.
mesos-go/detector/zoo
Zookeeper-based mesos-master leaderhip detection.
Zookeeper-based mesos-master leaderhip detection.
mesos-go/upid
Package upid defines the UPID type and some utilities of the UPID.
Package upid defines the UPID type and some utilities of the UPID.
p2k

Jump to

Keyboard shortcuts

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