memberlist

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNodeAvailable = errors.New("no Node available")

ErrNoNodeAvailable is the error returned if no Node is chosen in SelectNodeForIP and ShouldSelectIP.

Functions

This section is empty.

Types

type Cluster

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

Cluster implements ClusterInterface.

func NewCluster

func NewCluster(
	nodeIP net.IP,
	clusterBindPort int,
	nodeName string,
	nodeInformer coreinformers.NodeInformer,
	externalIPPoolInformer crdinformers.ExternalIPPoolInformer,
) (*Cluster, error)

NewCluster returns a new *Cluster.

func (*Cluster) AddClusterEventHandler

func (c *Cluster) AddClusterEventHandler(handler ClusterNodeEventHandler)

AddClusterEventHandler adds a clusterNodeEventHandler, which will run when consistentHashMap is updated, due to an ExternalIPPool or Node event.

func (*Cluster) AliveNodes added in v1.5.0

func (c *Cluster) AliveNodes() sets.String

AliveNodes returns the list of nodeNames in the cluster.

func (*Cluster) Run

func (c *Cluster) Run(stopCh <-chan struct{})

Run will join all the other K8s Nodes in a memberlist cluster and will create defaultWorkers workers (go routines) which will process the ExternalIPPool or Node events from the work queue.

func (*Cluster) SelectNodeForIP added in v1.5.0

func (c *Cluster) SelectNodeForIP(ip, externalIPPool string, filters ...func(string) bool) (string, error)

SelectNodeForIP returns the closest item (Node name) in the hash to the provided key (IP) and ExternalIPPool.

func (*Cluster) ShouldSelectIP added in v1.5.0

func (c *Cluster) ShouldSelectIP(ip, externalIPPool string, filters ...func(string) bool) (bool, error)

ShouldSelectIP returns true if the local Node selected as the owner Node of the IP in the specific ExternalIPPool. The local Node in the cluster holds the same consistent hash ring for each ExternalIPPool, consistentHash.Get gets the closest item (Node name) in the hash to the provided key (IP), if the name of the local Node is equal to the name of the selected Node, returns true.

type ClusterNodeEventHandler added in v1.5.0

type ClusterNodeEventHandler func(objName string)

type Interface added in v1.5.0

type Interface interface {
	SelectNodeForIP(ip, externalIPPool string, filters ...func(string) bool) (string, error)
	AliveNodes() sets.String
	AddClusterEventHandler(handler ClusterNodeEventHandler)
}

Jump to

Keyboard shortcuts

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