manager

package
v1.15.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBGPRouterManager

func NewBGPRouterManager(params bgpRouterManagerParams) agent.BGPRouterManager

NewBGPRouterManager constructs a GoBGP-backed BGPRouterManager.

See BGPRouterManager for details.

Types

type BGPRouterManager

type BGPRouterManager struct {
	lock.RWMutex
	Servers     LocalASNMap
	Reconcilers []reconciler.ConfigReconciler
	// contains filtered or unexported fields
}

BGPRouterManager implements the pkg.bgpv1.agent.BGPRouterManager interface.

Logically, this manager views each CiliumBGPVirtualRouter within a CiliumBGPPeeringPolicy as a BGP router instantiated on its host.

BGP routers are grouped and accessed by their local ASNs, thus this backend mandates that each CiliumBGPPeeringConfig have a unique local ASN and precludes a single host instantiating two routers with the same local ASN.

This manager employs two main data structures to implement its high level business logic.

A reconcilerDiff is used to establish which BgpServers must be created, and removed from the Manager along with which servers must have their configurations reconciled.

A set of ReconcilerConfigFunc(s), which usages are wrapped by the ReconcileBGPConfig function, reconcile individual features of a CiliumBGPPeeringConfig.

Together, the high-level flow the manager takes is:

  • Instantiate a reconcilerDiff to compute which BgpServers to create, remove, and reconcile
  • Create any BgpServers necessary, run ReconcilerConfigFuncs(s) on each
  • Run each ReconcilerConfigFunc, by way of ReconcileBGPConfig, on any BgpServers marked for reconcile

BgpServers are abstracted by the ServerWithConfig structure which provides a method set for low-level BGP operations.

func (*BGPRouterManager) ConfigurePeers

func (m *BGPRouterManager) ConfigurePeers(ctx context.Context,
	policy *v2alpha1api.CiliumBGPPeeringPolicy,
	ciliumNode *v2api.CiliumNode) error

ConfigurePeers is a declarative API for configuring the BGP peering topology given a desired CiliumBGPPeeringPolicy.

ConfigurePeers will evaluate BGPRouterManager's current state and the desired CiliumBGPPeeringPolicy policy then take the necessary actions to apply the provided policy. For more details see BGPRouterManager's comments.

ConfigurePeers should return only once a subsequent invocation is safe. This method is not thread safe and does not intend to be called concurrently.

func (*BGPRouterManager) GetPeers

func (m *BGPRouterManager) GetPeers(ctx context.Context) ([]*models.BgpPeer, error)

GetPeers gets peering state from previously initialized bgp instances.

func (*BGPRouterManager) GetRoutePolicies added in v1.15.0

GetRoutePolicies fetches BGP routing policies from underlying routing daemon.

func (*BGPRouterManager) GetRoutes

GetRoutes retrieves routes from the RIB of underlying router

func (*BGPRouterManager) Stop

func (m *BGPRouterManager) Stop()

Stop cleans up all servers, should be called at shutdown

type LocalASNMap

type LocalASNMap map[int64]*instance.ServerWithConfig

LocalASNMap maps local ASNs to their associated BgpServers and server configuration info.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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