Documentation ¶
Index ¶
- Variables
- type API
- type Deps
- type KVDBWithAtomic
- type Node
- type NodeSync
- func (ns *NodeSync) Close() error
- func (ns *NodeSync) GetAllNodes() Nodes
- func (ns *NodeSync) GetNodeID() uint32
- func (ns *NodeSync) HandlesEvent(event controller.Event) bool
- func (ns *NodeSync) Init() error
- func (ns *NodeSync) PublishNodeIPs(addresses contivconf.IPsWithNetworks, version contivconf.IPVersion) error
- func (ns *NodeSync) Resync(event controller.Event, kubeStateData controller.KubeStateData, ...) error
- func (ns *NodeSync) Revert(event controller.Event) error
- func (ns *NodeSync) Update(event controller.Event, txn controller.UpdateOperations) (changeDescription string, err error)
- type NodeUpdate
- func (ev *NodeUpdate) Direction() controller.UpdateDirectionType
- func (ev *NodeUpdate) Done(error)
- func (ev *NodeUpdate) GetName() string
- func (ev *NodeUpdate) IsBlocking() bool
- func (ev *NodeUpdate) Method() controller.EventMethodType
- func (ev *NodeUpdate) String() string
- func (ev *NodeUpdate) TransactionType() controller.UpdateTransactionType
- type Nodes
- type Option
Constants ¶
This section is empty.
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is a default instance of NodeSync.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { // GetNodeID returns the integer ID allocated for this node. // The method is thread-safe, but should not be called before the startup resync. GetNodeID() uint32 // PublishNodeIPs can be used to publish update about currently assigned // node IPs of the given IP version on the VPP-side. // The method is efficient enough that it can be called during every resync // - only if something has really changed an update will be sent. // The method should be called only from within the main event loop (not thread // safe) and not before the startup resync. PublishNodeIPs(addresses contivconf.IPsWithNetworks, version contivconf.IPVersion) error // GetAllNodes returns information about all nodes in the cluster. // The method should be called only from within the main event loop (not thread // safe) and not before the startup resync. GetAllNodes() Nodes // node name -> node info }
API defines methods provided by NodeSync for use by other plugins.
type Deps ¶
type Deps struct { infra.PluginDeps ServiceLabel servicelabel.ReaderAPI EventLoop controller.EventLoop DB KVDBWithAtomic }
Deps lists dependencies of NodeSync.
type KVDBWithAtomic ¶
type KVDBWithAtomic interface { keyval.KvProtoPlugin // NewBrokerWithAtomic creates new instance of prefixed (byte-oriented) broker with atomic operations. NewBrokerWithAtomic(keyPrefix string) keyval.BytesBrokerWithAtomic // Close closes connection to DB and releases all allocated resources. Close() error }
KVDBWithAtomic defines API that a DB client must provide for NodeSync to be able to allocate node IP and to publish node IPs to other nodes.
type Node ¶
type Node struct { ID uint32 Name string VppIPAddresses contivconf.IPsWithNetworks MgmtIPAddresses []net.IP PodCIDR *net.IPNet }
Node represents a single node in the cluster.
type NodeSync ¶
type NodeSync struct { Deps // contains filtered or unexported fields }
NodeSync plugin implements synchronization between Kubernetes nodes running VPP vswitch using a key-value database (by default etcd). Specifically, it allocates the first free positive integer, starting with 1, as a cluster-wide node identifier, primarily used for IP allocations for endpoints inside this node that will not collide with other nodes. Furthermore, NodeSync publishes allocations/changes of the VPP-side of node IP address(es) - information that is not known to Kubernetes.
func (*NodeSync) GetAllNodes ¶
GetAllNodes returns information about all nodes in the cluster. Methods should not be called before the startup resync. The method should be called only from within the main event loop (not thread safe) and not before the startup resync.
func (*NodeSync) GetNodeID ¶
GetNodeID returns the integer ID allocated for this node. The method is thread-safe, but should not be called before the startup resync.
func (*NodeSync) HandlesEvent ¶
func (ns *NodeSync) HandlesEvent(event controller.Event) bool
HandlesEvent selects database events - specifically DB entries related to node information.
func (*NodeSync) PublishNodeIPs ¶
func (ns *NodeSync) PublishNodeIPs(addresses contivconf.IPsWithNetworks, version contivconf.IPVersion) error
PublishNodeIPs can be used to publish update about currently assigned node IPs of the given IP version on the VPP-side. The method is efficient enough that it can be called during every resync - only if something has really changed an update will be sent. The method should be called only from within the main event loop (not thread safe) and not before the startup resync.
func (*NodeSync) Resync ¶
func (ns *NodeSync) Resync(event controller.Event, kubeStateData controller.KubeStateData, resyncCount int, _ controller.ResyncOperations) error
Resync during startup phase allocates or retrieves already allocated ID for this node. In the runtime, only status of other nodes is re-synchronized.
func (*NodeSync) Revert ¶
func (ns *NodeSync) Revert(event controller.Event) error
Revert is NOOP - plugin handles only BestEffort events.
func (*NodeSync) Update ¶
func (ns *NodeSync) Update(event controller.Event, txn controller.UpdateOperations) (changeDescription string, err error)
Update is called for KubeStateChange.
type NodeUpdate ¶
type NodeUpdate struct { NodeName string PrevState *Node // nil if the node joined the cluster NewState *Node // nil if the node left the cluster }
NodeUpdate is an Update event that represents change in the status of a K8s node. For other nodes, the event is triggered when:
- node joins the cluster
- node leaves the cluster
- VPP or management IP addresses of the node are updated
For this node, the event is triggered only when:
- the management IP addresses are updated
For update of this node VPP IP addresses, there is already resync event NodeIPv*Change.
func (*NodeUpdate) Direction ¶
func (ev *NodeUpdate) Direction() controller.UpdateDirectionType
Direction is Forward.
func (*NodeUpdate) GetName ¶
func (ev *NodeUpdate) GetName() string
GetName returns name of the NodeUpdate event.
func (*NodeUpdate) Method ¶
func (ev *NodeUpdate) Method() controller.EventMethodType
Method is Update.
func (*NodeUpdate) String ¶
func (ev *NodeUpdate) String() string
String describes NodeUpdate event.
func (*NodeUpdate) TransactionType ¶
func (ev *NodeUpdate) TransactionType() controller.UpdateTransactionType
TransactionType is BestEffort.