node

package
v0.20.4-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 6 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotSupportedDriver = &notSupportedDriver{}

NotSupportedDriver provides the default driver with none of the operations supported

Functions

func AddNode

func AddNode(n Node) error

AddNode adds a node to the node collection

func CleanupRegistry

func CleanupRegistry()

CleanupRegistry removes entry of all nodes from registry

func Contains

func Contains(nodes []Node, n Node) bool

Contains checks if the node is present in the given list of nodes

func GetNodesByName

func GetNodesByName() map[string]Node

GetNodesByName returns map of nodes where the node name is the key

func GetNodesByVoDriverNodeID

func GetNodesByVoDriverNodeID() map[string]Node

GetNodesByVoDriverNodeID returns map of nodes where volume driver node id is the key

func Register

func Register(name string, d Driver) error

Register registers the given node driver

func UpdateNode

func UpdateNode(n Node) error

UpdateNode updates a given node if it exists in the node collection

Types

type ConnectionOpts

type ConnectionOpts struct {
	Timeout         time.Duration
	TimeBeforeRetry time.Duration
	IgnoreError     bool
	Sudo            bool
}

ConnectionOpts provide basic options for all operations and can be embedded by other options

type Driver

type Driver interface {
	// Init initializes the node driver under the given scheduler
	Init() error

	// DeleteNode deletes the given node
	DeleteNode(node Node, timeout time.Duration) error

	// String returns the string name of this driver.
	String() string

	// RebootNode reboots the given node
	RebootNode(node Node, options RebootNodeOpts) error

	// RunCommand runs the given command on the node and returns the output
	RunCommand(node Node, command string, options ConnectionOpts) (string, error)

	// ShutdownNode shuts down the given node
	ShutdownNode(node Node, options ShutdownNodeOpts) error

	// FindFiles finds and returns the files for the given path regex and the node
	FindFiles(path string, node Node, options FindOpts) (string, error)

	// Systemctl runs a systemctl command for the given service on the node
	Systemctl(node Node, service string, options SystemctlOpts) error

	// TestConnection tests connection to given node. returns nil if driver can connect to given node
	TestConnection(node Node, options ConnectionOpts) error

	// YankDrive simulates a failure on the provided drive on the given node.
	// It returns the bus ID of the drive which can be used to recover it back
	YankDrive(node Node, driveNameToFail string, options ConnectionOpts) (string, error)

	// RecoverDrive recovers the given drive from failure on the given node.
	RecoverDrive(node Node, driveNameToRecover string, driveUUID string, options ConnectionOpts) error

	// SystemCheck checks whether core files are present on the given node.
	SystemCheck(node Node, options ConnectionOpts) (string, error)

	// SetASGClusterSize sets node count per zone for an asg cluster
	SetASGClusterSize(perZoneCount int64, timeout time.Duration) error

	// GetASGClusterSize gets node count for an asg cluster
	GetASGClusterSize() (int64, error)

	// SetClusterVersion sets desired version for cluster and its node pools
	SetClusterVersion(version string, timeout time.Duration) error

	// GetClusterVersion returns version of cluster and its node pools
	GetClusterVersion() (clusterVersion string, nodePoolsVersion []string, err error)

	// GetZones returns list of zones in which ASG cluster is running
	GetZones() ([]string, error)
}

Driver provides the node driver interface

func Get

func Get(name string) (Driver, error)

Get returns a registered node driver

type ErrFailedToFindFileOnNode

type ErrFailedToFindFileOnNode struct {
	Node  Node
	Cause string
}

ErrFailedToFindFileOnNode error type when failing to run find on the node

func (*ErrFailedToFindFileOnNode) Error

func (e *ErrFailedToFindFileOnNode) Error() string

type ErrFailedToRebootNode

type ErrFailedToRebootNode struct {
	Node  Node
	Cause string
}

ErrFailedToRebootNode error type when failing to reboot a node

func (*ErrFailedToRebootNode) Error

func (e *ErrFailedToRebootNode) Error() string

type ErrFailedToRecoverDrive

type ErrFailedToRecoverDrive struct {
	Node  Node
	Cause string
}

ErrFailedToRecoverDrive error type when we fail to simulate drive failure

func (*ErrFailedToRecoverDrive) Error

func (e *ErrFailedToRecoverDrive) Error() string

type ErrFailedToRunCommand

type ErrFailedToRunCommand struct {
	Addr  string
	Node  Node
	Cause string
}

ErrFailedToRunCommand error type when failing to run command

func (*ErrFailedToRunCommand) Error

func (e *ErrFailedToRunCommand) Error() string

type ErrFailedToRunSystemctlOnNode

type ErrFailedToRunSystemctlOnNode struct {
	Node  Node
	Cause string
}

ErrFailedToRunSystemctlOnNode error type when failing to run systemctl on the node

func (*ErrFailedToRunSystemctlOnNode) Error

type ErrFailedToShutdownNode

type ErrFailedToShutdownNode struct {
	Node  Node
	Cause string
}

ErrFailedToShutdownNode error type when failing to shutdown the node

func (*ErrFailedToShutdownNode) Error

func (e *ErrFailedToShutdownNode) Error() string

type ErrFailedToSystemCheck

type ErrFailedToSystemCheck struct {
	Node  Node
	Cause string
}

ErrFailedToSystemCheck error type when we fail to check for core files

func (*ErrFailedToSystemCheck) Error

func (e *ErrFailedToSystemCheck) Error() string

type ErrFailedToTestConnection

type ErrFailedToTestConnection struct {
	Node  Node
	Cause string
}

ErrFailedToTestConnection error type when failing to test connection

func (*ErrFailedToTestConnection) Error

func (e *ErrFailedToTestConnection) Error() string

type ErrFailedToYankDrive

type ErrFailedToYankDrive struct {
	Node  Node
	Cause string
}

ErrFailedToYankDrive error type when we fail to simulate drive failure

func (*ErrFailedToYankDrive) Error

func (e *ErrFailedToYankDrive) Error() string

type FindOpts

type FindOpts struct {
	Name     string
	MinDepth int
	MaxDepth int
	Type     FindType
	Empty    bool
	ConnectionOpts
}

FindOpts provide additional options for find operation

type FindType

type FindType string

FindType identifies the type of find command

const (
	// File identifies a search on find command to look for files only
	File FindType = "f"
	// Directory identifies a search on find command to look for directories only
	Directory FindType = "d"
)

type Node

type Node struct {
	api.StorageNode

	VolDriverNodeID          string
	Name                     string
	Addresses                []string
	UsableAddr               string
	Type                     Type
	Zone                     string
	Region                   string
	IsStorageDriverInstalled bool
	IsMetadataNode           bool
	StoragePools             []StoragePool
	// contains filtered or unexported fields
}

Node encapsulates a node in the cluster

func GetMetadataNodes

func GetMetadataNodes() []Node

GetMetadataNodes gets all the nodes which serves as internal kvdb metadata node

func GetNodes

func GetNodes() []Node

GetNodes returns all the nodes from the node collection

func GetStorageDriverNodes

func GetStorageDriverNodes() []Node

GetStorageDriverNodes returns only the worker node where storage driver is installed

func GetWorkerNodes

func GetWorkerNodes() []Node

GetWorkerNodes returns only the worker nodes/agent nodes

type RebootNodeOpts

type RebootNodeOpts struct {
	Force bool
	ConnectionOpts
}

RebootNodeOpts provide additional options for reboot operation

type ShutdownNodeOpts

type ShutdownNodeOpts struct {
	Force bool
	ConnectionOpts
}

ShutdownNodeOpts provide additional options for shutdown operation

type StoragePool

type StoragePool struct {
	*api.StoragePool
	// StoragePoolAtInit in the storage pool that's captured when the test initializes. This is useful for tests that
	// want to track changes in a pool since the test was started. For e.g tracking pool expansion changes
	StoragePoolAtInit *api.StoragePool
	// WorkloadSize is the size in bytes of the workload that will be launched by test on this storage pool
	WorkloadSize uint64
}

StoragePool is the storage pool structure on the node

type SystemctlOpts

type SystemctlOpts struct {
	Action string
	ConnectionOpts
}

SystemctlOpts provide options for systemctl operation

type TestConnectionOpts

type TestConnectionOpts struct {
	ConnectionOpts
}

TestConnectionOpts provide additional options for test connection operation

type Type

type Type string

Type identifies the type of the cluster node

const (
	// TypeMaster identifies a cluster node that is a master/manager
	TypeMaster Type = "Master"
	// TypeWorker identifies a cluster node that is a worker
	TypeWorker Type = "Worker"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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