Documentation ¶
Index ¶
- Constants
- Variables
- func CreatePolicy(name string, peerAddr netip.Addr, ...) (*types.RoutePolicy, error)
- func FamilyAdvertisementsEqual(first, second PeerFamilyAdvertisements) bool
- func GetPeerAddressFromConfig(conf *v2alpha1.CiliumBGPNodeInstance, peerName string) (netip.Addr, error)
- func PeerAdvertisementsEqual(first, second PeerAdvertisements) bool
- func PolicyName(peer, family, advertType string) string
- type AFPathsMap
- type CiliumPeerAdvertisement
- type ConfigReconciler
- type NeighborReconciler
- type NeighborReconcilerIn
- type NeighborReconcilerMetadata
- type NeighborReconcilerOut
- type PathMap
- type PeerAdvertisementIn
- type PeerAdvertisements
- type PeerData
- type PeerFamilyAdvertisements
- type PodCIDRReconciler
- type PodCIDRReconcilerIn
- type PodCIDRReconcilerMetadata
- type PodCIDRReconcilerOut
- type PodIPPoolReconciler
- type PodIPPoolReconcilerIn
- type PodIPPoolReconcilerMetadata
- type PodIPPoolReconcilerOut
- type PreflightReconciler
- type PreflightReconcilerIn
- type PreflightReconcilerOut
- type ReconcileAFPathsParams
- type ReconcileParams
- type ReconcileRoutePoliciesParams
- type ResourceAFPathsMap
- type ResourceRoutePolicyMap
- type RoutePolicyMap
- type ServiceReconciler
- type ServiceReconcilerIn
- type ServiceReconcilerMetadata
- type ServiceReconcilerOut
Constants ¶
const ( MaxPrefixLenIPv4 = 32 MaxPrefixLenIPv6 = 128 )
Variables ¶
var ConfigReconcilers = cell.ProvidePrivate( NewPreflightReconciler, NewNeighborReconciler, NewPodCIDRReconciler, NewPodIPPoolReconciler, NewServiceReconciler, )
Functions ¶
func CreatePolicy ¶
func CreatePolicy(name string, peerAddr netip.Addr, v4Prefixes, v6Prefixes types.PolicyPrefixMatchList, advert v2alpha1.BGPAdvertisement) (*types.RoutePolicy, error)
func FamilyAdvertisementsEqual ¶
func FamilyAdvertisementsEqual(first, second PeerFamilyAdvertisements) bool
func PeerAdvertisementsEqual ¶
func PeerAdvertisementsEqual(first, second PeerAdvertisements) bool
func PolicyName ¶
Types ¶
type AFPathsMap ¶
AFPathsMap is a map of paths per address family, indexed by the family
func ReconcileAFPaths ¶
func ReconcileAFPaths(rp *ReconcileAFPathsParams) (AFPathsMap, error)
ReconcileAFPaths reconciles BGP advertisements per address family. It will consume desired and current paths (AFPathsMap) and will return the outcome of the reconciliation.
type CiliumPeerAdvertisement ¶
type CiliumPeerAdvertisement struct {
// contains filtered or unexported fields
}
func NewCiliumPeerAdvertisement ¶
func NewCiliumPeerAdvertisement(p PeerAdvertisementIn) *CiliumPeerAdvertisement
func (*CiliumPeerAdvertisement) GetConfiguredAdvertisements ¶
func (p *CiliumPeerAdvertisement) GetConfiguredAdvertisements(conf *v2alpha1.CiliumBGPNodeInstance, selectAdvertTypes ...v2alpha1.BGPAdvertisementType) (PeerAdvertisements, error)
GetConfiguredAdvertisements can be called to get all configured advertisements of given BGPAdvertisementType for each peer. Advertisements are selected based on below criteria: Each peer is selected from the BGP node instance configuration. For each peer, the peer configuration is fetched from local store. Peer configuration contains the list of families and the advertisement selector. We iterate over all advertisements ( available from local store ), select only those that match the advertisement selector of the family. Information of peer -> family -> advertisements is returned to the consumer. Linear scan [ Peers ] - O(n) ( number of peers ) Linear scan [ Families ] - O(m) ( max 2 ) Linear scan [ Advertisements ] - O(k) ( number of advertisements - 3-4 types, which is again filtered)
type ConfigReconciler ¶
type ConfigReconciler interface { // Name returns the name of a reconciler. Name() string // Priority is used to determine the order in which reconcilers are called. Reconcilers are called from lowest to // highest. Priority() int // Reconcile performs the reconciliation actions for given BGPInstance. Reconcile(ctx context.Context, params ReconcileParams) error }
func GetActiveReconcilers ¶
func GetActiveReconcilers(log logrus.FieldLogger, reconcilers []ConfigReconciler) []ConfigReconciler
GetActiveReconcilers returns a list of reconcilers in order of priority that should be used to reconcile the BGP config.
type NeighborReconciler ¶
type NeighborReconciler struct { Logger logrus.FieldLogger SecretStore store.BGPCPResourceStore[*slim_corev1.Secret] PeerConfig store.BGPCPResourceStore[*v2alpha1.CiliumBGPPeerConfig] DaemonConfig *option.DaemonConfig }
NeighborReconciler is a ConfigReconciler which reconciles the peers of the provided BGP server with the provided CiliumBGPVirtualRouter.
func (*NeighborReconciler) Name ¶
func (r *NeighborReconciler) Name() string
func (*NeighborReconciler) Priority ¶
func (r *NeighborReconciler) Priority() int
Priority of neighbor reconciler is higher than pod/service announcements. This is important for graceful restart case, where all expected routes are pushed into gobgp RIB before neighbors are added. So, gobgp can send out all prefixes within initial update message exchange with neighbors before sending EOR marker.
func (*NeighborReconciler) Reconcile ¶
func (r *NeighborReconciler) Reconcile(ctx context.Context, p ReconcileParams) error
type NeighborReconcilerIn ¶
type NeighborReconcilerIn struct { cell.In Logger logrus.FieldLogger SecretStore store.BGPCPResourceStore[*slim_corev1.Secret] PeerConfig store.BGPCPResourceStore[*v2alpha1.CiliumBGPPeerConfig] DaemonConfig *option.DaemonConfig }
type NeighborReconcilerMetadata ¶
NeighborReconcilerMetadata keeps a map of running peers to peer configuration. key is the peer name.
type NeighborReconcilerOut ¶
type NeighborReconcilerOut struct { cell.Out Reconciler ConfigReconciler `group:"bgp-config-reconciler-v2"` }
func NewNeighborReconciler ¶
func NewNeighborReconciler(params NeighborReconcilerIn) NeighborReconcilerOut
type PeerAdvertisementIn ¶
type PeerAdvertisementIn struct { cell.In Logger logrus.FieldLogger PeerConfigStore store.BGPCPResourceStore[*v2alpha1.CiliumBGPPeerConfig] AdvertStore store.BGPCPResourceStore[*v2alpha1.CiliumBGPAdvertisement] }
type PeerAdvertisements ¶
type PeerAdvertisements map[string]PeerFamilyAdvertisements
PeerAdvertisements is a map of peer name to its family advertisements This is the top level map that is returned to the consumer with requested advertisements.
type PeerData ¶
type PeerData struct { Peer *v2alpha1.CiliumBGPNodePeer Config *v2alpha1.CiliumBGPPeerConfigSpec Password string }
PeerData keeps a peer and its configuration. It also keeps the TCP password from secret store. +deepequal-gen=true Note: If you change PeerDate, do not forget to 'make generate-k8s-api', which will update DeepEqual method.
type PeerFamilyAdvertisements ¶
type PeerFamilyAdvertisements map[v2alpha1.CiliumBGPFamily][]v2alpha1.BGPAdvertisement // key is the address family type
type PodCIDRReconciler ¶
type PodCIDRReconciler struct {
// contains filtered or unexported fields
}
func (*PodCIDRReconciler) Name ¶
func (r *PodCIDRReconciler) Name() string
func (*PodCIDRReconciler) Priority ¶
func (r *PodCIDRReconciler) Priority() int
func (*PodCIDRReconciler) Reconcile ¶
func (r *PodCIDRReconciler) Reconcile(ctx context.Context, p ReconcileParams) error
type PodCIDRReconcilerIn ¶
type PodCIDRReconcilerIn struct { cell.In Logger logrus.FieldLogger PeerAdvert *CiliumPeerAdvertisement DaemonConfig *option.DaemonConfig }
type PodCIDRReconcilerMetadata ¶
type PodCIDRReconcilerMetadata struct { AFPaths AFPathsMap RoutePolicies RoutePolicyMap }
PodCIDRReconcilerMetadata is a map of advertisements per family, key is family type
type PodCIDRReconcilerOut ¶
type PodCIDRReconcilerOut struct { cell.Out Reconciler ConfigReconciler `group:"bgp-config-reconciler-v2"` }
func NewPodCIDRReconciler ¶
func NewPodCIDRReconciler(params PodCIDRReconcilerIn) PodCIDRReconcilerOut
type PodIPPoolReconciler ¶
type PodIPPoolReconciler struct {
// contains filtered or unexported fields
}
func (*PodIPPoolReconciler) Name ¶
func (r *PodIPPoolReconciler) Name() string
func (*PodIPPoolReconciler) Priority ¶
func (r *PodIPPoolReconciler) Priority() int
func (*PodIPPoolReconciler) Reconcile ¶
func (r *PodIPPoolReconciler) Reconcile(ctx context.Context, p ReconcileParams) error
type PodIPPoolReconcilerIn ¶
type PodIPPoolReconcilerIn struct { cell.In Logger logrus.FieldLogger PeerAdvert *CiliumPeerAdvertisement PoolStore store.BGPCPResourceStore[*v2alpha1.CiliumPodIPPool] }
type PodIPPoolReconcilerMetadata ¶
type PodIPPoolReconcilerMetadata struct { PoolAFPaths ResourceAFPathsMap PoolRoutePolicies ResourceRoutePolicyMap }
PodIPPoolReconcilerMetadata holds any announced pod ip pool CIDRs keyed by pool name of the backing CiliumPodIPPool.
type PodIPPoolReconcilerOut ¶
type PodIPPoolReconcilerOut struct { cell.Out Reconciler ConfigReconciler `group:"bgp-config-reconciler-v2"` }
func NewPodIPPoolReconciler ¶
func NewPodIPPoolReconciler(in PodIPPoolReconcilerIn) PodIPPoolReconcilerOut
type PreflightReconciler ¶
type PreflightReconciler struct {
Logger logrus.FieldLogger
}
PreflightReconciler reconciles BPG Global configuration. This reconciler is similar to v1 preflight reconciler. It must be run before any other reconcilers for given BGP instance.
func (*PreflightReconciler) Name ¶
func (r *PreflightReconciler) Name() string
func (*PreflightReconciler) Priority ¶
func (r *PreflightReconciler) Priority() int
func (*PreflightReconciler) Reconcile ¶
func (r *PreflightReconciler) Reconcile(ctx context.Context, p ReconcileParams) error
type PreflightReconcilerIn ¶
type PreflightReconcilerIn struct { cell.In Logger logrus.FieldLogger }
type PreflightReconcilerOut ¶
type PreflightReconcilerOut struct { cell.Out Reconciler ConfigReconciler `group:"bgp-config-reconciler-v2"` }
func NewPreflightReconciler ¶
func NewPreflightReconciler(params PreflightReconcilerIn) PreflightReconcilerOut
type ReconcileAFPathsParams ¶
type ReconcileAFPathsParams struct { Logger logrus.FieldLogger Ctx context.Context Router types.Router DesiredPaths AFPathsMap CurrentPaths AFPathsMap }
type ReconcileParams ¶
type ReconcileParams struct { BGPInstance *instance.BGPInstance DesiredConfig *v2alpha1.CiliumBGPNodeInstance CiliumNode *v2api.CiliumNode }
type ReconcileRoutePoliciesParams ¶
type ReconcileRoutePoliciesParams struct { Logger logrus.FieldLogger Ctx context.Context Router types.Router DesiredPolicies RoutePolicyMap CurrentPolicies RoutePolicyMap }
type ResourceAFPathsMap ¶
type ResourceAFPathsMap map[resource.Key]AFPathsMap
ResourceAFPathsMap holds the AF paths keyed by the resource name.
type ResourceRoutePolicyMap ¶
type ResourceRoutePolicyMap map[resource.Key]RoutePolicyMap
ResourceRoutePolicyMap holds the route policies per resource.
type RoutePolicyMap ¶
type RoutePolicyMap map[string]*types.RoutePolicy
RoutePolicyMap holds routing policies configured by the policy reconciler keyed by policy name.
func ReconcileRoutePolicies ¶
func ReconcileRoutePolicies(rp *ReconcileRoutePoliciesParams) (RoutePolicyMap, error)
ReconcileRoutePolicies reconciles routing policies between the desired and the current state. It returns the updated routing policies and an error if the reconciliation fails.
type ServiceReconciler ¶
type ServiceReconciler struct {
// contains filtered or unexported fields
}
func (*ServiceReconciler) Name ¶
func (r *ServiceReconciler) Name() string
func (*ServiceReconciler) Priority ¶
func (r *ServiceReconciler) Priority() int
func (*ServiceReconciler) Reconcile ¶
func (r *ServiceReconciler) Reconcile(ctx context.Context, p ReconcileParams) error
type ServiceReconcilerIn ¶
type ServiceReconcilerIn struct { cell.In Logger logrus.FieldLogger PeerAdvert *CiliumPeerAdvertisement LBIPPoolStore store.BGPCPResourceStore[*v2alpha1.CiliumLoadBalancerIPPool] SvcDiffStore store.DiffStore[*slim_corev1.Service] EPDiffStore store.DiffStore[*k8s.Endpoints] }
type ServiceReconcilerMetadata ¶
type ServiceReconcilerMetadata struct { ServicePaths ResourceAFPathsMap ServiceAdvertisements PeerAdvertisements ServiceRoutePolicies ResourceRoutePolicyMap // contains cluster IP and external IP route policies LBPoolRoutePolicies ResourceRoutePolicyMap // contains load balancer IP pool route policies }
ServiceReconcilerMetadata holds any announced service CIDRs per address family.
type ServiceReconcilerOut ¶
type ServiceReconcilerOut struct { cell.Out Reconciler ConfigReconciler `group:"bgp-config-reconciler-v2"` }
func NewServiceReconciler ¶
func NewServiceReconciler(in ServiceReconcilerIn) ServiceReconcilerOut