Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Cell = cell.Module( "node-manager", "Manages the collection of Cilium nodes", cell.Provide(newAllNodeManager), cell.Provide(newGetClusterNodesRestAPIHandler), cell.Provide(newNodeConfigNotifier), metrics.Metric(NewNodeMetrics), )
Cell provides the NodeManager, which manages information about Cilium nodes in the cluster and informs other modules of changes to node configuration.
Functions ¶
func New ¶
func New( logger *slog.Logger, c *option.DaemonConfig, tunnelConf tunnel.Config, ipCache IPCache, ipsetMgr ipset.Manager, ipsetFilter IPSetFilterFn, nodeMetrics *nodeMetrics, health cell.Health, jobGroup job.Group, db *statedb.DB, devices statedb.Table[*tables.Device], wgCfg types.Config, localNodeStore *node.LocalNodeStore, ) (*manager, error)
New returns a new node manager
func NewNodeMetrics ¶
func NewNodeMetrics() *nodeMetrics
Types ¶
type IPCache ¶
type IPCache interface {
GetMetadataSourceByPrefix(prefix cmtypes.PrefixCluster) source.Source
UpsertMetadata(prefix cmtypes.PrefixCluster, src source.Source, resource ipcacheTypes.ResourceID, aux ...ipcache.IPMetadata)
RemoveMetadata(prefix cmtypes.PrefixCluster, resource ipcacheTypes.ResourceID, aux ...ipcache.IPMetadata)
UpsertMetadataBatch(updates ...ipcache.MU) (revision uint64)
RemoveMetadataBatch(updates ...ipcache.MU) (revision uint64)
}
IPCache is the set of interactions the node manager performs with the ipcache
type IPSetFilterFn ¶ added in v1.16.0
IPSetFilterFn is a function allowing to optionally filter out the insertion of IPSet entries based on node characteristics. The insertion is performed if the function returns false, and skipped otherwise.
type NodeConfigNotifier ¶ added in v1.18.0
type NodeConfigNotifier struct {
// contains filtered or unexported fields
}
NodeConfigNotifier is used to notify subscribers about changes in the local node configuration. Handlers must be subscribed during hive construction, before the lifecycle starts.
func (*NodeConfigNotifier) Notify ¶ added in v1.18.0
func (n *NodeConfigNotifier) Notify(nodeConfig config.Config) error
func (*NodeConfigNotifier) Subscribe ¶ added in v1.18.0
func (n *NodeConfigNotifier) Subscribe(handler config.ChangeHandler)
type NodeManager ¶
type NodeManager interface {
Notifier
// GetNodes returns a copy of all the nodes as a map from Identity to Node.
GetNodes() map[types.Identity]types.Node
// GetNodeIdentities returns a list of all node identities store in node
// manager.
GetNodeIdentities() []types.Identity
// NodeUpdated is called when the store detects a change in node
// information
NodeUpdated(n types.Node)
// NodeDeleted is called when the store detects a deletion of a node
NodeDeleted(n types.Node)
// NodeSync is called when the store completes the initial nodes listing
NodeSync()
// MeshNodeSync is called when the store completes the initial nodes listing including meshed nodes
MeshNodeSync()
// ClusterSizeDependantInterval returns a time.Duration that is dependent 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.
ClusterSizeDependantInterval(baseInterval time.Duration) time.Duration
// SetPrefixClusterMutatorFn allows to inject a custom prefix cluster mutator.
// The mutator may then be applied to the PrefixCluster(s) using cmtypes.PrefixClusterFrom,
// cmtypes.PrefixClusterFromCIDR and the like.
SetPrefixClusterMutatorFn(mutator func(*types.Node) []cmtypes.PrefixClusterOpts)
}
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(node.Handler)
// Unsubscribe removes the given NodeHandler from the list of subscribers.
Unsubscribe(node.Handler)
}
Notifier is the interface the wraps Subscribe and Unsubscribe. An implementation of this interface notifies subscribers of nodes being added, updated or deleted.