Documentation ¶
Overview ¶
Package speaker abstracts the BGP speaker controller from MetalLB. This package provides BGP announcements based on K8s object event handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Cell = cell.Module( "metallb-bgp", "MetalLB BGP", cell.Provide(newMetalLBBGPSpeaker), )
Cell provides access to the MetalLB BGP Speaker.
var ErrShutDown = errors.New("cannot enqueue event, speaker is shutdown")
Functions ¶
This section is empty.
Types ¶
type CidrSlice ¶
type CidrSlice []string
CidrSlice is a slice of Cidr strings with a method set for converting them to MetalLB advertisements.
func (CidrSlice) ToAdvertisements ¶
func (cs CidrSlice) ToAdvertisements() []*metallbbgp.Advertisement
ToAdvertisements converts the CidrSlice into metallb Advertisements.
If a cidr cannot be parsed it is omitted from the array of Advertisements returned an an error is logged.
type MetalLBBgpSpeaker ¶ added in v1.16.0
type MetalLBBgpSpeaker interface { // OnUpdateEndpoints notifies the Speaker of an update to the backends of a // service. OnUpdateEndpoints(eps *k8s.Endpoints) error // OnUpdateService notifies the Speaker of an update to a service. OnUpdateService(svc *slim_corev1.Service) error // OnDeleteService notifies the Speaker of a delete of a service. OnDeleteService(svc *slim_corev1.Service) error }
MetalLBBgpSpeaker represents the BGP speaker. It integrates Cilium's K8s events with MetalLB's logic for making BGP announcements. It is responsible for announcing BGP messages containing a loadbalancer IP address to peers.
type Speaker ¶
type Speaker interface { // SetService will announce the provided Service of type LoadBalancer to BGP peers. SetService(name string, svc *metallbspr.Service, eps *metallbspr.Endpoints) types.SyncState // SetNodeLabels will create or delete any BGP sessions given the provided labels // allow for this. // // The provided labels will be used to determine if the Speaker allows for BGP // peering. SetNodeLabels(labels map[string]string) types.SyncState // PeerSessions returns any active BGP sessions. PeerSessions() []metallbspr.Session // GetBGPController returns the BGPController of the speaker GetBGPController() *metallbspr.BGPController }
Speaker provides a method set for interfacing with a BGP speaker.
This interface is heavily modeled after MetalLB's speaker as it's the first BGP integration for Cilium's use cases.
If other BGP integrations are desired, consider building out custom types and a more abstracted method set.