cluster

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileToNode

func CopyFileToNode(in *Input, node string, file File)

CopyFileToNode copies a single file to a node.

func CopyFilesToNode

func CopyFilesToNode(in *Input, node string)

CopyFilesToNode copies the files needed for the cluster to the node. Copies the provided ssh key, the embedded-cluster binary and also all scripts from the scripts directory (they are all placed under /usr/local/bin inside the node).

func CreateNetworks

func CreateNetworks(in *Input)

CreateNetworks create two networks, one of type bridge and inside of it another one of type ovn, the latter is completely isolated from the host network and from the other networks on the same server.

func CreateNode

func CreateNode(in *Input, i int) string

CreateNode creates a single node. The i here is used to create a unique name for the node. Node is named as "node-<cluster id>-<i>". The node name is returned.

func CreateNodes

func CreateNodes(in *Input) []string

CreateNodes creats the nodes for the cluster. The amount of nodes is specified in the input.

func CreateProfile

func CreateProfile(in *Input)

CreateProfile that restricts the hardware and provides privileged access to the containers.

func NodeHasInternet

func NodeHasInternet(in *Input, node string)

NodeHasInternet checks if the node has internet access. It does this by pinging google.com.

func PullImage

func PullImage(in *Input)

PullImage pull the image used for the nodes.

func Run

func Run(ctx context.Context, t *testing.T, cmd Command) error

Run runs a command in a node.

Types

type Command

type Command struct {
	Node   string
	Line   []string
	Stdout io.WriteCloser
	Stderr io.WriteCloser
}

Command is a command to be run in a node.

type File

type File struct {
	SourcePath string
	DestPath   string
	Mode       int
}

File holds information about a file that must be uploaded to a node.

type Input

type Input struct {
	Nodes               int
	SSHPublicKey        string
	SSHPrivateKey       string
	EmbeddedClusterPath string
	Image               string

	T *testing.T
	// contains filtered or unexported fields
}

Input are the options passed in to the cluster creation plus some data for internal consumption only.

type Output

type Output struct {
	Nodes []string

	T *testing.T
	// contains filtered or unexported fields
}

Output is returned when a cluster is created. Contain a list of all node names and the cluster id.

func NewTestCluster

func NewTestCluster(in *Input) *Output

NewTestCluster creates a new cluster and returns an object of type Output that can be used to get the created nodes and destroy the cluster when it is no longer needed.

func (*Output) Destroy

func (o *Output) Destroy()

Destroy destroys a cluster pointed by the id property inside the output.

Jump to

Keyboard shortcuts

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