Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBGPControlPlaneDisabled is set when the BGP control plane is disabled ErrBGPControlPlaneDisabled = fmt.Errorf("BGP control plane is disabled") )
Functions ¶
This section is empty.
Types ¶
type BGPRouterManager ¶
type BGPRouterManager interface {
// ReconcileInstances evaluates the provided CiliumBGPNodeConfig
// and the implementation will configure itself to apply this configuration.
ReconcileInstances(ctx context.Context, bgpnc *v2.CiliumBGPNodeConfig, ciliumNode *v2.CiliumNode) error
// GetPeers fetches BGP peering state from underlying routing daemon.
//
// List of all peers will be returned and if there are multiple instances of
// BGP daemon running locally, then peers can be differentiated based on
// local AS number.
GetPeers(ctx context.Context) ([]*models.BgpPeer, error)
// GetRoutes fetches BGP routes from underlying routing daemon's RIBs.
GetRoutes(ctx context.Context, params restapi.GetBgpRoutesParams) ([]*models.BgpRoute, error)
// GetRoutePolicies fetches BGP routing policies from underlying routing daemon.
GetRoutePolicies(ctx context.Context, params restapi.GetBgpRoutePoliciesParams) ([]*models.BgpRoutePolicy, error)
// Stop will stop all BGP instances and clean up local state.
Stop(ctx cell.HookContext) error
}
BGPRouterManager provides a declarative API for defining BGP peers.
type Controller ¶
type Controller struct {
Logger *slog.Logger
// CiliumNodeResource provides a stream of events for changes to the local CiliumNode resource.
CiliumNodeResource daemon_k8s.LocalCiliumNodeResource
// LocalCiliumNode is the CiliumNode object for the local node.
LocalCiliumNode *v2.CiliumNode
// BGP node store
BGPNodeConfigStore store.BGPCPResourceStore[*v2.CiliumBGPNodeConfig]
// Sig informs the Controller that a Kubernetes
// event of interest has occurred.
//
// The signal itself provides no other information,
// when it occurs the Controller will query each
// informer for the latest API information required
// to drive it's control loop.
Sig *signaler.BGPCPSignaler
// BGPMgr is an implementation of the BGPRouterManager interface
// and provides a declarative API for configuring BGP peers.
BGPMgr BGPRouterManager
}
Controller is the agent side BGP Control Plane controller.
Controller listens for events and drives BGP related sub-systems to maintain a desired state.
func NewController ¶
func NewController(params ControllerParams) (*Controller, error)
NewController constructs a new BGP Control Plane Controller.
When the constructor returns the Controller will be actively watching for events and configuring BGP related sub-systems.
The constructor requires an implementation of BGPRouterManager to be provided. This implementation defines which BGP backend will be used (GoBGP, FRR, Bird, etc...) NOTE: only GoBGP currently implemented.
func (*Controller) Reconcile ¶
func (c *Controller) Reconcile(ctx context.Context) error
Reconcile is the main reconciliation loop for the BGP Control Plane Controller.
func (*Controller) Run ¶
func (c *Controller) Run(ctx context.Context)
Run places the Controller into its control loop.
When new events trigger a signal the control loop will be evaluated.
A cancel of the provided ctx will kill the control loop along with the running informers.
type ControllerParams ¶
type ControllerParams struct {
cell.In
Logger *slog.Logger
Lifecycle cell.Lifecycle
Health cell.Health
JobGroup job.Group
Shutdowner hive.Shutdowner
Sig *signaler.BGPCPSignaler
RouteMgr BGPRouterManager
BGPNodeConfigStore store.BGPCPResourceStore[*v2.CiliumBGPNodeConfig]
DaemonConfig *option.DaemonConfig
LocalCiliumNodeResource daemon_k8s.LocalCiliumNodeResource
}
ControllerParams contains all parameters needed to construct a Controller