Documentation
¶
Index ¶
- Variables
- func NewBGPRouterManager(params bgpRouterManagerParams) agent.BGPRouterManager
- type BGPManagerMetrics
- type BGPRouterManager
- func (m *BGPRouterManager) DestroyRouterOnStop(destroy bool)
- func (m *BGPRouterManager) GetPeers(ctx context.Context) ([]*models.BgpPeer, error)
- func (m *BGPRouterManager) GetRoutePolicies(ctx context.Context, params restapi.GetBgpRoutePoliciesParams) ([]*models.BgpRoutePolicy, error)
- func (m *BGPRouterManager) GetRoutes(ctx context.Context, params restapi.GetBgpRoutesParams) ([]*models.BgpRoute, error)
- func (m *BGPRouterManager) ReconcileInstances(ctx context.Context, nodeObj *v2.CiliumBGPNodeConfig, ...) error
- func (m *BGPRouterManager) Start(_ cell.HookContext) error
- func (m *BGPRouterManager) Stop(ctx cell.HookContext) error
- type LocalInstanceMap
- type State
Constants ¶
This section is empty.
Variables ¶
var (
ErrInstanceDoesNotExist = errors.New("instance does not exist")
)
Functions ¶
func NewBGPRouterManager ¶ added in v1.19.0
func NewBGPRouterManager(params bgpRouterManagerParams) agent.BGPRouterManager
NewBGPRouterManager constructs a new BGPRouterManager.
Types ¶
type BGPManagerMetrics ¶ added in v1.19.0
type BGPManagerMetrics struct {
// ReconcileErrorsTotal is the number of errors during reconciliation of the BGP manager.
ReconcileErrorsTotal metric.Vec[metric.Counter]
// ReconcileRunDuration measures the duration of the reconciliation run. Histogram can
// be used to observe the total number of reconciliation runs and distribution of the run
// duration.
ReconcileRunDuration metric.Vec[metric.Observer]
}
func NewBGPManagerMetrics ¶ added in v1.19.0
func NewBGPManagerMetrics() *BGPManagerMetrics
type BGPRouterManager ¶ added in v1.19.0
type BGPRouterManager struct {
lock.RWMutex
// BGP instances and reconcilers
BGPInstances LocalInstanceMap
ConfigReconcilers []reconciler.ConfigReconciler
// statedb tables
DB *statedb.DB
ReconcileErrorTable statedb.RWTable[*tables.BGPReconcileError]
// contains filtered or unexported fields
}
BGPRouterManager implements the agent's BGPRouterManager interface.
Logically, this manager views each BGP instance within a CiliumBGPClusterConfig as a BGP router instantiated on its host.
This manager employs two main data structures to implement its high level business logic:
A reconcileDiff is used to establish which BGP instances must be created, and removed from the Manager along with which instances must have their configurations reconciled.
A set of ConfigReconcilers, which usages are wrapped by the reconcileBGPConfig function, reconcile configuration of individual BGP instances.
Together, the high-level flow the manager takes is:
- instantiate a reconcilerDiff to compute which BGP instances to create, remove, and reconcile,
- create any instances necessary, run reconcileBGPConfig on each,
- run each config reconciler, by way of calling reconcileBGPConfig on any instances marked for reconcile.
func (*BGPRouterManager) DestroyRouterOnStop ¶ added in v1.19.0
func (m *BGPRouterManager) DestroyRouterOnStop(destroy bool)
DestroyRouterOnStop should be set to true if the underlying router should be fully destroyed upon Stop(). Note that this causes sending a Cease notification to BGP peers, which terminates Graceful Restart. Full destroy is useful especially for tests, where multiple instances of the RouterManager may be running.
func (*BGPRouterManager) GetPeers ¶ added in v1.19.0
GetPeers gets peering state from previously initialized bgp instances.
func (*BGPRouterManager) GetRoutePolicies ¶ added in v1.19.0
func (m *BGPRouterManager) GetRoutePolicies(ctx context.Context, params restapi.GetBgpRoutePoliciesParams) ([]*models.BgpRoutePolicy, error)
GetRoutePolicies fetches BGP routing policies from underlying routing daemon.
func (*BGPRouterManager) GetRoutes ¶ added in v1.19.0
func (m *BGPRouterManager) GetRoutes(ctx context.Context, params restapi.GetBgpRoutesParams) ([]*models.BgpRoute, error)
GetRoutes retrieves routes from the RIB of underlying router
func (*BGPRouterManager) ReconcileInstances ¶ added in v1.19.0
func (m *BGPRouterManager) ReconcileInstances(ctx context.Context, nodeObj *v2.CiliumBGPNodeConfig, ciliumNode *v2.CiliumNode) error
ReconcileInstances is an API for configuring the BGP Instances from the desired CiliumBGPNodeConfig resource.
ReconcileInstances will evaluate BGP instances to be created, removed and reconciled.
func (*BGPRouterManager) Start ¶ added in v1.19.0
func (m *BGPRouterManager) Start(_ cell.HookContext) error
func (*BGPRouterManager) Stop ¶ added in v1.19.0
func (m *BGPRouterManager) Stop(ctx cell.HookContext) error
Stop cleans up all servers, called by hive lifecycle at shutdown
type LocalInstanceMap ¶ added in v1.19.0
type LocalInstanceMap map[string]*instance.BGPInstance
LocalInstanceMap maps instance names to their associated BgpInstances and configuration info.