Documentation
¶
Index ¶
Constants ¶
const ( // GraphName : name of the graph with the managed state as a whole. GraphName = "DeviceConnectivity" // GlobalSG : name of the sub-graph with global configuration. GlobalSG = "Global" // NetworkIoSG : name of the sub-graph with network IO devices. NetworkIoSG = "NetworkIO" // PhysicalIfsSG : sub-graph with network interfaces corresponding to physical NICs. PhysicalIfsSG = "PhysicalInterfaces" // LogicalIoSG : name of the sub-graph with logical network interfaces. LogicalIoSG = "LogicalIO" // WirelessSG : sub-graph with everything related to wireless connectivity. WirelessSG = "Wireless" // L3SG : subgraph with configuration items related to Layer3 of the ISO/OSI model. L3SG = "L3" // AdaptersSG : sub-graph with everything related to adapters. AdaptersSG = "Adapters" // AdapterAddrsSG : sub-graph with external items representing addresses assigned to adapters. AdapterAddrsSG = "AdapterAddrs" // IPRulesSG : sub-graph with IP rules. IPRulesSG = "IPRules" // RoutesSG : sub-graph with IP routes. RoutesSG = "Routes" // ArpsSG : sub-graph with ARP entries. ArpsSG = "ARPs" // ACLsSG : sub-graph with device-wide ACLs. ACLsSG = "ACLs" // IPv4ACLsSG : sub-graph of ACLsSG with IPv4 rules. IPv4ACLsSG = "IPv4Rules" // IPv6ACLsSG : sub-graph of ACLsSG with IPv6 rules. IPv6ACLsSG = "IPv6Rules" )
Device connectivity configuration is modeled using dependency graph (see libs/depgraph). Config graph with all sub-graphs and config item types used for Linux network stack:
+----------------------------------------------------------------------------------------+ | DeviceConnectivity | | | | +--------------------------------------+ +------------------------------------+ | | | NetworkIO | | Global | | | | | | | | | | +-----------+ +------------+ | | +-------------+ +-------------+ | | | | | NetIO | | NetIO | | | | ResolvConf | | IPRule | | | | | | (external)| | (external) | ... | | | (singleton) | | (Local RT) | | | | | +-----------+ +------------+ | | +-------------+ +-------------+ | | | +--------------------------------------+ | +-------------------+ | | | | | IPRule | ... | | | | | (for HV=kubevirt) | | | | | +-------------------+ | | | +------------------------------------+ | | | | | | +-----------------+ +------------------+ +-------------------------------------+ | | | PhysicalIfs | | LogicalIO (L2) | | Wireless | | | | | | | | | | | | +--------+ | | +------+ | | +-------------+ +-------------+ | | | | | PhysIf | ... | | | Vlan | ... | | | Wwan | | Wlan | | | | | +--------+ | | +------+ | | | (singleton) | | (singleton) | | | | +-----------------+ | +------+ | | +-------------+ +-------------+ | | | | | Bond | ... | +-------------------------------------+ | | | +------+ | | | +------------------+ | | | | +----------------------------------------------------------------------------------+ | | | L3 | | | | | | | | +-------------------------------+ | | | | | IPRules | | | | | +----------------------------------------+ | | | | | | | Adapters | | +-------+ +--------+ | | | | | | | | |IPRule | | IPRule | ... | | | | | | +---------+ +---------+ | | +-------+ +--------+ | | | | | | | Adapter | | Adapter | ... | +-------------------------------+ | | | | | +---------+ +---------+ | | | | | | +------------+ +------------+ | +-------------------------------+ | | | | | | DhcpClient | | DhcpClient | ... | | Routes | | | | | | +------------+ +------------+ | | | | | | | | +------------------------------------+ | | +-------+ +-------+ | | | | | | | AdapterAddrs | | | | Route | | Route | ... | | | | | | | | | | +-------+ +-------+ | | | | | | | +--------------+ | | +-------------------------------+ | | | | | | | AdapterAddrs | ... | | | | | | | | | (external) | | | +-------------------------------+ | | | | | | +--------------+ | | | ARPs | | | | | | +------------------------------------+ | | | | | | | +----------------------------------------+ | +-----+ +-----+ | | | | | | | Arp | | Arp | ... | | | | | | +-----+ +-----+ | | | | | +-------------------------------+ | | | | | | | +----------------------------------------------------------------------------------+ | | | | +----------------------------------------------------------------------------------+ | | | ACLs | | | | | | | | +---------------+ | | | | | SSHAuthKeys | | | | | | (singleton) | | | | | +---------------+ | | | | +--------------------------------+ +--------------------------------+ | | | | | IPv4Rules | | IPv6Rules | | | | | | | | | | | | | | +---------------+ | | +---------------+ | | | | | | | IptablesChain | ... | | | IptablesChain | ... | | | | | | +---------------+ | | +---------------+ | | | | | | +---------------+ | | +---------------+ | | | | | | | IptablesRule | ... | | | IptablesRule | ... | | | | | | +---------------+ | | +---------------+ | | | | | +--------------------------------+ +--------------------------------+ | | | +----------------------------------------------------------------------------------+ | +----------------------------------------------------------------------------------------+
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { DPC types.DevicePortConfig AA types.AssignableAdapters RS types.RadioSilence GCP types.ConfigItemValueMap // True if flow logging is enabled in at least one network instance. FlowlogEnabled bool // Cluster network status used when edge node is part of a kubernetes cluster. ClusterStatus types.EdgeNodeClusterStatus }
Args : a high-level device configuration received from the controller, further translated by DpcReconciler into the corresponding low-level network configuration and applied into the target network stack.
type DNSStatus ¶
type DNSStatus struct { // Non-nil if reconciler failed to apply DNS configuration. Error error // Configured DNS servers sorted by physical interface name. Servers map[string][]net.IP // interface name -> DNS servers }
DNSStatus : state information related to domain name system (DNS).
type DpcReconciler ¶
type DpcReconciler interface { // Reconcile : call to apply the current DPC into the target network stack. // Synchronous configuration operations are run from within the caller's Go routine. Reconcile(ctx context.Context, args Args) ReconcileStatus }
DpcReconciler should translate the currently selected Device port configuration (DevicePortConfig struct; abbreviated to DPC) into the corresponding low-level network configuration of the target network stack and apply it using the Reconciler (see libs/reconciler). It is not required for DpcReconciler to be thread-safe.
type LinuxDpcReconciler ¶
type LinuxDpcReconciler struct { sync.Mutex // Enable to have the current state exported to /run/nim-current-state.dot // on every change. ExportCurrentState bool // Enable to have the intended state exported to /run/nim-intended-state.dot // on every change. ExportIntendedState bool // Note: the exported attributes below should be injected, // but most are optional. Log *base.LogObject // mandatory AgentName string NetworkMonitor netmonitor.NetworkMonitor // mandatory SubControllerCert pubsub.Subscription SubEdgeNodeCert pubsub.Subscription PubCipherBlockStatus pubsub.Publication CipherMetrics *cipher.AgentMetrics PubWwanConfig pubsub.Publication HVTypeKube bool // contains filtered or unexported fields }
LinuxDpcReconciler is a DPC-reconciler for Linux network stack, i.e. it configures and uses Linux networking to provide device connectivity.
func (*LinuxDpcReconciler) GetCurrentState ¶
func (r *LinuxDpcReconciler) GetCurrentState() (graph dg.GraphR, release func())
GetCurrentState : get the current state (read-only). Exported only for unit-testing purposes.
func (*LinuxDpcReconciler) GetIntendedState ¶
func (r *LinuxDpcReconciler) GetIntendedState() (graph dg.GraphR, release func())
GetIntendedState : get the intended state (read-only). Exported only for unit-testing purposes.
func (*LinuxDpcReconciler) Reconcile ¶
func (r *LinuxDpcReconciler) Reconcile(ctx context.Context, args Args) ReconcileStatus
Reconcile : call to apply the current DPC into the Linux network stack.
type ReconcileStatus ¶
type ReconcileStatus struct { // Error summarizing the outcome of the reconciliation. Error error // True if any async operations are in progress. AsyncInProgress bool // ResumeReconcile channel is used by DpcReconciler to signal that reconciliation // should be triggered (even if Args has not necessarily changed). This is either // because some config operation was running asynchronously and has just finalized // (and should be followed up on), or because something changed in the current state // that DpcReconciler needs to reflect in the applied config. ResumeReconcile <-chan struct{} // CancelAsyncOps : send cancel signal to all asynchronously running operations. CancelAsyncOps func() // WaitForAsyncOps : wait for all asynchronously running operations to complete. WaitForAsyncOps func() // The set of configuration items currently in a failed state. // Includes information about the last (failed) operation. FailingItems reconciler.OperationLog // Radio silence state information. RS types.RadioSilence // Status of domain name system (DNS) configuration. // Not to be confused with device network status // (which DPC reconciler does not work with). DNS DNSStatus }
ReconcileStatus : state data related to config reconciliation.