bgp

package
v0.0.0-...-606a1df Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrKindIPV4 = "ipv4"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BGPWorker

type BGPWorker interface {
	Start() error
	Stop() error
}

BGPWorker describes a BGP worker that can advertise BGP routes and communities

func NewBGPWorker

func NewBGPWorker(ctx context.Context, configKey string, watcher *watcher.Watcher, ipDevices *system.IP, ipPrimary *system.IP, ipvs *system.IPVS, bgpController Controller, communities []string, logger logrus.FieldLogger) (BGPWorker, error)

NewBGPWorker creates a new BGPWorker, which configures BGP for all VIPs

type Controller

type Controller interface {

	// Get returns the addresses currently in the BGP RIB
	Get(ctx context.Context) ([]string, error)

	// Set receives a list of ip addresses and performs the necessary
	// steps to configure each address in BGP.
	Set(ctx context.Context, addresses, configuredAddresses []string, communities []string) error

	// SetV6 set, for v6.  Very similar to above function
	SetV6(ctx context.Context, addresses []string, communities []string) error

	// Teardown removes all addresses from BGP.
	// Perhaps this will never be applied.
	Teardown(context.Context) error
}

The Controller provides an interface for configuring BGP. Feed a controller a list of VIP addresses that require configuration, and it will manage the whole add/remove/change process.

type GoBGPDController

type GoBGPDController struct {
	// contains filtered or unexported fields
}

func NewBGPDController

func NewBGPDController(executablePath string, logger logrus.FieldLogger) *GoBGPDController

func (*GoBGPDController) Get

func (g *GoBGPDController) Get(ctx context.Context) ([]string, error)

Get fetches a list of configured addresses in gobgp

func (*GoBGPDController) Set

func (g *GoBGPDController) Set(ctx context.Context, addresses, configuredAddresses []string, communities []string) error

Set configures the ipvsadm rules for ipv4 with an optional set of community strings. If a community is not set or blank, then it will not be used.

func (*GoBGPDController) SetV6

func (g *GoBGPDController) SetV6(ctx context.Context, addresses []string, communities []string) error

SetV6 set ipvsadm rule with ipv6 syntax. If a blank community slice is supplied, no community is advertised.

func (*GoBGPDController) Teardown

func (g *GoBGPDController) Teardown(context.Context) error

type IPPoolV2

type IPPoolV2 struct {
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty" yaml:"kind,omitempty"`
	Metadata   struct {
		CIDR string `json:"cidr,omitempty" yaml:"cidr,omitempty"`
	} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Spec struct {
		IPIP struct {
			Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
		} `json:"ipip,omitempty" yaml:"ipip,omitempty"`
		NatOutgoing bool `json:"nat-outgoing,omitempty" yaml:"nat-outgoing,omitempty"`
		Disabled    bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
	} `json:"spec,omitempty" yaml:"spec,omitempty"`
}

func (*IPPoolV2) Load

func (i *IPPoolV2) Load(cidr string)

func (*IPPoolV2) Marshal

func (i *IPPoolV2) Marshal() ([]byte, error)

type IPPoolV3

type IPPoolV3 struct {
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty" yaml:"kind,omitempty"`
	Metadata   struct {
		Name string `json:"name,omitempty" yaml:"name,omitempty"`
	} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Spec struct {
		CIDR        string `json:"cidr,omitempty" yaml:"cidr,omitempty"`
		IPIPMode    string `json:"ipipMode,omitempty" yaml:"ipipMode,omitempty"`
		NatOutgoing bool   `json:"natOutgoing,omitempty" yaml:"natOutgoing,omitempty"`
		Disabled    bool   `json:"disabled,omitempty" yaml:"disabled,omitempty"`
	} `json:"spec,omitempty" yaml:"spec,omitempty"`
}

func (*IPPoolV3) Load

func (i *IPPoolV3) Load(cidr string)

func (*IPPoolV3) Marshal

func (i *IPPoolV3) Marshal() ([]byte, error)

type Marshals

type Marshals interface {
	Load(cidr string)
	Marshal() ([]byte, error)
}

Jump to

Keyboard shortcuts

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