node

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleController = "controller"
	RoleAgent      = "agent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	*Node
}

func (*Agent) DumpFlow

func (n *Agent) DumpFlow() ([]string, error)

DumpFlow dumps the flows and parse the Output

func (*Agent) FetchLog

func (n *Agent) FetchLog() ([]byte, error)

func (*Agent) GetName

func (n *Agent) GetName() string

func (*Agent) Healthz

func (n *Agent) Healthz() (bool, error)

func (*Agent) Restart

func (n *Agent) Restart() error

type Controller

type Controller struct {
	*Node
}

func (*Controller) FetchLog

func (n *Controller) FetchLog() ([]byte, error)

func (*Controller) GetName

func (n *Controller) GetName() string

func (*Controller) Healthz

func (n *Controller) Healthz() (bool, error)

func (*Controller) Restart

func (n *Controller) Restart() error

type Manager

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

Manager manage and cached all nodes

func NewManager

func NewManager(disableAgentRestarter, disableControllerRestarter bool, nodes ...*Node) *Manager

func NewManagerFromConfig

func NewManagerFromConfig(nodesConfig *config.NodesConfig) (*Manager, error)

func (*Manager) DumpFlowAll

func (m *Manager) DumpFlowAll() (map[string][]string, error)

func (*Manager) GetAgent

func (m *Manager) GetAgent(name string) (*Agent, error)

func (*Manager) GetController

func (m *Manager) GetController(name string) (*Controller, error)

func (*Manager) GetRandomAgent

func (m *Manager) GetRandomAgent(except ...string) (*Agent, error)

func (*Manager) GetRandomController

func (m *Manager) GetRandomController(except ...string) (*Controller, error)

func (*Manager) ListAgent

func (m *Manager) ListAgent() []*Agent

func (*Manager) ListController

func (m *Manager) ListController() []*Controller

func (*Manager) ServiceRestarter

func (m *Manager) ServiceRestarter(minInterval, upwardFloatInterval int) *ServiceRestarter

ServiceRestarter random restart controller and agent when e2e Deprecated, we should use external chaos engineering tools to replace restarter

type Node

type Node struct {
	// Name is an unique identification of the node
	Name string
	// Roles identifies the type of node
	Roles sets.String
	// User name for connect to this node
	User string
	// Accessible address, such as 192.168.0.1:22
	DialAddr string
	// Methonds for login into. If empty, file ~/.ssh/id_rsa be use.
	AuthMethods []ssh.AuthMethod
	// BridgeName only available when roles contains agent
	BridgeName string
	// contains filtered or unexported fields
}

func (*Node) GetClient

func (n *Node) GetClient() (*ssh.Client, error)

GetClient return client connect to this node, must not close the returned client.

type Service

type Service interface {
	GetName() string
	Restart() error
	Healthz() (bool, error)
	FetchLog() ([]byte, error)
}

type ServiceRestarter

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

ServiceRestarter control automatically restart part of services after every random interval.

func (*ServiceRestarter) Run

func (c *ServiceRestarter) Run()

func (*ServiceRestarter) RunAsync

func (c *ServiceRestarter) RunAsync()

Run it in another goroutine

func (*ServiceRestarter) Stop

func (c *ServiceRestarter) Stop()

stop a living restarter and block here util the restarter is closed

Jump to

Keyboard shortcuts

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