Version: v3.3.3+incompatible Latest Latest

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 10 Imported by: 2



Package bgpreflector reflects BGP routes installed in the host system's network stack (default network namespace) into VPP.

For now it only reflects the routes installed by the Bird daemon ( - routes with the protocol number 12, as defined in /etc/iproute2/rt_protos

As of now, bgpreflector is only enabled if useExternalIPAM == true in Contiv IPAM config.



This section is empty.


View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of BGPReflector plugin.


This section is empty.


type BGPReflector

type BGPReflector struct {
	// contains filtered or unexported fields

BGPReflector plugin implements BGP route reflection from Linux host to VPP.

func NewPlugin

func NewPlugin(opts ...Option) *BGPReflector

NewPlugin creates a new Plugin with the provides Options

func (*BGPReflector) Close

func (br *BGPReflector) Close() error

Close cleans up the resources.

func (*BGPReflector) HandlesEvent

func (br *BGPReflector) HandlesEvent(event controller.Event) bool

HandlesEvent selects:

- any Resync event
- BGPRouteUpdate

func (*BGPReflector) Init

func (br *BGPReflector) Init() (err error)

Init is NOOP - the plugin is initialized during the first resync.

func (*BGPReflector) Resync

func (br *BGPReflector) Resync(event controller.Event, kubeStateData controller.KubeStateData,
	resyncCount int, txn controller.ResyncOperations) (err error)

Resync resynchronizes BGPReflector against the BGP routes in the Linux host. A set of already allocated pod IPs is updated.

func (*BGPReflector) Revert

func (br *BGPReflector) Revert(event controller.Event) error

Revert is NOOP - never called.

func (*BGPReflector) Update

func (br *BGPReflector) Update(event controller.Event, txn controller.UpdateOperations) (changeDescription string, err error)

Update handles BGPRouteUpdate events.

type BGPRouteUpdate

type BGPRouteUpdate struct {
	Type       BGPRouteUpdateType
	DstNetwork *net.IPNet
	GwAddr     net.IP

BGPRouteUpdate is triggered when a BGP route on the host changes.

func (*BGPRouteUpdate) Direction

Direction is Forward.

func (*BGPRouteUpdate) Done

func (ev *BGPRouteUpdate) Done(error)

Done is NOOP.

func (*BGPRouteUpdate) GetName

func (ev *BGPRouteUpdate) GetName() string

GetName returns name of the BGPRouteUpdate event.

func (*BGPRouteUpdate) IsBlocking

func (ev *BGPRouteUpdate) IsBlocking() bool

IsBlocking returns false.

func (*BGPRouteUpdate) Method

Method is Update.

func (*BGPRouteUpdate) String

func (ev *BGPRouteUpdate) String() string

String describes BGPRouteUpdate event.

func (*BGPRouteUpdate) TransactionType

func (ev *BGPRouteUpdate) TransactionType() controller.UpdateTransactionType

TransactionType is BestEffort.

type BGPRouteUpdateType

type BGPRouteUpdateType int

BGPRouteUpdateType represents type of the BGP update.

const (
	// RouteAdd represents addition of a new BGP route.
	RouteAdd BGPRouteUpdateType = iota
	// RouteDelete represents deletion of a BGP route.

func (BGPRouteUpdateType) String

func (t BGPRouteUpdateType) String() string

type Deps

type Deps struct {
	ContivConf contivconf.API
	EventLoop  controller.EventLoop

Deps lists dependencies of the BGPReflector plugin.

type Option

type Option func(*BGPReflector)

Option is a function that acts on a Plugin to inject Dependencies or configuration

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

Jump to

Keyboard shortcuts

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