docker

package
v0.0.0-...-82e5c22 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Log                   *zap.SugaredLogger
	Certs                 *agent.Certs
	NodeAgentBin          string
	BaseImage             string
	ContainerPrefix       string
	DockerClient          *client.Client
	RemoveContainers      bool
	CreateContainerConfig func(*CreateContainerConfig) error

	Nodes []*Node
	// contains filtered or unexported fields
}

Cluster is a local Cluster that runs nodes as Docker containers. The underlying host must have a Docker daemon running. This supports standard environment variables for configuring the Docker client (DOCKER_HOST etc.).

func MustNewCluster

func MustNewCluster() *Cluster

func NewCluster

func NewCluster() (*Cluster, error)

NewCluster creates a new local Docker cluster. By default, this looks for the node agent binary by searching up from PWD for a "nodeagent" file.

func (*Cluster) Cleanup

func (c *Cluster) Cleanup(ctx context.Context) error

func (*Cluster) NewNodes

func (c *Cluster) NewNodes(ctx context.Context, n int) (clusteriface.Nodes, error)

func (*Cluster) WithBaseImage

func (c *Cluster) WithBaseImage(img string) *Cluster

func (*Cluster) WithCreateContainerConfig

func (c *Cluster) WithCreateContainerConfig(f func(*CreateContainerConfig) error) *Cluster

func (*Cluster) WithLogger

func (c *Cluster) WithLogger(l *zap.SugaredLogger) *Cluster

func (*Cluster) WithNodeAgentBin

func (c *Cluster) WithNodeAgentBin(p string) *Cluster

type CreateContainerConfig

type CreateContainerConfig struct {
	Name             string
	ContainerConfig  *container.Config
	HostConfig       *container.HostConfig
	NetworkingConfig *network.NetworkingConfig
	Platform         *specs.Platform
}

type Node

type Node struct {
	ID            int
	ContainerName string
	ContainerID   string
	HostPort      int
	Env           map[string]string
	// contains filtered or unexported fields
}

func (*Node) Dial

func (n *Node) Dial(ctx context.Context, network, addr string) (net.Conn, error)

func (*Node) ReadFile

func (n *Node) ReadFile(ctx context.Context, path string) (io.ReadCloser, error)

func (*Node) SendFile

func (n *Node) SendFile(ctx context.Context, filePath string, contents io.Reader) error

func (*Node) StartProc

func (*Node) Stop

func (n *Node) Stop(ctx context.Context) error

func (*Node) String

func (n *Node) String() string

Jump to

Keyboard shortcuts

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