manager

package
v1.13.12 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 29 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration interface {
	TunnelingEnabled() bool
	RemoteNodeIdentitiesEnabled() bool
	NodeEncryptionEnabled() bool
	NodeIpsetNeeded() bool
}

Configuration is the set of configuration options the node manager depends on

type IPCache

type IPCache interface {
	Upsert(ip string, hostIP net.IP, hostKey uint8, k8sMeta *ipcache.K8sMetadata, newIdentity ipcache.Identity) (bool, error)
	Delete(IP string, source source.Source) bool
	UpsertLabels(prefix netip.Prefix, lbls labels.Labels, src source.Source, rid ipcacheTypes.ResourceID)
	RemoveLabels(prefix netip.Prefix, lbls labels.Labels, rid ipcacheTypes.ResourceID)
}

IPCache is the set of interactions the node manager performs with the ipcache

type Manager added in v1.5.0

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

Manager is the entity that manages a collection of nodes

func NewManager added in v1.5.0

func NewManager(name string, dp datapath.NodeHandler, c Configuration, sc selectorCacheUpdater, pt policyTriggerer) (*Manager, error)

NewManager returns a new node manager

func (*Manager) Close added in v1.5.0

func (m *Manager) Close()

Close shuts down a node manager

func (*Manager) ClusterSizeDependantInterval added in v1.5.0

func (m *Manager) ClusterSizeDependantInterval(baseInterval time.Duration) time.Duration

ClusterSizeDependantInterval returns a time.Duration that is dependant on the cluster size, i.e. the number of nodes that have been discovered. This can be used to control sync intervals of shared or centralized resources to avoid overloading these resources as the cluster grows.

Example sync interval with baseInterval = 1 * time.Minute

nodes | sync interval ------+----------------- 1 | 41.588830833s 2 | 1m05.916737320s 4 | 1m36.566274746s 8 | 2m11.833474640s 16 | 2m49.992800643s 32 | 3m29.790453687s 64 | 4m10.463236193s 128 | 4m51.588744261s 256 | 5m32.944565093s 512 | 6m14.416550710s 1024 | 6m55.946873494s 2048 | 7m37.506428894s 4096 | 8m19.080616652s 8192 | 9m00.662124608s 16384 | 9m42.247293667s

func (*Manager) GetNodeIdentities added in v1.6.0

func (m *Manager) GetNodeIdentities() []nodeTypes.Identity

GetNodeIdentities returns a list of all node identities store in node manager.

func (*Manager) GetNodes added in v1.5.0

func (m *Manager) GetNodes() map[nodeTypes.Identity]nodeTypes.Node

GetNodes returns a copy of all of the nodes as a map from Identity to Node.

func (*Manager) Iter added in v1.6.0

func (m *Manager) Iter(f func(nh datapath.NodeHandler))

Iter executes the given function in all subscribed node handlers.

func (*Manager) NodeDeleted added in v1.5.0

func (m *Manager) NodeDeleted(n nodeTypes.Node)

NodeDeleted is called after a node has been deleted. It removes the node from the manager if the node is still owned by the source of which the event origins from. If the node was removed, NodeDelete() is invoked of the datapath interface.

func (*Manager) NodeUpdated added in v1.5.0

func (m *Manager) NodeUpdated(n nodeTypes.Node)

NodeUpdated is called after the information of a node has been updated. The node in the manager is added or updated if the source is allowed to update the node. If an update or addition has occurred, NodeUpdate() of the datapath interface is invoked.

func (*Manager) StartNeighborRefresh added in v1.8.7

func (m *Manager) StartNeighborRefresh(nh datapath.NodeNeighbors)

StartNeighborRefresh spawns a controller which refreshes neighbor table by sending arping periodically.

func (*Manager) Subscribe added in v1.6.0

func (m *Manager) Subscribe(nh datapath.NodeHandler)

Subscribe subscribes the given node handler to node events.

func (*Manager) Unsubscribe added in v1.6.0

func (m *Manager) Unsubscribe(nh datapath.NodeHandler)

Unsubscribe unsubscribes the given node handler with node events.

func (*Manager) WithIPCache added in v1.12.0

func (m *Manager) WithIPCache(ipc IPCache) *Manager

WithIPCache sets the ipcache field in the Manager.

func (*Manager) WithPolicyTriggerer added in v1.11.0

func (m *Manager) WithPolicyTriggerer(pt policyTriggerer) *Manager

WithPolicyTriggerer sets the policy update trigger in the Manager.

func (*Manager) WithSelectorCacheUpdater added in v1.11.0

func (m *Manager) WithSelectorCacheUpdater(sc selectorCacheUpdater) *Manager

WithSelectorCacheUpdater sets the selector cache updater in the Manager.

type Notifier

type Notifier interface {
	// Subscribe adds the given NodeHandler to the list of subscribers that are
	// notified of node changes. Upon call to this method, the NodeHandler is
	// being notified of all nodes that are already in the cluster by calling
	// the NodeHandler's NodeAdd callback.
	Subscribe(datapath.NodeHandler)
	// Unsubscribe removes the given NodeHandler from the list of subscribers.
	Unsubscribe(datapath.NodeHandler)
}

Notifier is the interface the wraps Subscribe and Unsubscribe. An implementation of this interface notifies subscribers of nodes being added, updated or deleted.

Jump to

Keyboard shortcuts

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