controllers

package
v0.0.0-...-8540621 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const UnhealthyAgentThreshold = 30 * time.Second

UnhealthyAgentThreshold is the amount of time where an agent is considered unhealthy if its last heartbeat is greater than this value.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentHandler

type AgentHandler struct {
	MsgChannel chan *nats.Msg
	// contains filtered or unexported fields
}

AgentHandler is responsible for handling messages for a specific agent.

func (*AgentHandler) Stop

func (ah *AgentHandler) Stop()

Stop immediately stops the agent handler from listening to any messages. It blocks until the agent is cleaned up.

type AgentTopicListener

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

AgentTopicListener is responsible for listening to and handling messages on the agent topic.

func NewAgentTopicListener

func NewAgentTopicListener(agtMgr agent.Manager, tpMgr *tracepoint.Manager,
	sendMsgFn SendMessageFn) (*AgentTopicListener, error)

NewAgentTopicListener creates a new agent topic listener.

func (*AgentTopicListener) HandleMessage

func (a *AgentTopicListener) HandleMessage(msg *nats.Msg) error

HandleMessage handles a message on the agent topic.

func (*AgentTopicListener) Initialize

func (a *AgentTopicListener) Initialize() error

Initialize loads in the current agent state into the agent topic listener.

func (*AgentTopicListener) SendMessageToAgent

func (a *AgentTopicListener) SendMessageToAgent(agentID uuid.UUID, msg messagespb.VizierMessage) error

SendMessageToAgent sends the given message to the agent over the NATS agent channel.

func (*AgentTopicListener) Stop

func (a *AgentTopicListener) Stop()

Stop stops processing any agent messagespb.

func (*AgentTopicListener) StopAgent

func (a *AgentTopicListener) StopAgent(agentID uuid.UUID)

StopAgent should be called when an agent should be deleted and its message processing should be stopped.

type EtcdManager

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

EtcdManager manages state for the given etcd instance.

func NewEtcdManager

func NewEtcdManager(client *clientv3.Client) *EtcdManager

NewEtcdManager creates a new etcd manager.

func (*EtcdManager) IsDefragging

func (m *EtcdManager) IsDefragging() bool

IsDefragging returns whether etcd is currently running a defrag.

func (*EtcdManager) Run

func (m *EtcdManager) Run()

Run periodically checks the size of the etcd db and defrags if necessary.

func (*EtcdManager) Stop

func (m *EtcdManager) Stop()

Stop stops the etcd manager from periodically checking and defragging etcd.

type MessageBusController

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

MessageBusController handles and responds to any incoming NATS messages.

func NewMessageBusController

func NewMessageBusController(conn *nats.Conn, agtMgr agent.Manager,
	tpMgr *tracepoint.Manager, k8smetaHandler *k8smeta.Handler,
	isLeader *bool) (*MessageBusController, error)

NewMessageBusController creates a new controller for handling NATS messages.

func (*MessageBusController) Close

func (mc *MessageBusController) Close()

Close closes the subscription and NATS connection.

type SendMessageFn

type SendMessageFn func(string, []byte) error

SendMessageFn is the function the TopicListener uses to publish messages back to NATS.

type Server

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

Server defines an gRPC server type.

func NewServer

NewServer creates GRPC handlers.

func (*Server) ConvertLabelsToPods

func (s *Server) ConvertLabelsToPods(tp *logicalpb.TracepointDeployment) error

ConvertLabelsToPods fetches all the pods in the PodLabelStore that match the labels described in the input tp, and then convert the LabelSelector to a PodProcess.

func (*Server) GetAgentInfo

GetAgentInfo returns information about registered agents.

func (*Server) GetAgentUpdates

GetAgentUpdates streams agent updates to the requestor periodically as they come in. It first sends the complete initial agent state in the beginning of the request, and then deltas after that. Note that as it is currently designed, it can only handle one stream at a time (to a single metadata server). That is because the agent manager tracks the deltas in the state in a single object, rather than per request.

func (*Server) GetSchemas

GetSchemas returns the schemas in the system.

func (*Server) GetTracepointInfo

GetTracepointInfo is a request to check the status for the given tracepoint.

func (*Server) GetWithPrefixKey

GetWithPrefixKey fetches all the metadata KVs with the given prefix. This is used for debug purposes.

func (*Server) RegisterTracepoint

RegisterTracepoint is a request to register the tracepoints specified in the TracepointDeployment on all agents.

func (*Server) RemoveTracepoint

RemoveTracepoint is a request to evict the given tracepoint on all agents.

func (*Server) UpdateConfig

UpdateConfig updates the config for the specified agent.

type TopicListener

type TopicListener interface {
	Initialize() error
	HandleMessage(*nats.Msg) error
	Stop()
}

TopicListener handles NATS messages for a specific topic.

Directories

Path Synopsis
mock
Package mock_agent is a generated GoMock package.
Package mock_agent is a generated GoMock package.
mock
Package mock_cronscript is a generated GoMock package.
Package mock_cronscript is a generated GoMock package.
mock
Package mock_tracepoint is a generated GoMock package.
Package mock_tracepoint is a generated GoMock package.

Jump to

Keyboard shortcuts

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