docker

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package docker provides a quick naive interface to Docker calls over ssh

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Kill

func Kill(client *ssh.Client, node int) error

Kill kills a single node by index on a server

func KillAll

func KillAll(client *ssh.Client) error

KillAll kills all nodes on a server

func Login

func Login(client *ssh.Client, username string, password string) error

Login is an abstraction of docker login

func Logout

func Logout(client *ssh.Client) error

Logout is an abstraction of docker logout

func NetworkCreate

func NetworkCreate(tn *testnet.TestNet, serverID int, subnetID int, node int) error

NetworkCreate creates a docker network for a node

func NetworkDestroy

func NetworkDestroy(client *ssh.Client, node int) error

NetworkDestroy tears down a single docker network

func NetworkDestroyAll

func NetworkDestroyAll(client *ssh.Client) error

NetworkDestroyAll removes all whiteblock networks on a node

func Pull

func Pull(clients []*ssh.Client, image string) error

Pull pulls an image on all the given servers

func Run

func Run(tn *testnet.TestNet, serverID int, container Container) error

Run starts a node

func StartServices

func StartServices(tn *testnet.TestNet, services []util.Service) error

StartServices creates the service network and starts all the services on a server

func StopServices

func StopServices(tn *testnet.TestNet) error

StopServices stops all services and remove the service network from a server

Types

type Container

type Container interface {
	// GetEnvironment gives the environment variables for the container
	GetEnvironment() map[string]string

	// GetImage gives the image from which the container will be built
	GetImage() string

	// GetIP gives the IP address for the container
	GetIP() (string, error)

	// GetName gets the name of the container
	GetName() string

	// GetNetworkName gets the name of the containers network
	GetNetworkName() string

	// GetResources gets the maximum resource allocation of the node
	GetResources() util.Resources
}

Container represents the basic functionality needed to build a container

func NewNodeContainer

func NewNodeContainer(node *db.Node, env map[string]string, resources util.Resources, SubnetID int) Container

NewNodeContainer creates a representation of a container for a regular node

func NewSideCarContainer

func NewSideCarContainer(sc *db.SideCar, env map[string]string, resources util.Resources, SubnetID int) Container

NewSideCarContainer creates a representation of a container for a side car node

type ContainerDetails

type ContainerDetails struct {
	Environment  map[string]string
	Image        string
	Node         int
	Resources    util.Resources
	SubnetID     int
	NetworkIndex int
	Type         ContainerType
}

ContainerDetails represents a docker containers details

func (*ContainerDetails) GetEnvironment

func (cd *ContainerDetails) GetEnvironment() map[string]string

GetEnvironment gives the environment variables for the container

func (*ContainerDetails) GetIP

func (cd *ContainerDetails) GetIP() (string, error)

GetIP gives the IP address for the container

func (*ContainerDetails) GetImage

func (cd *ContainerDetails) GetImage() string

GetImage gives the image from which the container will be built

func (*ContainerDetails) GetName

func (cd *ContainerDetails) GetName() string

GetName gets the name of the container

func (*ContainerDetails) GetNetworkName

func (cd *ContainerDetails) GetNetworkName() string

GetNetworkName gets the name of the containers network

func (*ContainerDetails) GetResources

func (cd *ContainerDetails) GetResources() util.Resources

GetResources gets the maximum resource allocation of the node

type ContainerType

type ContainerType int

ContainerType represents the type of node the container is

const (
	// Node is a standard node in the network
	Node ContainerType = 0

	// SideCar is a sidecar for a node in the network
	SideCar ContainerType = 1

	// Service is a service node
	Service ContainerType = 2
)

type Network

type Network struct {
}

Network represents a docker network

Jump to

Keyboard shortcuts

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