calcium

package
v0.0.0-...-1a62c48 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUMemNodeContainers

type CPUMemNodeContainers map[float64]map[int64]NodeContainers

CPUMemNodeContainers store cpu, mem and nodecontainers

type CPUMemNodeContainersMap

type CPUMemNodeContainersMap map[float64]map[int64]NodeCPUMap

CPUMemNodeContainersMap store cpu, mem and nodecpumap

type Calcium

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

Calcium implement the cluster

func New

func New(config types.Config) (*Calcium, error)

New returns a new cluster config

func (*Calcium) AddNode

func (c *Calcium) AddNode(ctx context.Context, nodename, endpoint, podname, ca, cert, key string, cpu, share int, memory int64, labels map[string]string) (*types.Node, error)

AddNode add a node in pod

func (*Calcium) AddPod

func (c *Calcium) AddPod(ctx context.Context, podname, favor, desc string) (*types.Pod, error)

AddPod add pod

func (*Calcium) BuildImage

func (c *Calcium) BuildImage(ctx context.Context, opts *types.BuildOptions) (chan *types.BuildImageMessage, error)

BuildImage will build image for repository since we wanna set UID for the user inside container, we have to know the uid parameter

build directory is like:

buildDir ├─ :appname ├─ code
         ├─ Dockerfile

func (*Calcium) ContainerDeployed

func (c *Calcium) ContainerDeployed(ctx context.Context, ID, appname, entrypoint, nodename, data string) error

ContainerDeployed show container deploy status

func (*Calcium) Copy

func (c *Calcium) Copy(ctx context.Context, opts *types.CopyOptions) (chan *types.CopyMessage, error)

Copy uses docker cp to copy specified things and send to remote

func (*Calcium) CreateContainer

func (c *Calcium) CreateContainer(ctx context.Context, opts *types.DeployOptions) (chan *types.CreateContainerMessage, error)

CreateContainer use options to create containers

func (*Calcium) DeployStatusStream

func (c *Calcium) DeployStatusStream(ctx context.Context, appname, entrypoint, nodename string) chan *types.DeployStatus

DeployStatusStream watch deploy status

func (*Calcium) GetContainer

func (c *Calcium) GetContainer(ctx context.Context, ID string) (*types.Container, error)

GetContainer get a container

func (*Calcium) GetContainers

func (c *Calcium) GetContainers(ctx context.Context, IDs []string) ([]*types.Container, error)

GetContainers get containers

func (*Calcium) GetNode

func (c *Calcium) GetNode(ctx context.Context, podname, nodename string) (*types.Node, error)

GetNode get node

func (*Calcium) GetNodeByName

func (c *Calcium) GetNodeByName(ctx context.Context, nodename string) (*types.Node, error)

GetNodeByName get node by name

func (*Calcium) GetPod

func (c *Calcium) GetPod(ctx context.Context, podname string) (*types.Pod, error)

GetPod get one pod

func (*Calcium) ListContainers

func (c *Calcium) ListContainers(ctx context.Context, appname, entrypoint, nodename string) ([]*types.Container, error)

ListContainers list containers

func (*Calcium) ListNetworks

func (c *Calcium) ListNetworks(ctx context.Context, podname string, driver string) ([]*types.Network, error)

ListNetworks by podname just get one node from podname and call docker network ls only get those driven by network driver

func (*Calcium) ListNodeContainers

func (c *Calcium) ListNodeContainers(ctx context.Context, nodename string) ([]*types.Container, error)

ListNodeContainers list containers belong to one node

func (*Calcium) ListPodNodes

func (c *Calcium) ListPodNodes(ctx context.Context, podname string, all bool) ([]*types.Node, error)

ListPodNodes list nodes belong to pod

func (*Calcium) ListPods

func (c *Calcium) ListPods(ctx context.Context) ([]*types.Pod, error)

ListPods show pods

func (*Calcium) Lock

func (c *Calcium) Lock(ctx context.Context, name string, timeout int) (lock.DistributedLock, error)

Lock is lock for calcium

func (*Calcium) ReallocResource

func (c *Calcium) ReallocResource(ctx context.Context, IDs []string, cpu float64, mem int64) (chan *types.ReallocResourceMessage, error)

ReallocResource allow realloc container resource

func (*Calcium) RemoveContainer

func (c *Calcium) RemoveContainer(ctx context.Context, IDs []string, force bool) (chan *types.RemoveContainerMessage, error)

RemoveContainer remove containers returns a channel that contains removing responses

func (*Calcium) RemoveImage

func (c *Calcium) RemoveImage(ctx context.Context, podname, nodename string, images []string) (chan *types.RemoveImageMessage, error)

RemoveImage remove images

func (*Calcium) RemoveNode

func (c *Calcium) RemoveNode(ctx context.Context, nodename, podname string) (*types.Pod, error)

RemoveNode remove a node

func (*Calcium) RemovePod

func (c *Calcium) RemovePod(ctx context.Context, podname string) error

RemovePod remove pod

func (*Calcium) ReplaceContainer

func (c *Calcium) ReplaceContainer(ctx context.Context, opts *types.DeployOptions, force bool) (chan *types.ReplaceContainerMessage, error)

ReplaceContainer replace containers with same resource

func (*Calcium) RunAndWait

func (c *Calcium) RunAndWait(ctx context.Context, opts *types.DeployOptions, stdin io.ReadCloser) (chan *types.RunAndWaitMessage, error)

RunAndWait implement lambda

func (*Calcium) SetNodeAvailable

func (c *Calcium) SetNodeAvailable(ctx context.Context, podname, nodename string, available bool) (*types.Node, error)

SetNodeAvailable set node available or not

func (*Calcium) SetStore

func (c *Calcium) SetStore(s store.Store)

SetStore 用于在单元测试中更改etcd store为mock store

type NodeCPUMap

type NodeCPUMap map[*types.Node][]types.CPUMap

NodeCPUMap store cpu and node info

type NodeContainers

type NodeContainers map[*types.Node][]*types.Container

NodeContainers store containers and node info

Jump to

Keyboard shortcuts

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