k8s

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressesStreamMsg

type AddressesStreamMsg struct {
	Name      string
	Addresses bee.Addresses
	Error     error
}

AddressesStreamMsg represents message sent over the AddressStream channel

type BalancesStreamMsg

type BalancesStreamMsg struct {
	Name     string
	Balances bee.Balances
	Error    error
}

BalancesStreamMsg represents message sent over the BalancesStream channel

type Cluster

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

Cluster represents cluster of Bee nodes

func NewCluster

func NewCluster(name string, o orchestration.ClusterOptions, logger logging.Logger) *Cluster

NewCluster returns new cluster

func (*Cluster) AddNodeGroup

func (c *Cluster) AddNodeGroup(name string, o orchestration.NodeGroupOptions)

AddNodeGroup adds new node group to the cluster

func (*Cluster) Addresses

func (c *Cluster) Addresses(ctx context.Context) (addrs map[string]orchestration.NodeGroupAddresses, err error)

Addresses returns ClusterAddresses

func (*Cluster) Balances

func (c *Cluster) Balances(ctx context.Context) (balances orchestration.ClusterBalances, err error)

Balances returns ClusterBalances

func (*Cluster) FlattenBalances

func (c *Cluster) FlattenBalances(ctx context.Context) (balances orchestration.NodeGroupBalances, err error)

FlattenBalances returns aggregated NodeGroupBalances

func (*Cluster) FlattenOverlays

func (c *Cluster) FlattenOverlays(ctx context.Context, exclude ...string) (map[string]swarm.Address, error)

FlattenOverlays returns aggregated ClusterOverlays excluding the provided node group names

func (*Cluster) FlattenSettlements

func (c *Cluster) FlattenSettlements(ctx context.Context) (settlements orchestration.NodeGroupSettlements, err error)

FlattenSettlements returns aggregated NodeGroupSettlements

func (*Cluster) FlattenTopologies

func (c *Cluster) FlattenTopologies(ctx context.Context) (topologies map[string]bee.Topology, err error)

FlattenTopologies returns an aggregate of Topologies

func (*Cluster) FullNodeNames

func (c *Cluster) FullNodeNames() (names []string)

FullNodeNames returns a list of full node names

func (*Cluster) GlobalReplicationFactor

func (c *Cluster) GlobalReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)

GlobalReplicationFactor returns the total number of nodes in the cluster that contain given chunk

func (*Cluster) LightNodeNames

func (c *Cluster) LightNodeNames() (names []string)

LightNodeNames returns a list of light node names

func (*Cluster) Name

func (c *Cluster) Name() string

Name returns name of the cluster

func (*Cluster) NodeGroup

func (c *Cluster) NodeGroup(name string) (ng orchestration.NodeGroup, err error)

NodeGroup returns node group

func (*Cluster) NodeGroups

func (c *Cluster) NodeGroups() (l map[string]orchestration.NodeGroup)

NodeGroups returns map of node groups in the cluster

func (*Cluster) NodeGroupsSorted

func (c *Cluster) NodeGroupsSorted() (l []string)

NodeGroupsSorted returns sorted list of node names in the node group

func (*Cluster) NodeNames

func (c *Cluster) NodeNames() (names []string)

NodeNamess returns a list of node names in the cluster across all node groups

func (*Cluster) Nodes

func (c *Cluster) Nodes() map[string]orchestration.Node

Nodes returns map of nodes in the cluster

func (*Cluster) NodesClients

func (c *Cluster) NodesClients(ctx context.Context) (map[string]*bee.Client, error)

NodesClients returns map of node's clients in the cluster excluding stopped nodes

func (*Cluster) NodesClientsAll

func (c *Cluster) NodesClientsAll(ctx context.Context) (map[string]*bee.Client, error)

NodesClientsAll returns map of node's clients in the cluster

func (*Cluster) Overlays

func (c *Cluster) Overlays(ctx context.Context, exclude ...string) (overlays orchestration.ClusterOverlays, err error)

Overlays returns ClusterOverlays excluding the provided node group names

func (*Cluster) Peers

func (c *Cluster) Peers(ctx context.Context, exclude ...string) (peers orchestration.ClusterPeers, err error)

Peers returns peers of all nodes in the cluster

func (*Cluster) RandomNode

func (c *Cluster) RandomNode(ctx context.Context, r *rand.Rand) (node orchestration.Node, err error)

RandomNode returns random running node from a cluster

func (*Cluster) Settlements

func (c *Cluster) Settlements(ctx context.Context) (settlements orchestration.ClusterSettlements, err error)

Settlements returns

func (*Cluster) Size

func (c *Cluster) Size() (size int)

Size returns size of the cluster

func (*Cluster) Topologies

func (c *Cluster) Topologies(ctx context.Context) (topologies orchestration.ClusterTopologies, err error)

Topologies returns ClusterTopologies

type HasChunkStreamMsg

type HasChunkStreamMsg struct {
	Name  string
	Found bool
	Error error
}

HasChunkStreamMsg represents message sent over the HasChunkStream channel

type Node

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

Node represents Bee node

func NewNode

func NewNode(name string, opts orchestration.NodeOptions, logger logging.Logger) (n *Node)

NewNode returns Bee node

func (Node) ClefKey

func (n Node) ClefKey() string

ClefKey returns node's clefKey

func (Node) ClefPassword

func (n Node) ClefPassword() string

ClefPassword returns node's clefPassword

func (Node) Client

func (n Node) Client() *bee.Client

Client returns node's name

func (Node) Config

func (n Node) Config() *orchestration.Config

Config returns node's config

func (Node) Create

func (n Node) Create(ctx context.Context, o orchestration.CreateOptions) (err error)

Create

func (Node) Delete

func (n Node) Delete(ctx context.Context, namespace string) (err error)

func (Node) LibP2PKey

func (n Node) LibP2PKey() string

LibP2PKey returns node's libP2PKey

func (Node) Name

func (n Node) Name() string

Name returns node's name

func (Node) Ready

func (n Node) Ready(ctx context.Context, namespace string) (ready bool, err error)

func (Node) SetClefKey added in v0.9.0

func (n Node) SetClefKey(key string) orchestration.Node

SetClefKey sets node's Clef key

func (Node) SetClefPassword added in v0.9.0

func (n Node) SetClefPassword(password string) orchestration.Node

SetClefKey sets node's Clef key

func (Node) SetSwarmKey added in v0.9.0

func (n Node) SetSwarmKey(key string) orchestration.Node

SetSwarmKey sets node's Swarm key

func (Node) Start

func (n Node) Start(ctx context.Context, namespace string) (err error)

func (Node) Stop

func (n Node) Stop(ctx context.Context, namespace string) (err error)

func (Node) SwarmKey

func (n Node) SwarmKey() string

SwarmKey returns node's swarmKey

type NodeGroup

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

NodeGroup represents group of Bee nodes

func NewNodeGroup

func NewNodeGroup(name string, o orchestration.NodeGroupOptions, logger logging.Logger) *NodeGroup

NewNodeGroup returns new node group

func (*NodeGroup) AddNode

func (g *NodeGroup) AddNode(ctx context.Context, name string, o orchestration.NodeOptions) (err error)

AddNode adss new node to the node group

func (*NodeGroup) Addresses

func (g *NodeGroup) Addresses(ctx context.Context) (addrs orchestration.NodeGroupAddresses, err error)

Addresses returns NodeGroupAddresses

func (*NodeGroup) AddressesStream

func (g *NodeGroup) AddressesStream(ctx context.Context) (<-chan AddressesStreamMsg, error)

AddressesStream returns stream of addresses of all nodes in the node group

func (*NodeGroup) Balances

func (g *NodeGroup) Balances(ctx context.Context) (balances orchestration.NodeGroupBalances, err error)

Balances returns NodeGroupBalances

func (*NodeGroup) BalancesStream

func (g *NodeGroup) BalancesStream(ctx context.Context) (<-chan BalancesStreamMsg, error)

BalancesStream returns stream of balances of all nodes in the cluster

func (*NodeGroup) CreateNode

func (g *NodeGroup) CreateNode(ctx context.Context, name string) (err error)

CreateNode creates new node in the k8s cluster

func (*NodeGroup) DeleteNode

func (g *NodeGroup) DeleteNode(ctx context.Context, name string) (err error)

DeleteNode deletes node from the k8s cluster and removes it from the node group

func (*NodeGroup) Fund

func (g *NodeGroup) Fund(ctx context.Context, name string, o orchestration.FundingOptions) (err error)

Fund adds funds to the node

func (*NodeGroup) GroupReplicationFactor

func (g *NodeGroup) GroupReplicationFactor(ctx context.Context, a swarm.Address) (grf int, err error)

GroupReplicationFactor returns the total number of nodes in the node group that contain given chunk

func (*NodeGroup) HasChunkStream

func (g *NodeGroup) HasChunkStream(ctx context.Context, a swarm.Address) (<-chan HasChunkStreamMsg, error)

HasChunkStream returns stream of HasChunk requests for all nodes in the node group

func (*NodeGroup) Name

func (g *NodeGroup) Name() string

Name returns name of the node group

func (*NodeGroup) Node

func (g *NodeGroup) Node(name string) (orchestration.Node, error)

Node returns node

func (*NodeGroup) NodeClient

func (g *NodeGroup) NodeClient(name string) (*bee.Client, error)

NodeClient returns node's client

func (*NodeGroup) NodeReady

func (g *NodeGroup) NodeReady(ctx context.Context, name string) (ok bool, err error)

NodeReady returns node's readiness

func (*NodeGroup) Nodes

func (g *NodeGroup) Nodes() map[string]orchestration.Node

Nodes returns map of nodes in the node group

func (*NodeGroup) NodesClients

func (g *NodeGroup) NodesClients(ctx context.Context) (map[string]*bee.Client, error)

NodesClients returns map of node's clients in the node group excluding stopped nodes

func (*NodeGroup) NodesClientsAll

func (g *NodeGroup) NodesClientsAll(ctx context.Context) map[string]*bee.Client

NodesClientsAll returns map of node's clients in the node group

func (*NodeGroup) NodesSorted

func (g *NodeGroup) NodesSorted() []string

NodesSorted returns list of nodes sorted by names from the node group.

func (*NodeGroup) Overlays

func (g *NodeGroup) Overlays(ctx context.Context) (overlays orchestration.NodeGroupOverlays, err error)

Overlays returns NodeGroupOverlays

func (*NodeGroup) OverlaysStream

func (g *NodeGroup) OverlaysStream(ctx context.Context) (<-chan OverlaysStreamMsg, error)

OverlaysStream returns stream of overlay addresses of all nodes in the node group TODO: add semaphore

func (*NodeGroup) Peers

func (g *NodeGroup) Peers(ctx context.Context) (peers orchestration.NodeGroupPeers, err error)

Peers returns NodeGroupPeers

func (*NodeGroup) PeersStream

func (g *NodeGroup) PeersStream(ctx context.Context) (<-chan PeersStreamMsg, error)

PeersStream returns stream of peers of all nodes in the node group

func (*NodeGroup) PregenerateSwarmKey added in v0.9.0

func (g *NodeGroup) PregenerateSwarmKey(ctx context.Context, name string) (err error)

PregenerateSwarmKey for a node if needed

func (*NodeGroup) RunningNodes

func (g *NodeGroup) RunningNodes(ctx context.Context) (running []string, err error)

RunningNodes returns list of running nodes TODO: filter by labels

func (*NodeGroup) Settlements

func (g *NodeGroup) Settlements(ctx context.Context) (settlements orchestration.NodeGroupSettlements, err error)

Settlements returns NodeGroupSettlements

func (*NodeGroup) SettlementsStream

func (g *NodeGroup) SettlementsStream(ctx context.Context) (<-chan SettlementsStreamMsg, error)

SettlementsStream returns stream of settlements of all nodes in the cluster

func (*NodeGroup) SetupNode

SetupNode creates new node in the node group, starts it in the k8s cluster and funds it

func (*NodeGroup) Size

func (g *NodeGroup) Size() int

Size returns size of the node group

func (*NodeGroup) StartNode

func (g *NodeGroup) StartNode(ctx context.Context, name string) (err error)

StartNode start node by scaling its statefulset to 1

func (*NodeGroup) StopNode

func (g *NodeGroup) StopNode(ctx context.Context, name string) (err error)

StopNode stops node by scaling down its statefulset to 0

func (*NodeGroup) StoppedNodes

func (g *NodeGroup) StoppedNodes(ctx context.Context) (stopped []string, err error)

StoppedNodes returns list of stopped nodes TODO: filter by labels

func (*NodeGroup) Topologies

func (g *NodeGroup) Topologies(ctx context.Context) (topologies orchestration.NodeGroupTopologies, err error)

Topologies returns NodeGroupTopologies

func (*NodeGroup) TopologyStream

func (g *NodeGroup) TopologyStream(ctx context.Context) (<-chan TopologyStreamMsg, error)

TopologyStream returns stream of Kademlia topologies of all nodes in the node group

type OverlaysStreamMsg

type OverlaysStreamMsg struct {
	Name    string
	Address swarm.Address
	Error   error
}

OverlaysStreamMsg represents message sent over the OverlaysStream channel

type PeersStreamMsg

type PeersStreamMsg struct {
	Name  string
	Peers []swarm.Address
	Error error
}

PeersStreamMsg represents message sent over the PeersStream channel

type SettlementsStreamMsg

type SettlementsStreamMsg struct {
	Name        string
	Settlements bee.Settlements
	Error       error
}

SettlementsStreamMsg represents message sent over the SettlementsStream channel

type TopologyStreamMsg

type TopologyStreamMsg struct {
	Name     string
	Topology bee.Topology
	Error    error
}

TopologyStreamMsg represents message sent over the TopologyStream channel

Jump to

Keyboard shortcuts

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