Documentation ¶
Index ¶
- type Krypton
- func (k *Krypton) AddContainer(ctx context.Context, container *types.Container) error
- func (k *Krypton) AddNode(ctx context.Context, name, endpoint, podname, ca, cert, key string, ...) (*types.Node, error)
- func (k *Krypton) AddPod(ctx context.Context, name, favor, desc string) (*types.Pod, error)
- func (k *Krypton) CleanContainerData(ctx context.Context, ID, appname, entrypoint, nodename string) error
- func (k *Krypton) ContainerDeployed(ctx context.Context, ID, appname, entrypoint, nodename, data string) error
- func (k *Krypton) CreateLock(key string, ttl int) (lock.DistributedLock, error)
- func (k *Krypton) DeleteNode(ctx context.Context, node *types.Node)
- func (k *Krypton) GetAllNodes(ctx context.Context) (nodes []*types.Node, err error)
- func (k *Krypton) GetAllPods(ctx context.Context) (pods []*types.Pod, err error)
- func (k *Krypton) GetContainer(ctx context.Context, ID string) (*types.Container, error)
- func (k *Krypton) GetContainers(ctx context.Context, IDs []string) (containers []*types.Container, err error)
- func (k *Krypton) GetNode(ctx context.Context, podname, nodename string) (*types.Node, error)
- func (k *Krypton) GetNodeByName(ctx context.Context, nodename string) (node *types.Node, err error)
- func (k *Krypton) GetNodesByPod(ctx context.Context, podname string) (nodes []*types.Node, err error)
- func (k *Krypton) GetPod(ctx context.Context, name string) (*types.Pod, error)
- func (k *Krypton) ListContainers(ctx context.Context, appname, entrypoint, nodename string) ([]*types.Container, error)
- func (k *Krypton) ListNodeContainers(ctx context.Context, nodename string) ([]*types.Container, error)
- func (k *Krypton) MakeDeployStatus(ctx context.Context, opts *types.DeployOptions, nodesInfo []types.NodeInfo) ([]types.NodeInfo, error)
- func (k *Krypton) RemoveContainer(ctx context.Context, container *types.Container) error
- func (k *Krypton) RemovePod(ctx context.Context, podname string) error
- func (k *Krypton) UpdateNode(ctx context.Context, node *types.Node) error
- func (k *Krypton) UpdateNodeResource(ctx context.Context, podname, nodename string, cpu types.CPUMap, mem int64, ...) error
- func (k *Krypton) WatchDeployStatus(appname, entrypoint, nodename string) etcdclient.Watcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Krypton ¶
type Krypton struct {
// contains filtered or unexported fields
}
Krypton means store with etcd
func (*Krypton) AddContainer ¶
AddContainer add a container mainly record its relationship on pod and node actually if we already know its node, we will know its pod but we still store it storage path in etcd is `/container/:containerid`
func (*Krypton) AddNode ¶
func (k *Krypton) AddNode(ctx context.Context, name, endpoint, podname, ca, cert, key string, cpu, share int, memory int64, labels map[string]string) (*types.Node, error)
AddNode save it to etcd storage path in etcd is `/pod/:podname/node/:nodename/info`
func (*Krypton) AddPod ¶
AddPod add a pod save it to etcd storage path in etcd is `/pod/:podname/info`
func (*Krypton) CleanContainerData ¶
func (k *Krypton) CleanContainerData(ctx context.Context, ID, appname, entrypoint, nodename string) error
CleanContainerData clean container data
func (*Krypton) ContainerDeployed ¶
func (k *Krypton) ContainerDeployed(ctx context.Context, ID, appname, entrypoint, nodename, data string) error
ContainerDeployed store deployed container info
func (*Krypton) CreateLock ¶
CreateLock create a lock instance
func (*Krypton) DeleteNode ¶
DeleteNode delete a node
func (*Krypton) GetAllNodes ¶
GetAllNodes get all nodes from etcd any error will break and return immediately
func (*Krypton) GetAllPods ¶
GetAllPods get all pods in etcd any error will break and return error immediately storage path in etcd is `/pod`
func (*Krypton) GetContainer ¶
GetContainer get a container container if must be in full length, or we can't find it in etcd storage path in etcd is `/container/:containerid`
func (*Krypton) GetContainers ¶
func (k *Krypton) GetContainers(ctx context.Context, IDs []string) (containers []*types.Container, err error)
GetContainers get many containers
func (*Krypton) GetNode ¶
GetNode get a node from etcd and construct it's docker client a node must belong to a pod and since node is not the smallest unit to user, to get a node we must specify the corresponding pod storage path in etcd is `/pod/:podname/node/:nodename/info`
func (*Krypton) GetNodeByName ¶
GetNodeByName get node by name
func (*Krypton) GetNodesByPod ¶
func (k *Krypton) GetNodesByPod(ctx context.Context, podname string) (nodes []*types.Node, err error)
GetNodesByPod get all nodes bound to pod here we use podname instead of pod instance storage path in etcd is `/pod/:podname/node`
func (*Krypton) ListContainers ¶
func (k *Krypton) ListContainers(ctx context.Context, appname, entrypoint, nodename string) ([]*types.Container, error)
ListContainers list containers
func (*Krypton) ListNodeContainers ¶
func (k *Krypton) ListNodeContainers(ctx context.Context, nodename string) ([]*types.Container, error)
ListNodeContainers list containers belong to one node
func (*Krypton) MakeDeployStatus ¶
func (k *Krypton) MakeDeployStatus(ctx context.Context, opts *types.DeployOptions, nodesInfo []types.NodeInfo) ([]types.NodeInfo, error)
MakeDeployStatus get deploy status from store
func (*Krypton) RemoveContainer ¶
RemoveContainer remove a container container id must be in full length
func (*Krypton) UpdateNode ¶
UpdateNode update a node, save it to etcd storage path in etcd is `/pod/:podname/node/:nodename/info`
func (*Krypton) UpdateNodeResource ¶
func (k *Krypton) UpdateNodeResource(ctx context.Context, podname, nodename string, cpu types.CPUMap, mem int64, action string) error
UpdateNodeResource update cpu and mem on a node, either add or substract need to lock
func (*Krypton) WatchDeployStatus ¶
func (k *Krypton) WatchDeployStatus(appname, entrypoint, nodename string) etcdclient.Watcher
WatchDeployStatus watch deployed status