agent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAgentConnection

func GetAgentConnection(ag *v1alpha1.Agent) (*grpc.ClientConn, error)

GetAgentConnection returns a GRPC connection corresponding to the provided Agent manifest.

Types

type Controller

type Controller struct {
	// Manager is the controller manager for all the running controller
	// against agent manager.
	Manager *controller.Manager

	// Nodes contains the agent associated with the controller.
	// Each of these agents are managed by the agent controller using a global
	// controller manager
	Nodes map[string]Node
	// contains filtered or unexported fields
}

Controller corresponds to the agent controller managed by apiserver.

var AgentCtrl *Controller = NewController()

AgentCtrl is the global instance of the agent controller running for the API server.

func NewController

func NewController() *Controller

NewController returns a new agent controller manager which manages all the agents running for the API server.

func (*Controller) Agent

func (a *Controller) Agent(name string) *v1alpha1.Agent

Agent returns the agent manifest of the provided name

func (*Controller) AgentConnection

func (a *Controller) AgentConnection(agent string) *grpc.ClientConn

AgentConnection returns the grpc connection for the agent.

func (*Controller) BlacklistedAgents

func (a *Controller) BlacklistedAgents() []string

BlacklistedAgents returns a list of agent nodes which are blacklisted by the agent controller

func (*Controller) Configure

func (a *Controller) Configure()

Configure sets up the Agent controller and all its required components.

func (*Controller) ControllerFunc

func (a *Controller) ControllerFunc(_ctx context.Context, ag *v1alpha1.Agent) error

ControllerFunc is the function which runs for each agent connected to the Api server and deals with it's management.

func (*Controller) GetActiveAgentsWithInfo

func (a *Controller) GetActiveAgentsWithInfo() map[string]*v1alpha1.Agent

GetActiveAgentsWithInfo returns a list with info of all active agents not including blacklisted.

func (*Controller) GetAllActiveAgents

func (a *Controller) GetAllActiveAgents() []string

GetAllActiveAgents returns all the agent which are not blacklisted.

func (*Controller) GetAllAgentsWithInfo

func (a *Controller) GetAllAgentsWithInfo() map[string]*v1alpha1.Agent

GetAllAgentsWithInfo returns a list with info of all the agents including blacklisted.

func (*Controller) GetBlacklistedAgentsWithInfo

func (a *Controller) GetBlacklistedAgentsWithInfo() map[string]*v1alpha1.Agent

GetBlacklistedAgentsWithInfo returns a list with info of all the blacklisted agents

func (*Controller) Name

func (a *Controller) Name() string

Name returns the name of the agent controller, it is completely defined by the name of the underlying store controller.

func (*Controller) Run

func (a *Controller) Run() error

Run starts running the agent controller.

func (*Controller) Stop

func (a *Controller) Stop() error

Stop shuts down the controller.

func (*Controller) Type

func (a *Controller) Type() string

Type returns the type of controller configured, for agent this is agent.

type Node

type Node struct {
	Agent *v1alpha1.Agent

	Name string
	// contains filtered or unexported fields
}

Node represents a single Agent object

func (*Node) CheckHealth

func (n *Node) CheckHealth() error

CheckHealth checks for the health status of the provided agent in context. If the agent is not healthy or there is some issue with the connectivity the function returns an error.

Jump to

Keyboard shortcuts

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